- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Proper usage of Media library
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;
- knkc
- 14 Posts
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
- justnielsen
- 40 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Proper usage of Media library