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

0

Aspen Plus - Sensitivity Analysis / Case Study - Need Assistance


23 replies to this topic
Share this topic:
| More

#1 SickPuppy0

SickPuppy0

    Junior Member

  • Members
  • 22 posts

Posted 07 February 2023 - 05:18 AM

Hello! Can someone please point me in the right direction, I've spent all day on this and have read through the support documentation / user manual.

I want to perform a sensitivity analysis. In this example I want to evaluate entropy departure as a function of pressure. Please see the image uploaded to imgur below. I have annotated what I've tried thus far. This is so easy to do in HYSYS via the "Case Study", however, I cannot find entropy departure in HYSYS.

https://imgur.com/a/yxymiyH

Can someone please assist and advise what I'm missing? There is no option to select entropy departure as a dependent variable (output).

Thank you so much, appreciate it.


Edited by SickPuppy0, 07 February 2023 - 05:22 AM.


#2 SilverShaded

SilverShaded

    Gold Member

  • Members
  • 237 posts

Posted 07 February 2023 - 12:06 PM

I don't think  enthalpy/entropy departures are directly available in Hysys, easy to calcuate though if you use the ideal gas enthalpy/entropy correlations and subtract the Hysys Peng-Robinson estimate of stream enthalpy/entropy and take into account the Enthalpy of formation.


Edited by SilverShaded, 07 February 2023 - 12:07 PM.


#3 SickPuppy0

SickPuppy0

    Junior Member

  • Members
  • 22 posts

Posted 07 February 2023 - 08:06 PM

Thank you for the feedback. I have manually calculated entropy departure successfully via PR-EOS. However, I am now required to use BWRS-EOS.

 

The entropy departure is available in Aspen Plus. Regarding my original question, I was able to successfully perform the sensitivity analysis by first creating a Property Set and using the DSMX code for entropy departure.

 

However, the values (when using PR-EOS) as reported by Aspen Plus do not match my manually calculated values for PR-EOS.

 

Is there another software I could use to check these values? I tried installing and using Prode Properties, however, the add-in will not appear under excel, so I am lost on what to do.

 

Thanks again



#4 breizh

breizh

    Gold Member

  • Admin
  • 6,349 posts

Posted 07 February 2023 - 08:37 PM

Hi,

You may review your calculation:

https://en.wikipedia...arture_function

Note: what is important is the difference (Internal energy or enthalpy or entropy) not the absolute value.

To me nothing to do with software.

EDIT:

https://www.epj-conf...m2014_02106.pdf

 

my 2 cents

Breizh 



#5 SilverShaded

SilverShaded

    Gold Member

  • Members
  • 237 posts

Posted 08 February 2023 - 04:05 AM

Thank you for the feedback. I have manually calculated entropy departure successfully via PR-EOS. However, I am now required to use BWRS-EOS.

 

The entropy departure is available in Aspen Plus. Regarding my original question, I was able to successfully perform the sensitivity analysis by first creating a Property Set and using the DSMX code for entropy departure.

 

However, the values (when using PR-EOS) as reported by Aspen Plus do not match my manually calculated values for PR-EOS.

 

Is there another software I could use to check these values? I tried installing and using Prode Properties, however, the add-in will not appear under excel, so I am lost on what to do.

 

Thanks again

Hysys PR entropy departure calc is the correct value, i have checked it manually.  However, entropy is pressure dependent unlike enthalpy and you have to use the same reference pressure.  To match Hysys you have to use two departure values, one at the reference temperature and pressure and one at the actual temperature and pressure. 

 

Use PREOS.XLS, Hysys or A+ will match it if you know what your doing.


Edited by SilverShaded, 08 February 2023 - 04:08 AM.


#6 SickPuppy0

SickPuppy0

    Junior Member

  • Members
  • 22 posts

Posted 22 February 2023 - 06:42 AM

 

Thank you for the feedback. I have manually calculated entropy departure successfully via PR-EOS. However, I am now required to use BWRS-EOS.

 

The entropy departure is available in Aspen Plus. Regarding my original question, I was able to successfully perform the sensitivity analysis by first creating a Property Set and using the DSMX code for entropy departure.

 

However, the values (when using PR-EOS) as reported by Aspen Plus do not match my manually calculated values for PR-EOS.

 

Is there another software I could use to check these values? I tried installing and using Prode Properties, however, the add-in will not appear under excel, so I am lost on what to do.

 

