Getting Physical - NewtonCoolingWithDefaults

Gallery
Tutorial
Click on the image to view it full size
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.
Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)
External links