usnistgov / REFPROP-wrappers

Wrappers around NIST REFPROP for languages such as Python, MATLAB, etc.
193 stars 127 forks source link

Need Help Converting Excel Progeram from REFPROP 9.1 to REFPROP 10 #276

Closed fdibella closed 4 years ago

fdibella commented 4 years ago

Hello Friends: I purchased REFPROP 10 recently and discovered that my "old" Excel programs that use Refrprop 8 and 9 do not work. I then also learned from the manual that a BIG change was made to the REFPROP CALL statements BUT THAT NIST produced a program that "transforms" the "OLD" REFPROP statements in an excel workbook to the "New" REFPROP statements. NOT being to versatile in the jargon of "wraps" , "macros" , etc. I DO NOT know how NIST wants us to manipulate these files to be able to get my REFPROP 10 to work with all my old REFPROP 9 workbooks.

Please help untangle the 'jargon" for me and direct me to the promised land of succesful Thermodynamics programing.

Thank you

EricLemmon commented 4 years ago

I love your last note about "successful Thermodynamics programming", very nice!

Take a look at these and see if they help:

https://github.com/usnistgov/REFPROP-docs/blob/nist-pages/index.md#resolving-problems-linking-with-excel https://github.com/usnistgov/REFPROP-wrappers/tree/master/wrappers/Excel

BFE614 commented 4 years ago

The best way to learn how to make the conversion is to read the “Welcome tab” and then dissect cells in the “Available Properties” tab in the new REFPROP.xls file. This should get you started. It takes some time, but is better than starting from scratch. If your worksheet is large with a lot of calls, just make a new sheet and try creating a few simple cells.

Old version 9.1 =Density(“air”,”PT”,”E”,100,100) New version 10.0 =REFPROP(“D”,”air”,”PT”,”E”,100,100) Use Excel replace command to replace =Density( with =REFPROP(“D”, You can replace all density calls on a sheet at once, then do all enthalpy calls, etc…

In general, replace Density with D, Enthalpy with H, etc., but put it in quotes inside the open parenthesis and add REFPROP right after the equal sign but before the open parenthesis.

Density D Enthalpy H Entropy S Temperature T Pressure P Volume V Compressibility factor Z Look through the examples in the new REFPROP.xls for replacement letters or words for other properties. Also, change “=FluidString( , )” to “=FluidString10( , )”.

fdibella commented 4 years ago

Hello Eric: This is a good idea. It is solving the problem with a little more “brute force” than necessary BUT it avoids the need for the “wraps”, “VBs” and “macros” that I am less comfortable using. PLUS: I need to use the “FIND” and “Replace” commands anyway to get the “old” excel programs using REFPROP 9.1 to be directed to the correct new location of the REFPROP files on the new Laptop.

Thank you.

Best regards and stay safe…

Frank

EricLemmon commented 4 years ago

Just to clarify things, there is a macro available to do all of this for you, take a look at items 8 and 9 here for more information:

https://github.com/usnistgov/REFPROP-docs/blob/nist-pages/index.md#resolving-problems-linking-with-excel

fdibella commented 2 years ago

Hello: I’ve been using REFPROP Version 10 for many years and it works great. However, I just noticed that the AIR properties for enthalpy and entropy at 300 K and 0.101 MPa gives values of 426.7 kJ/kG and 3.887 kJ/kG-K, respectively which indicates that the reference temp. is not 300 K as it indicates it should be in the default settings. I’ve checked the inputs : =refprop(“h”,”air”, “PT”,”AI”,1.013/10, 300) . Any ideas, please, why my version of REFPROP V.10 is not giving me values for S and h that my colleagues are getting? NOTE: The difference in enthalpy between any two points is givingme the CORRECT difference.

Frank

ianhbell commented 2 years ago

@fdibella - you need to set the reference state in Excel to be the same as in the GUI. There is a line in the VBA you can uncomment that will have that effect.

fdibella commented 2 years ago

Hello Mr. Bell

Ian: Thank you for your reply. But I think I did not made my self clear or I don’t understand your response.

The REFPROP 10 that I installed 2 years ago seems to be working. I did need to convert my “REFPROP V9 “ files to the REFPROP V10. I did this by hand when I needed a particular file. But only recently a colleague pointed out that the absolute enthalpies calculated for a state point seem to use the wrong baseline reference temperature. The difference between statepoints is fine but the absolute values don’t use 300K as the reference. I checked the REFPROP file for Air, for example, in the prepared list of REFPROP fluids and it DOES show that 300K is the reference. But an enthalpy of air at 300K and 1 bar,a is output as 426.7 kJ/kG.

Comments , please. It is appreciated.

Frank

EricLemmon commented 2 years ago

Are you using air as a mixture or as a pseudo-pure fluid? When treated as a mixture (with air.mix), the reference state will not match the absolute values. When treated as a pseudo-pure fluid (with air.ppf), then they will match, but for the ideal gas values only. The real gas values will slightly different at 1 bar and increase as the pressure increases.

fdibella commented 2 years ago

Hello: Interesting. I am using the “air” properties that were prepared by NIST and sent with the REFPROP properties. Thus, I believe I am using the air.mix as prepared by NIST as a 21%O2 + 79% N2 mixture. I have not changed what NIST prepared. I’ll look into this further.

ianhbell commented 2 years ago

In the VBA code, you can change the reference state. See here:

image

Docs here: https://refprop-docs.readthedocs.io/en/latest/DLL/legacy.html#f/_/SETREFdll