Thanks again

Hysys PR entropy departure calc is the correct value, i have checked it manually.  However, entropy is pressure dependent unlike enthalpy and you have to use the same reference pressure.  To match Hysys you have to use two departure values, one at the reference temperature and pressure and one at the actual temperature and pressure. 

 

Use PREOS.XLS, Hysys or A+ will match it if you know what your doing.

 

 

Oh shit! This could explain everything! 

 

I've since coded BWRS-EOS into Python, and again I'm having significant issues with the entropy departure. I'll try what you've suggested and report back.

 

Thank you



#7 SickPuppy0

SickPuppy0

    Junior Member

  • Members
  • 22 posts

Posted 22 February 2023 - 06:55 AM

Hmm, however, this shouldn't be an issue as comparison to the reference state will simply cancel? I don't need the departure values to match Aspen, I just need the final result to be correct.

 

Here's some numbers for Propane evaluated via BWRS-EOS:

T1 = 378.15 K,   P1 = 500 kPaA,   Enthalpy Departure: -407.06 J/mol,   Entropy Departure = -52.43 J/mol,    Cp Ideal = 89.82 J/mol.K

T2 = 463.15 K,   P2 = 2500 kPaA, Enthalpy Departure: -1324.7 J/mol,   Entropy Departure = -67.12 J/mol,    Cp Ideal = 105.04 J/mol.K

 

enthalpy_delta = 0.5*(89.82+105.04)*(463.15-378.15) + (-1324.7-(-407.06)) = 7363.91 J/mol  CORRECT

 

entropy_delta = 0.5*(89.82+105.04)*ln(463.15/378.15) - 8.31447 * ln(2500/500) + (-67.12-(-52.43)) = -8.32 J/mol.K. INCORRECT

 

Python script:  https://pastebin.com/80w9npaT

 

The results for enthalpy are correct, however, entropy is horribly incorrect. I strongly believe this is due to the entropy departure values which differ from what I calculate via Peng-Robinson by over 1000%. As summarised in the comparison between PR-EOS and BWRS-EOS below, the entropy departure as calculated by BWRS is an order of magnitude larger than PR-EOS.

 

VKFui.png

 

Any advice would be highly appreciated, I've been struggling for a while and cannot get this to work.

 

Entropy departure per K.E Starling:

 

pYqwN.png


Edited by SickPuppy0, 22 February 2023 - 07:13 AM.


#8 breizh

breizh

    Gold Member

  • Admin
  • 6,349 posts

Posted 22 February 2023 - 07:53 AM

Hi,

My hand calculations for your conditions using Peng Robinson: 

Sr1 = -7.089 e-01 J/mol K

Sr2 = -2.294 J/mol K

very similar to yours

Breizh



#9 SilverShaded

SilverShaded

    Gold Member

  • Members
  • 237 posts

Posted 22 February 2023 - 09:32 AM

Hmm, however, this shouldn't be an issue as comparison to the reference state will simply cancel? I don't need the departure values to match Aspen, I just need the final result to be correct.

 

Here's some numbers for Propane evaluated via BWRS-EOS:

T1 = 378.15 K,   P1 = 500 kPaA,   Enthalpy Departure: -407.06 J/mol,   Entropy Departure = -52.43 J/mol,    Cp Ideal = 89.82 J/mol.K

T2 = 463.15 K,   P2 = 2500 kPaA, Enthalpy Departure: -1324.7 J/mol,   Entropy Departure = -67.12 J/mol,    Cp Ideal = 105.04 J/mol.K

 

enthalpy_delta = 0.5*(89.82+105.04)*(463.15-378.15) + (-1324.7-(-407.06)) = 7363.91 J/mol  CORRECT

 

entropy_delta = 0.5*(89.82+105.04)*ln(463.15/378.15) - 8.31447 * ln(2500/500) + (-67.12-(-52.43)) = -8.32 J/mol.K. INCORRECT

 

Python script:  https://pastebin.com/80w9npaT

 

The results for enthalpy are correct, however, entropy is horribly incorrect. I strongly believe this is due to the entropy departure values which differ from what I calculate via Peng-Robinson by over 1000%. As summarised in the comparison between PR-EOS and BWRS-EOS below, the entropy departure as calculated by BWRS is an order of magnitude larger than PR-EOS.

 

VKFui.png

 

Any advice would be highly appreciated, I've been struggling for a while and cannot get this to work.

 

