Jump to content



Featured Articles

Check out the latest featured articles.

File Library

Check out the latest downloads available in the File Library.

New Article

Product Viscosity vs. Shear

Featured File

Vertical Tank Selection

New Blog Entry

Low Flow in Pipes- posted in Ankur's blog

Excel Code For Lee-Kesler(-Plocker) Calculations

excel lkp lee-kesler-plocker thermodynamic

This topic has been archived. This means that you cannot reply to this topic.
12 replies to this topic
Share this topic:
| More

#1 mitoman

mitoman

    Junior Member

  • Members
  • 11 posts

Posted 16 June 2016 - 04:37 PM

Can you tell me, where can I get or buy LK(P) code for Excel? I need excatly this and no other program for LK(P) calculations (Prode, DWSIM....). Does someone know what company/university use this code?

 

Every information would be really nice...



#2 PaoloPemi

PaoloPemi

    Gold Member

  • Members
  • 549 posts

Posted 17 June 2016 - 05:26 AM

Plocker combining rule gives some advantages (over Lee Kesler std.) with mixtures of fluids differing appreciably in nmolecular size (as for example the C1-C8 discussed in previous thread),

it shouldn't be difficult to code the model starting from original description (see for example Plocker, Knapp, Prausnitz 1978),

as alternative you may be able to find open sources,

I am not familiar with DWsim (and cannot give any comment about correctness of code and results) however it is open source and you can extract the part of source which you need, may be you need to correct or adapt something...

LKP model is available in many products (I have Prode Properties) but for these the source is not available.



#3 DanW

DanW

    Gold Member

  • Members
  • 50 posts

Posted 17 June 2016 - 08:35 AM

Not an easy task. If none of the previous solutions that I've sent you through private e-mails work, the LKP code in DWSIM should be a good start for Excel because it is in VB.NET: https://github.com/D... Classes/LKP.vb

 

Please note that DWSIM has an Excel interface and exposes the LKP model through it so you can build the phase diagram manually.



#4 mitoman

mitoman

    Junior Member

  • Members
  • 11 posts

Posted 17 June 2016 - 04:42 PM

Hey Daniel!

 

Thank you for your effort! Everything I've done in DWSIM works and got the results I needed. But my mentor demands connection between LKP and Gerg (Excel). He's not satisfied with copying and editing the results from DWSIM to Excel and drawing graph for Gerg comparison.

 

 

gerg-lkp-tabol-graf.jpg

 

Getting DWSIM and Excel working together will probably be much tougher. The easiest way is to get LKP in Excel. Then I'll have one document open in Excel - a few tabs for Gerg and another few for LKP - and one tab for both of them (phase envelope graph). My final result will still be the same - phase envelope. In this case results will be changing automatically whenever initial values will be changed.

The point of all is that I'll just insert needed values (critical temperature, critical pressure...) and Excel will do all by himself. 

 

 

After I've posted this topic I've found out about DWSIM Excel add-in. This looks like perfect for me. Now I'm trying to to follow this, but it's not working. Screenshots at the bottom are from Win 10 and Office 2010 (I got this version bc Properties only worked here). The same goes for Win 7 and Office 2013.

http://dwsim.inforsi...ic_Calculations

 

I've loaded DWSIM add-in, enabled macros, call function, but it doesn't work.

 

1.jpg

2.jpg

3.jpg

4.jpg

5.jpg

 

What else can I do? Smth is not loading correctly?



#5 DanW

DanW

    Gold Member

  • Members
  • 50 posts

Posted 17 June 2016 - 06:42 PM

Try using that DWSIM 4 version I've sent to you. It should work in both 32-bit and 64-bit excel versions. Also, try "Methane" instead of "methane".  :)



#6 mitoman

mitoman

    Junior Member

  • Members
  • 11 posts

Posted 18 June 2016 - 11:41 AM

I've tried using distinction between capital and regular letters. It's the same. The problem seems to be this Generic Key. Version 4 gives me no different results as the one you send me.

 

aaaaaaaa.jpg

a.jpg

 

It's something with the code and I don't know what to do. Reading literature about his problem on the internet didn't gave me any solutions.

 

I'm running everything as administrator, trying to enable/disable different add-ins, trying in different systems, different Offices, trying DWSIM 4 and the one you send me...

 

The best I get is this. With the same for LKP, I get "Value".....=GetPhaseList("Lee-Kesler-Plöcker ")

 

hhhhhhhhhh.jpg

 

What else can I even try? If this works there won't be much work for me....

 

*I had some problems with Gerg in Excel. Something with System Variables. This might be the case also?

 

iiiiiiiii.jpg

tttttttttttt.jpg

 

 

 

**I tried the same on my old laptop with Win XP and it's the same. This Generic Key is missing.


Edited by mitoman, 18 June 2016 - 05:35 PM.


#7 DanW

DanW

    Gold Member

  • Members
  • 50 posts

Posted 18 June 2016 - 06:15 PM

Download DWSIM 4 Preview 1 Installer from here: https://sourceforge....w1.exe/download

 

Your tests should work with the version you have but it is always better to have the latest version.

 

On the samples folder you'll find a "DWSIM Add-In Sample.xlsx" file. it should work 100% once you enable DWSIM's Excel Add-In (DWSIM.xll). Once you get it up and running, you can begin doing your calculations with LKP.

 

9yINpV.jpg

 

Regards,

Daniel 



#8 DanW

DanW

    Gold Member

  • Members
  • 50 posts

