Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in HAPropsSI when using enthalpy as an input (Excel VBA) #2025

Closed
ArchieLuxton opened this issue Jun 4, 2021 · 4 comments
Closed

Error in HAPropsSI when using enthalpy as an input (Excel VBA) #2025

ArchieLuxton opened this issue Jun 4, 2021 · 4 comments
Milestone

Comments

@ArchieLuxton
Copy link

I'm having some problems with the Excel wrapper calculating values based on Tdb and H - when I interrogate the error in the VBA console I can see that the HAPropsSI_temp function is returning either -1.#IND error or -1.#QNAN error.

Example inputs that give these errors are attached as a file, but a few are listed below:

Inputs: Tdb = 302.55, H = 64,654.35, P = 101,800
Output: -1.#IND

Inputs: Tdb = 283.15, H = 20,000, P = 101,400
Ouput = -1.#IND

Inputs: Tdb = 283.15, H = 20,000, P = 101,400
Output = -1.#QNAN

I've tried the following versions of the CoolProp_stdcall.dll source file (picked at random) and get the same errors:

6.4.1
6.4.0
6.1.0
4.2.5
3.0.0

The DLL file is stored in my Temp location (C:\Users\ME\AppData\Local\Temp), but I have no problems performing other calculations so I don't think this is the problem.

I'm using the latest version of Excel on Microsoft 365, 32-bit. Windows 10 on a work computer.

Many thanks

CoolProp_Errors.xlsx

QNAN

IND

@ibell
Copy link
Contributor

ibell commented Jun 17, 2021

How about atmospheric pressure? Same issue?

@ArchieLuxton
Copy link
Author

Hi Ian, thanks for the response. I've attached a file that cycles through different atmospheric pressures, from 100,000 Pa to 101,480.

At certain points (roughly every ~200 Pa apart) it resolves the right value, but at the majority of pressures (and particularly around 100,300 - 100,560) it springs up the same errors.

CoolProp_Errors_Pressure.xlsx

Thanks

@ibell
Copy link
Contributor

ibell commented Jun 18, 2021 via email

@ArchieLuxton
Copy link
Author

Hi Ian,

So I've got to the bottom of it - turns out the CoolProp script in VBA was looking in a different place than I thought for the CoolProp_stdcall.dll file! It was looking by default in C:\Users***\AppData\Roaming\CoolProp, even though I was setting the ChDir as my Temp files location. I added an extra line in the HAPropsSI function to check the current directory and set to Temp if it wasn't already. Not ideal to do this for thousands of calculations but seems to be reliable in making sure CoolProp looks in the right place for the dll (this reference has to be dynamic as other users use the same sheets/plugins).

The nightly release now works perfectly, thanks for the help!

@jowr jowr added this to the v6.4.2 milestone Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants