The ExternalMedia library provides a framework for interfacing external codes computing fluid properties to Modelica.Media-compatible component models.
I just learned the modelica language recently, and I am currently building a mathematical model, using the externalmedia physical property library, and customizing many functions, but the following problems occurred during the running process, how to solve this situation.
Failed to differentiate the equation
T = Water.ph.T_ph(Ps, Hs*1000, 0);
in order to reduce the DAE index.
Cannot find differentiation function:
Water.ph.T_ph(Ps, Hs*1000, 0)
with respect to time
Failed to reduce the DAE index.
Here are the relevant partial functions, and what I'm guessing is the offending code.
V1*der(Ps)=Rs*T*(Ge+Gaux+Geved-Gvo-Gn)/3600;
rou2=Water.pT.d_pT(Ps,T,0);
der(rou2*V1*Hs)=(Ge*He+Gaux*Haux+Geved*h1-Gvo*Hs-Gn*Hs)/3600;
function T_ph
"Return thermodynamic state as function of p, h and phase"
extends Modelica.Icons.Function;
input Water.total.Medium.AbsolutePressure p "Pressure";
input Water.total.Medium.SpecificEnthalpy h "Enthalpy";
input Water.total.Medium.FixedPhase phase=0
"2 for two-phase, 1 for one-phase, 0 if not known";
output Water.total.Medium.Temperature T;
protected
Water.total.Medium.ThermodynamicState state;
algorithm
state := Water.total.Medium.setState_ph(
p,
h,
phase);
T:=state.T;
end T_ph;
function total
package Medium
extends ExternalMedia.Media.CoolPropMedium(
mediumName = "Water")
end Medium;
end total;
Because I used the differentiation of time, I guess that the custom function may not be able to perform related processing, and I don't know how to solve it.
Thanks in advance for your reply.
I just learned the modelica language recently, and I am currently building a mathematical model, using the externalmedia physical property library, and customizing many functions, but the following problems occurred during the running process, how to solve this situation.
Here are the relevant partial functions, and what I'm guessing is the offending code.
Because I used the differentiation of time, I guess that the custom function may not be able to perform related processing, and I don't know how to solve it. Thanks in advance for your reply.