Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Proper usage of Media library

Proper usage of Media library

I've been trying to learn to use the media library in Modelica. When I try to use the function setState_pTX and the run the model below it throws an error that says
" Function Modelica.Media.Interfaces.PartialMedium.setState_pTX is neither external nor has an algorithm. It should have been redeclared."
Please tell me how to properly declare the function. Thanks.

model Media
  import Modelica.SIunits.*;
    replaceable package Medium = Modelica.Media.Interfaces.PartialMedium
                         "Medium model" annotation (__Dymola_choicesAllMatching = true);
                        Medium.ThermodynamicState state;
                        parameter Pressure Pair = 1e5;
                        parameter Temperature Tair = 25+273.15;


equation
  state = Modelica.Media.Interfaces.PartialMedium.setState_pTX(Pair, Tair,Medium.reference_X);
end Media;








Re: Proper usage of Media library

Knkc,

Everything looks correct. The one thing that causes the error is the fact that you try to deduce medium properties from 'PartialMedium' which is an 'interface' and not a medium model.

Replace 'Modelica.Media.Interfaces.PartialMedium' with e.g 'Modelica.Media.Water.StandardWater' and everything should be fine.

Best regards
Rene Just Nielsen

There are 0 guests and 0 other users also viewing this topic
You are here: