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

Using ExternalMedia to access RefProp via CoolProp #48

Open
patrick-fourspring-nnl opened this issue Dec 23, 2021 · 11 comments
Open

Using ExternalMedia to access RefProp via CoolProp #48

patrick-fourspring-nnl opened this issue Dec 23, 2021 · 11 comments

Comments

@patrick-fourspring-nnl
Copy link

We welcome any suggestions for the following issue using External Media (v3.3.0) within OpenModelica (runing Modelica v3.2.3):


The following Modelica code works:

model CoolPropTest

package Medium = 
ExternalMedia.Media.CoolPropMedium(
mediumName = "Water");

Medium.AbsolutePressure p1 = 8e6;
Medium.SpecificEnthalpy h1 = 1.0e5;

Medium.Density d;

equation

d = Medium.density_ph(p1, h1, 0);

end CoolPropTest;


Using the same code to access RefProp does not work

model CoolPropTest

package Medium = 
ExternalMedia.Media.CoolPropMedium(
mediumName = "REFPROP::Water");

Medium.AbsolutePressure p1 = 8e6;
Medium.SpecificEnthalpy h1 = 1.0e5;

Medium.Density d;

equation

d = Medium.density_ph(p1, h1, 0);

end CoolPropTest;

error Code:

calc_transport has the value of 1
TTSE is off
enable_TTSE has the value of 0
BICUBIC is off
enable_BICUBIC has the value of 0
enable_EXTTP has the value of 1
twophase_derivsmoothing_xend has the value of 0.0
rho_smoothing_xend has the value of 0.0
debug has the value of 0

This backend does not implement calc_specify_phasefunction
simulation terminated by an assertation at initialization
Simulation process failed. Exited with code -1.


Thanks,
Patrick

@jowr
Copy link
Collaborator

jowr commented Feb 17, 2022

The latest release of ExternalMedia helped with this problem, but there are still a few things that do not work with REFPROP. Sorry.

@patrick-fourspring-nnl
Copy link
Author

patrick-fourspring-nnl commented Feb 17, 2022 via email

@freundlicherDon
Copy link

I have a similar problem when using Dymola 2022x.
I tested both the master branch with Modelica 3.3.1 as well as v4-dev with Modelica 4.0.0 and could run
Test.CO2.TestStatesSupercritical sucessfully with a compiled STATIC Library of External Media (made with cmake and VS2019).
However, when I change the substance name in
Examples.CO2CoolProp to
substanceNames = {"REFPROP-CO2"}

I get the following error in both cases:
calc_first_saturation_deriv is not implemented for this backend

I have installed RefProp 10 on my computer under C:/program files/REFPROP. (I successfully used this REFPROP installation with older external media version under Dymola 2019).

@casella
Copy link
Collaborator

casella commented May 20, 2022

We are currently working to solve several issues with the dynamic/shared library, see #50. As soon as that thing is stabilized, we can get back to this issue.

@shjiang
Copy link

shjiang commented Mar 1, 2023

I had the same problem.

@shjiang
Copy link

shjiang commented Mar 6, 2023

I have made some changes on the ExternalMedia library, and it works now for me, with MSL4.0, vs 2019, and dymola 2023. The ThermoCycle library works as well. I have placed the codes with the below link. Hopes it helps.
https://github.com/shjiang/ThermoCycle-ExternalMedia
I hope that your question is solved @patrick-fourspring-nnl, as I have made several tests.

@casella
Copy link
Collaborator

casella commented Apr 12, 2023

@patrick-fourspring-nnl we have now fixed a lot of issues with ExternalMedia, and we're going to release 3.3.2 and 4.0.0 anytime soon. I'm not sure about the REFPROP interface, because I don't have it installed on my PC so I can't test that.

@thorade
Copy link
Contributor

thorade commented Nov 2, 2023

I tested today, with the release v4.0.0 and RefProp 10, and below code works for me on Windows 11.

  package Medium
    extends ExternalMedia.Media.CoolPropMedium(
      mediumName = "REFPROP::Pentane",
      substanceNames = {"n-Pentane"},
      inputChoice=ExternalMedia.Common.InputChoice.ph);
  end Medium;

@patrick-fourspring-nnl
Copy link
Author

patrick-fourspring-nnl commented Nov 3, 2023 via email

@thorade
Copy link
Contributor

thorade commented Feb 15, 2024

I tested again today, and this is the new model:

  package Medium
    extends ExternalMedia.Media.CoolPropMedium(
      mediumName = "Pentane any string can go here",
      substanceNames = {"REFPROP::Pentane"},
      inputChoice=ExternalMedia.Common.InputChoice.ph);
  end Medium;

in mediumName, you can put whatever descriptive string you like, but substanceName is where you would have to put the REFPROP:: thing, and if you put it there, it gives an error message:

Error: The following error was detected at time: 0
ExternalMedia error: calc_first_saturation_deriv is not implemented for this backend
The stack of functions is:
ExternalMedia.Examples.CO2CoolPropRefProp.setSat_T_Unique32
ExternalMedia.Examples.CO2CoolPropRefProp.setSat_T_Unique32(T2)

@thorade
Copy link
Contributor

thorade commented Feb 21, 2024

That finding has also been reported here: CoolProp/CoolProp#2013

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

6 participants