AmbientCondition

Gallery
Tutorial
Click on the image to view it full size
The Modelica By Example target code is:

within ModelicaByExample.Components.HeatTransfer;
model AmbientCondition
  "Model of an \"infinite reservoir\" at some ambient temperature"
  parameter Modelica.SIunits.Temperature T_amb "Ambient temperature";
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a node annotation ...
equation
  node.T = T_amb;
end AmbientCondition;

The block AmbientCondition exports via SysPhS to Modelica as:


model AmbientCondition
  AmbientCondition _AmbientCondition;
  model AmbientCondition
    HeatPortA node;
    parameter Temperature tAmb;
  equation
    node.t=tAmb;
  end AmbientCondition;
  connector HeatPortA
    extends HeatFlowElement;
  end HeatPortA;
  type Temperature=Real(unit="K");
  connector HeatFlowElement
    flow HeatFlowRate hFR;
    Temperature t;
  end HeatFlowElement;
  type HeatFlowRate=Real(unit="J/s");
end AmbientCondition;

You may wondering where there's an extra ConstraintBlock just to equate the temperature t on the Port with the ambient temperature tAmb. It's a workaround for this:

If you just have a BindingConnector from t to tAmb you get the following Modelica code:


...
  model AmbientCondition
    HeatPortA node;
    parameter Temperature tAmb;
  equation
    node.h.t=tAmb;
  end AmbientCondition;
...
This fails validation:
Error: AmbientCondition.AmbientCondition [5:3-5:3] Unknown identifier node.h.t.
Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)
External links