Skip to content

Commit

Permalink
Further update the test hall models, #79
Browse files Browse the repository at this point in the history
  • Loading branch information
MBaranskiEBC committed Aug 23, 2020
1 parent ae1e4b3 commit 9097876
Show file tree
Hide file tree
Showing 23 changed files with 557 additions and 259 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
within ModelicaModels.ControlledSystems;
model ControlledSystemBoundaries
"Version of controlled system with boundary conditions"
model AHU "Version of air handling unit with boundary conditions"
extends ModelicaModels.BaseClasses.ControlledSystemBaseClass(volumeFlow(
tableOnFile=false, table=[0,0.31,0.29]), freshAirSource(nPorts=2));
Modelica.Blocks.Sources.Sine outdoorTemperature(
Expand Down Expand Up @@ -154,4 +153,4 @@ equation
Evaluate=false,
OutputCPUtime=false,
OutputFlatModelica=false));
end ControlledSystemBoundaries;
end AHU;
260 changes: 150 additions & 110 deletions pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/TestHall.mo

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ControlledSystemBoundaries
AHU
TestHall

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
within ModelicaModels.SubsystemModels.TestHall;
model HallLong
"Version of the hall model for long prediction horizons"

extends ModelicaModels.Subsystems.TestHall.BaseClasses.HallConnected;