Entropy departure per K.E Starling:

 

pYqwN.png

 

I'm kinda interested to get this working but dont have the original publication, tried the parameters out of hysys (which does seem to get the right answer in the software) but my manual calculation is nonsense.  Probably due to units in my case.  I hit a brick wall.

 



#10 breizh

breizh

    Gold Member

  • Admin
  • 6,349 posts

Posted 23 February 2023 - 05:09 AM

Hi,

To support your work, consider the paper attached.

Pay attention of units (British).

 

EDIT: the equation for enthalpy departure in your code is different from the equation in the paper attached 

 

Good luck.

 

Breizh 



#11 PaoloPemi

PaoloPemi

    Gold Member

  • Members
  • 549 posts

Posted 23 February 2023 - 02:34 PM

SickPuppy0,
make sure to adopt the correct formulas (and unit conversion),
since you mentioned Prode Properties herebelow dS, dH calculated with Prode for Peng-Robinson, BWRS and Lee-Kesler-Plocker

 

T   K                                    378.15                          463,15
P   KPa                                500                               2500
dH (Lee Kesler Plocker)    -404.6208744             -1383.153503
dH (Peng Robinson)         -400.801857               -1490.951624
dH (BWRS)                       -397.7927583              -1355.284247
dS (Lee Kesler Plocker)    -0.754053702             -2.195269712
dS (Peng Robinson)         -0.708777759             -2.294205138
dS (BWRS)                       -0.733152114              -2.106519652

 

 

hoping this may help to fix your code

 


Edited by PaoloPemi, 23 February 2023 - 03:01 PM.


#12 SilverShaded

SilverShaded

    Gold Member

  • Members
  • 237 posts

Posted 24 February 2023 - 06:04 AM

Hi,

To support your work, consider the paper attached.

Pay attention of units (British).

 

EDIT: the equation for enthalpy departure in your code is different from the equation in the paper attached 

 

Good luck.

 

Breizh 

Thanks for the paper!, been trying to find time to look at it, i seem to get a reasonable enthlpy departure but still cannot get a believable entropy dep.  Both methods seems to give the same wrong asnwer (the formula in the paper and the longer formular shown above by sickpuup).  They seam to be an order of magnitude too big as mentioned earlier sickpuppy.

Even more frustrating is using the coeffcients out of hysys i cant figure what units they are in...  and also its using a different basis for entropy than the PR or Lee-Keser methods.so hard to compare.

Anyway i learn't something new which is its iterative wiith mutliple roots!  Hopefully find time next week to have another look, has anyone figured it out?

 


Edited by SilverShaded, 24 February 2023 - 06:05 AM.


#13 breizh

breizh

    Gold Member

  • Admin
  • 6,349 posts

Posted 24 February 2023 - 06:45 AM

Hi,

To be frank I'm struggling with Imperial Units!  No indication in the paper about the units for the calculation (H-H0) or (S-So).

 

Breizh 



#14 SilverShaded

SilverShaded

    Gold Member

  • Members
  • 237 posts

Posted 24 February 2023 - 09:13 AM

I was gussing BTU/lbmol/F, allways gives me a headache when i see imperial units.

I think i may have got it,

 

S-S0 = (H-H0)/T - R ln f   i think is wrong it should be S-S0 = (H-H0)/T - R ln (f/P), ie should be the fugacity coeficient not the fugacity, works perfectly for peng robinson is SI units

 

e.g. -400.11 j/mol / 378.15 - 8.3145 * ln(0.47936/5) = -0.70758

For BWRS using the coefficienct in the paper i get

-0.54 and -2.02 j/mol  which is a little bit off but im going to guess that the coefficients were updated later on to give better matches.

I stil have no idea what Hysys is doing...

 



#15 mrbabu

mrbabu

    Gold Member

  • Members
  • 55 posts

Posted 24 February 2023 - 10:07 AM

Paolo,

I am curious, how did you calculate these values for Propane with Prode Properties ?

 

T   K                                    378.15                          463,15
P   KPa                                500                               2500
dH (Lee Kesler Plocker)    -404.6208744             -1383.153503
dH (Peng Robinson)         -400.801857               -1490.951624
dH (BWRS)                       -397.7927583              -1355.284247
dS (Lee Kesler Plocker)    -0.754053702             -2.195269712
dS (Peng Robinson)         -0.708777759             -2.294205138
dS (BWRS)                       -0.733152114              -2.106519652



