usnistgov / REFPROP-wrappers

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

Error in "RefProp_units" Mathcad Worksheet #605

Closed mdsrjw closed 4 months ago

mdsrjw commented 4 months ago

Description

I am seeing an error being reported by Mathcad in the "RefProp_units" file. The error reported states "A function or a variable name is required here." The function is in the "Coefficient of Thermal Expansion" section of the Mathcad worksheet. Thoughts on why only this function is a problem?

Steps to Reproduce

Inherent to the Mathcad Worksheet so nothing required to reproduce the problem.

Versions

REFPROP Version: 10.0.0.98b DLL version Operating System and Version: Win 11
Access Method: Mathcad wrapper

Additional Information

See snippet below from "RefProp_units" worksheet for problem function. Function Error

henningjp commented 4 months ago

I've been seeing this myself since updating to Prime 10. This is a PTC bug and I'll be reporting it soon. This equation solved just fine in earlier versions of Prime, but now fails in Prime 10.

The failing function was from an earlier version of this file, as it calculates the expansion coefficient in Mathcad using the base REFPROP functions of density and drho/dT. I moved this calculation into the C++ DLL for speed and consistency with the other functions, but left this one in the file for verification purposes.

We have two options:

  1. I rearranged the equation as a two-line function program that assigns -1 to a constant, alpha. The second line returns this alpha variable divided by the density function times the derivative function. I have no idea why this works and the straight-forward syntax does not.

  2. Disable this equation. Since the other five variations of this function work just fine and this variation is redundant (and slower).

I can't update the file on GitHub for a couple of weeks. We should leave this issue open until it gets updated. You are welcome to implement fix number 1 above, verify it, and submit a PR with the changed file. Otherwise I'll get to it when I get back.

mdsrjw commented 4 months ago

Thanks for the reply, Jeff. I am not certain why, but I could not get my worksheet to function even with your suggested changes. In the end, I decided to just disable the equation. I'll try to do some more investigation, to see if I can overcome this problem.

Thanks,

Bob

On Sat, Jul 6, 2024 at 9:10 AM Jeff Henning @.***> wrote:

I've been seeing this myself since updating to Prime 10. This is a PTC bug and I'll be reporting it soon. This equation solved just fine in earlier versions of Prime, but now fails in Prime 10.

The failing function was from an earlier version of this file, as it calculates the expansion coefficient in Mathcad using the base REFPROP functions of density and drho/dT. I moved this calculation into the C++ DLL for speed and consistency with the other functions, but left this one in the file for verification purposes.

We have two options:

1.

I rearranged the equation as a two-line function that assigns -1 to a constant, alpha. The second line returns this alpha variable divided by the density function times the derivative function. I have no idea why this works and the straight-forward syntax does not. 2.

Disable this equation. Since the other five variations of this function work just fine and this variation is redundant (and slower).

I can't update the file on GitHub for a couple of weeks. We should leave this issue open until it gets updated. You are welcome to implement fix #1 https://github.com/usnistgov/REFPROP-wrappers/pull/1 above, verify it, and submit a PR with the changed file. Otherwise I'll get to it when I get back.

— Reply to this email directly, view it on GitHub https://github.com/usnistgov/REFPROP-wrappers/issues/605#issuecomment-2211765457, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKISPNCKXLI7ANPPKFTON2TZK7UDXAVCNFSM6AAAAABKKRNW6SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMJRG43DKNBVG4 . You are receiving this because you authored the thread.Message ID: @.***>

henningjp commented 4 months ago

@mdsrjw - I'm back to my machine.

Here's the mod I made to the worksheet. Again, I have no idea why this works in Prime 10 and the original one-line function does not.

image vs the original image

If this works for you as well, I'll update the include file in the repository. Let me know.

Also, I'm trying to generate a more generic example for PTC that doesn't require them to install this REFPROP add-in. If you come up with something that demonstrates the issue simply, let me know.

Jeff

mdsrjw commented 4 months ago

Thank you, Jeff. I tested your Mathcad "program" and it works fine as suggested. I will leave the RefProp_units sheet with your suggested method. I can submit this to the general Mathcad usage group at the PTC site if this is OK with you. There are many long-time users that understand the base program very well and could possibly provide some insight. I'll also consider a similar function that doesn't necessarily require refprop.

Regards, Bob Wilson

On Sun, Jul 21, 2024 at 8:32 AM Jeff Henning @.***> wrote:

@mdsrjw https://github.com/mdsrjw - I'm back to my machine.

Here's the mod I made to the worksheet. Again, I have no idea why this works in Prime 10 and the original one-line function does not.

image.png (view on web) https://github.com/user-attachments/assets/a8be59f9-3ed1-462e-af1a-7b93f3c6fec6 vs the original image.png (view on web) https://github.com/user-attachments/assets/3771095a-23f8-4090-af1a-080d2a8ef180

If this works for you as well, I'll update the include file in the repository. Let me know.

Also, I'm trying to generate a more generic example for PTC that doesn't require them to install this REFPROP add-in. If you come up with something that demonstrates the issue simply, let me know.

Jeff

— Reply to this email directly, view it on GitHub https://github.com/usnistgov/REFPROP-wrappers/issues/605#issuecomment-2241594809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKISPNHTPFH7SLUM5HI2BF3ZNOS5PAVCNFSM6AAAAABKKRNW6SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGU4TIOBQHE . You are receiving this because you were mentioned.Message ID: @.***>

mdsrjw commented 4 months ago

Jeff,

I had a response on the Mathcad community site. They confirm that it is a bug and had been discovered previously. Here is the thread:

Solved: Function Worked in Prime 9, but not in Prime 10 (w... - PTC Community https://community.ptc.com/t5/Mathcad/Function-Worked-in-Prime-9-but-not-in-Prime-10-without-mods/m-p/962397#M212979

On Sun, Jul 21, 2024 at 8:32 AM Jeff Henning @.***> wrote:

@mdsrjw https://github.com/mdsrjw - I'm back to my machine.

Here's the mod I made to the worksheet. Again, I have no idea why this works in Prime 10 and the original one-line function does not.

image.png (view on web) https://github.com/user-attachments/assets/a8be59f9-3ed1-462e-af1a-7b93f3c6fec6 vs the original image.png (view on web) https://github.com/user-attachments/assets/3771095a-23f8-4090-af1a-080d2a8ef180

If this works for you as well, I'll update the include file in the repository. Let me know.

Also, I'm trying to generate a more generic example for PTC that doesn't require them to install this REFPROP add-in. If you come up with something that demonstrates the issue simply, let me know.

Jeff

— Reply to this email directly, view it on GitHub https://github.com/usnistgov/REFPROP-wrappers/issues/605#issuecomment-2241594809, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKISPNHTPFH7SLUM5HI2BF3ZNOS5PAVCNFSM6AAAAABKKRNW6SVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBRGU4TIOBQHE . You are receiving this because you were mentioned.Message ID: @.***>