Posted 18 June 2016 - 07:48 PM

I was able to generate the phase diagram using DWSIM in Excel. The sheet is attached below.

 

The interaction parameter that DWSIM uses for Methane/N-octane comes from the original paper and is equal to 1.423.

 

Since DWSIM doesn't calculate the critical point directly, you can estimate it by extrapolating the two curves and checking where they cross each other.

 

g4jS9t.jpg

Attached Files


Edited by DanW, 18 June 2016 - 07:57 PM.


#9 mitoman

mitoman

    Junior Member

  • Members
  • 11 posts

Posted 05 August 2016 - 04:31 AM

I've been trying to write a code for LK calculations. Haven't use the approximation method yet, but so far can't get the correct results for Z®. It should be similar to Z(0). This is my code for reference fluid.

%Izračun Zr

%Konstante za referenčni fluid
b1_R=0.2026579; b2_R=0.331511; b3_R=0.027655; b4_R=0.203488; c1_R=0.0313385; c2_R=0.0503618; c3_R=0.016901; c4_R=0.041577; d1_R=0.48736*10^-4; 
d2_R=0.0740336*10^-4; BETA_R=1.226; GAMA_R=0.03754

%Tr_0=[0.30, 0.35, 0.40, 0.45, 0.50, 0.55, 0.60, 0.70, 0.75, 0.80, 0.85, 0.90, 0.93, 0.95, 0.97, 0.98, 0.99, 1.00, 1.01, 1.02, 1.05, 1.1, 1.15, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00, 3.50, 4.00]
%Pr_0=[0.010, 0.050, 0.100, 0.200, 0.400, 0.600, 0.800, 1.000, 1.200, 1.500, 2.000, 3.000, 5.000, 7.000, 10.000]

%clear all
Tr_r=[2, 2.2]
Pr_r=[0.800, 1]
syms Vr_r Z0_r
   
ZR = []; 
    for j = 1:length(Tr_r)
        B_R = (b1_R - b2_R/Tr_r(j) - b3_R/Tr_r(j)^2 - b4_R/Tr_r(j)^3);
        C_R = (c1_R - c2_R/Tr_r(j) + c3_R/Tr_r(j)^3);
        D_R = (d1_R + d2_R/Tr_r(j));
    for i = 1:length(Pr_r)
            Vr = double(solve(-Pr_r(i)*Vr_r/Tr_r(j) + 1 + B_R/Vr_r + C_R/Vr_r^2 + D_R/Vr_r^5 + c4_R/(Tr_r(j)^3*Vr_r^2)*(BETA_R + GAMA_R/Vr_r^2)*exp(-GAMA_R/Vr_r^2), Vr_r));
            
        %Izračun Z0_r
        ZR(end+1) = double(solve(-Z0_r + 1 + B_R/Vr + C_R/Vr^2 + D_R/Vr^5 + c4_R/(Tr_r(j)^3*Vr^2)*(BETA_R + (GAMA_R/Vr^2))*exp(-GAMA_R/Vr^2), Z0_r));
    end
end
disp(ZR)

It should go like that:

fgfgfgf.jpg

 

My results are : 1.0041    1.0059    1.0117    1.0151

But they should be : 0.0617    0.0767   0.0719   0.0857
 
I know this code won't work for smaller values of Tr and Pr. There is a need for approximation with Newton-Raphson method. I also tried for the biggest values of Tr and Pr and it's still the same.
 
What am I doing wrong? 
 
What is the calculation procedure after I get those LK tables? What thermodynamic properties can I calculate?

Edited by mitoman, 05 August 2016 - 08:00 AM.


#10 serra

serra

    Gold Member

  • Members
  • 310 posts

Posted 05 August 2016 - 09:40 AM

Mitoman,

there are solved examples in many books,

but please see the aswer given by Paolo for Lee Kesler Plocker

 

http://www.cheresour...r-calculations/

 

it may seem that you are looking for a wrong solutions....



#11 mitoman

mitoman

    Junior Member

  • Members
  • 11 posts

Posted 05 August 2016 - 01:07 PM

I've seen it. Thanks for the effort, but I need the whole procedure, not just the results. It's not up to me. I need old school version. :)

 

First is to get those tables done and I have two problems:

- calculating Z®

- implementing Newton-Raphson method

 

Can anyone help me with that?



#12 serra

serra

    Gold Member

  • Members
  • 310 posts

Posted 05 August 2016 - 02:42 PM

your first post was about generating a phase diagram for C1-nC8 and I think Paolo answerd the question (see the phase diagram generated with Prode Properties and LKP)

if you wish to discuss details with the scope to write your own code perhaps the student's forum would be more appropriate,

anyway, the information you are looking for is available in many books, my copy of Chemical Engineering thermodynamics (Daubert) includes the Fortran code for Lee Kesler, the Thermophysical properties of fluids (Marc Assael ...) has the code for LKP plus examples etc.



#13 somy

somy

    Brand New Member

  • Members
  • 2 posts

Posted 14 March 2017 - 06:21 AM

Dear all,

 

I am simulating CO2 absorption process in a rate-based model using aspen plus software. the solvent which I am using  is a mixture of physical solvent + Monoethanol amine (chemical solvent) . the gas is flue gas. I have to confirm that the amount of CO2 absorption using this mixture is higher than Monoethanolamine alone as solvent.  would you please help me regarding this problem? which thermodynamic model is suitable for mixed solvents. and is it necessary the codding or something like this?






Similar Topics