#16 breizh

breizh

    Gold Member

  • Admin
  • 6,349 posts

Posted 24 February 2023 - 11:47 PM

Hi,

Consider my calculation, using your data for the coefficients but modifying the equations according to paper and comments from SilverShaded.

 

(S-S0) = (H-H0)/T-R*Ln (Phi) with Phi = f /P, f fugacity and P pressure

 

Easy to demonstrate using the word doc (Thermodynamic textbook), same for the calculation using the info on the right side of the document (Pressure explicit EOS).

 

Hope this is helping you.

 

Breizh



#17 PaoloPemi

PaoloPemi

    Gold Member

  • Members
  • 549 posts

Posted 25 February 2023 - 02:04 AM

mrbabu,

with Prode Properties you can calculate departures in different ways (just consider the relationships among fugacity, enthalpy, entropy...),

for example, since with Prode yo have access to fugacities, enthalpies, entropies and volumes for a stream you can calculate :

 

dS = dH / T - Rgas*SUM(zi*ln(phi))

 

similar correlations for dH and so on...

however a simple solution is to evaluate the difference (real model - ideal model),
I define stream 1 and 2 with the same composition but 1 has the ideal model for H, S while in stream 2 I define for H, S the model I am interested to evaluate...
note that StrSGH() returns mass based values, to convert to mole multiply by Molar Weight,

in Excel, cell B1 enter temperature, cell B2 enter pressure
then enter these macros to calculate dH and dS at specified conditions...

= setOp(1,B1,B2)
= setOp(2,B1,B2)
= (StrSGH(2)-StrSGH(1))*StrMw(1)
= (StrSGS(2)-StrSGS(1))*StrMw(1)

 

 

click this link to see the snapshot of Excel :

https://ibb.co/nLTTxpY


according my tests this works for all H , S  models included in Prode Properties with some minor differences for models based on Helmholtz (GERG 2008 etc.)  probably cause these have specific correlations for ideal state...

 

Attached Files



#18 SilverShaded

SilverShaded

    Gold Member

  • Members
  • 237 posts

Posted 25 February 2023 - 02:46 PM

It seems to me that this formula is just wrong, somewhere they seem to have got confused between fugacity and fugacity co-efficient, I just wish my maths and thermo was good enough to understand where it went wrong...

 

Attached Files


Edited by SilverShaded, 25 February 2023 - 02:46 PM.


#19 SickPuppy0

SickPuppy0

    Junior Member

  • Members
  • 22 posts

Posted 27 February 2023 - 03:04 AM

It seems to me that this formula is just wrong, somewhere they seem to have got confused between fugacity and fugacity co-efficient, I just wish my maths and thermo was good enough to understand where it went wrong...

 

attachicon.gif Clipboard01.png

 

I am getting phenomenal results now. For BWRS equation of state the entropy change must be calculated like so:

 

(S2 - S1) = CpIdeal * ln(T2/T1) + (entropy departure2 - entropy departure1)

 

STATE 1: Z: 0.9617, Molar Volume: 6047.7cm3/mol, Enthalpy Departure: -407.1J/mol, Entropy Departure: -52.4J/mol, CpID: 89.8J/mol.K, CvID: 81.5 J/mol.K.

STATE2: Z: 0.9028, Molar Volume: 1390.6cm3/mol, Enthalpy Departure: -1234.7J/mol, Entropy Departure: -67.1J/mol, CpID: 105.0J/mol.K, CvID: 97.7J/mol.K.

 

dS = (89.8+105.0)/2*ln(463.15/378.15)+(-67.1-(-52.4)) = 5.05

 

 

State 1 V (cm3/mol): 6047.67

State 2 V (cm3/mol): 1390.62
Enthalpy Delta kJ/kg.mol: 7363.71

Entropy Delta kJ/kg.mol: 5.069

 

Updated code: https://pastebin.com/NzvKSD0s


Edited by SickPuppy0, 27 February 2023 - 03:06 AM.


#20 SilverShaded

SilverShaded

    Gold Member

  • Members
  • 237 posts

Posted 27 February 2023 - 06:20 AM

Thanks to your post i've figured out were i was going wrong with the Hysys Si version (pressure in wrong unit - doh). 

I'm not convinced entropy departure is -52.4 J/mol though.

