Tags and keywords
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.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;
Achieving this simple reuse with specific initial values turns out to be a bit fiddly in SysML/SysPhS, but it's not too bad once you've established the basic pattern.
As throughout this trail:
So in this case the t0:Temperature
is not used. We instead use SysML Context-Specific Values with InstanceSpecifications as shown carrying the initialisation values tree to assign a 'start' to the temperature t
within the Port.
The Dependency from the part cap
to the instance tree that defines its default is just for illustration.
As a minor annoyance:
The block Adiabatic
exports via SysPhS to Modelica as:
model Adiabatic
Adiabatic _Adiabatic;
model Adiabatic
ThermalCapacitance cap(c.start=0.12,c.fixed=true,node.t.start=363.15,node.t.fixed=true);
Temperature tNode;
equation
cap.c*der(cap.node.t)=cap.node.hFR;
tNode=cap.node.t;
end Adiabatic;
model ThermalCapacitance
parameter HeatCapacitance c;
parameter Temperature t0;
HeatPortA node;
end ThermalCapacitance;
type Temperature=Real(unit="K");
type HeatCapacitance=Real(unit="J/K");
connector HeatPortA
extends HeatFlowElement;
end HeatPortA;
connector HeatFlowElement
flow HeatFlowRate hFR;
Temperature t;
end HeatFlowElement;
type HeatFlowRate=Real(unit="J/s");
end Adiabatic;
Yes, it's a lot of work for that flat line in the plot, but it's the correct flat line, and things do get more exciting as more complex systems are built.