The Modelica fluid library attempts to have the useful attribute of being able to initialize either from temperature or enthalpy. However, in the Simulation log several errors show up that are a bit mysterious.
The logged errors don't seem to impact the simulation but they should not be appearing because:
- The values passed to temperature_phX should be valid
- use_T_start = true so the "else" option causing the errors should not be run
Below is a code that reproduces the error when you run "RunMe" along with an option that will not produce the error. The representative error is at the bottom.
Any insight to how to solve this issue would be greatly appreciated.
model InitialValuesSimplified
outer Modelica.Fluid.System system "System wide properties";
replaceable package Medium =
Modelica.Media.Water.StandardWater "Medium in the component";
parameter Medium.AbsolutePressure p_a_start=system.p_start
"Pressure at port a";
parameter Boolean use_T_start=true "Use T_start if true, otherwise h_start";
// Creates error log
parameter Medium.Temperature T_a_start=
if use_T_start then
system.T_start
else
Medium.temperature_phX(p_a_start,h_a_start,X_start)
"Temperature at port a";
// No error log
// parameter Medium.Temperature T_a_start=
// if use_T_start then
// system.T_start
// else
// system.T_start
// "Temperature at port a";
parameter Modelica.Media.Interfaces.Types.MassFraction X_start[Medium.nX]=
Medium.X_default "Mass fractions m_i/m";
parameter Medium.SpecificEnthalpy h_a_start=
if use_T_start then
Medium.specificEnthalpy_pTX(p_a_start,T_a_start,X_start)
else
1e5 "Specific enthalpy at port a";
end InitialValuesSimplified;
Code to run snippet:
model RunMe
InitialValuesSimplified initialValuesSimplified;
inner Modelica.Fluid.System system;
end RunMe;
Error code sample:
Log-file of program ./dymosim
(generated: Mon Sep 12 17:15:19 2016)
dymosim started
... "dsin.txt" loading (dymosim input file)
T >= 273.15
The following error was detected at time: 0
IF97 medium function g1: the temperature (= 86.3 K) is lower than 273.15 K!
The stack of functions is:
Modelica.Media.Water.IF97_Utilities.BaseIF97.Basic.g1
Modelica.Media.Water.IF97_Utilities.waterBaseProp_pT
Modelica.Media.Water.IF97_Utilities.h_props_pT(
initialValuesSimplified.p_a_start,
initialValuesSimplified.T_a_start,
Modelica.Media.Water.IF97_Utilities.waterBaseProp_pT(initialValuesSimplified.p_a_start, initialValuesSimplified.T_a_start, 0))
Non-linear solver will attempt to handle this problem.