I now get -0.883 J/mole and -2.18 J/mol which compares resonably well with Peng Robinson of -0.708 and -2.290 J/mol at the two conditions.

 

Strangely your method seems to give the right answer for delta entropy, if i use 'my' method i get 4.99 Entropy Delta, which is similar.

Neither method seems to reproduce the actual entropy reported in Hysys for either stream.  This is confusing :)





 



#21 SickPuppy0

SickPuppy0

    Junior Member

  • Members
  • 22 posts

Posted 27 February 2023 - 07:52 AM

Thanks to your post i've figured out were i was going wrong with the Hysys Si version (pressure in wrong unit - doh). 

I'm not convinced entropy departure is -52.4 J/mol though.

I now get -0.883 J/mole and -2.18 J/mol which compares resonably well with Peng Robinson of -0.708 and -2.290 J/mol at the two conditions.

 

Strangely your method seems to give the right answer for delta entropy, if i use 'my' method i get 4.99 Entropy Delta, which is similar.

Neither method seems to reproduce the actual entropy reported in Hysys for either stream.  This is confusing :)





 

 

I believe because BWRS is power series in density the first term on the RHS of the equation (k.R*log(rho_molar*k.R*T))  IS the ideal gas contribution of molar volume. So it's incorrect to compare PR entropy departure against BWRS entropy departure as PR does not include the molar volume contribution in the derivation for entropy departure (I could be wrong this is just my current understanding)

 

Even comparing the two in Aspen Plus yields wildy different values with the BWRS entropy departure being consistently an order of magnitude larger than the entropy departure estimated by PR.

 

To be honest I don't fully understand the mathematics, however, applying the entropy departure equation as presented by Starling and omitting -R * ln(P2/P1) in the ideal gas contribution yields excellent results for every case I have studied thus far.

 

I also believe HYSYS has proprietary methods to evaluate certain properties which may be contributing to the observed minute difference.


Edited by SickPuppy0, 27 February 2023 - 07:57 AM.


#22 SilverShaded

SilverShaded

    Gold Member

  • Members
  • 237 posts

Posted 27 February 2023 - 09:05 AM

"omitting -R * ln(P2/P1) in the ideal gas contribution"

 

aha! thats probably the difference... 

 

EntroDep from the big equation - Rln(p1/2) = entropy dep as calcuated by DH/T - R*ln(phi)

 

its just a difference in where the pressure correction is placed.


Edited by SilverShaded, 27 February 2023 - 11:05 AM.


#23 mrbabu

mrbabu

    Gold Member

  • Members
  • 55 posts

Posted 01 March 2023 - 01:57 AM

mrbabu,

with Prode Properties you can calculate departures in different ways (just consider the relationships among fugacity, enthalpy, entropy...),

for example, since with Prode yo have access to fugacities, enthalpies, entropies and volumes for a stream you can calculate :

 

dS = dH / T - Rgas*SUM(zi*ln(phi))

 

similar correlations for dH and so on...

however a simple solution is to evaluate the difference (real model - ideal model),
I define stream 1 and 2 with the same composition but 1 has the ideal model for H, S while in stream 2 I define for H, S the model I am interested to evaluate...
note that StrSGH() returns mass based values, to convert to mole multiply by Molar Weight,

in Excel, cell B1 enter temperature, cell B2 enter pressure
then enter these macros to calculate dH and dS at specified conditions...

= setOp(1,B1,B2)
= setOp(2,B1,B2)
= (StrSGH(2)-StrSGH(1))*StrMw(1)
= (StrSGS(2)-StrSGS(1))*StrMw(1)

 

 

click this link to see the snapshot of Excel :

https://ibb.co/nLTTxpY

according my tests this works for all H , S  models included in Prode Properties with some minor differences for models based on Helmholtz (GERG 2008 etc.)  probably cause these have specific correlations for ideal state...

 

thank you very much Paolo !

I'll open a specific thread about Prode Properties as I need to access several properties and the derivatives (dP, dT, dW)



#24 breizh

breizh

    Gold Member

  • Admin
  • 6,349 posts

Posted 03 March 2023 - 07:18 AM

Hi,

I've updated my document with derivation and application to the initial problem. I found a few mistakes in the documents supplied by the OP.

At the end of the day better to use a Simulator, hand calculation is a pain. 

Hope this is helping those interested by the subject.

 

EDIT : Sorry I shared the wrong file, my apologies

Breizh 

 






Similar Topics