File Exchange

image thumbnail

Mixture property calculations using PR, RK and SRK EoS.

version 1.2 (8.14 KB) by

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



View License

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.

Comments and Ratings (5)


h_acar (view profile)

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?


Marc (view profile)

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),~,~] =
Error in nonlcon_dist (line 22)
Error in C:\Program Files\MATLAB\R2013a\toolbox\optim\optim\barrier.p>barrier (line 398)

Error in fmincon (line 900)
    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);


Antonio (view profile)

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


hb (view profile)

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

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.



Files updated after fixing wrong data.


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

MATLAB Release
MATLAB 7.10 (R2010a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video