CoolingToAmbient

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

within ModelicaByExample.Components.HeatTransfer.Examples;
model Adiabatic "A model without any heat transfer"
  ThermalCapacitance cap(C=0.12, T0(displayUnit="K") = 363.15)
    "Thermal capacitance component"
    annotation ...
end Adiabatic;

within ModelicaByExample.Components.HeatTransfer;
model ConvectionToAmbient "An overly specialized model of convection"
  parameter Modelica.SIunits.CoefficientOfHeatTransfer h;
  parameter Modelica.SIunits.Area A;
  parameter Modelica.SIunits.Temperature T_amb "Ambient temperature";
  Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a
    annotation ...
equation
  port_a.Q_flow = h*A*(port_a.T-T_amb) "Heat transfer equation";
end ConvectionToAmbient;

within ModelicaByExample.Components.HeatTransfer.Examples;
model CoolingToAmbient "A model using convection to an ambient condition"

  ThermalCapacitance cap(C=0.12, T0(displayUnit="K") = 363.15)
    "Thermal capacitance component"
    annotation ...
  ConvectionToAmbient conv(h=0.7, A=1.0, T_amb=298.15)
    "Convection to an ambient temprature"
    annotation ...
equation
  connect(cap.node, conv.port_a) annotation ...
end CoolingToAmbient;

As throughout this trail:

The Dependencies from the parts cap and conv to the instance trees that define their defaults is just for illustration.

The block CoolingToAmbient exports via SysPhS to Modelica as:


model CoolingToAmbient
  CoolingToAmbient _CoolingToAmbient;
  model CoolingToAmbient
    ConvectionToAmbient conv(a.start=1.0,a.fixed=true,h.start=0.7,h.fixed=true,tAmb.start=298.15,tAmb.fixed=true);
    ThermalCapacitance cap(c.start=0.12,c.fixed=true,node.t.start=363.15,node.t.fixed=true);
  equation
    connect(cap.node,conv.hPA);
  end CoolingToAmbient;
  model ConvectionToAmbient
    parameter CoefficientOfHeatTransfer h;
    parameter Area a;
    parameter Temperature tAmb;
    HeatPortA hPA;
  equation
    hPA.hFR=h*a*(hPA.t-tAmb);
  end ConvectionToAmbient;
  model ThermalCapacitance
    parameter HeatCapacitance c;
    parameter Temperature t0;
    HeatPortA node;
  equation
    c*der(node.t)=node.hFR;
  end ThermalCapacitance;
  connector HeatPortA
    extends HeatFlowElement;
  end HeatPortA;
  connector HeatFlowElement
    flow HeatFlowRate hFR;
    Temperature t;
  end HeatFlowElement;
  type CoefficientOfHeatTransfer=Real(unit="W/(m2.K)");
  type Area=Real(unit="m2");
  type Temperature=Real(unit="K");
  type HeatCapacitance=Real(unit="J/K");
  type HeatFlowRate=Real(unit="J/s");
end CoolingToAmbient;
The plot shows the convergence of the temperature towards the ambient temperature.
Up next
Notes
Snippets (quotes/extracts)
Visit also
Visit also (backlinks)
Related slides (includes other tutorials)
Related slides (backlinks, includes other tutorials)
External links