Code covered by the BSD License  

Highlights from
Mixture property calculations using PR, RK and SRK EoS.

Be the first to rate this file! 29 Downloads (last 30 days) File Size: 8.14 KB File ID: #27850

Mixture property calculations using PR, RK and SRK EoS.

by

 

08 Jun 2010 (Updated )

The file prsrk.m calculates major thermodynamic properties using any of PR, RK or SRK EoS.

| Watch this File

File Information
Description

Included in the zipped file you find the prsrk.m routine to calculate molar volume, compressibility factor, fugacity coefficient, Helmholtz energy, entropy, enthalpy, internal energy, and Gibbs energy of vapor and liquid mixtures. The other Matlab functions/scripts are part of a steady-state distillation example as depicted in Fig. 15.6 (pp. 568) of Henley, E. J. and Seader, J. D., "Equilibrium-Stage Separation Operations in Chemical Engineering", 1981, John Wiley & Sons. The files include:

1 ) main_dist.m is the main script containing input data and the call to fmincon.
2 ) feed_dist.m performes BP, DP and flash calculations for the feed conditions.
3 ) model_dist.m is the vectorized distillation column model.
4 ) nonlcon_dist.m is the nonlinear function argument of fmincon.
5 ) parameters_dist.m includes all the parameters needed for the simulation such as tehrmodynamic parameters and pressure drop along the stages.

The results of the simulation in Matlab agree perfectly with those found by simulating the same system in Aspen Plus 2006.

Required Products Optimization Toolbox
MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
15 Feb 2014 h_acar

I tried this file to estimate the vapor fraction of a reactor feed. I have 64 days inlet data, most of the days the result is consistent with Aspen HYSYS flash calculation but for some days(nearly 10 days) the fmincon function gives negative results and vapor fraction becomes negative, which is impossible. How can I fix the prolem?

06 Dec 2013 Marc

Tried running this and got the following error. Not sure what the problem is??

Error using -
Matrix dimensions must agree.
Error in prsrk (line 90)
AR = a/(b*(sqrt(u^2 - 4*v)))*log((2*Z + Bs*(u - sqrt(u^2 - 4*v)))/ (2*Z + Bs*(u +
sqrt(u^2 - 4*v)))) - ...
Error in model_dist (line 6)
[~,~,phiL,~,~,HL(j),~,~] =
prsrk(x(j,:),P(j)*1e5,T(j)+273.15,pc,Tc,w,k,cpig,DHf,DGf,'L',Thermo);
Error in nonlcon_dist (line 22)
model_dist
Error in C:\Program Files\MATLAB\R2013a\toolbox\optim\optim\barrier.p>barrier (line 398)

Error in fmincon (line 900)
[X,FVAL,EXITFLAG,OUTPUT,LAMBDA,GRAD,HESSIAN] =
barrier(funfcn,X,A,B,Aeq,Beq,l,u,confcn,options.HessFcn, ...
Error in main_dist (line 65)
r = fmincon('1',x0,[],[],[],[],[],[],@nonlcon_dist,options,u,d,N,C);

15 May 2013 Antonio

hb, please give the specifics on the problem you're running into...

09 May 2013 hb

the submission doesn't run. I'm working with matlab 2009, is it a problem?? thnx

01 Mar 2011 Lee Shunn

In "prsrk.m" the units on reference pressure (Pref) should be Pascals, not bar to be consistent with other inputs and your gas constant.

Updates
02 Mar 2011

Thanks to Lee Shunn's comments (March 1, 2011), the reference pressure was fixed to comply with consistency.

18 Dec 2013

Files updated after fixing wrong data.

Contact us