0% found this document useful (0 votes)
38 views2 pages

Código 2

This document contains code for calculating vapor-liquid equilibrium using a Peng-Robinson equation of state. It initializes constants, sets an initial composition, enters a loop to estimate temperature and composition iteratively until the error is less than 0.0001. Matrix M is used to copy values between iterations.

Uploaded by

Sergio Luna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views2 pages

Código 2

This document contains code for calculating vapor-liquid equilibrium using a Peng-Robinson equation of state. It initializes constants, sets an initial composition, enters a loop to estimate temperature and composition iteratively until the error is less than 0.0001. Matrix M is used to copy values between iterations.

Uploaded by

Sergio Luna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

if sign(M(1,2))==sign(M(2,2)) 

    M(2,3)=M(1,3) 
else  
    M(2,3)=M(1,1) 
end 
  
M(2,4)=P-(R*T)/(M(2,3)-b)+a/(M(2,3)*(M(2,3)+b)*T^0.5) 
  
  
M(1,1)=M(2,1) 
M(1,2)=M(2,2) 
M(1,3)=M(2,3) 
M(1,4)=M(2,4) 
  
end 
  
v=M(2,1) 
  
% constantes Antoine 
Ai=[16.5938 13.8594] 
Bi=[3644.3 2773.78] 
Ci=[239.76 220.07] 
  
Tcr=[521.64 562.05] %K 
Pcr=[8097 4895]  % kPa 
R= 8.314 % kJ/kmolK 
  
P=1000 %kPa 
  
X1=0 
  
while X1 <1 
     
X2=1-X1 
Xi=[X1 X2] 
  
  
fi=ones(1, NC) 
  
errorf=10 
while errorf >0.0001 
  
%estimar temperatura(supuesto) 
  
for i=1:NC 
   Tsati(i)=Bi(i)/(Ai(i)-log(P))-Ci(i)  
end 
  
for i=1:NC 
   TsatiXi(i)=Tsati(i)*Xi(i)  

  
for j=1:NC 
     
    Yjaj(j)=Yi(j)*ai(j)^0.5 
     
end 
  
for i=1:NC 
    fic(i)=exp(log(v/(v-b))+bi(i)/(v-b)+
((2*sum(Yjaj)*ai(i)^0.5)/(R*b*T^1.5)-(a*bi(i))/(R*b^2*T^1.5))*log(v/
(v+b))-(a*bi(i))/(R*T^1.5*b*(v+b))-log((P*v)/(R*T))) 
end 
  
for i=1:NC 
errorfi(i)=abs((fi(i)-fic(i))/(fic(i))) 
end 
  
errorf=sum(errorfi) 
fi=fic 

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy