Propiedades termodinámicas 1

6
APLICACIÓN DE LAS ECUACIONES DE ESTADO EN MATLAB HENRRY ALDEMAR ARCINIEGAS 3085045 MANUEL EDUARDO LOPEZ 308525 PROFESOR: ÁLVARO GÓMEZ UNIVERSIDA NACIONAL DE COLOMBIA

Transcript of Propiedades termodinámicas 1

Page 1: Propiedades termodinámicas 1

APLICACIÓN DE LAS ECUACIONES DE ESTADO EN MATLAB

HENRRY ALDEMAR ARCINIEGAS 3085045

MANUEL EDUARDO LOPEZ 308525

PROFESOR:

ÁLVARO GÓMEZ

UNIVERSIDA NACIONAL DE COLOMBIA

SEDE MANIZALES

2010

Page 2: Propiedades termodinámicas 1

ingresar Psup, Tref, Pref, Tc, Pc, Cpa, Cpb,Cpc, Cpd y un vector de

temperatura

hacer un factor de correccion para q la presion supuesta no sea tan

diferente de la presion de saturacion

ingresar parametros de la ecuacion de pengrobinson para encontrar los coeficientes de la ecuacion cubica

luego mediante la ecuacion cardano encontrar las raices del polinomio y

hacer Zmax= Zvap y Zmin=Zliq

encontrar fvap y fliq

fvap=fliq

si

Psup=Psat

integrando el polinomio de Cp se encuentra la hentalpia y la entropia

No

Page 3: Propiedades termodinámicas 1

Este es el programa para calcular las propiedades termodinámicas en la fase liquido-vapor.

clc,clear allR=8.3145e-5;%bar.m3/mol.kR1=8.3145e-2;%bar.m3/kmol.kPsup=2;%barTref=298.15;%kPref=1;%barfprintf('Elija la ecuacion de estado que va a utilizar:\n')fprintf('\n(1) Peng-Robinson.\n(2) Redlich Kwong.')opc=input('\n\nElija su opcion: ');Tc=input('Temperatura critica: ');%kPc=input('Presión critica: ');%barw=input('Factor acéntrico: ');Cpa=input('Cpa: ');Cpb=input('Cpb: ');Cpc=input('Cpc: ');Cpd=input('Cpd: ');T=[73.15:10:Tc]%kfor k=1:length(T) if k>2 m=(log(PV(k-2)/PV(k-1)))/(inv(T(k-2))-inv(T(k-1))); Psup = PV(k-1)*exp(m*(inv(T(k))-inv(T(k-1)))); end P=Psaturacion(T(k),Psup,Tc,Pc,w,opc); if opc==1 [Z(k,:),f,Hres,Sres]=pengrobinson(T(k),P,Tc,Pc,w); else [Z(k,:),f,Hres,Sres]=soave_redlich_kwong(T(k),P,Tc,Pc,w); end DHIG=(Cpa*(T(k)-Tref))+((Cpb/2)*((T(k)^2)-(Tref^2)))+((Cpc/3)*((T(k)^3)-(Tref^3)))+((Cpd/4)*((T(k)^4)-(Tref^4))); DSIG=Cpa*log(T(k)/Tref) + Cpb*(T(k)-Tref)+((Cpc/2)*((T(k)^2)-(Tref^2)))+((Cpd/3)*((T(k)^3)-(Tref^3)))-(R*log(P/Pref)); S(k,:)=Sres+DSIG; H(k,:)=Hres+DHIG; PV(k,:)=P; V(k,:)=Z(k,:)*R1*T(k)/(P);enddisplay(PV)display(Z)display(V)display(H)display(S)

function [Psat]=Psaturacion(T,Psup,Tc,Pc,w,opc)if opc==1 [z,f]=pengrobinson(T,Psup,Tc,Pc,w);elseif opc==2 [z,f]=soave_redlich_kwong(T,Psup,Tc,Pc,w);else opc=input('Seleccione la ecuacion de estado!: ');end

Page 4: Propiedades termodinámicas 1

fo=abs(1-(f(1)/f(2)));tol=1e-8;while fo>tol Psup=Psup*f(1)/f(2); if opc==1 [Z,f]=pengrobinson(T,Psup,Tc,Pc,w); else [Z,f]=soave_redlich_kwong(T,Psup,Tc,Pc,w); end fo=abs(1-f(1)/f(2));endPsat=Psup;