Modelica.Blocks.Sources.CombiTimeTable weather(
tableOnFile=true,
extrapolation=Modelica.Blocks.Types.Extrapolation.HoldLastPoint,
columns={2},
tableName="InputTable",
fileName="weather.mat",
smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments)
"Table with weather forecast" annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-10,50})));
Modelica.Blocks.Sources.CombiTimeTable decisionVariables(
tableOnFile=true,
extrapolation=Modelica.Blocks.Types.Extrapolation.HoldLastPoint,
tableName="tab1",
smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments,
columns={2},
fileName="decisionVariables.mat")
"Table with decision variables" annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={30,50})));
Modelica.Blocks.Sources.Constant AirVolumeFlow(k=8000)
"Air volume flow rate, could be an initial value"
annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
Modelica.Blocks.Math.Gain V2m(k=1.2/3600) "Volume to mass flow"
annotation (Placement(transformation(extent={{-62,84},{-50,96}})));
Modelica.Blocks.Sources.Constant Tnormal(k=273 + 22)
"Average Temperature of supply air or forecast"
annotation (Placement(transformation(extent={{-100,40},{-80,60}})));
Modelica.Blocks.Sources.RealExpression realExpression(y=35 -
decisionVariables.y[1])
annotation (Placement(transformation(extent={{-66,-44},{-10,-26}})));
Modelica.Blocks.Interfaces.RealOutput hallTemperature
"Absolute temperature as output signal"
annotation (Placement(transformation(extent={{90,50},{110,70}})));
equation
connect(AirVolumeFlow.y,V2m. u) annotation (Line(points={{-79,90},{-63.2,90}},
color={0,0,127}));
connect(realExpression.y, hallBaseClass.CCA_SEN_T__WS_SUP__AI_U_C)
annotation (Line(points={{-7.2,-35},{0,-35},{0,-14},{20,-14}}, color={0,0,
127}));
connect(V2m.y, fluidSource.dotm) annotation (Line(points={{-49.4,90},{-40,90},
{-40,3.34},{-18.2,3.34}}, color={0,0,127}));
connect(Tnormal.y, fluidSource.T_fluid) annotation (Line(points={{-79,50},{
-60,50},{-60,-2.78},{-18.2,-2.78}}, color={0,0,127}));
connect(weather.y[1], hallBaseClass.AIR_AHU_SEN_T_AIR_ODA__AI_U__C)
annotation (Line(points={{1,50},{8,50},{8,10},{20,10}}, color={0,0,127}));
connect(hallBaseClass.hallTemperature, hallTemperature) annotation (Line(
points={{60,14},{80,14},{80,60},{100,60}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end HallLong;
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
within ModelicaModels.SubsystemModels.TestHall;
model HallShort "Version of the hall model for short prediction horizons"

extends ModelicaModels.Subsystems.TestHall.BaseClasses.HallConnected;

Modelica.Blocks.Sources.CombiTimeTable weather(
tableOnFile=true,
extrapolation=Modelica.Blocks.Types.Extrapolation.HoldLastPoint,
columns={2},
tableName="InputTable",
fileName="weather.mat",
smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments)
"Table with weather forecast" annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-10,50})));
Modelica.Blocks.Sources.CombiTimeTable decisionVariables(
tableOnFile=true,
extrapolation=Modelica.Blocks.Types.Extrapolation.HoldLastPoint,
tableName="tab1",
smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments,
columns={2},
fileName="decisionVariables.mat")
"Table with decision variables" annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={30,50})));
Modelica.Blocks.Sources.Constant AirVolumeFlow(k=8000)
"Air volume flow rate, could be an initial value"
annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
Modelica.Blocks.Math.Gain V2m(k=1.2/3600) "Volume to mass flow"
annotation (Placement(transformation(extent={{-62,84},{-50,96}})));
Modelica.Blocks.Interfaces.RealOutput hallTemperature
"Absolute temperature as output signal"
annotation (Placement(transformation(extent={{90,50},{110,70}})));
Modelica.Blocks.Sources.CombiTimeTable variation(
tableOnFile=true,
extrapolation=Modelica.Blocks.Types.Extrapolation.HoldLastPoint,
tableName="tab1",
columns=2:3,
fileName="variation.mat") "Table with control input"
annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-90,48})));
Modelica.Thermal.HeatTransfer.Celsius.ToKelvin hallTemperature1
annotation (Placement(transformation(extent={{-70,42},{-58,54}})));
Modelica.Blocks.Sources.Constant currentWaterTemperature(k=22)
"Can be an iniitial value"
annotation (Placement(transformation(extent={{-40,-40},{-20,-20}})));
equation
connect(AirVolumeFlow.y,V2m. u) annotation (Line(points={{-79,90},{-63.2,90}},
color={0,0,127}));
connect(V2m.y, fluidSource.dotm) annotation (Line(points={{-49.4,90},{-40,90},
{-40,3.34},{-18.2,3.34}}, color={0,0,127}));
connect(weather.y[1], hallBaseClass.AIR_AHU_SEN_T_AIR_ODA__AI_U__C)
annotation (Line(points={{1,50},{8,50},{8,10},{20,10}}, color={0,0,127}));
connect(hallBaseClass.hallTemperature, hallTemperature) annotation (Line(
points={{60,14},{80,14},{80,60},{100,60}}, color={0,0,127}));
connect(currentWaterTemperature.y, hallBaseClass.CCA_SEN_T__WS_SUP__AI_U_C)
annotation (Line(points={{-19,-30},{0,-30},{0,-14},{20,-14}}, color={0,0,
127}));
connect(fluidSource.T_fluid, hallTemperature1.Kelvin) annotation (Line(points=
{{-18.2,-2.78},{-46,-2.78},{-46,48},{-57.4,48}}, color={0,0,127}));
connect(variation.y[1], hallTemperature1.Celsius)
annotation (Line(points={{-79,48},{-71.2,48}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end HallShort;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
within ModelicaModels.SubsystemModels;
package TestHall "Models for the test hall case study"
end TestHall;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
HallLong
HallShort
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
BaseClasses
DetailedModels
TestHall
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ model HallBaseClass "Simplified model of hall 1"
"Nominal mass flow rate"
annotation(Dialog(group = "Nominal condition"));

parameter AixLib.FastHVAC.Media.BaseClasses.MediumSimple medium = AixLib.FastHVAC.Media.WaterSimple();
parameter AixLib.FastHVAC.Media.BaseClasses.MediumSimple medium = ModelicaModels.Subsystems.TestHall.BaseClasses.SimpleAir();

Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature outdoorAir
annotation (Placement(transformation(extent={{-60,40},{-40,60}})));
Expand Down Expand Up @@ -62,6 +62,9 @@ model HallBaseClass "Simplified model of hall 1"
CInt={10^8},
T_start=295.15)
annotation (Placement(transformation(extent={{60,20},{80,42}})));
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort
"Heat transfer into the working fluid"
annotation (Placement(transformation(extent={{-10,88},{10,108}})));
equation
connect(waterTemperature.Kelvin,supplyWater. T) annotation (Line(points={{-67.4,
-70},{-62,-70}}, color={0,0,127}));
Expand Down Expand Up @@ -92,6 +95,8 @@ equation
{4,-70},{4,20},{20,20},{20,9.4}}, color={191,0,0}));
connect(workingFluid.heatPort, intWalRC.port_a)
annotation (Line(points={{20,9.4},{20,30},{60,30}}, color={191,0,0}));
connect(workingFluid.heatPort, heatPort) annotation (Line(points={{20,9.4},{20,
80},{0,80},{0,98}}, color={191,0,0}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-140,-100},
{100,100}})), Diagram(
coordinateSystem(preserveAspectRatio=false, extent={{-140,-100},{100,100}})),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
within ModelicaModels.Subsystems.TestHall.BaseClasses;
model HallCalibrationBaseClass

