?
Solved

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

Posted on 2012-04-05
1
Medium Priority
?
562 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
yuk99 earned 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sourc…
This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Suggested Courses

777 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