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

Vba Code To Extract Volume, Fugacity, Enthalpy And Entropy Derivatives

vba code volume entahlpy entropy derivatives prode

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

#1 mattb

mattb

    Brand New Member

  • Members
  • 9 posts

Posted 22 February 2016 - 09:02 AM

can you refresh my memory as to how to extract composition and temperature derivatives of fugacity, volume, enthalpy and entropy with VBA code from Prode Properties ?  

I have the C code working but I need to convert to VBA and I have problems with pointers,

I think there was a VBA code here posted by Paolo but I am unable to find the post at cheresources forum...

Thanks for help.



#2 PaoloPemi

PaoloPemi

    Gold Member

  • Members
  • 550 posts

Posted 22 February 2016 - 11:04 AM

as for C / C++  etc. with Prode Properties you can access directly the functions to calculate

 

Fugacity + derivatives (vs. p,t,w)

Enthalpy + derivatives (vs. p,t,w)

Entropy + derivatives (vs. p,t,w)

Volume + derivatives (vs. p,t,w)

 

with VBA you need to create a space (remember first element is 0 as in C)

for example you may write something like this

 

' define space
Dim w(0 To 10) As Double
Dim dVw(0 To 10) As Double

' initialize process
process = 1
res = DPinit(process,stream)

' define composition
w(0) = 0.81
w(1) = 0.09
w(2) = 0.06
w(3) = 0.02
w(4) = 0.01
w(5) = 0.004
w(6) = 0.006
w(7) = 0.0
w(8) = 0.0
w(9) = 0.0

t = 280
p = 250000

' calculate volume and dV/dt dV/dp dV/dw
res = StrVvd(process,1,t,p,w(0),V,dVt,dVp,dVw(0))
 

in a similar way you can calculate the fugacity, enthalpy and entropy.

 

Being a direct access execution is fast,

for complex models such as CPA or SAFT you may allow some additional time for solving the association contribute,

 

Paolo



#3 mattb

mattb

    Brand New Member

  • Members
  • 9 posts

Posted 30 March 2016 - 02:24 PM

thanks Paolo,

I was able to extract the values following your instruction,

do you know if these are numerical or analytical ... ?


Edited by mattb, 30 March 2016 - 02:24 PM.





Similar Topics