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

1

Prode Properties In Excel


8 replies to this topic
Share this topic:
| More

#1 ryn376

ryn376

    Gold Member

  • Members
  • 94 posts

Posted 24 June 2020 - 12:09 PM

Does anybody have a primer (instructions) on how to initialize components, EOS, T, P, etc using Excel formulas and not macros for Prode Properties? I have read through the manual provided, but do no understand how. I have played with it, but cannot seem to get it to work properly. For example, if I change mol fractions, it only updates when I reopen, but pressures and mol fracs are not pulling correctly.


Edited by ryn376, 24 June 2020 - 01:30 PM.


#2 PaoloPemi

PaoloPemi

    Gold Member

  • Members
  • 493 posts

Posted 24 June 2020 - 01:58 PM

in Excel the common methods to edit streams (change compositions, models etc.) are from Properties Editor or with VBA macros,

from Properties Editor you can edit all streams, to save edited values  there is a button Save on Stream:Operating tab,

with VBA macros you can define compositions, molar fractions, models etc.

see for example

https://www.cheresou...rties-in-excel/

 

once you define components and feed,  the program calculates compositions, solving the different unit operations (as in other simulators),

if you wish to define components, models etc. using Excel formulas I would suggest to create a VBA macro and use that macro in your formula,  for example =defineStream(c1,c2,c3,z1,z2,z3...)


Edited by PaoloPemi, 24 June 2020 - 02:12 PM.


#3 ryn376

ryn376

    Gold Member

  • Members
  • 94 posts

Posted 25 June 2020 - 06:22 AM

Paolo,

 

Thanks for the reply. A few things, I would prefer not to have to use macros if possible. Mainly so that I can push and pull values easily without having to reference specific cells in a macro. I would prefer to just write formulas in cells and not have to go into the VBA editor, is that possible? I don't mind using VBA to make a button that I click to says to push and pull values, though.

 

 

Another problem is that I when I use VBA, I get "Compile error: Sub or Function not defined" when I use

 

Sub d()
Call initS(2)
End Sub
 
I assume I need to load something. I am using the latest version, downloaded yesterday Rel 1.2d1 free version. It does not seem to come with the files listed in the manual anymore:
 
pseudo.dat
bips.dat
mod.dat
def.ppp
res.lan
lic.dat
 
I even checked the hidden files. I assume those are files are deprecated.

Attached Files


Edited by ryn376, 25 June 2020 - 06:23 AM.


#4 PaoloPemi

PaoloPemi

    Gold Member

  • Members
  • 493 posts

Posted 25 June 2020 - 07:26 AM

Prode Properties distribution for Windows includes a folder  C:/Program Files/Prode/Excel with several examples, if you wish to create a new worksheet include the definitions for Excel VBA, these definitions are available in ppp.vba and instruct Excel about the methods exported by Prode Properties library, you can access these methods from Excel with formulas as =StrGD(1) or VBA, there are other options but those require a knowledge of Office interface, personally i prefer VBA which is simple to learn, also Excel includes a decent debugger which can be helpful to find arrors and mistakes in your code...

You can define streams (list of components, feed, models, BIPs etc.) from VBA or Editor,

from VBA you can start with initS() which clears all contents in specified stream then add components, feed fractions, models etc. and finally call setS() to store values,

you can modify the fractions of each component with  putZ(..) and then call setS() to store values

 

For I = 1 To getCNr(stream)
        val = Cells(I + 15, 3)
        res = putZ(stream, I, val)
        sum = sum + val ' increment total
Next I

 

see the attached worksheet as example

 

Attached Files

  • Attached File  test.xls   183.5KB   11 downloads


#5 ryn376

ryn376

    Gold Member

  • Members
  • 94 posts

Posted 02 July 2020 - 11:23 AM

Paolo,

 

Thank you for responding. Sorry I have taken so long to get back. To use the Prode macros in any workbook, do I have to add the module as you did in text.xls? If so, that is why it wasn't working for me. Is there a way to not have to copy the properties module into every new workbook that I want to use the macros in?


Edited by ryn376, 02 July 2020 - 12:22 PM.


#6 PaoloPemi

PaoloPemi

    Gold Member

  • Members
  • 493 posts

Posted 02 July 2020 - 12:55 PM

in Windows, to use the macros you need to instruct Excel where to find these macros (for Prode in external library ppp.dll), which variables to pass etc. , you can provide this information once by loading the addin (properties.xla) which has global visibility or put your definitions in each sheet, of course you can include the definitions only for the macros of your interest,

as alternative, in Office for Android, you can adopt different mechanisms...



#7 ryn376

ryn376

    Gold Member

  • Members
  • 94 posts

Posted 02 July 2020 - 01:31 PM

How do I load the addin in VBA so that it runs? As you can see, the properties.xla is loaded, but it does not work.

 

 

Attached Files



#8 PaoloPemi

PaoloPemi

    Gold Member

  • Members
  • 493 posts

Posted 03 July 2020 - 01:04 AM

the addin properties.xla allows to insert the macros in Excel cells,

for example you can insert in a cell

= StrMw(1)

= StrPc(1,1)

...

for your specific case (create a different vba project) I would suggest to copy and paste the VBA defiitions as discussed in previous post, then you save the page with your code and all VBA macros and definitions included,

Excel saves everything and you do not need to care for,  if you mean that,

why don't you wish to include the VBA definitions in your page ?

it is the normal practice as far as I know.



#9 ryn376

ryn376

    Gold Member

  • Members
  • 94 posts

Posted 07 July 2020 - 07:25 AM

Paolo,

 

It makes sense to me now. Thank you for your time!






Similar Topics