Modelica.Media.Interfaces.PartialSimpleMedium.setState_psX and Modelica.Media.Interfaces.PartialSimpleMedium.specificEntropy are not compatible with each other.
redeclare function extends specificEntropy "Return specific entropy"
extends Modelica.Icons.Function;
algorithm
s := cv_const*Modelica.Math.log(state.T/T0);
end specificEntropy;
redeclare replaceable function setState_psX
"Return thermodynamic state from p, s, and X or Xi"
extends Modelica.Icons.Function;
input AbsolutePressure p "Pressure";
input SpecificEntropy s "Specific entropy";
input MassFraction X[:]=reference_X "Mass fractions";
output ThermodynamicState state "Thermodynamic state record";
algorithm
state := ThermodynamicState(p=p, T=Modelica.Math.exp(s/cp_const +
Modelica.Math.log(reference_T)))
"Here the incompressible limit is used, with cp as heat capacity";
end setState_psX;
Using only either reference_T or T0 solves the problem for me for Modelica.Media.Water.ConstantPropertyLiquidWater TestConstantPropertyLiquidWater.txt (Dymola 2026x). Hondestly, I dont fully understand the difference of T0 and reference_T because is it written constant Temperature T0=reference_T "Zero enthalpy temperature";
Some further comments:
- Why does
ConstantPropertyLiquidWater extend PartialSimpleMedium?
- Is
PartialSimpleMedium supposed to be a base class for an incompressible fluid? In this case, shouldn't cp and cv be change to c and shouldn't the enthalpy formulation be changed to dh = c*dT + v*dp?
- Is
PartialSimpleMedium supposed to be a base class for an ideal gas? In this case shouldn't the entropy formulation include R*ln(p/p0)?
Modelica.Media.Interfaces.PartialSimpleMedium.setState_psXandModelica.Media.Interfaces.PartialSimpleMedium.specificEntropyare not compatible with each other.Using only either
reference_TorT0solves the problem for me forModelica.Media.Water.ConstantPropertyLiquidWaterTestConstantPropertyLiquidWater.txt (Dymola 2026x). Hondestly, I dont fully understand the difference ofT0andreference_Tbecause is it writtenconstant Temperature T0=reference_T "Zero enthalpy temperature";Some further comments:
ConstantPropertyLiquidWaterextendPartialSimpleMedium?PartialSimpleMediumsupposed to be a base class for an incompressible fluid? In this case, shouldn'tcpandcvbe change tocand shouldn't the enthalpy formulation be changed todh = c*dT + v*dp?PartialSimpleMediumsupposed to be a base class for an ideal gas? In this case shouldn't the entropy formulation includeR*ln(p/p0)?