parameter AixLib.FastHVAC.Media.BaseClasses.MediumSimple medium=AixLib.FastHVAC.Media.WaterSimple();
extends ModelicaModels.Subsystems.TestHall.BaseClasses.HallConnected;

Modelica.Blocks.Math.Feedback feedback1
annotation (Placement(transformation(extent={{16,-40},{36,-60}})));
Expand All @@ -12,34 +12,23 @@ model HallCalibrationBaseClass
extent={{-6,-6},{6,6}},
rotation=90,
origin={-48,-24})));
AixLib.FastHVAC.Components.Pumps.FluidSource
fluidSource(medium = medium)
annotation (Placement(transformation(extent={{-42,10},{-24,-8}})));
Modelica.Blocks.Math.Gain gain(k=1.2/3600)
annotation (Placement(transformation(extent={{-54,8},{-46,16}})));
HallBaseClass hall
annotation (Placement(transformation(extent={{-12,-14},{16,14}})));
AixLib.FastHVAC.Components.Sinks.Vessel vessel
annotation (Placement(transformation(extent={{48,-10},{68,10}})));
Modelica.Blocks.Math.Product product
annotation (Placement(transformation(extent={{46,-60},{66,-40}})));
equation
connect(fluidSource.enthalpyPort_b, hall.enthalpyPort_a)
annotation (Line(points={{-24,0.1},{-24,0},{-12,0}}, color={176,0,0}));
connect(hall.enthalpyPort_b, vessel.enthalpyPort_a)
annotation (Line(points={{16,0},{51,0}}, color={176,0,0}));
connect(hall.hallTemperature, feedback1.u2)
annotation (Line(points={{16,9.8},{26,9.8},{26,-42}}, color={0,0,127}));
connect(integrator.u, product.y)
annotation (Line(points={{78,-50},{67,-50}}, color={0,0,127}));
connect(feedback1.y, product.u1) annotation (Line(points={{35,-50},{38,-50},{
38,-44},{44,-44}}, color={0,0,127}));
connect(feedback1.y, product.u2) annotation (Line(points={{35,-50},{38,-50},{
38,-56},{44,-56}}, color={0,0,127}));
connect(gain.y, fluidSource.dotm) annotation (Line(points={{-45.6,12},{-26,12},
{-26,3.34},{-18.2,3.34}}, color={0,0,127}));
connect(toKelvin.Kelvin, fluidSource.T_fluid) annotation (Line(points={{-48,
-17.4},{-48,-2.78},{-40.2,-2.78}}, color={0,0,127}));
connect(gain.y, fluidSource.dotm) annotation (Line(points={{-45.6,12},{-44,12},
{-44,3.34},{-40.2,3.34}}, color={0,0,127}));
-17.4},{-48,-2.78},{-18.2,-2.78}}, color={0,0,127}));
connect(hallBaseClass.hallTemperature, feedback1.u2) annotation (Line(points=
{{60,14},{72,14},{72,-30},{26,-30},{26,-42}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)),
experiment(StopTime=5184000, Interval=3600));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
within ModelicaModels.Subsystems.TestHall.BaseClasses;
model HallConnected "A model of the hall with fluid source and sink"

parameter AixLib.FastHVAC.Media.BaseClasses.MediumSimple medium=ModelicaModels.Subsystems.TestHall.BaseClasses.SimpleAir();

HallBaseClass hallBaseClass(medium=medium)
annotation (Placement(transformation(extent={{20,-20},{60,20}})));
AixLib.FastHVAC.Components.Pumps.FluidSource
fluidSource(medium=medium)
annotation (Placement(transformation(extent={{-20,10},{-2,-8}})));
AixLib.FastHVAC.Components.Sinks.Vessel vessel
annotation (Placement(transformation(extent={{80,-10},{100,10}})));
equation
connect(fluidSource.enthalpyPort_b, hallBaseClass.enthalpyPort_a) annotation (
Line(points={{-2,0.1},{14,0.1},{14,0},{20,0}}, color={176,0,0}));
connect(hallBaseClass.enthalpyPort_b, vessel.enthalpyPort_a)
annotation (Line(points={{60,0},{83,0}}, color={176,0,0}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
end HallConnected;
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
HallBaseClass
HallCalibrationBaseClass
SimpleAir
HallConnected
Loading

0 comments on commit 9097876

Please sign in to comment.