Solved

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

Posted on 2012-04-05
1
559 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 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
In this article, you will read about the trends across the human resources departments for the upcoming year. Some of them include improving employee experience, adopting new technologies, using HR software to its full extent, and integrating artifi…
This video shows how use content aware, what it’s used for, and when to use it over other tools.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

705 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