function [Z,f,Hres,Sres]=pengrobinson(T,P,Tc,Pc,w) R=8.3145; k=0.37464+(1.54226*w)-(0.26992*(w^2));alfa=( 1+k*( 1 - sqrt(T/Tc) ) ) ^2;a=0.45724*((((R^2)*(Tc^2))/Pc)*alfa);b=0.07780*((R*Tc)/Pc);A=(a*P)/(R*T)^2;B=(b*P)/(R*T);C1=(B-1);C2=A - 3*B^2 -2*B ;C3=(-A*B+(B^2)+(B^3));Z=cardano(C1,C2,C3);Z=Z(imag(Z)==0);if length(Z)>1 Z=[min(Z),max(Z)];endda=-0.45724*(R^2)*(Tc^2)/Pc*k*sqrt(alfa/(T*Tc));Hres = R*T*(Z-1)+(T*da-a)/(2*sqrt(2)*b)*log( (Z+( 1+sqrt(2) )*B) ./ (Z+ ( 1-sqrt(2) ) *B) );Sres= R*log(Z-B) + da/(2*sqrt(2)*b)*log( ( Z+(1+sqrt(2))*B )./ (Z+(1-sqrt(2))*B) );fi=exp((Z-1)-log(Z-B)-A/(2*sqrt(2)*B)*log( ( Z+(1+sqrt(2))*B )./ (Z+(1-sqrt(2))*B) ) );f=P*fi;

function [Z,f,Hres,Sres]=soave_redlich_kwong(T,P,Tc,Pc,w) R=8.3145; k=0.48+(1.574*w)-0.176*(w^2);alfa=(1+k*(1-sqrt(T/Tc)))^2;a=(0.42748*(R^2)*(Tc^2)*alfa)/Pc;b=(0.08664*R*Tc)/Pc;A=(a*P)/((R*T)^2);B=(b*P)/(R*T);C1=-1;C2=A-B-(B^2);C3=-A*B;Z=cardano(C1,C2,C3);Z=Z(imag(Z)==0);if length(Z)>1

Page 5: Propiedades termodinámicas 1

Z=[min(Z),max(Z)];endda=-((0.42748*(R^2)*(Tc^2))/Pc)*k*sqrt(alfa/(T*Tc));Hres=R*T*(Z-1)+((T*da-a)/b*log((Z+B)/Z));Sres=R*log(Z-B)+(da/b*log((Z+B)/Z));fi=exp(log(Z-B)-(A/B)*log((Z+B)/Z)+(Z-1));f=fi*P;

function z=cardano(c2,c1,c0)p=1/3*(3*c1-c2^2);q=1/27*(2*(c2^3)-9*c2*c1+27*c0);R=(q^2)/4+(p^3)/27;arg1=-q/2+sqrt(R);if arg1<0 P=-(-arg1)^(1/3);else P=arg1^(1/3);endarg2=(-q/2)-sqrt(R);if arg2<0 Q=-(-arg2)^(1/3);else Q=arg2^(1/3);endx=[P+Q,-(P+Q)/2+(P-Q)/2*sqrt(-3),-(P+Q)/2-(P-Q)/2*sqrt(-3)];z=x-c2/3;

Propiedades para el Oxigeno

TemperaturasPresion Sat Factor de compresibilidad Volumen especifico Molar

Liq Vap Liq Vap73.15 0.1134 0.0004 0.9945 0.0232 53.357183.15 0.4663 0.0016 0.9832 0.0241 14.577193.15 1.3885 0.0045 0.9611 0.0252 5.3612

103.15 3.3135 0.0103 0.9256 0.0266 2.3958113.15 6.7599 0.0204 0.8747 0.0284 1.2173123.15 12.3011 0.0371 0.8063 0.0308 0.6711133.15 20.5505 0.0641 0.7171 0.0345 0.3863143.15 32.1626 0.1107 0.5985 0.0410 0.2215153.15 47.8465 0.2255 0.4019 0.0600 0.1070

TemperaturasEntalpia *1.0e+004 Entropia

Liq Vap Liq Vap73.15 -1.3493 -0.6311 -137.1448 -38.964683.15 -1.3014 -0.6065 -119.2602 -35.688493.15 -1.2518 -0.5843 -104.5867 -32.9215

103.15 -1.1998 -0.5658 -92.1003 -30.6431113.15 -1.1441 -0.5529 -81.1095 -28.8608

Page 6: Propiedades termodinámicas 1

123.15 -1.0830 -0.5476 -71.0988 -27.6235133.15 -1.0132 -0.5534 -61.6025 -27.0662143.15 -0.9274 -0.5780 -51.9899 -27.5781153.15 -0.7882 -0.6590 -39.8376 -31.4012