-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Modelica models required for new use case, #47
- Loading branch information
1 parent
a8fc68d
commit 9804cc4
Showing
12 changed files
with
1,153 additions
and
1 deletion.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
pyDMPC/ModelicaModels/ModelicaModels/BaseClasses/ThermalConductor.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
within ModelicaModels.BaseClasses; | ||
model ThermalConductor | ||
"Lumped thermal element transporting heat without storing it" | ||
extends Modelica.Thermal.HeatTransfer.Interfaces.Element1D; | ||
|
||
Modelica.Blocks.Interfaces.RealInput G | ||
annotation (Placement(transformation(extent={{-120,70},{-80,110}}))); | ||
equation | ||
Q_flow = G*dT; | ||
annotation ( | ||
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ | ||
100,100}}), graphics={ | ||
Rectangle( | ||
extent={{-90,70},{90,-70}}, | ||
lineColor={0,0,0}, | ||
pattern=LinePattern.None, | ||
fillColor={192,192,192}, | ||
fillPattern=FillPattern.Backward), | ||
Line( | ||
points={{-90,70},{-90,-70}}, | ||
thickness=0.5), | ||
Line( | ||
points={{90,70},{90,-70}}, | ||
thickness=0.5), | ||
Text( | ||
extent={{-150,115},{150,75}}, | ||
textString="%name", | ||
lineColor={0,0,255}), | ||
Text( | ||
extent={{-150,-75},{150,-105}}, | ||
lineColor={0,0,0}, | ||
textString="G=%G")}), | ||
Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100}, | ||
{100,100}}), graphics={ | ||
Line( | ||
points={{-80,0},{80,0}}, | ||
color={255,0,0}, | ||
thickness=0.5, | ||
arrow={Arrow.None,Arrow.Filled}), | ||
Text( | ||
extent={{-100,-20},{100,-40}}, | ||
lineColor={255,0,0}, | ||
textString="Q_flow"), | ||
Text( | ||
extent={{-100,40},{100,20}}, | ||
lineColor={0,0,0}, | ||
textString="dT = port_a.T - port_b.T")}), | ||
Documentation(info="<html> | ||
<p> | ||
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: | ||
</p> | ||
<ul> | ||
<li><p> | ||
Conductance for a <b>box</b> geometry under the assumption | ||
that heat flows along the box length:</p> | ||
<pre> | ||
G = k*A/L | ||
k: Thermal conductivity (material constant) | ||
A: Area of box | ||
L: Length of box | ||
</pre> | ||
</li> | ||
<li><p> | ||
Conductance for a <b>cylindrical</b> geometry under the assumption | ||
that heat flows from the inside to the outside radius | ||
of the cylinder:</p> | ||
<pre> | ||
G = 2*pi*k*L/log(r_out/r_in) | ||
pi : Modelica.Constants.pi | ||
k : Thermal conductivity (material constant) | ||
L : Length of cylinder | ||
log : Modelica.Math.log; | ||
r_out: Outer radius of cylinder | ||
r_in : Inner radius of cylinder | ||
</pre> | ||
</li> | ||
</ul> | ||
<pre> | ||
Typical values for k at 20 degC in W/(m.K): | ||
aluminium 220 | ||
concrete 1 | ||
copper 384 | ||
iron 74 | ||
silver 407 | ||
steel 45 .. 15 (V2A) | ||
wood 0.1 ... 0.2 | ||
</pre> | ||
</html>")); | ||
end ThermalConductor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
ControlledSystemBaseClass | ||
HRCController | ||
ThermalConductor |
93 changes: 93 additions & 0 deletions
93
pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/TestHall.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
within ModelicaModels.ControlledSystems; | ||
model TestHall "Model of the test hall" | ||
replaceable package MediumAir = AixLib.Media.Air; | ||
replaceable package MediumWater = AixLib.Media.Water; | ||
Subsystems.Hall hall | ||
annotation (Placement(transformation(extent={{20,-10},{44,10}}))); | ||
Modelica.Fluid.Sources.MassFlowSource_T IntakeAirSource( | ||
nPorts=3, | ||
redeclare package Medium = MediumAir, | ||
X={0.03,0.97}, | ||
T=30 + 273.15, | ||
use_T_in=true, | ||
use_X_in=false, | ||
use_m_flow_in=false, | ||
m_flow=8000/3600*1.2) | ||
annotation (Placement(transformation(extent={{-62,-10},{-42,10}}))); | ||
AixLib.Fluid.Sensors.RelativeHumidity supplyAirHumidity(redeclare package | ||
Medium = MediumAir) "Relative humidity of supply air" | ||
annotation (Placement(transformation(extent={{-42,20},{-22,40}}))); | ||
AixLib.Fluid.Sensors.Temperature supplyAirTemperature(redeclare package | ||
Medium = MediumAir) "Temperature of supply air" | ||
annotation (Placement(transformation(extent={{-12,20},{8,40}}))); | ||
Modelica.Blocks.Interfaces.RealInput CCAValve "Input signal connector" | ||
annotation (Placement(transformation(extent={{-120,-60},{-80,-20}}))); | ||
Modelica.Blocks.Interfaces.RealInput suppyAirTemperature | ||
"Prescribed fluid temperature" | ||
annotation (Placement(transformation(extent={{-120,-16},{-80,24}}))); | ||
Modelica.Fluid.Sources.Boundary_pT IntakeAirSink( | ||
nPorts=1, | ||
redeclare package Medium = MediumAir, | ||
use_T_in=false, | ||
use_X_in=false, | ||
use_p_in=false, | ||
p(displayUnit="Pa") = 101300) | ||
annotation (Placement(transformation(extent={{100,-10},{80,10}}))); | ||
Modelica.Blocks.Interfaces.RealOutput AHUTemperature | ||
"Temperature in port medium" | ||
annotation (Placement(transformation(extent={{90,70},{110,90}}))); | ||
Modelica.Blocks.Interfaces.RealOutput AHUHumidity | ||
"Relative humidity in port medium" | ||
annotation (Placement(transformation(extent={{90,50},{110,70}}))); | ||
Modelica.Blocks.Interfaces.RealInput Room1Set "Input signal connector" | ||
annotation (Placement(transformation(extent={{-120,-90},{-80,-50}}))); | ||
Modelica.Blocks.Interfaces.RealInput Room2Set "Input signal connector" | ||
annotation (Placement(transformation(extent={{-120,-110},{-80,-70}}))); | ||
Modelica.Blocks.Sources.Constant temperature(k=293) | ||
annotation (Placement(transformation(extent={{40,-50},{60,-30}}))); | ||
Modelica.Blocks.Sources.Constant delta(k=1) | ||
annotation (Placement(transformation(extent={{40,-80},{60,-60}}))); | ||
Modelica.Blocks.Interfaces.RealOutput Room1T | ||
"Connector of Real output signal" | ||
annotation (Placement(transformation(extent={{90,-30},{110,-10}}))); | ||
Modelica.Blocks.Interfaces.RealOutput Room1del | ||
"Connector of Real output signal" | ||
annotation (Placement(transformation(extent={{90,-50},{110,-30}}))); | ||
Modelica.Blocks.Interfaces.RealOutput Room2T | ||
"Connector of Real output signal" | ||
annotation (Placement(transformation(extent={{90,-70},{110,-50}}))); | ||
Modelica.Blocks.Interfaces.RealOutput Room2del | ||
"Connector of Real output signal" | ||
annotation (Placement(transformation(extent={{90,-90},{110,-70}}))); | ||
Modelica.Thermal.HeatTransfer.Celsius.FromKelvin conversionAHUTemperature | ||
annotation (Placement(transformation(extent={{38,70},{58,90}}))); | ||
equation | ||
connect(IntakeAirSource.ports[1], hall.port_a) annotation (Line(points={{-42,0.666667}, | ||
{-12,0.666667},{-12,0},{20,0}}, color={0,127,255})); | ||
connect(hall.u1, CCAValve) annotation (Line(points={{20,-8},{0,-8},{0,-40},{-100, | ||
-40}}, color={0,0,127})); | ||
connect(IntakeAirSource.T_in, suppyAirTemperature) | ||
annotation (Line(points={{-64,4},{-100,4}}, color={0,0,127})); | ||
connect(supplyAirHumidity.port, IntakeAirSource.ports[2]) annotation (Line( | ||
points={{-32,20},{-32,-5.55112e-17},{-42,-5.55112e-17}}, color={0,127,255})); | ||
connect(supplyAirTemperature.port, IntakeAirSource.ports[3]) annotation (Line( | ||
points={{-2,20},{-2,-0.666667},{-42,-0.666667}}, color={0,127,255})); | ||
connect(hall.port_b, IntakeAirSink.ports[1]) | ||
annotation (Line(points={{44,0},{80,0}}, color={0,127,255})); | ||
connect(supplyAirHumidity.phi, AHUHumidity) annotation (Line(points={{-21,30}, | ||
{-16,30},{-16,60},{100,60}}, color={0,0,127})); | ||
connect(temperature.y, Room1T) annotation (Line(points={{61,-40},{76,-40},{76, | ||
-20},{100,-20}}, color={0,0,127})); | ||
connect(temperature.y, Room1del) | ||
annotation (Line(points={{61,-40},{100,-40}}, color={0,0,127})); | ||
connect(delta.y, Room2T) annotation (Line(points={{61,-70},{80,-70},{80,-60}, | ||
{100,-60}}, color={0,0,127})); | ||
connect(delta.y, Room2del) annotation (Line(points={{61,-70},{80,-70},{80,-80}, | ||
{100,-80}}, color={0,0,127})); | ||
connect(supplyAirTemperature.T, conversionAHUTemperature.Kelvin) annotation ( | ||
Line(points={{5,30},{20,30},{20,80},{36,80}}, color={0,0,127})); | ||
connect(conversionAHUTemperature.Celsius, AHUTemperature) | ||
annotation (Line(points={{59,80},{100,80}}, color={0,0,127})); | ||
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( | ||
coordinateSystem(preserveAspectRatio=false))); | ||
end TestHall; |
2 changes: 1 addition & 1 deletion
2
pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/package.order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
ControlledSystemBoundaries | ||
ControlledSystemPID.mo | ||
TestHall |
25 changes: 25 additions & 0 deletions
25
pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
within ModelicaModels.SubsystemModels.DetailedModels; | ||
model Hall | ||
extends ModelicaModels.SubsystemModels.BaseClasses.HeatExchangerCommunicationBaseClass( | ||
IntakeAirSource(nPorts=1), | ||
IntakeAirSink(nPorts=1), | ||
Pressure(k=10000), | ||
volumeFlow(fileName="../../Inputs/volumeFlow.txt")); | ||
extends ModelicaModels.Subsystems.BaseClasses.HallBaseClass(volume(nPorts=2)); | ||
|
||
equation | ||
connect(IntakeAirSource.ports[1], volume.ports[2]) annotation (Line(points={{ | ||
-100,12},{-60,12},{-60,-170},{54,-170},{54,-90},{100,-90}}, color={0, | ||
127,255})); | ||
connect(decisionVariables.y[1], valveEffect.u) annotation (Line(points={{-65, | ||
-110},{-50,-110},{-50,-126},{2.8,-126}}, color={0,0,127})); | ||
connect(res.port_b, IntakeAirSink.ports[1]) annotation (Line(points={{152, | ||
-110},{168,-110},{168,12},{170,12}}, color={0,127,255})); | ||
connect(res.port_b, supplyAirHumidity.port) annotation (Line(points={{152, | ||
-110},{168,-110},{168,0},{66,0},{66,38}}, color={0,127,255})); | ||
connect(res.port_b, supplyAirTemperature.port) annotation (Line(points={{152, | ||
-110},{168,-110},{168,0},{104,0},{104,38}}, color={0,127,255})); | ||
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( | ||
coordinateSystem(preserveAspectRatio=false)), | ||
experiment(StopTime=86400, Interval=10)); | ||
end Hall; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ CoolerML | |
HeaterML | ||
HRCML | ||
HumidifierML | ||
Hall |
33 changes: 33 additions & 0 deletions
33
pyDMPC/ModelicaModels/ModelicaModels/Subsystems/BaseClasses/GenericModelBaseClass.mo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
within ModelicaModels.Subsystems.BaseClasses; | ||
model GenericModelBaseClass | ||
AixLib.Fluid.FixedResistances.PressureDrop supplyPressureDrop( | ||
m_flow_nominal=0.3, | ||
dp_nominal=350, | ||
redeclare package Medium = MediumAir) "Pressure drop in supply duct" | ||
annotation (Placement(transformation( | ||
extent={{-10,-10},{10,10}}, | ||
rotation=0, | ||
origin={34,0}))); | ||
AixLib.Fluid.MixingVolumes.MixingVolume vol( | ||
redeclare package Medium = MediumAir, | ||
nPorts=1, | ||
m_flow_nominal=0.5, | ||
V=0.1) annotation (Placement(transformation(extent={{-10,0},{10,20}}))); | ||
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow | ||
annotation (Placement(transformation(extent={{-46,20},{-26,40}}))); | ||
replaceable package MediumAir = AixLib.Media.Air; | ||
AixLib.Fluid.Sensors.Temperature supplyTempMeas(redeclare package Medium = | ||
MediumAir) "Temperature after HRC" | ||
annotation (Placement(transformation(extent={{40,14},{60,34}}))); | ||
Modelica.Blocks.Interfaces.RealOutput supplyTemp "Temperature in port medium" | ||
annotation (Placement(transformation(extent={{100,14},{120,34}}))); | ||
equation | ||
connect(vol.ports[1],supplyPressureDrop. port_a) | ||
annotation (Line(points={{0,0},{24,0}}, color={0,127,255})); | ||
connect(vol.heatPort, prescribedHeatFlow.port) annotation (Line(points={{-10, | ||
10},{-16,10},{-16,30},{-26,30}}, color={191,0,0})); | ||
connect(supplyPressureDrop.port_b, supplyTempMeas.port) | ||
annotation (Line(points={{44,0},{50,0},{50,14}}, color={0,127,255})); | ||
connect(supplyTempMeas.T, supplyTemp) | ||
annotation (Line(points={{57,24},{110,24}}, color={0,0,127})); | ||
end GenericModelBaseClass; |
Oops, something went wrong.