text
stringlengths 1
4.74k
| code
stringlengths 69
637k
|
---|---|
Ramp going up and down. | within Modelica.Thermal.FluidHeatFlow.Examples.Utilities;
model DoubleRamp "Ramp going up and down"
extends Modelica.Blocks.Interfaces.SO;
parameter Real offset=1 "Offset of ramps";
parameter SI.Time startTime=0.2 "StartTime of 1st ramp";
parameter SI.Time interval=0.2
"Interval between end of 1st and beginning of 2nd ramp";
parameter Real height_1=-1 "Height of ramp"
parameter SI.Time duration_1(min=Modelica.Constants.small)=0.2
"Duration of ramp"
parameter Real height_2=1 "Height of ramp"
parameter SI.Time duration_2(min=Modelica.Constants.small)=0.2
"Duration of ramp"
Modelica.Blocks.Math.Add add
Modelica.Blocks.Sources.Ramp ramp1(
final height=height_1,
final duration=duration_1,
final startTime=startTime,
final offset=offset)
Modelica.Blocks.Sources.Ramp ramp2(
final height=height_2,
final duration=duration_2,
final startTime=startTime + duration_1 + interval,
final offset=0)
equation
connect(ramp1.y, add.u1)
connect(ramp2.y, add.u2)
connect(add.y, y)
end DoubleRamp; |
Utility models for examples | within Modelica.Thermal.FluidHeatFlow.Examples;
package Utilities "Utility models for examples"
extends Modelica.Icons.UtilitiesPackage;
end Utilities; |
Partial model of absolute sensor. Partial model for an absolute sensor (pressure/temperature). | within Modelica.Thermal.FluidHeatFlow.Interfaces;
partial model AbsoluteSensor "Partial model of absolute sensor"
extends Modelica.Icons.RoundSensor;
parameter FluidHeatFlow.Media.Medium medium=FluidHeatFlow.Media.Medium()
"Sensor's medium"
FluidHeatFlow.Interfaces.FlowPort_a flowPort(final medium=medium)
Modelica.Blocks.Interfaces.RealOutput y
equation
// no mass exchange
flowPort.m_flow = 0;
// no energy exchange
flowPort.H_flow = 0;
end AbsoluteSensor; |
Partial model of flow sensor. Partial model for a flow sensor (mass flow/heat flow). | within Modelica.Thermal.FluidHeatFlow.Interfaces;
partial model FlowSensor "Partial model of flow sensor"
extends Modelica.Icons.RoundSensor;
extends FluidHeatFlow.BaseClasses.TwoPort(
final m=0,
final T0=293.15,
final T0fixed=false,
final tapT=1);
Modelica.Blocks.Interfaces.RealOutput y
equation
// no pressure drop
dp = 0;
// no energy exchange
Q_flow = 0;
end FlowSensor; |
Connectors and partial models | within Modelica.Thermal.FluidHeatFlow;
package Interfaces "Connectors and partial models"
extends Modelica.Icons.InterfacesPackage;
end Interfaces; |
Partial model of relative sensor. Partial model for a relative sensor (pressure drop/temperature difference). | within Modelica.Thermal.FluidHeatFlow.Interfaces;
partial model RelativeSensor "Partial model of relative sensor"
extends RelativeSensorBase;
Modelica.Blocks.Interfaces.RealOutput y
end RelativeSensor; |
Partial model of relative sensor without signal output. Partial model for a relative sensor (pressure drop/temperature difference) without signal output. | within Modelica.Thermal.FluidHeatFlow.Interfaces;
partial model RelativeSensorBase "Partial model of relative sensor without signal output"
extends Modelica.Icons.RoundSensor;
parameter FluidHeatFlow.Media.Medium medium=FluidHeatFlow.Media.Medium()
"Sensor's medium"
FluidHeatFlow.Interfaces.FlowPort_a flowPort_a(final medium=medium)
FluidHeatFlow.Interfaces.FlowPort_b flowPort_b(final medium=medium)
equation
// no mass exchange
flowPort_a.m_flow = 0;
flowPort_b.m_flow = 0;
// no energy exchange
flowPort_a.H_flow = 0;
flowPort_b.H_flow = 0;
end RelativeSensorBase; |
Medium properties | within Modelica.Thermal.FluidHeatFlow;
package Media "Medium properties"
extends Modelica.Icons.MaterialPropertiesPackage;
end Media; |
Enthalpy flow sensor. The EnthalpyFlowSensor measures the enthalpy flow rate. | within Modelica.Thermal.FluidHeatFlow.Sensors;
model EnthalpyFlowSensor "Enthalpy flow sensor"
extends FluidHeatFlow.Interfaces.FlowSensor(y(unit="W")
"Enthalpy flow as output signal");
equation
y = flowPort_a.H_flow;
end EnthalpyFlowSensor; |
Mass flow sensor. The MassFlowSensor measures the mass flow rate. | within Modelica.Thermal.FluidHeatFlow.Sensors;
model MassFlowSensor "Mass flow sensor"
extends FluidHeatFlow.Interfaces.FlowSensor(y(unit="kg/s")
"Mass flow as output signal");
equation
y = V_flow*medium.rho;
end MassFlowSensor; |
Ideal sensors to measure port properties | within Modelica.Thermal.FluidHeatFlow;
package Sensors "Ideal sensors to measure port properties"
extends Modelica.Icons.SensorsPackage;
end Sensors; |
Absolute pressure sensor. The PressureSensor measures the absolute pressure. | within Modelica.Thermal.FluidHeatFlow.Sensors;
model PressureSensor "Absolute pressure sensor"
extends FluidHeatFlow.Interfaces.AbsoluteSensor(y(unit="Pa", displayUnit=
"bar") "Absolute pressure as output signal");
equation
y = flowPort.p;
end PressureSensor; |
Pressure difference sensor. The RelPressureSensor measures the pressure drop between flowPort_a and flowPort_b. | within Modelica.Thermal.FluidHeatFlow.Sensors;
model RelPressureSensor "Pressure difference sensor"
extends FluidHeatFlow.Interfaces.RelativeSensorBase;
Modelica.Blocks.Interfaces.RealOutput y(unit="Pa", displayUnit="bar")
"Pressure difference as output signal"
equation
y = flowPort_a.p - flowPort_b.p;
end RelPressureSensor; |
Temperature difference sensor. The RelTemperatureSensor measures the temperature difference between flowPort_a and flowPort_b. | within Modelica.Thermal.FluidHeatFlow.Sensors;
model RelTemperatureSensor "Temperature difference sensor"
extends FluidHeatFlow.Interfaces.RelativeSensorBase;
Modelica.Blocks.Interfaces.RealOutput y(unit="K")
"Temperature difference as output signal"
equation
medium.cp*y = flowPort_a.h - flowPort_b.h;
end RelTemperatureSensor; |
Absolute temperature sensor. The TempreatureSensor measures the absolute temperature (Kelvin). | within Modelica.Thermal.FluidHeatFlow.Sensors;
model TemperatureSensor "Absolute temperature sensor"
extends FluidHeatFlow.Interfaces.AbsoluteSensor(y(unit="K")
"Absolute temperature as output signal");
equation
medium.cp*y = flowPort.h;
end TemperatureSensor; |
Volume flow sensor. The VolumeFlowSensor measures the volume flow rate. | within Modelica.Thermal.FluidHeatFlow.Sensors;
model VolumeFlowSensor "Volume flow sensor"
extends FluidHeatFlow.Interfaces.FlowSensor(y(unit="m3/s")
"Volume flow as output signal");
equation
y = V_flow;
end VolumeFlowSensor; |
Defines absolute pressure level. AbsolutePressure to define pressure level of a closed cooling cycle. | within Modelica.Thermal.FluidHeatFlow.Sources;
model AbsolutePressure "Defines absolute pressure level"
extends FluidHeatFlow.BaseClasses.SinglePortLeft(
final Exchange=false,
final T0=293.15,
final T0fixed=false);
parameter SI.Pressure p(start=0) "Pressure ground";
equation
// defining pressure
flowPort.p = p;
// no no mass flow means no energy flow
flowPort.H_flow = 0;
end AbsolutePressure; |
Ambient with constant properties. (Infinite) ambient with constant pressure and temperature. | within Modelica.Thermal.FluidHeatFlow.Sources;
model Ambient "Ambient with constant properties"
extends FluidHeatFlow.BaseClasses.SinglePortLeft(
final Exchange=true,
final T0=293.15,
final T0fixed=false);
parameter Boolean usePressureInput=false
"Enable / disable pressure input"
parameter SI.Pressure constantAmbientPressure(start=0)
"Ambient pressure"
parameter Boolean useTemperatureInput=false
"Enable / disable temperature input"
parameter SI.Temperature constantAmbientTemperature(start=293.15, displayUnit="degC")
"Ambient temperature"
Modelica.Blocks.Interfaces.RealInput ambientPressure=pAmbient if usePressureInput
Modelica.Blocks.Interfaces.RealInput ambientTemperature=TAmbient if useTemperatureInput
protected
SI.Pressure pAmbient;
SI.Temperature TAmbient;
equation
if not usePressureInput then
pAmbient = constantAmbientPressure;
end if;
if not useTemperatureInput then
TAmbient = constantAmbientTemperature;
end if;
flowPort.p = pAmbient;
T = TAmbient;
end Ambient; |
Model of an ideal pump. Simple fan resp. pump where characteristic is dependent on shaft's speed, <br>
torque * speed = pressure increase * volume flow (without losses)<br>
Pressure increase versus volume flow is defined by a linear function,
from dp0(V_flow=0) to V_flow0(dp=0).<br>
The axis intersections vary with speed as follows: | within Modelica.Thermal.FluidHeatFlow.Sources;
model IdealPump "Model of an ideal pump"
extends FluidHeatFlow.BaseClasses.TwoPort(final tapT=1);
parameter SI.AngularVelocity wNominal(start=1, displayUnit="rev/min")
"Nominal speed"
parameter SI.Pressure dp0(start=2)
"Max. pressure increase @ V_flow=0"
parameter SI.VolumeFlowRate V_flow0(start=2)
"Max. volume flow rate @ dp=0"
SI.AngularVelocity w=der(flange_a.phi) "Speed";
protected
SI.Pressure dp1;
SI.VolumeFlowRate V_flow1;
public
Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a
equation
// pump characteristic
dp1 = dp0*sign(w/wNominal)*(w/wNominal)^2;
V_flow1 = V_flow0*(w/wNominal);
if noEvent(abs(w)<Modelica.Constants.small) then
dp = 0;
flange_a.tau = 0;
else
dp = -dp1*(1 - V_flow/V_flow1);
flange_a.tau*w = -dp*V_flow;
end if;
// no energy exchange with medium
Q_flow = 0;
end IdealPump; |
Ideal fluid sources, e.g., ambient, volume flow | within Modelica.Thermal.FluidHeatFlow;
package Sources "Ideal fluid sources, e.g., ambient, volume flow"
extends Modelica.Icons.SourcesPackage;
end Sources; |
Enforces constant pressure increase. Fan resp. pump with constant pressure increase. Mass resp. volume flow is the response of the whole system. | within Modelica.Thermal.FluidHeatFlow.Sources;
model PressureIncrease "Enforces constant pressure increase"
extends FluidHeatFlow.BaseClasses.TwoPort(final tapT=1);
parameter Boolean usePressureIncreaseInput=false
"Enable / disable pressure increase input"
parameter SI.Pressure constantPressureIncrease(start=1)
"Pressure increase"
Modelica.Blocks.Interfaces.RealInput pressureIncrease(unit="Pa")=internalPressureIncrease if usePressureIncreaseInput
protected
SI.Pressure internalPressureIncrease;
equation
if not usePressureIncreaseInput then
internalPressureIncrease = constantPressureIncrease;
end if;
Q_flow = 0;
dp = -internalPressureIncrease;
end PressureIncrease; |
Enforces constant volume flow. Fan resp. pump with constant volume flow rate. Pressure increase is the response of the whole system. | within Modelica.Thermal.FluidHeatFlow.Sources;
model VolumeFlow "Enforces constant volume flow"
extends FluidHeatFlow.BaseClasses.TwoPort(final tapT=1);
parameter Boolean useVolumeFlowInput=false
"Enable / disable volume flow input"
parameter SI.VolumeFlowRate constantVolumeFlow(start=1)
"Volume flow rate"
Modelica.Blocks.Interfaces.RealInput volumeFlow(unit="m3/s")=internalVolumeFlow if useVolumeFlowInput
protected
SI.VolumeFlowRate internalVolumeFlow;
equation
if not useVolumeFlowInput then
internalVolumeFlow = constantVolumeFlow;
end if;
Q_flow = 0;
V_flow = internalVolumeFlow;
end VolumeFlow; |
Library of 1-dimensional heat transfer with lumped elements | within Modelica.Thermal;
package HeatTransfer "Library of 1-dimensional heat transfer with lumped elements"
extends Modelica.Icons.Package;
end HeatTransfer; |
Fixed temperature boundary condition in degree Celsius. This model defines a fixed temperature T at its port in [degC],
i.e., it defines a fixed temperature as a boundary condition. | within Modelica.Thermal.HeatTransfer.Celsius;
model FixedTemperature
"Fixed temperature boundary condition in degree Celsius"
extends HeatTransfer.Icons.FixedTemperature;
parameter Modelica.Units.NonSI.Temperature_degC T
"Fixed temperature at the port";
Interfaces.HeatPort_b port
equation
port.T = Modelica.Units.Conversions.from_degC(T);
end FixedTemperature; |
Conversion from Kelvin to degree Celsius. This component converts an input signal from Kelvin to Celsius
and provides is as output signal. | within Modelica.Thermal.HeatTransfer.Celsius;
model FromKelvin "Conversion from Kelvin to degree Celsius"
extends HeatTransfer.Icons.Conversion;
Modelica.Blocks.Interfaces.RealInput Kelvin(unit="K")
Modelica.Blocks.Interfaces.RealOutput Celsius(unit="degC")
equation
Celsius = Modelica.Units.Conversions.to_degC(Kelvin);
end FromKelvin; |
Components with Celsius input and/or output | within Modelica.Thermal.HeatTransfer;
package Celsius "Components with Celsius input and/or output"
extends Modelica.Icons.VariantsPackage;
</pre></blockquote>
</html>"));
end Celsius; |
Variable temperature boundary condition in degCelsius. This model represents a variable temperature boundary condition
The temperature value in [degC] is given by the input signal
to the model. The effect is that an instance of this model acts as
an infinite reservoir able to absorb or generate as much energy
as required to keep the temperature at the specified value. | within Modelica.Thermal.HeatTransfer.Celsius;
model PrescribedTemperature
"Variable temperature boundary condition in degCelsius"
extends HeatTransfer.Icons.PrescribedTemperature;
Interfaces.HeatPort_b port
Modelica.Blocks.Interfaces.RealInput T(unit="degC")
equation
port.T = Modelica.Units.Conversions.from_degC(T);
end PrescribedTemperature; |
Absolute temperature sensor in degCelsius. This is an ideal absolute temperature sensor which returns
the temperature of the connected port in Celsius as an output
signal. The sensor itself has no thermal interaction with
whatever it is connected to. Furthermore, no
thermocouple-like lags are associated with this
sensor model. | within Modelica.Thermal.HeatTransfer.Celsius;
model TemperatureSensor "Absolute temperature sensor in degCelsius"
Modelica.Blocks.Interfaces.RealOutput T(unit="degC")
"Absolute temperature in degree Celsius as output signal"
Interfaces.HeatPort_a port
equation
T = Modelica.Units.Conversions.to_degC(port.T);
port.Q_flow = 0;
end TemperatureSensor; |
Conversion from degree Celsius to Kelvin. This component converts an input signal from Celsius to Kelvin
and provide is as output signal. | within Modelica.Thermal.HeatTransfer.Celsius;
model ToKelvin "Conversion from degree Celsius to Kelvin"
extends HeatTransfer.Icons.Conversion;
Modelica.Blocks.Interfaces.RealInput Celsius(unit="degC")
Modelica.Blocks.Interfaces.RealOutput Kelvin(unit="K")
equation
Kelvin = Modelica.Units.Conversions.from_degC(Celsius);
end ToKelvin; |
Lumped thermal element for radiation heat transfer. This is a model describing the thermal radiation, i.e., electromagnetic
radiation emitted between two bodies as a result of their temperatures.
The following constitutive equation is used: | within Modelica.Thermal.HeatTransfer.Components;
model BodyRadiation "Lumped thermal element for radiation heat transfer"
extends Interfaces.Element1D;
parameter Real Gr(unit="m2")
"Net radiation conductance between two surfaces (see docu)";
equation
Q_flow = Gr*Modelica.Constants.sigma*(port_a.T^4 - port_b.T^4);
</pre></blockquote>
<p>
where Gr is the radiation conductance and sigma is the Stefan-Boltzmann
constant (= Modelica.Constants.sigma). Gr may be determined by
measurements and is assumed to be constant over the range of operations.
</p>
<p>
For simple cases, Gr may be analytically computed. The analytical
equations use epsilon, the emission value of a body which is in the
range 0..1. Epsilon=1, if the body absorbs all radiation (= black body).
Epsilon=0, if the body reflects all radiation and does not absorb any.
</p>
<blockquote><pre>
Typical values for epsilon:
aluminium, polished 0.04
copper, polished 0.04
gold, polished 0.02
paper 0.09
rubber 0.95
silver, polished 0.02
wood 0.85..0.9
</pre></blockquote>
<p><strong>Analytical Equations for Gr</strong></p>
<p>
<strong>Small convex object in large enclosure</strong>
(e.g., a hot machine in a room):
</p>
<blockquote><pre>
Gr = e*A
where
e: Emission value of object (0..1)
A: Surface area of object where radiation
heat transfer takes place
</pre></blockquote>
<p><strong>Two parallel plates</strong>:</p>
<blockquote><pre>
Gr = A/(1/e1 + 1/e2 - 1)
where
e1: Emission value of plate1 (0..1)
e2: Emission value of plate2 (0..1)
A : Area of plate1 (= area of plate2)
</pre></blockquote>
<p><strong>Two long cylinders in each other</strong>, where radiation takes
place from the inner to the outer cylinder):
</p>
<blockquote><pre>
Gr = 2*pi*r1*L/(1/e1 + (1/e2 - 1)*(r1/r2))
where
pi: = Modelica.Constants.pi
r1: Radius of inner cylinder
r2: Radius of outer cylinder
L : Length of the two cylinders
e1: Emission value of inner cylinder (0..1)
e2: Emission value of outer cylinder (0..1)
</pre></blockquote>
</html>"));
end BodyRadiation; |
Lumped thermal element for heat convection (Q_flow = Gc*dT). This is a model of linear heat convection, e.g., the heat transfer between a plate and the surrounding air; see also:
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Components.ConvectiveResistor\">ConvectiveResistor</a>.
It may be used for complicated solid geometries and fluid flow over the solid by determining the
convective thermal conductance Gc by measurements. The basic constitutive equation for convection is | within Modelica.Thermal.HeatTransfer.Components;
model Convection
"Lumped thermal element for heat convection (Q_flow = Gc*dT)"
SI.HeatFlowRate Q_flow "Heat flow rate from solid -> fluid";
SI.TemperatureDifference dT "= solid.T - fluid.T";
Modelica.Blocks.Interfaces.RealInput Gc(unit="W/K")
"Signal representing the convective thermal conductance in [W/K]"
Interfaces.HeatPort_a solid
Interfaces.HeatPort_b fluid
equation
dT = solid.T - fluid.T;
solid.Q_flow = Q_flow;
fluid.Q_flow = -Q_flow;
Q_flow = Gc*dT;
Q_flow: Heat flow rate from connector 'solid' (e.g., a plate)
to connector 'fluid' (e.g., the surrounding air)
</pre></blockquote>
<p>
Gc = G.signal[1] is an input signal to the component, since Gc is
nearly never constant in practice. For example, Gc may be a function
of the speed of a cooling fan. For simple situations,
Gc may be <em>calculated</em> according to
</p>
<blockquote><pre>
Gc = A*h
A: Convection area (e.g., perimeter*length of a box)
h: Heat transfer coefficient
</pre></blockquote>
<p>
where the heat transfer coefficient h is calculated
from properties of the fluid flowing over the solid. Examples:
</p>
<p>
<strong>Machines cooled by air</strong> (empirical, very rough approximation according
to [<a href=\"modelica://Modelica.Thermal.HeatTransfer.UsersGuide.References\">Fischer2017</a>, p. 452]:
</p>
<blockquote><pre>
h = 7.8*v^0.78 [W/(m2.K)] (forced convection)
= 12 [W/(m2.K)] (free convection)
where
v: Air velocity in [m/s]
</pre></blockquote>
<p><strong>Laminar</strong> flow with constant velocity of a fluid along a
<strong>flat plate</strong> where the heat flow rate from the plate
to the fluid (= solid.Q_flow) is kept constant
(according to [<a href=\"modelica://Modelica.Thermal.HeatTransfer.UsersGuide.References\">Holman2010</a>, p.265]):
</p>
<blockquote><pre>
h = Nu*k/x;
Nu = 0.453*Re^(1/2)*Pr^(1/3);
where
h : Heat transfer coefficient
Nu : = h*x/k (Nusselt number)
Re : = v*x*rho/mu (Reynolds number)
Pr : = cp*mu/k (Prandtl number)
v : Absolute velocity of fluid
x : distance from leading edge of flat plate
rho: density of fluid (material constant
mu : dynamic viscosity of fluid (material constant)
cp : specific heat capacity of fluid (material constant)
k : thermal conductivity of fluid (material constant)
and the equation for h holds, provided
Re < 5e5 and 0.6 < Pr < 50
</pre></blockquote>
</html>"),
Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
{100,100}}), graphics={
Line(points={{100,0},{100,0}}, color={0,127,255}),
Line(points={{100,0},{100,0}}, color={0,127,255}),
Line(points={{100,0},{100,0}}, color={0,127,255})}));
end Convection; |
Lumped thermal element for heat convection (dT = Rc*Q_flow). This is a model of linear heat convection, e.g., the heat transfer between a plate and the surrounding air; same as the
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Components.Convection\">Convection</a> component
but using the convective resistance instead of the convective conductance as an input.
This is advantageous for series connections of ConvectiveResistors,
especially if it shall be allowed that a convective resistance is defined to be zero (i.e. no temperature difference). | within Modelica.Thermal.HeatTransfer.Components;
model ConvectiveResistor
"Lumped thermal element for heat convection (dT = Rc*Q_flow)"
SI.HeatFlowRate Q_flow "Heat flow rate from solid -> fluid";
SI.TemperatureDifference dT "= solid.T - fluid.T";
Modelica.Blocks.Interfaces.RealInput Rc(unit="K/W")
"Signal representing the convective thermal resistance in [K/W]"
Interfaces.HeatPort_a solid
Interfaces.HeatPort_b fluid
equation
dT = solid.T - fluid.T;
solid.Q_flow = Q_flow;
fluid.Q_flow = -Q_flow;
dT = Rc*Q_flow;
end ConvectiveResistor; |
Signal adaptor for a HeatTransfer port with temperature and derivative of temperature as outputs and heat flow as input (especially useful for FMUs). Adaptor between a heatport connector and a signal representation of the flange.
This component is used to provide a pure signal interface around a HeatTransfer model
and export this model in form of an input/output block,
especially as FMU (<a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>).
Examples of the usage of this adaptor are provided in
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Examples.GenerationOfFMUs\">HeatTransfer.Examples.GenerationOfFMUs</a>.
This adaptor has heatflow as input and temperature and derivative of temperature as output signals. | within Modelica.Thermal.HeatTransfer.Components;
model GeneralHeatFlowToTemperatureAdaptor
"Signal adaptor for a HeatTransfer port with temperature and derivative of temperature as outputs and heat flow as input (especially useful for FMUs)"
extends Modelica.Blocks.Interfaces.Adaptors.FlowToPotentialAdaptor(
final Name_p="T",
final Name_pder="dT",
final Name_pder2="d2T",
final Name_f="Q",
final Name_fder="der(Q)",
final Name_fder2="der2(Q)",
final use_pder2=false,
final use_fder=false,
final use_fder2=false,
p(unit="K", displayUnit="degC"),
final pder(unit="K/s"),
final pder2(unit="K/s2"),
final f(unit="W"),
final fder(unit="W/s"),
final fder2(unit="W/s2"));
HeatTransfer.Interfaces.HeatPort_a heatPort
equation
y = heatPort.T "output = potential = temperature";
u = heatPort.Q_flow "input = flow = heat flow";
end GeneralHeatFlowToTemperatureAdaptor; |
Signal adaptor for a HeatTransfer port with heat flow as output and temperature and derivative of temperature as input (especially useful for FMUs). Adaptor between a heatport connector and a signal representation of the flange.
This component is used to provide a pure signal interface around a HeatTransfer model
and export this model in form of an input/output block,
especially as FMU (<a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>).
Examples of the usage of this adaptor are provided in
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Examples.GenerationOfFMUs\">HeatTransfer.Examples.GenerationOfFMUs</a>.
This adaptor has temperature and derivative of temperature as input signals and heatflow as output signal. | within Modelica.Thermal.HeatTransfer.Components;
model GeneralTemperatureToHeatFlowAdaptor
"Signal adaptor for a HeatTransfer port with heat flow as output and temperature and derivative of temperature as input (especially useful for FMUs)"
extends Modelica.Blocks.Interfaces.Adaptors.PotentialToFlowAdaptor(
final Name_p="T",
final Name_pder="dT",
final Name_pder2="d2T",
final Name_f="Q",
final Name_fder="der(Q)",
final Name_fder2="der2(Q)",
final use_pder2=false,
final use_fder=false,
final use_fder2=false,
p(unit="K", displayUnit="degC"),
final pder(unit="K/s"),
final pder2(unit="K/s2"),
final f(unit="W"),
final fder(unit="W/s"),
final fder2(unit="W/s2"));
HeatTransfer.Interfaces.HeatPort_b heatPort
equation
y = heatPort.Q_flow "output = flow = heat flow";
u = heatPort.T "input = potential = temperature";
end GeneralTemperatureToHeatFlowAdaptor; |
Lumped thermal element storing heat. This is a generic model for the heat capacity of a material.
No specific geometry is assumed beyond a total volume with
uniform temperature for the entire volume.
Furthermore, it is assumed that the heat capacity
is constant (independent of temperature). | within Modelica.Thermal.HeatTransfer.Components;
model HeatCapacitor "Lumped thermal element storing heat"
parameter SI.HeatCapacity C
"Heat capacity of element (= cp*m)";
SI.Temperature T(start=293.15, displayUnit="degC")
"Temperature of element";
SI.TemperatureSlope der_T(start=0)
"Time derivative of temperature (= der(T))";
Interfaces.HeatPort_a port
equation
T = port.T;
der_T = der(T);
C*der(T) = port.Q_flow;
end HeatCapacitor; |
Lumped thermal components | within Modelica.Thermal.HeatTransfer;
package Components "Lumped thermal components"
extends Modelica.Icons.Package;
end Components; |
Collects m heat flows. This is a model to collect the heat flows from <em>m</em> heatports to one single heatport. | within Modelica.Thermal.HeatTransfer.Components;
model ThermalCollector "Collects m heat flows"
parameter Integer m(min=1)=3 "Number of collected heat flows";
Interfaces.HeatPort_a port_a[m]
Interfaces.HeatPort_b port_b
equation
port_b.Q_flow + sum(port_a.Q_flow) = 0;
port_a.T = fill(port_b.T, m);
end ThermalCollector; |
Collects Ns x Np heat flows. This is a model to collect the heat flows from <em>Ns</em> x <em>Np</em> heatports to one single heatport. | within Modelica.Thermal.HeatTransfer.Components;
model ThermalCollectorMatrix "Collects Ns x Np heat flows"
parameter Integer Ns(min=1) "Number of rows";
parameter Integer Np(min=1) "Number of columns";
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a port_a[Ns, Np]
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port_b
equation
port_b.Q_flow + sum(port_a.Q_flow) = 0;
port_a.T = fill(port_b.T, Ns, Np);
end ThermalCollectorMatrix; |
Lumped thermal element transporting heat without storing it. This is a model for transport of heat without storing it; see also:
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Components.ThermalResistor\">ThermalResistor</a>.
It may be used for complicated geometries where
the thermal conductance G (= inverse of thermal resistance)
is determined by measurements and is assumed to be constant
over the range of operations. If the component consists mainly of
one type of material and a regular geometry, it may be calculated,
e.g., with one of the following equations: | within Modelica.Thermal.HeatTransfer.Components;
model ThermalConductor
"Lumped thermal element transporting heat without storing it"
extends Interfaces.Element1D;
parameter SI.ThermalConductance G
"Constant thermal conductance of material";
equation
Q_flow = G*dT;
end ThermalConductor; |
Lumped thermal element transporting heat without storing it. This is a model for transport of heat without storing it, same as the
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Components.ThermalConductor\">ThermalConductor</a>
but using the thermal resistance instead of the thermal conductance as a parameter.
This is advantageous for series connections of ThermalResistors,
especially if it shall be allowed that a ThermalResistance is defined to be zero (i.e. no temperature difference). | within Modelica.Thermal.HeatTransfer.Components;
model ThermalResistor
"Lumped thermal element transporting heat without storing it"
extends Interfaces.Element1D;
parameter SI.ThermalResistance R
"Constant thermal resistance of material";
equation
dT = R*Q_flow;
end ThermalResistor; |
Control temperature of a resistor. A constant voltage of 10 V is applied to a
temperature dependent resistor of 10*(1+(T-20C)/(235+20C)) Ohms,
whose losses v**2/r are dissipated via a
thermal conductance of 0.1 W/K to ambient temperature 20 degree C.
The resistor is assumed to have a thermal capacity of 1 J/K,
having ambient temperature at the beginning of the experiment.
The temperature of this heating resistor is held by an OnOff controller
at reference temperature within a given bandwidth +/- 1 K
by switching on and off the voltage source.
The reference temperature starts at 25 degree C
and rises between t = 2 and 8 seconds linear to 50 degree C.
An appropriate simulating time would be 10 seconds. | within Modelica.Thermal.HeatTransfer.Examples;
model ControlledTemperature "Control temperature of a resistor"
extends Modelica.Icons.Example;
parameter SI.Temperature TAmb(displayUnit="degC") = 293.15
"Ambient temperature";
parameter SI.TemperatureDifference TDif = 2
"Error in temperature";
output SI.Temperature TRes(displayUnit="degC") = resistor.T_heatPort "Resulting temperature";
Modelica.Electrical.Analog.Basic.Ground ground
Modelica.Electrical.Analog.Sources.ConstantVoltage constantVoltage(V=10)
HeatTransfer.Components.HeatCapacitor heatCapacitor(C=1, T(start=TAmb, fixed=
true))
Modelica.Electrical.Analog.Basic.Resistor resistor(
R=10,
T_ref=293.15,
alpha=1/255,
useHeatPort=true)
HeatTransfer.Sources.FixedTemperature fixedTemperature(T=TAmb)
HeatTransfer.Celsius.TemperatureSensor temperatureSensor
HeatTransfer.Components.ThermalConductor thermalConductor(G=0.1)
Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch idealSwitch
Modelica.Blocks.Sources.Ramp ramp(
height=25,
duration=6,
offset=25,
startTime=2)
Modelica.Blocks.Logical.OnOffController onOffController(bandwidth=TDif)
Modelica.Blocks.Logical.Not logicalNot
equation
connect(constantVoltage.n, resistor.n)
connect(constantVoltage.n, ground.p)
connect(resistor.heatPort, thermalConductor.port_a)
connect(thermalConductor.port_b, fixedTemperature.port)
connect(resistor.heatPort, temperatureSensor.port)
connect(resistor.heatPort, heatCapacitor.port)
connect(constantVoltage.p, idealSwitch.p)
connect(idealSwitch.n, resistor.p)
connect(ramp.y, onOffController.reference)
connect(temperatureSensor.T, onOffController.u)
connect(onOffController.y, logicalNot.u)
connect(logicalNot.y, idealSwitch.control)
end ControlledTemperature; |
Example to demonstrate variants to generate FMUs (Functional Mock-up Units). This example demonstrates how to generate an input/output block (e.g. in form of an
FMU - <a href=\"https://fmi-standard.org\">Functional Mock-up Unit</a>) from various HeatTransfer components.
The goal is to export such an input/output block from Modelica and import
it in another modeling environment. The essential issue is that before
exporting it must be known in which way the component is utilized in the
target environment. Depending on the target usage, different flange variables
need to be in the interface with either input or output causality.
Note, this example model can be used to test the FMU export/import of a Modelica tool.
Just export the components marked in the icons as \"toFMU\" as FMUs and import
them back. The models should then still work and give the same results as a
pure Modelica model. | within Modelica.Thermal.HeatTransfer.Examples;
model GenerationOfFMUs
"Example to demonstrate variants to generate FMUs (Functional Mock-up Units)"
extends Modelica.Icons.Example;
Modelica.Blocks.Sources.Sine sine1(f=2, amplitude=1000)
HeatTransfer.Examples.Utilities.DirectCapacity directCapacity(C=1.1)
HeatTransfer.Examples.Utilities.InverseCapacity inverseCapacity(C=2.2)
HeatTransfer.Examples.Utilities.Conduction conductor(G=10)
HeatTransfer.Components.HeatCapacitor capacitor3a(C=1.1, T(fixed=true, start=
293.15))
HeatTransfer.Sources.PrescribedHeatFlow heatFlow3
HeatTransfer.Components.GeneralHeatFlowToTemperatureAdaptor heatFlowToTemperature3a(use_pder=
false)
HeatTransfer.Components.HeatCapacitor capacitor3b(C=2.2, T(fixed=true, start=
293.15))
HeatTransfer.Components.GeneralHeatFlowToTemperatureAdaptor heatFlowToTemperature3b(use_pder=
false)
equation
connect(sine1.y, directCapacity.Q_flowDrive)
connect(directCapacity.T, inverseCapacity.T)
connect(inverseCapacity.Q_flow, directCapacity.Q_flow)
connect(heatFlowToTemperature3a.f, conductor.Q_flow1)
connect(conductor.Q_flow2,heatFlowToTemperature3b. f)
connect(heatFlowToTemperature3a.p, conductor.T1)
connect(conductor.T2,heatFlowToTemperature3b. p)
connect(sine1.y, heatFlow3.Q_flow)
connect(heatFlow3.port, capacitor3a.port)
connect(capacitor3a.port,heatFlowToTemperature3a. heatPort)
connect(heatFlowToTemperature3b.heatPort, capacitor3b.port)
connect(directCapacity.derT, inverseCapacity.derT)
end GenerationOfFMUs; |
Second order thermal model of a motor. This example contains a simple second order thermal model of a motor.
The periodic power losses are described by table \"lossTable\": | within Modelica.Thermal.HeatTransfer.Examples;
model Motor "Second order thermal model of a motor"
extends Modelica.Icons.Example;
parameter SI.Temperature TAmb(displayUnit="degC") = 293.15
"Ambient temperature";
Modelica.Blocks.Sources.CombiTimeTable lossTable(
extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments,
table=[0,100,500; 360,1000,500; 600,100,500])
HeatTransfer.Sources.PrescribedHeatFlow windingLosses(T_ref=368.15, alpha=
3.03E-3)
HeatTransfer.Components.HeatCapacitor winding(C=2500, T(start=TAmb, fixed=
true))
HeatTransfer.Celsius.TemperatureSensor Twinding
HeatTransfer.Components.ThermalConductor winding2core(G=10)
HeatTransfer.Sources.PrescribedHeatFlow coreLosses
HeatTransfer.Components.HeatCapacitor core(C=25000, T(start=TAmb, fixed=true))
HeatTransfer.Celsius.TemperatureSensor Tcore
Modelica.Blocks.Sources.Constant convectionConstant(k=25)
HeatTransfer.Components.Convection convection
HeatTransfer.Sources.FixedTemperature environment(T=TAmb)
equation
connect(windingLosses.port, winding.port)
connect(coreLosses.port, core.port)
connect(winding.port, winding2core.port_a)
connect(winding2core.port_b, core.port)
connect(winding.port, Twinding.port)
connect(core.port, Tcore.port)
connect(winding2core.port_b, convection.solid)
connect(convection.fluid, environment.port)
connect(convectionConstant.y, convection.Gc)
connect(lossTable.y[1], windingLosses.Q_flow)
connect(lossTable.y[2], coreLosses.Q_flow)
end Motor; |
Example models to demonstrate the usage of package Modelica.Thermal.HeatTransfer | within Modelica.Thermal.HeatTransfer;
package Examples "Example models to demonstrate the usage of package Modelica.Thermal.HeatTransfer"
extends Modelica.Icons.ExamplesPackage;
end Examples; |
Simple conduction demo. This example demonstrates the thermal response of two masses connected by
a conducting element. The two masses have the same heat capacity but different
initial temperatures (T1=100 [degC], T2= 0 [degC]). The mass with the higher
temperature will cool off while the mass with the lower temperature heats up.
They will each asymptotically approach the calculated temperature <strong>T_final_K</strong>
(<strong>T_final_degC</strong>) that results from dividing the total initial energy in the system by the sum
of the heat capacities of each element. | within Modelica.Thermal.HeatTransfer.Examples;
model TwoMasses "Simple conduction demo"
extends Modelica.Icons.Example;
parameter SI.Temperature T_final_K(fixed=false)
"Projected final temperature";
HeatTransfer.Components.HeatCapacitor mass1(C=15, T(start=373.15, fixed=true))
HeatTransfer.Components.HeatCapacitor mass2(C=15, T(start=273.15, fixed=true))
HeatTransfer.Components.ThermalConductor conduction(G=10)
HeatTransfer.Celsius.TemperatureSensor Tsensor1
HeatTransfer.Celsius.TemperatureSensor Tsensor2
equation
connect(mass1.port, conduction.port_a)
connect(conduction.port_b, mass2.port)
connect(mass1.port, Tsensor1.port)
connect(mass2.port, Tsensor2.port)
initial equation
T_final_K = (mass1.T*mass1.C + mass2.T*mass2.C)/(mass1.C + mass2.C);
end TwoMasses; |
Input/output block of a conduction model. | within Modelica.Thermal.HeatTransfer.Examples.Utilities;
model Conduction "Input/output block of a conduction model"
extends Modelica.Blocks.Icons.Block;
parameter SI.ThermalConductance G=1 "Thermal conductance";
HeatTransfer.Components.GeneralTemperatureToHeatFlowAdaptor temperatureToHeatFlow1(use_pder=
false)
Modelica.Blocks.Interfaces.RealInput T1(unit="K", displayUnit="degC")
"Temperature of left heatPort of conduction element"
Modelica.Blocks.Interfaces.RealOutput Q_flow1(unit="W")
"Heat flow generated by the conduction element"
HeatTransfer.Components.ThermalConductor thermalConductor(G=G)
Modelica.Blocks.Interfaces.RealInput T2(unit="K", displayUnit="degC")
"Temperature of right heatPort of conduction element"
Modelica.Blocks.Interfaces.RealOutput Q_flow2(unit="W")
"Heat flow generated by the conduction element"
HeatTransfer.Components.GeneralTemperatureToHeatFlowAdaptor temperatureToHeatFlow2(use_pder=
false)
equation
connect(Q_flow1,temperatureToHeatFlow1. f)
connect(temperatureToHeatFlow2.f, Q_flow2)
connect(temperatureToHeatFlow1.p, T1)
connect(temperatureToHeatFlow2.p, T2)
connect(temperatureToHeatFlow1.heatPort, thermalConductor.port_a)
connect(thermalConductor.port_b,temperatureToHeatFlow2. heatPort)
end Conduction; |
Input/output block of a direct heatCapacity model. | within Modelica.Thermal.HeatTransfer.Examples.Utilities;
model DirectCapacity
"Input/output block of a direct heatCapacity model"
extends Modelica.Blocks.Icons.Block;
parameter SI.HeatCapacity C(min=0)=1 "HeatCapacity";
HeatTransfer.Components.HeatCapacitor heatCapacitor(C=C, T(fixed=true, start=
293.15))
HeatTransfer.Sources.PrescribedHeatFlow forceSource
Modelica.Blocks.Interfaces.RealInput Q_flowDrive(unit="W")
HeatTransfer.Components.GeneralHeatFlowToTemperatureAdaptor heatFlowToTemperature(use_pder=
true)
Modelica.Blocks.Interfaces.RealOutput T(unit="K", displayUnit="degC")
"Heat capacity changes temperature T due to heat flow Q_flow"
Modelica.Blocks.Interfaces.RealOutput derT(unit="K/s")
"Heat capacity changes temperature T due to heat flow Q_flow"
Modelica.Blocks.Interfaces.RealInput Q_flow(unit="W")
"Heat flow to the heat capacity"
equation
connect(heatFlowToTemperature.f, Q_flow)
connect(heatFlowToTemperature.p, T)
connect(heatFlowToTemperature.pder, derT)
connect(heatCapacitor.port,heatFlowToTemperature. heatPort)
connect(Q_flowDrive, forceSource.Q_flow)
connect(heatCapacitor.port, forceSource.port)
end DirectCapacity; |
Input/output block of an inverse heatCapacity model. | within Modelica.Thermal.HeatTransfer.Examples.Utilities;
model InverseCapacity
"Input/output block of an inverse heatCapacity model"
extends Modelica.Blocks.Icons.Block;
parameter SI.HeatCapacity C(min=0)=1 "HeatCapacity";
HeatTransfer.Components.HeatCapacitor mass(C=C, T(fixed=true, start=293.15))
HeatTransfer.Components.GeneralTemperatureToHeatFlowAdaptor temperatureToHeatFlow
Modelica.Blocks.Interfaces.RealInput T(unit="K", displayUnit="degC")
"Temperature to drive the heatCapacity"
Modelica.Blocks.Interfaces.RealInput derT(unit="K/s")
"Temperature to drive the heatCapacity"
Modelica.Blocks.Interfaces.RealOutput Q_flow(unit="W")
"Heat flow needed to drive the heatPort according to T, derT"
equation
connect(temperatureToHeatFlow.f, Q_flow)
connect(temperatureToHeatFlow.p, T)
connect(temperatureToHeatFlow.pder, derT)
connect(temperatureToHeatFlow.heatPort, mass.port)
end InverseCapacity; |
Utility classes used by the Example models | within Modelica.Thermal.HeatTransfer.Examples;
package Utilities "Utility classes used by the Example models"
extends Modelica.Icons.UtilitiesPackage;
end Utilities; |
Fixed temperature boundary condition in degFahrenheit. This model defines a fixed temperature T at its port in [degF],
i.e., it defines a fixed temperature as a boundary condition. | within Modelica.Thermal.HeatTransfer.Fahrenheit;
model FixedTemperature
"Fixed temperature boundary condition in degFahrenheit"
extends HeatTransfer.Icons.FixedTemperature;
parameter Modelica.Units.NonSI.Temperature_degF T
"Fixed temperature at the port";
Interfaces.HeatPort_b port
equation
port.T = Modelica.Units.Conversions.from_degF(T);
end FixedTemperature; |
Conversion from Kelvin to degree Fahrenheit. This component converts all input signals from Kelvin to Fahrenheit
and provides them as output signals. | within Modelica.Thermal.HeatTransfer.Fahrenheit;
model FromKelvin "Conversion from Kelvin to degree Fahrenheit"
extends HeatTransfer.Icons.Conversion;
Modelica.Blocks.Interfaces.RealInput Kelvin(unit="K")
Modelica.Blocks.Interfaces.RealOutput Fahrenheit(unit="degF")
equation
Fahrenheit = Modelica.Units.Conversions.to_degF(Kelvin);
end FromKelvin; |
Components with Fahrenheit input and/or output | within Modelica.Thermal.HeatTransfer;
package Fahrenheit "Components with Fahrenheit input and/or output"
extends Modelica.Icons.VariantsPackage;
</pre></blockquote>
</html>"));
end Fahrenheit; |
Variable temperature boundary condition in degFahrenheit. This model represents a variable temperature boundary condition
The temperature value in [degF] is given by the input signal
to the model. The effect is that an instance of this model acts as
an infinite reservoir able to absorb or generate as much energy
as required to keep the temperature at the specified value. | within Modelica.Thermal.HeatTransfer.Fahrenheit;
model PrescribedTemperature
"Variable temperature boundary condition in degFahrenheit"
extends HeatTransfer.Icons.PrescribedTemperature;
Interfaces.HeatPort_b port
Modelica.Blocks.Interfaces.RealInput T(unit="degF")
equation
port.T = Modelica.Units.Conversions.from_degF(T);
end PrescribedTemperature; |
Absolute temperature sensor in degFahrenheit. This is an ideal absolute temperature sensor which returns
the temperature of the connected port in Fahrenheit as an output
signal. The sensor itself has no thermal interaction with
whatever it is connected to. Furthermore, no
thermocouple-like lags are associated with this
sensor model. | within Modelica.Thermal.HeatTransfer.Fahrenheit;
model TemperatureSensor "Absolute temperature sensor in degFahrenheit"
Modelica.Blocks.Interfaces.RealOutput T
Interfaces.HeatPort_a port
equation
T = Modelica.Units.Conversions.to_degF(port.T);
port.Q_flow = 0;
end TemperatureSensor; |
Conversion from degree Fahrenheit to Kelvin. This component converts a input signal from degree Fahrenheit to Kelvin
and provides is as output signal. | within Modelica.Thermal.HeatTransfer.Fahrenheit;
model ToKelvin "Conversion from degree Fahrenheit to Kelvin"
extends HeatTransfer.Icons.Conversion;
Modelica.Blocks.Interfaces.RealInput Fahrenheit(unit="degF")
Modelica.Blocks.Interfaces.RealOutput Kelvin(unit="K")
equation
Kelvin = Modelica.Units.Conversions.from_degF(Fahrenheit);
end ToKelvin; |
Conversion of temperatures. This icon represents part of a temperature conversion model. | within Modelica.Thermal.HeatTransfer.Icons;
model Conversion "Conversion of temperatures"
end Conversion; |
Icon of fixed temperature source. This icon represents a fixed temperature source model. | within Modelica.Thermal.HeatTransfer.Icons;
model FixedTemperature "Icon of fixed temperature source"
end FixedTemperature; |
Icons | within Modelica.Thermal.HeatTransfer;
package Icons "Icons"
extends Modelica.Icons.IconsPackage;
end Icons; |
Icon of prescribed temperature source. This icon represents a prescribed temperature source model. | within Modelica.Thermal.HeatTransfer.Icons;
model PrescribedTemperature "Icon of prescribed temperature source"
extends FixedTemperature;
end PrescribedTemperature; |
Partial heat transfer element with two HeatPort connectors that does not store energy. This partial model contains the basic connectors and variables to
allow heat transfer models to be created that <strong>do not store energy</strong>,
This model defines and includes equations for the temperature
drop across the element, <strong>dT</strong>, and the heat flow rate
through the element from port_a to port_b, <strong>Q_flow</strong>. | within Modelica.Thermal.HeatTransfer.Interfaces;
partial model Element1D
"Partial heat transfer element with two HeatPort connectors that does not store energy"
SI.HeatFlowRate Q_flow
"Heat flow rate from port_a -> port_b";
SI.TemperatureDifference dT "port_a.T - port_b.T";
public
HeatPort_a port_a
HeatPort_b port_b
equation
dT = port_a.T - port_b.T;
port_a.Q_flow = Q_flow;
port_b.Q_flow = -Q_flow;
end Element1D; |
Thermal port for 1-dim. heat transfer (filled rectangular icon). This connector is used for 1-dimensional heat flow between components.
The variables in the connector are: | within Modelica.Thermal.HeatTransfer.Interfaces;
connector HeatPort_a
"Thermal port for 1-dim. heat transfer (filled rectangular icon)"
extends HeatPort;
end HeatPort_a; |
Thermal port for 1-dim. heat transfer (unfilled rectangular icon). This connector is used for 1-dimensional heat flow between components.
The variables in the connector are: | within Modelica.Thermal.HeatTransfer.Interfaces;
connector HeatPort_b
"Thermal port for 1-dim. heat transfer (unfilled rectangular icon)"
extends HeatPort;
end HeatPort_b; |
Connectors and partial models | within Modelica.Thermal.HeatTransfer;
package Interfaces "Connectors and partial models"
extends Modelica.Icons.InterfacesPackage;
end Interfaces; |
Partial model to include a conditional HeatPort in order to dissipate losses, used for graphical modeling, i.e., for building models by drag-and-drop. This partial model provides a conditional heat port for dissipating losses. | within Modelica.Thermal.HeatTransfer.Interfaces;
partial model PartialConditionalHeatPort
"Partial model to include a conditional HeatPort in order to dissipate losses, used for graphical modeling, i.e., for building models by drag-and-drop"
parameter Boolean useHeatPort = false "= true, if HeatPort is enabled"
parameter SI.Temperature T=293.15
"Fixed device temperature if useHeatPort = false"
HeatTransfer.Interfaces.HeatPort_a heatPort if useHeatPort
"Optional port to which dissipated losses are transported in form of heat"
HeatTransfer.Sources.FixedTemperature fixedTemperature(final T=T) if not
useHeatPort
protected
HeatPort_a internalHeatPort
equation
connect(heatPort, internalHeatPort)
connect(fixedTemperature.port, internalHeatPort)
end PartialConditionalHeatPort; |
Partial model to include a conditional HeatPort in order to dissipate losses, used for textual modeling, i.e., for elementary models. This partial model provides a conditional heat port for dissipating losses. | within Modelica.Thermal.HeatTransfer.Interfaces;
partial model PartialElementaryConditionalHeatPort
"Partial model to include a conditional HeatPort in order to dissipate losses, used for textual modeling, i.e., for elementary models"
parameter Boolean useHeatPort = false "= true, if heatPort is enabled"
parameter SI.Temperature T=293.15
"Fixed device temperature if useHeatPort = false"
HeatTransfer.Interfaces.HeatPort_a heatPort(final T=TheatPort, final Q_flow=-
lossPower) if useHeatPort
"Optional port to which dissipated losses are transported in form of heat"
SI.Power lossPower
"Loss power leaving component via heatPort (> 0, if heat is flowing out of component)";
SI.Temperature TheatPort "Temperature of heatPort";
equation
if not useHeatPort then
TheatPort = T;
end if;
end PartialElementaryConditionalHeatPort; |
Partial model to include a conditional HeatPort in order to dissipate losses, used for textual modeling, i.e., for elementary models. This partial model provides a conditional heat port for dissipating losses. | within Modelica.Thermal.HeatTransfer.Interfaces;
partial model PartialElementaryConditionalHeatPortWithoutT
"Partial model to include a conditional HeatPort in order to dissipate losses, used for textual modeling, i.e., for elementary models"
parameter Boolean useHeatPort = false "= true, if heatPort is enabled"
HeatTransfer.Interfaces.HeatPort_a heatPort(final Q_flow=-lossPower) if
useHeatPort
"Optional port to which dissipated losses are transported in form of heat"
SI.Power lossPower
"Loss power leaving component via heatPort (> 0, if heat is flowing out of component)";
end PartialElementaryConditionalHeatPortWithoutT; |
Fixed temperature boundary condition in degRankine. This model defines a fixed temperature T at its port in degree Rankine,
[degRk], i.e., it defines a fixed temperature as a boundary condition. | within Modelica.Thermal.HeatTransfer.Rankine;
model FixedTemperature "Fixed temperature boundary condition in degRankine"
extends HeatTransfer.Icons.FixedTemperature;
parameter Modelica.Units.NonSI.Temperature_degRk T
"Fixed Temperature at the port";
Interfaces.HeatPort_b port
equation
port.T = Modelica.Units.Conversions.from_degRk(T);
end FixedTemperature; |
Conversion from Kelvin to degree Rankine. This component converts all input signals from Kelvin to Rankine
and provides them as output signals. | within Modelica.Thermal.HeatTransfer.Rankine;
model FromKelvin "Conversion from Kelvin to degree Rankine"
extends HeatTransfer.Icons.Conversion;
Modelica.Blocks.Interfaces.RealInput Kelvin(unit="K")
Modelica.Blocks.Interfaces.RealOutput Rankine(unit="degRk")
equation
Rankine = Modelica.Units.Conversions.to_degRk(Kelvin);
end FromKelvin; |
Components with Rankine input and/or output | within Modelica.Thermal.HeatTransfer;
package Rankine "Components with Rankine input and/or output"
extends Modelica.Icons.VariantsPackage;
</pre></blockquote>
</html>"));
end Rankine; |
Variable temperature boundary condition in degRankine. This model represents a variable temperature boundary condition
The temperature value in degree Rankine, [degRk] is given by the input signal
to the model. The effect is that an instance of this model acts as
an infinite reservoir able to absorb or generate as much energy
as required to keep the temperature at the specified value. | within Modelica.Thermal.HeatTransfer.Rankine;
model PrescribedTemperature
"Variable temperature boundary condition in degRankine"
extends HeatTransfer.Icons.PrescribedTemperature;
Interfaces.HeatPort_b port
Modelica.Blocks.Interfaces.RealInput T(unit="degRk")
equation
port.T = Modelica.Units.Conversions.from_degRk(T);
end PrescribedTemperature; |
Absolute temperature sensor in degRankine. This is an ideal absolute temperature sensor which returns
the temperature of the connected port in Rankine as an output
signal. The sensor itself has no thermal interaction with
whatever it is connected to. Furthermore, no
thermocouple-like lags are associated with this
sensor model. | within Modelica.Thermal.HeatTransfer.Rankine;
model TemperatureSensor "Absolute temperature sensor in degRankine"
Modelica.Blocks.Interfaces.RealOutput T
Interfaces.HeatPort_a port
equation
T = Modelica.Units.Conversions.to_degRk(port.T);
port.Q_flow = 0;
end TemperatureSensor; |
Conversion from degree Rankine to Kelvin. This component converts all input signals from degree Rankine to Kelvin
and provides them as output signals. | within Modelica.Thermal.HeatTransfer.Rankine;
model ToKelvin "Conversion from degree Rankine to Kelvin"
extends HeatTransfer.Icons.Conversion;
Modelica.Blocks.Interfaces.RealInput Rankine(unit="degRk")
Modelica.Blocks.Interfaces.RealOutput Kelvin(unit="K")
equation
Kelvin = Modelica.Units.Conversions.from_degRk(Rankine);
end ToKelvin; |
HeatFlowSensor, conditional fixed temperature. If useFixedTemperature = false, this sensor acts just as a normal
<a href=\"modelica://Modelica.Thermal.HeatTransfer.Sensors.HeatFlowSensor\">HeatFlowSensor</a>. | within Modelica.Thermal.HeatTransfer.Sensors;
model ConditionalFixedHeatFlowSensor
"HeatFlowSensor, conditional fixed temperature"
extends Modelica.Icons.RoundSensor;
parameter Boolean useFixedTemperature(start=false)
"Fixed temperature if true"
HeatTransfer.Interfaces.HeatPort_a port_a
HeatTransfer.Interfaces.HeatPort_b port_b
HeatTransfer.Sensors.HeatFlowSensor heatFlowSensor
HeatTransfer.Sources.FixedTemperature fixedTemperature(final T(displayUnit=
"K") = 293.15) if useFixedTemperature
Modelica.Blocks.Interfaces.RealOutput Q_flow(unit="W")
"Heat flow from port_a to port_b as output signal"
equation
connect(heatFlowSensor.port_b, port_b)
connect(port_a, heatFlowSensor.port_a)
connect(fixedTemperature.port, heatFlowSensor.port_a)
connect(heatFlowSensor.Q_flow, Q_flow)
end ConditionalFixedHeatFlowSensor; |
Heat flow rate sensor. This model is capable of monitoring the heat flow rate flowing through
this component. The sensed value of heat flow rate is the amount that
passes through this sensor while keeping the temperature drop across the
sensor zero. This is an ideal model so it does not absorb any energy
and it has no direct effect on the thermal response of a system it is included in.
The output signal is positive, if the heat flows from port_a to port_b. | within Modelica.Thermal.HeatTransfer.Sensors;
model HeatFlowSensor "Heat flow rate sensor"
extends Modelica.Icons.RoundSensor;
Modelica.Blocks.Interfaces.RealOutput Q_flow(unit="W")
"Heat flow from port_a to port_b as output signal"
Interfaces.HeatPort_a port_a
Interfaces.HeatPort_b port_b
equation
port_a.T = port_b.T;
port_a.Q_flow + port_b.Q_flow = 0;
Q_flow = port_a.Q_flow;
end HeatFlowSensor; |
Thermal sensors | within Modelica.Thermal.HeatTransfer;
package Sensors "Thermal sensors"
extends Modelica.Icons.SensorsPackage;
end Sensors; |
Relative temperature sensor. The relative temperature \"port_a.T - port_b.T\" is determined between
the two ports of this component and is provided as output signal in Kelvin. | within Modelica.Thermal.HeatTransfer.Sensors;
model RelTemperatureSensor "Relative temperature sensor"
extends Modelica.Icons.RectangularSensor;
Interfaces.HeatPort_a port_a
Interfaces.HeatPort_b port_b
Modelica.Blocks.Interfaces.RealOutput T_rel(unit="K", displayUnit="K")
"Relative temperature as output signal"
equation
T_rel = port_a.T - port_b.T;
0 = port_a.Q_flow;
0 = port_b.Q_flow;
end RelTemperatureSensor; |
Absolute temperature sensor in Kelvin. This is an ideal absolute temperature sensor which returns
the temperature of the connected port in Kelvin as an output
signal. The sensor itself has no thermal interaction with
whatever it is connected to. Furthermore, no
thermocouple-like lags are associated with this
sensor model. | within Modelica.Thermal.HeatTransfer.Sensors;
model TemperatureSensor "Absolute temperature sensor in Kelvin"
Modelica.Blocks.Interfaces.RealOutput T(unit="K")
"Absolute temperature as output signal"
Interfaces.HeatPort_a port
equation
T = port.T;
port.Q_flow = 0;
end TemperatureSensor; |
Fixed heat flow boundary condition. This model allows a specified amount of heat flow rate to be \"injected\"
into a thermal system at a given port. The constant amount of heat
flow rate Q_flow is given as a parameter. The heat flows into the
component to which the component FixedHeatFlow is connected,
if parameter Q_flow is positive. | within Modelica.Thermal.HeatTransfer.Sources;
model FixedHeatFlow "Fixed heat flow boundary condition"
parameter SI.HeatFlowRate Q_flow
"Fixed heat flow rate at port";
parameter SI.Temperature T_ref=293.15
"Reference temperature";
parameter SI.LinearTemperatureCoefficient alpha=0
"Temperature coefficient of heat flow rate";
Interfaces.HeatPort_b port
equation
port.Q_flow = -Q_flow*(1 + alpha*(port.T - T_ref));
end FixedHeatFlow; |
Fixed temperature boundary condition in Kelvin. This model defines a fixed temperature T at its port in Kelvin,
i.e., it defines a fixed temperature as a boundary condition. | within Modelica.Thermal.HeatTransfer.Sources;
model FixedTemperature "Fixed temperature boundary condition in Kelvin"
parameter SI.Temperature T "Fixed temperature at port";
Interfaces.HeatPort_b port
equation
port.T = T;
end FixedTemperature; |
Thermal sources | within Modelica.Thermal.HeatTransfer;
package Sources "Thermal sources"
extends Modelica.Icons.SourcesPackage;
end Sources; |
Prescribed heat flow boundary condition. This model allows a specified amount of heat flow rate to be \"injected\"
into a thermal system at a given port. The amount of heat
is given by the input signal Q_flow into the model. The heat flows into the
component to which the component PrescribedHeatFlow is connected,
if the input signal is positive. | within Modelica.Thermal.HeatTransfer.Sources;
model PrescribedHeatFlow "Prescribed heat flow boundary condition"
parameter SI.Temperature T_ref=293.15
"Reference temperature";
parameter SI.LinearTemperatureCoefficient alpha=0
"Temperature coefficient of heat flow rate";
Modelica.Blocks.Interfaces.RealInput Q_flow(unit="W")
Interfaces.HeatPort_b port
equation
port.Q_flow = -Q_flow*(1 + alpha*(port.T - T_ref));
end PrescribedHeatFlow; |
Variable temperature boundary condition in Kelvin. This model represents a variable temperature boundary condition.
The temperature in [K] is given as input signal <strong>T</strong>
to the model. The effect is that an instance of this model acts as
an infinite reservoir able to absorb or generate as much energy
as required to keep the temperature at the specified value. | within Modelica.Thermal.HeatTransfer.Sources;
model PrescribedTemperature
"Variable temperature boundary condition in Kelvin"
Interfaces.HeatPort_b port
Modelica.Blocks.Interfaces.RealInput T(unit="K")
equation
port.T = T;
end PrescribedTemperature; |
VehicleInterfaces Library (Version 2.0.1) - Interface definitions and architectures for vehicle system modeling | within ;
package VehicleInterfaces "VehicleInterfaces Library (Version 2.0.1) - Interface definitions and architectures for vehicle system modeling"
extends Modelica.Icons.Package;
import Modelica.Units.SI;
end VehicleInterfaces; |
Collection of type definitions | within VehicleInterfaces;
package Types "Collection of type definitions"
extends Modelica.Icons.TypesPackage;
type NormalizedReal = Modelica.Icons.TypeReal (
final quantity="",
final unit="1",
final displayUnit="1",
final min=0,
final max=1) "Normalized real number";
type Gear = Modelica.Icons.TypeInteger (final quantity="gear")
"Gear ...,-2,-1,0,1,2,... = 2nd rear, 1st rear, neutral, 1st, 2nd forward, etc";
package GearMode
"Type, constants and menu choices for gear mode, as temporary solution until enumerations are available"
// type GearMode = enumeration(Park, Drive, Neutral, Rear, Manual, Limited);
constant Integer Park=1;
constant Integer Drive=2;
constant Integer Neutral=3;
constant Integer Rear=4;
constant Integer Manual=5;
constant Integer Limited=6;
type Temp
"Temporary type of gear mode with choices for menus (until enumerations are available)"
extends Integer(min=1,max=6);
end Temp;
end GearMode;
package IgnitionSetting
"Type, constants and menu choices for ignition setting, as temporary solution until enumerations are available"
// type IgnitionSetting = enumeration(Off, On, Start);
constant Integer Off=1 "Ignition is off";
constant Integer On=2 "Ignition is on";
constant Integer Start=3
"Ignition is on and driver requires to start engine";
type Temp
"Temporary type of ignition setting with choices for menus (until enumerations are available)"
extends Integer(min=1,max=3);
end Temp;
end IgnitionSetting;
end Types; |
Constant torque loss and inertia due to the accessories. Simple accessory model with a single inertia and constant torque loss. | within VehicleInterfaces.Accessories;
model MinimalAccessories
"Constant torque loss and inertia due to the accessories"
extends VehicleInterfaces.Icons.Accessories;
extends Interfaces.Base(includeEngineBearing=world.driveTrainMechanics3D);
parameter SI.Inertia accessoriesInertia=0.001
"Total effective rotational inertia of the accessories";
parameter SI.Torque accessoriesLoad=2
"Total effective torque load due to the accessories (constant)";
parameter Modelica.Mechanics.MultiBody.Types.Axis axisOfRotation={1,0,0}
"Axis of rotation for accessories when including MultiBody effects";
Modelica.Mechanics.MultiBody.Parts.Rotor1D inertia(
J=accessoriesInertia,
n=axisOfRotation)
Modelica.Mechanics.Rotational.Sources.SignTorque torqueLoss(
tau_nominal=-accessoriesLoad,
useSupport=includeEngineBearing,
w0=1)
Modelica.Mechanics.MultiBody.Parts.Mounting1D torqueReaction(
n=axisOfRotation) if includeEngineBearing
protected
outer Modelica.Mechanics.MultiBody.World world;
equation
connect(torqueLoss.flange, inertia.flange_a)
connect(inertia.flange_b, engineFlange.flange)
connect(torqueReaction.frame_a, engineFlange.bearingFrame)
connect(torqueReaction.flange_b,torqueLoss.support)
connect(inertia.frame_a, torqueReaction.frame_a)
end MinimalAccessories; |
Empty accessories. Empty accessories subsystem. Using this empty model in overall vehicle architecture the functionality of accessories subsystem can be eliminated. | within VehicleInterfaces.Accessories;
model NoAccessories "Empty accessories"
extends VehicleInterfaces.Icons.Accessories;
extends VehicleInterfaces.Icons.Empty;
extends Interfaces.Base;
end NoAccessories; |
Collection of accessory subsystem definitions | within VehicleInterfaces;
package Accessories "Collection of accessory subsystem definitions"
extends Modelica.Icons.VariantsPackage;
end Accessories; |
Accessories Tutorial. | within VehicleInterfaces.Accessories;
class Tutorial "Accessories Tutorial"
extends Modelica.Icons.Information;
end Tutorial; |
Basic interface definition for the accessories. This partial model defines the interfaces required for an accessories subsystem.
This class should be extended to form a particular accessory model. See the
<a href=\"modelica://VehicleInterfaces.Accessories\">documentation</a> and
<a href=\"modelica://VehicleInterfaces.Accessories.Tutorial\">tutorial</a>
for more information. | within VehicleInterfaces.Accessories.Interfaces;
partial model Base "Basic interface definition for the accessories"
parameter Boolean usingMultiBodyEngine=false
"= true, if connecting to a MultiBody engine"
protected
parameter Boolean includeEngineBearing=false "Include the engine bearing";
public
Modelica.Mechanics.MultiBody.Interfaces.FlangeWithBearing engineFlange(
final includeBearingConnector=includeEngineBearing or usingMultiBodyEngine)
"Source of drive torque"
VehicleInterfaces.Interfaces.ControlBus controlBus "Control signal bus"
Mechanics.MultiBody.MultiBodyEnd end_2(
final includeBearingConnector=includeEngineBearing or usingMultiBodyEngine)
equation
connect(end_2.flange, engineFlange)
end Base; |
Collection of interface definitions for accessories | within VehicleInterfaces.Accessories;
package Interfaces "Collection of interface definitions for accessories"
extends Modelica.Icons.InterfacesPackage;
end Interfaces; |
Atmospheres with constant conditions. This is the simplest atmosphere model with constant characteristics. | within VehicleInterfaces.Atmospheres;
model ConstantAtmosphere "Atmospheres with constant conditions"
extends VehicleInterfaces.Icons.Atmosphere;
extends VehicleInterfaces.Atmospheres.Interfaces.Base(
redeclare final function windVelocity = constantWindVelocity (windVelocity=v),
redeclare final function density = constantDensity (density=rho),
redeclare final function temperature = constantTemperature (T0=T),
redeclare final function humidity = constantHumidity (h0=h));
parameter SI.Velocity[3] v=zeros(3) "Wind velocity";
parameter SI.AbsolutePressure ambientPressure=101300
"Air pressure";
parameter SI.Temperature T=293.15 "Air temperature";
parameter Real h=0.5 "Air humidity (0-1)";
constant Real R=287.0512249529787 "Gas constant for air";
protected
parameter SI.Density rho=ambientPressure/(R*T);
function constantWindVelocity
extends VehicleInterfaces.Atmospheres.Interfaces.windVelocityBase;
input SI.Velocity[3] windVelocity={0,0,0};
algorithm
v := windVelocity;
end constantWindVelocity;
function constantDensity "Determine density"
extends VehicleInterfaces.Atmospheres.Interfaces.densityBase;
input SI.Density density=1.18 "Density";
algorithm
rho := density;
end constantDensity;
function constantTemperature "Determine temperature"
extends VehicleInterfaces.Atmospheres.Interfaces.temperatureBase;
input SI.Temperature T0=293 "Constant temperature";
algorithm
T := T0;
end constantTemperature;
function constantHumidity "Determine humidity"
extends VehicleInterfaces.Atmospheres.Interfaces.humidityBase;
input Real h0=0.5 "Constant humidity";
algorithm
h := h0;
end constantHumidity;
end ConstantAtmosphere; |
Collection of atmosphere subsystem definitions | within VehicleInterfaces;
package Atmospheres "Collection of atmosphere subsystem definitions"
extends Modelica.Icons.VariantsPackage;
end Atmospheres; |
Atmosphere Tutorial. | within VehicleInterfaces.Atmospheres;
class Tutorial "Atmosphere Tutorial"
extends Modelica.Icons.Information;
//Rest of model definition
...
<strong>end</strong> ConstantAtmosphere;
</pre></blockquote>
</li>
<li>Adding these redeclares also means we need to add 4 parameters to
the model <strong>v</strong>, <strong>rho</strong>, <strong>h</strong>
and <strong>T</strong> which are the constant wind velocity, density,
humidity and temperature respectively.</li>
<li>This model is now complete and can be used. The ConstantAtmosphere
definition included in VehicleInterfaces actually has pressure,
temperature and wind velocity as it's parameters and automatically
calculates the air density.</li>
</ol>
</html>"));
end Tutorial; |
Base model for all atmospheres. Dummy model to demonstrate how the wind velocity model should be defined and included in atmosphere model. | within VehicleInterfaces.Atmospheres.Interfaces;
partial model Base "Base model for all atmospheres"
replaceable function windVelocity=windVelocityBase
"Dummy model for wind velocity"
replaceable function density=densityBase "Dummy model for air density"
replaceable function temperature=temperatureBase
"Dummy model for air temperature"
replaceable function humidity=humidityBase "Dummy model for air humidity"
end Base; |
Determine density. Partial base model for air density. Extend this model appropriately to define final user model. | within VehicleInterfaces.Atmospheres.Interfaces;
partial function densityBase "Determine density"
extends Modelica.Icons.Function;
input SI.Position[3] r=zeros(3)
"Position vector from world frame to point, resolved in world frame";
output SI.Density rho=1.18 "Density";
end densityBase; |
Determine humidity. Partial base model for air humidity. Extend this model appropriately to define final user model. | within VehicleInterfaces.Atmospheres.Interfaces;
partial function humidityBase "Determine humidity"
extends Modelica.Icons.Function;
input SI.Position[3] r=zeros(3)
"Position vector from world frame to point, resolved in world frame";
output Real h=0.5 "Humidity";
end humidityBase; |
Collection of interface definitions for atmosphere | within VehicleInterfaces.Atmospheres;
package Interfaces "Collection of interface definitions for atmosphere"
extends Modelica.Icons.Package;
end Interfaces; |
Determine temperature. Partial base model for air temperature. Extend this model appropriately to define final user model. | within VehicleInterfaces.Atmospheres.Interfaces;
partial function temperatureBase "Determine temperature"
extends Modelica.Icons.Function;
input SI.Position[3] r=zeros(3)
"Position vector from world frame to point, resolved in world frame";
output SI.Temperature T=298 "Temperature";
end temperatureBase; |
Determine wind velocity. Partial base model for wind velocity. Extend this model appropriately to define final user model. | within VehicleInterfaces.Atmospheres.Interfaces;
partial function windVelocityBase "Determine wind velocity"
extends Modelica.Icons.Function;
input SI.Position[3] r=zeros(3)
"Position vector from world frame to point, resolved in world frame";
output SI.Velocity[3] v=zeros(3)
"Wind velocity vector, resolved in world frame";
end windVelocityBase; |
Output the normalized input signal u [0..1] in inverted form y [1..0].. This block is used to invert a normalized input signal u from [0..1] to [1..0].
Formally, the output <strong>y</strong> is computed as: | within VehicleInterfaces.Blocks;
block InvertNormalizedInput
"Output the normalized input signal u [0..1] in inverted form y [1..0]."
extends Modelica.Blocks.Interfaces.SISO;
equation
y = 1 - u;
end InvertNormalizedInput; |
Subsets and Splits