usnistgov / REFPROP-wrappers

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

Excel returning wrong values from RefProp #111

Closed deloelse closed 5 years ago

deloelse commented 7 years ago

I have encountered wrong values from RefProp using Excel

Example:

=Entropy("R134a","Th","SI",368,402.51)

should return 1.60000000

instead it returns 1.19171415

I am working on a graduate studies requirement using RefProp data, unfortunately, I cannot do it in Excel because it returns wrong values.

In MatLab it returns the proper values:

refpropm('S','T',368,'H',402505,'R134a')

ans =1.6000e+03

Coding is a bit tedious, however, if it would only be possible to use Excel with macros, it would have been much more easier.

Kindly please enlighten what NIST is been doing to fix the issue

Thanks

Rodel, Manila, Philippines

ianhbell commented 7 years ago

Please see : https://pages.nist.gov/REFPROP-docs/#reference-states-enthalpy-and-entropy-differences . That is the core of the problem.

MATLAB and Excel handle reference state differently.

ianhbell commented 7 years ago

Or rather, the MATLAB and Excel wrappers of REFPROP handle the reference states differently

deloelse commented 7 years ago

Hello,

I have read those written in the above, and have also tried changing the SETREF code (2nd input, from 2& to 1&, unfortunately it doesn't show any changes).

So it all boils down to the reference state set. I have this grad school project where we need the absolute values of thermodynamic properties at single state points. I was told not to use Excel because it returns erroneous values (as stated in previous email). However, MatLab, C++ and even a customized Turbo C code that calls RefProp all return the same values (it is only Excel that returns something different).

Does it mean I have no recourse but to use one of the above mentioned programming language, and not rely on the Excel and its RefProp wrapper? (I must admit, I am more comfortable in using Excel and VBA/macros, however, as this problem occurs, I think I have no other options..)

Is there a way that wrappers for each available programming language and/or external software, would return the same values when called upon?

Thanks as always, Rodel

On Mon, Jun 12, 2017 at 4:16 AM, Ian Bell notifications@github.com wrote:

Or rather, the MATLAB and Excel wrappers of REFPROP handle the reference states differently

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/usnistgov/REFPROP-issues/issues/2#issuecomment-307653943, or mute the thread https://github.com/notifications/unsubscribe-auth/Abw0KZVjmice-3wtH5zlB51r9-wTpQnBks5sDEs0gaJpZM4N2YzB .

deloelse commented 7 years ago

Also,

It is unfortunate that with what I am doing now in Excel, I have to use the calls out, like, I'd be using Temp and Entropy to find Enthalpy, then I have to use Temp and Enthalpy to find Entropy on some other state point..like:

=Enthalpy("R134a","Ts","SI",368,1.6)

returns 402.51

while

=Entropy("R134a","Th","SI",368,402.51)

returns 1.19171415

where it's suppose to return 1.6, supposed to be the same as above

Meaning, I cannot use those parameters interchangeably, because it returns different values..

But it is possible on MatLab, C++..A choice between coding and a spreadsheet with a macro would have me preferring the latter, unfortunately, it doesnt allow me too..

Thanks for the feedback..

On Mon, Jun 12, 2017 at 10:39 AM, Rodel Frago deloelse@gmail.com wrote:

Hello,

I have read those written in the above, and have also tried changing the SETREF code (2nd input, from 2& to 1&, unfortunately it doesn't show any changes).

So it all boils down to the reference state set. I have this grad school project where we need the absolute values of thermodynamic properties at single state points. I was told not to use Excel because it returns erroneous values (as stated in previous email). However, MatLab, C++ and even a customized Turbo C code that calls RefProp all return the same values (it is only Excel that returns something different).

Does it mean I have no recourse but to use one of the above mentioned programming language, and not rely on the Excel and its RefProp wrapper? (I must admit, I am more comfortable in using Excel and VBA/macros, however, as this problem occurs, I think I have no other options..)

Is there a way that wrappers for each available programming language and/or external software, would return the same values when called upon?

Thanks as always, Rodel

On Mon, Jun 12, 2017 at 4:16 AM, Ian Bell notifications@github.com wrote:

Or rather, the MATLAB and Excel wrappers of REFPROP handle the reference states differently

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/usnistgov/REFPROP-issues/issues/2#issuecomment-307653943, or mute the thread https://github.com/notifications/unsubscribe-auth/Abw0KZVjmice-3wtH5zlB51r9-wTpQnBks5sDEs0gaJpZM4N2YzB .

ianhbell commented 7 years ago

I talked with Eric, and the heart of this problem is that TH inputs can have multiple solutions, and that is the problem you are running into. You need to append < or > to your inputs for TH to convince Excel to use one or the other of the roots. Please see the docs: https://pages.nist.gov/REFPROP-docs/#convergence-failures-and-forcing-phase-calculations

deloelse commented 7 years ago

Thanks for the info..

Have tried it though, I cant get it through..Do you have the proper syntax for this?

Also, the professor isn't convinced on this, and I was told not to use Excel on this project..(It's a convergent-divergent nozzle, with thermodynamic properties per set points on the nozzle..to calculate for an irreversible process, that is, I need to determine the amount of delta entropy (increasing) as temp drops, for an expansion on the nozzle, so callouts using temp-entropy and temp-enthalpy should have been interchangeable)..

Thanks as always, Rodel

On Jun 13, 2017 6:41 AM, "Ian Bell" notifications@github.com wrote:

I talked with Eric, and the heart of this problem is that TH inputs can have multiple solutions, and that is the problem you are running into. You need to append < or > to your inputs for TH to convince Excel to use one or the other of the roots. Please see the docs: https://pages.nist.gov/ REFPROP-docs/#convergence-failures-and-forcing-phase-calculations

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/usnistgov/REFPROP-issues/issues/2#issuecomment-307945454, or mute the thread https://github.com/notifications/unsubscribe-auth/Abw0KYTF8__-ZER0k85idXyVURJ-7vieks5sDbRlgaJpZM4N2YzB .

ianhbell commented 7 years ago

image

The problem is not Excel, it is the fact that you can have multiple solutions, which may be hidden from you depending on how you interface with REFPROP

deloelse commented 7 years ago

Thanks for this, now I know of the proper syntaxing..

I would run my project on Excel and MatLab and compare results..Will inform you of any significant discrepancy..

Thanks as always, Rodel..

On Jun 13, 2017 10:22 AM, "Ian Bell" notifications@github.com wrote:

[image: image] https://user-images.githubusercontent.com/11966765/27061734-88738476-4fa3-11e7-8701-feffffef4951.png

The problem is not Excel, it is the fact that you can have multiple solutions, which may be hidden from you depending on how you interface with Excel

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/usnistgov/REFPROP-issues/issues/2#issuecomment-307978552, or mute the thread https://github.com/notifications/unsubscribe-auth/Abw0KS_0bXHOE2ZcWxPuNK2ijVU-sDjqks5sDeLvgaJpZM4N2YzB .