Tags and keywords
The Modelica By Example target code (with 'initial equation') is:
model NewtonCoolingWithDefaults "Cooling example with default parameter values"
parameter Real T_inf=25 "Ambient temperature";
parameter Real T0=90 "Initial temperature";
parameter Real h=0.7 "Convective cooling coefficient";
parameter Real A=1.0 "Surface area";
parameter Real m=0.1 "Mass of thermal capacitance";
parameter Real c_p=1.2 "Specific heat";
Real T "Temperature";
initial equation
T = T0 "Specify initial value for T";
equation
m*c_p*der(T) = h*A*(T_inf-T) "Newton's law of cooling";
end NewtonCoolingWithDefaults;
The exported Modelica code is (using lower case value property names):
model NewtonCoolingWithDefaults
parameter Real t_inf(start=25.0,fixed=true);
parameter Real t0(start=90.0,fixed=true);
parameter Real h(start=0.7,fixed=true);
parameter Real a(start=1.0,fixed=true);
parameter Real m(start=0.1,fixed=true);
parameter Real c_p(start=1.2,fixed=true);
Real t(start=90.0,fixed=true);
equation
m*c_p*der(t)=h*a*(t_inf-t);
end NewtonCoolingWithDefaults;
The SysPhS version as formulated here is quite different from the Modelica University version because:
The SysPhS version gets around the lack of 'initial equation' here by setting the initial temperature directly.