0

I am a student who is researching about HVAC. I'm modelling a heat pump system and I got some problem.

As I was going to get the fluid property by ExternalMedia, I got some error.

The source code is below:

model Pentane_hs
package wf
  extends ExternalMedia.Media.CoolPropMedium(
    mediumName = "Pentane",
    substanceNames = {"n-Pentane"},
    inputChoice=ExternalMedia.Common.InputChoice.hs);
end wf;
  wf.BaseProperties fluid "Properties of the two-phase fluid";
  Modelica.SIunits.SpecificEnthalpy h;
  Modelica.SIunits.Pressure p;
  Modelica.SIunits.SpecificEntropy s;
  Modelica.SIunits.DerDensityByEnthalpy drdh
    "Derivative of average density by enthalpy";
  Modelica.SIunits.DerDensityByPressure drdp
    "Derivative of average density by pressure";
equation 
  //p = 1E5;
  h = 0 + time*1E6;
  s = 1500;  //600 + time*2000;
  fluid.p = p;
  fluid.s = s;
  fluid.h = h;
  drdp = wf.density_derp_h(fluid.state);
  drdh = wf.density_derh_p(fluid.state);
end Pentane_hs;

This is the error I get:

enter image description here

I'm using Dymola 2023x.

I tried to import the library but it failed.

I want to get the property by pressure and temperature.

marco
  • 5,944
  • 10
  • 22
CHO
  • 3
  • 2

2 Answers2

4

The solution of Marco works, but it limits you to use libraries that are also using MSL 3.2.3 instead of MSL 4.0.0. You can convert the ExternalMedia to MSL 4.0.0. Dymola should ask you if you want to do that when you load the ExternalMedia library. With the inbuilt conversion scripts most of the library is converted automatically and you should be able to test your model.

Imke Krueger
  • 671
  • 3
  • 6
  • Ok, good if it works. It seemed dangerous to me to simply convert automatically. A MSL 4.0.0 compatible version is announced on https://github.com/modelica-3rdparty/ExternalMedia, but it was not released yet. Do you have any experience how well it works? – marco Jan 03 '23 at 14:38
  • Thanks alot it work by automatically conversion to MSL 4.0.0. To convert the MSL 3.2.3 script to MSL 4.0.0 I needed to open Dymola by ADMINISTER mode. – CHO Jan 09 '23 at 05:51
2

From the error messages in your screenshot we see that Dymola cannot resolve the paths starting with Modelica.Units.SI. They are correct in older Modelica library versions, but not in the current release 4.0.0.

The ExternalMedia library requires Modelica 3.2.3, but recent Dymola versions have Modelica 4.0.0 installed as default.

You have to install Modelica 3.2.3 as described in the appendix of the Dymola User Manual Volume 1, section Installing earlier Modelica versions including compatible libraries.

  1. Get the zip file CompatibilityLibraries MSL 3.2.3.zip located in the extras directory of the Dymola installer

  2. Extract the zip to the library folder of your Dymola installation, typically C:\Program Files\Dymola 2023x\Modelica\Library, but before you do that, read the next point.

  3. This is not noted in the user manual, but the file Complex.mo and the folder ModelicaReference will be overwritten. I suggest to make a backup first, so you can easily revert.

  4. Start Dymola and change the default Modelica library version under File > Options > Version. Screenshot of MSL version option in Dymola

  5. The user manual also suggests to tick Force upgrade of models to this version, but I am not sure if it makes a difference in your case.

  6. Restart Dymola, then load your libraries.

marco
  • 5,944
  • 10
  • 22
  • I tried it and the MSL 3.2.3 work good. But to use the MSL 3.2.3 External Media with the library based on MSL 4.0.0 I converted the script automatically. Thanks for your reply. – CHO Jan 09 '23 at 05:53