Solved

Matlab problem with my program : i can't find the temperature .. ?

Posted on 2012-04-05
1
552 Views
Last Modified: 2016-03-02
hello,  i have a problem with my solution in Matlab...
i can't find the good temperature using this condition : V1<=V1crit && erreur1 < 0.03.
(Temperature needs to be between 65 Celsius et 100 Celsius) (pressure = 750 mmhg )
any ideas..?
Thank you
here is my code...


clear all
clc

format short e
syms phi


liq=712.8636+178.216;
vap=31854+174.84+735.28+2736;          

alim=liq+vap;                                             % en mol/s
z=[0.0195889 0.004897227 0.875321506 0.004804458 0.020204884 0.075183011];                  %composition in

%constantes Antoine (in the order Ch3OH et H2O)
A=[7.87863 7.96681 6.84471 6.88555 0 6.49457];
B=[1473.11 1668.210 1060.793 1175.817 0 255.68];
C=[230 228 231.541 224.867 0 266.55];

Psat=zeros(1,6);    %en mmHg
k=zeros(1,6);

P=input('entrer la pression d''operation en mmhg: \n');
Ptot = 760*P;

critere = 10;
while critere ~= 1
   
   
    T=input('entrez une température entre 65 C et 100 C (pour 750 mmHg): \n'); %Temp??
    y=10;
   
    %calcul des ki
       
    for i=1:length(z) %a verifier
        Psat(i) = 10^(A(i) - B(i)/(T+C(i)));
        k(i) = Psat(i)/Ptot; %constantes d'équilibre
    end
   
    %************************
    % Equation Rachford-Rice
    %************************
   
   
    %composition melange eau-methanol
    z1=(z(1)*alim/liq);
    z2=(z(2)*alim/liq);
   
    N=10^5;          %Nombre d'iterations
    phi=0.5;        %valeur initiale
    epsilon=0.02;
   
    for i=1:N
       
        %Méthode de Newton
        fphi=(z1*(1-k(1))/(1+phi*(k(1)-1))) + (z2*(1-k(2))/(1+phi*(k(2)-1)));
        fphiprime=(z1*(k(1)-1)^2)/(1+phi*(k(1)-1))^2 + (z2*(k(2)-1)^2)/(1+phi*(k(2)-1))^2;
       
        phidot = phi - (fphi/fphiprime);
        erreur=abs(phidot-phi)/abs(phidot);
       
        if erreur <= epsilon && phidot > 0 && phidot <= 1
            phi=phidot;
            break
        end
        phi=phidot;
    end
   
    if phi < 0 || phi > 1
        fprintf('\n **phi doesn't converge')
        y=1;
    end
    phi
   
    %******************************************
    %calcul des compositions de sortie liquide
    %******************************************
   
   
    %composition pour la sortie liquide
    x1out = z1/(1+phi*(k(1)-1));
    x2out = z2/(1+phi*(k(2)-1));
   
    %composition pour calculer la vapeur qui sort
    %   x1 = z(1)/(1+phi*(k(1)-1));
    %   x2 = z(2)/(1+phi*(k(2)-1));
   
    %  y1 = k(1)*x1out;
    %  y2 = k(2)*x2out;
   
    V = phi*(liq)+vap;          %en mol/s
    L = alim - V;               %en mol/s
   
   
    %débits gazeux de ch3oh et eau a la conduite de recyclage
   
    %   V1 = phi*liq*y1;
    %   V2 = phi*liq*y2;
   
    L1 = L*x1out;
    L2 = L*x2out;
   
    V1=z(1)*alim-L1;
    V2=z(2)*alim-L2;
   
    y1=V1/V;
    y2=V2/V;
    y3=z(3)*alim/V;
    y4=z(4)*alim/V;
    y5=z(5)*alim/V;
    y6=z(6)*alim/V;
   
   
    %débits attendus dans la recirculation
    V1crit=38e3*0.0034;
    V2crit=38e3*0.00062;
   
    %*********************************************************************
    % Vérification de la composition (gaz et liquide) et du bilan massique
    %*********************************************************************
    Xestime = x1out+x2out;
    erreur = abs(1-Xestime);
   
    Yestime= y1+y2+y3+y4+y5+y6;
    erreur1=abs(1-Yestime);
   
     if y~=1
        if abs(erreur) < 0.03
            fprintf('**Composition liquide OK \n')
        else
            fprintf('la composition de liquide not ok\n')
            Xestime
        end

        if V1<=V1crit && erreur1 < 0.03
            fprintf('**Composition gaz OK \n')
        else
            fprintf('la composition de gaz not ok \n\n')
            Yestime
        end

        if abs(alim-L-V)<1
            fprintf('**Bilan massique OK \n')
        else
            fprintf('Le bilan not ok \n')
        end

    end
   
   
    critere=input('\n try new parametre (yes=any numbers,no=1)? : \n');
   
end

Xsomme=Xestime
Ysomme=Yestime

x = [x1out x2out]
y = [y1 y2 y3 y4 y5 y6]

L
V

V1
0
Comment
Question by:kriftsi
1 Comment
 
LVL 15

Accepted Solution

by:
yuk99 earned 500 total points
ID: 37814735
I don't understand the question. Please reformulate it clearer. Try to show less code just to reproduce the problem. And please use only English.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What does Survey Monkey cost? 7 122
Text Transformation using ActionScript 3 5 133
Least Squares Curve Fitting 4 77
Issue with using GPO to install Mimecast in Outlook. 6 34
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question