From 90978760f56012b0758baf047fc9ac52183ba270 Mon Sep 17 00:00:00 2001 From: Marc Baranski Date: Sun, 23 Aug 2020 17:13:21 +0200 Subject: [PATCH] Further update the test hall models, #79 --- .../{ControlledSystemBoundaries.mo => AHU.mo} | 5 +- .../ControlledSystems/TestHall.mo | 260 ++++++++++-------- .../ControlledSystems/package.order | 2 +- .../DetailedModels/Geo/Building.mo | 18 -- .../DetailedModels/Geo/Field.mo | 53 ---- .../Geo/GeoCommunicationBaseClass.mo | 47 ---- .../DetailedModels/Geo/package.order | 3 - .../SubsystemModels/TestHall/HallLong.mo | 60 ++++ .../SubsystemModels/TestHall/HallShort.mo | 71 +++++ .../SubsystemModels/TestHall/package.mo | 3 + .../SubsystemModels/TestHall/package.order | 2 + .../SubsystemModels/package.order | 1 + .../TestHall/BaseClasses/HallBaseClass.mo | 7 +- .../BaseClasses/HallCalibrationBaseClass.mo | 23 +- .../TestHall/BaseClasses/HallConnected.mo | 20 ++ .../TestHall/BaseClasses/package.order | 1 + .../Subsystems/TestHall/Hall.mo | 59 ++++ .../Subsystems/TestHall/IdealHeater.mo | 84 ++++++ .../Subsystems/TestHall/Office.mo | 79 ++++++ .../Subsystems/TestHall/package.mo | 2 +- .../Subsystems/TestHall/package.order | 3 + .../Tests/TestHall/HallCalibrationNominal.mo | 9 +- .../ModelicaModels/ModelicaModels/package.mo | 4 +- 23 files changed, 557 insertions(+), 259 deletions(-) rename pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/{ControlledSystemBoundaries.mo => AHU.mo} (98%) delete mode 100644 pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/Building.mo delete mode 100644 pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/Field.mo delete mode 100644 pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/GeoCommunicationBaseClass.mo delete mode 100644 pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/package.order create mode 100644 pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/HallLong.mo create mode 100644 pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/HallShort.mo create mode 100644 pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/package.mo create mode 100644 pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/package.order create mode 100644 pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallConnected.mo create mode 100644 pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/Hall.mo create mode 100644 pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/IdealHeater.mo create mode 100644 pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/Office.mo diff --git a/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/ControlledSystemBoundaries.mo b/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/AHU.mo similarity index 98% rename from pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/ControlledSystemBoundaries.mo rename to pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/AHU.mo index 227f8d5..0e5d42c 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/ControlledSystemBoundaries.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/AHU.mo @@ -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( @@ -154,4 +153,4 @@ equation Evaluate=false, OutputCPUtime=false, OutputFlatModelica=false)); -end ControlledSystemBoundaries; +end AHU; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/TestHall.mo b/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/TestHall.mo index 32cce5a..8a9f773 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/TestHall.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/TestHall.mo @@ -1,113 +1,153 @@ 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, - T=30 + 273.15, - use_T_in=true, - use_X_in=false, - use_m_flow_in=false, - m_flow=8000/3600*1.2, - X={0.003,0.997}) - 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}}))); - Modelica.Blocks.Interfaces.RealInput HallSet "Input signal connector" - annotation (Placement(transformation(extent={{-80,-110},{-40,-70}}))); - Modelica.Blocks.Sources.RealExpression wallMasses(y=hall.wallMasses.port.T) - annotation (Placement(transformation(extent={{-10,-106},{10,-86}}))); - Modelica.Blocks.Sources.RealExpression concreteFloor(y=hall.concreteFloor.port.T) - annotation (Placement(transformation(extent={{-10,-120},{10,-100}}))); - Modelica.Blocks.Sources.RealExpression volume(y=hall.volume.heatPort.T) - annotation (Placement(transformation(extent={{-10,-134},{10,-114}}))); - Modelica.Blocks.Interfaces.RealOutput wallMassesT "Value of Real output" - annotation (Placement(transformation(extent={{28,-106},{48,-86}}))); - Modelica.Blocks.Interfaces.RealOutput concreteFloorT "Value of Real output" - annotation (Placement(transformation(extent={{28,-120},{48,-100}}))); - Modelica.Blocks.Interfaces.RealOutput volumeT "Value of Real output" - annotation (Placement(transformation(extent={{28,-134},{48,-114}}))); +model TestHall + Subsystems.TestHall.Office office(offset_1=-5, offset_2=-2) + annotation (Placement(transformation(extent={{-10,80},{10,100}}))); + Modelica.Blocks.Interfaces.RealInput T_in1 "Prescribed fluid temperature" + annotation (Placement(transformation(extent={{-120,-10},{-80,30}}))); + Modelica.Blocks.Interfaces.RealInput T_CCA1 "Input signal connector" + annotation (Placement(transformation(extent={{-120,-40},{-80,0}}))); + Modelica.Blocks.Interfaces.RealOutput thermostat1 + annotation (Placement(transformation(extent={{90,82},{110,102}}))); + Modelica.Blocks.Interfaces.RealOutput T_room1 + annotation (Placement(transformation(extent={{90,64},{110,84}}))); + Modelica.Blocks.Interfaces.RealOutput T_hall + annotation (Placement(transformation(extent={{90,6},{110,26}}))); + Modelica.Blocks.Interfaces.RealOutput simTime "Value of Real output" + annotation (Placement(transformation(extent={{90,-62},{110,-42}}))); + Modelica.Blocks.Interfaces.RealInput Tset "Prescribed fluid temperature" + annotation (Placement(transformation(extent={{-120,30},{-80,70}}))); + Subsystems.TestHall.IdealHeater idealHeater + annotation (Placement(transformation(extent={{-40,20},{-20,40}}))); + Modelica.Blocks.Interfaces.RealOutput energy "Value of Real output" + annotation (Placement(transformation(extent={{90,-82},{110,-62}}))); + Modelica.Blocks.Sources.RealExpression energyMeter(y=AHU_power.y + office.power + + office2.power + idealHeater.power + hall.hallPower) + annotation (Placement(transformation(extent={{-44,-88},{-22,-70}}))); + Modelica.Blocks.Sources.RealExpression AHU_power(y=1.2*16000/3600*1000*((hall.hallTemperature + - weather.y[1] + 273.15)*0.3 + T_in1 - hall.hallTemperature)) + annotation (Placement(transformation(extent={{-100,-88},{-78,-70}}))); + Modelica.Blocks.Sources.Constant T_AHU_ref(k=23) + "Air volume flow rate, could be an initial value" + annotation (Placement(transformation(extent={{-100,-46},{-90,-36}}))); + Subsystems.TestHall.IdealHeater idealHeater_ref + annotation (Placement(transformation(extent={{-40,-40},{-20,-20}}))); + Modelica.Blocks.Sources.RealExpression AHU_power_ref(y=1.2*16000/3600*1000*(( + hall_ref.hallTemperature - weather.y[1] + 273.15)*0.3 + T_AHU_ref.k - + hall_ref.hallTemperature)) + annotation (Placement(transformation(extent={{-100,-106},{-78,-88}}))); + Modelica.Blocks.Sources.RealExpression energyMeter_ref(y=AHU_power_ref.y + + office.power_ref + office2.power_ref + idealHeater_ref.power + hall_ref.hallPower) + annotation (Placement(transformation(extent={{-44,-106},{-22,-88}}))); + Modelica.Blocks.Interfaces.RealOutput energy_ref "Value of Real output" + annotation (Placement(transformation(extent={{90,-106},{110,-86}}))); + Subsystems.TestHall.Office office2(startTime=-3600) + annotation (Placement(transformation(extent={{-10,52},{10,72}}))); + Modelica.Blocks.Interfaces.RealOutput thermostat2 + annotation (Placement(transformation(extent={{90,46},{110,66}}))); + Modelica.Blocks.Interfaces.RealOutput T_room2 + annotation (Placement(transformation(extent={{90,28},{110,48}}))); + Modelica.Blocks.Interfaces.RealInput Tset2 + "Prescribed fluid temperature" + annotation (Placement(transformation(extent={{-120,62},{-80,102}}))); + Modelica.Blocks.Sources.CombiTimeTable weather( + table=[0.0,293], + tableOnFile=true, + smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments, + fileName="../weather.mat", + extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic, + startTime=0, + columns={2}, + tableName="InputTable") + "Table with weather forecast" annotation (Placement(transformation( + extent={{-6,-6},{6,6}}, + rotation=0, + origin={-54,-6}))); + Modelica.Thermal.HeatTransfer.Celsius.FromKelvin weatherCelsius + annotation (Placement(transformation(extent={{-38,-14},{-26,-2}}))); + Modelica.Blocks.Continuous.Integrator integrator1(k=1/3600000) + annotation (Placement(transformation(extent={{-68,-76},{-54,-62}}))); + Modelica.Blocks.Continuous.Integrator integrator2(k=1/3600000) + annotation (Placement(transformation(extent={{-68,-100},{-54,-86}}))); + Subsystems.TestHall.Hall hall + annotation (Placement(transformation(extent={{0,0},{20,20}}))); + Subsystems.TestHall.Hall hall_ref + annotation (Placement(transformation(extent={{0,-60},{20,-40}}))); + Modelica.Blocks.Interfaces.RealOutput T_hall_ref + annotation (Placement(transformation(extent={{90,-40},{110,-20}}))); + Modelica.Blocks.Sources.RealExpression timer(y=time) + annotation (Placement(transformation(extent={{60,-60},{82,-42}}))); + Modelica.Blocks.Continuous.Integrator integrator3(k=1/3600000) + annotation (Placement(transformation(extent={{-8,-78},{6,-64}}))); + Modelica.Blocks.Continuous.Integrator integrator4(k=1/3600000) + annotation (Placement(transformation(extent={{-8,-100},{6,-86}}))); 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})); - connect(wallMasses.y, wallMassesT) - annotation (Line(points={{11,-96},{38,-96}}, color={0,0,127})); - connect(concreteFloor.y, concreteFloorT) - annotation (Line(points={{11,-110},{38,-110}}, color={0,0,127})); - connect(volume.y, volumeT) - annotation (Line(points={{11,-124},{38,-124}}, color={0,0,127})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false))); + connect(office.thermostat, thermostat1) + annotation (Line(points={{10,92},{100,92}}, color={0,0,127})); + connect(office.T_room, T_room1) annotation (Line(points={{10,88},{54,88},{54, + 74},{100,74}}, color={0,0,127})); + connect(Tset, office.T_set) annotation (Line(points={{-100,50},{-66,50},{-66, + 91},{-10,91}}, color={0,0,127})); + connect(T_in1, office.T_in) annotation (Line(points={{-100,10},{-56,10},{-56, + 97},{-10,97}}, color={0,0,127})); + connect(T_AHU_ref.y, office.T_in_ref) annotation (Line(points={{-89.5,-41},{ + -68,-41},{-68,46},{-40,46},{-40,85},{-10,85}}, color={0,0,127})); + connect(office2.thermostat, thermostat2) annotation (Line(points={{10,64},{52, + 64},{52,56},{100,56}}, color={0,0,127})); + connect(office2.T_room, T_room2) annotation (Line(points={{10,60},{46,60},{46, + 38},{100,38}}, color={0,0,127})); + connect(Tset2, office2.T_set) annotation (Line(points={{-100,82},{-26,82},{ + -26,63},{-10,63}}, color={0,0,127})); + connect(T_in1, office2.T_in) annotation (Line(points={{-100,10},{-56,10},{-56, + 69},{-10,69}}, color={0,0,127})); + connect(T_AHU_ref.y, office2.T_in_ref) annotation (Line(points={{-89.5,-41},{ + -68,-41},{-68,46},{-26,46},{-26,57},{-10,57}}, color={0,0,127})); + connect(idealHeater.port1, hall.heatPort) + annotation (Line(points={{-20.6,30},{14,30},{14,19.6}}, color={191,0,0})); + connect(hall.hallTemperature, idealHeater.T) annotation (Line(points={{20,16}, + {40,16},{40,42},{-50,42},{-50,32.6},{-40,32.6}}, color={0,0,127})); + connect(T_CCA1, hall.CCA_SEN_T__WS_SUP__AI_U_C) annotation (Line(points={{ + -100,-20},{-60,-20},{-60,-18},{-20,-18},{-20,4},{0,4}}, color={0,0, + 127})); + connect(hall.T_fluid, T_in1) annotation (Line(points={{0,9},{-6,9},{-6,10},{ + -100,10}}, color={0,0,127})); + connect(weather.y[1], weatherCelsius.Kelvin) annotation (Line(points={{-47.4, + -6},{-42,-6},{-42,-8},{-39.2,-8}}, color={0,0,127})); + connect(weatherCelsius.Celsius, hall.AIR_AHU_SEN_T_AIR_ODA__AI_U__C) + annotation (Line(points={{-25.4,-8},{-18,-8},{-18,14},{0,14}}, color={0,0, + 127})); + connect(T_AHU_ref.y, hall_ref.T_fluid) annotation (Line(points={{-89.5,-41},{ + -68,-41},{-68,-50},{-12,-50},{-12,-51},{0,-51}}, color={0,0,127})); + connect(weatherCelsius.Celsius, hall_ref.AIR_AHU_SEN_T_AIR_ODA__AI_U__C) + annotation (Line(points={{-25.4,-8},{-6,-8},{-6,-46},{0,-46}}, color={0,0, + 127})); + connect(idealHeater_ref.port1, hall_ref.heatPort) annotation (Line(points={{ + -20.6,-30},{14,-30},{14,-40.4}}, color={191,0,0})); + connect(hall_ref.hallTemperature, idealHeater_ref.T) annotation (Line(points= + {{20,-44},{22,-44},{22,-20},{-46,-20},{-46,-27.4},{-40,-27.4}}, color + ={0,0,127})); + connect(AHU_power.y, integrator1.u) annotation (Line(points={{-76.9,-79},{-74, + -79},{-74,-69},{-69.4,-69}}, color={0,0,127})); + connect(AHU_power_ref.y, integrator2.u) annotation (Line(points={{-76.9,-97}, + {-74,-97},{-74,-93},{-69.4,-93}}, color={0,0,127})); + connect(hall.hallTemperature, T_hall) + annotation (Line(points={{20,16},{100,16}}, color={0,0,127})); + connect(hall_ref.hallTemperature, T_hall_ref) annotation (Line(points={{20, + -44},{60,-44},{60,-30},{100,-30}}, color={0,0,127})); + connect(weatherCelsius.Celsius, hall_ref.CCA_SEN_T__WS_SUP__AI_U_C) + annotation (Line(points={{-25.4,-8},{-6,-8},{-6,-56},{0,-56}}, color={0,0, + 127})); + connect(simTime, timer.y) annotation (Line(points={{100,-52},{92,-52},{92,-51}, + {83.1,-51}}, color={0,0,127})); + connect(energyMeter.y, integrator3.u) annotation (Line(points={{-20.9,-79},{ + -16,-79},{-16,-71},{-9.4,-71}}, color={0,0,127})); + connect(energyMeter_ref.y, integrator4.u) annotation (Line(points={{-20.9,-97}, + {-16.45,-97},{-16.45,-93},{-9.4,-93}}, color={0,0,127})); + connect(integrator4.y, energy_ref) annotation (Line(points={{6.7,-93},{49.35, + -93},{49.35,-96},{100,-96}}, color={0,0,127})); + connect(integrator3.y, energy) annotation (Line(points={{6.7,-71},{49.35,-71}, + {49.35,-72},{100,-72}}, color={0,0,127})); + annotation ( + Icon(coordinateSystem(preserveAspectRatio=false)), + Diagram(coordinateSystem(preserveAspectRatio=false)), + experiment(StopTime=86400, Interval=10)); end TestHall; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/package.order b/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/package.order index c310a38..46da236 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/package.order +++ b/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/package.order @@ -1,2 +1,2 @@ -ControlledSystemBoundaries +AHU TestHall diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/Building.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/Building.mo deleted file mode 100644 index 065388d..0000000 --- a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/Building.mo +++ /dev/null @@ -1,18 +0,0 @@ -within ModelicaModels.SubsystemModels.DetailedModels.Geo; -model Building "Simplified building model" - - extends ModelicaModels.SubsystemModels.DetailedModels.Geo.GeoCommunicationBaseClass(variation( - table=[0,293])); - - extends ModelicaModels.Subsystems.Geo.BaseClasses.BuildingBaseClass; - -equation - connect(variation.y[1], boundary.T_in) annotation (Line(points={{-79,90},{-68, - 90},{-68,20},{-94,20},{-94,4},{-82,4}}, color={0,0,127})); - connect(percent.y, product1.u1) - annotation (Line(points={{-57.4,-50},{-36,-50}}, color={0,0,127})); - connect(product1.y, prescribedHeatFlow.Q_flow) annotation (Line(points={{-13, - -56},{0,-56},{0,20},{-34,20},{-34,42},{-18,42}}, color={0,0,127})); - connect(prescribedHeatFlow.port, vol1.heatPort) - annotation (Line(points={{6,42},{14,42}}, color={191,0,0})); -end Building; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/Field.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/Field.mo deleted file mode 100644 index f26ffb8..0000000 --- a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/Field.mo +++ /dev/null @@ -1,53 +0,0 @@ -within ModelicaModels.SubsystemModels.DetailedModels.Geo; -model Field "Simplified model of geothermal field" - - extends - ModelicaModels.SubsystemModels.DetailedModels.Geo.GeoCommunicationBaseClass(variation( - extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic, table=[0, - 10000; 2635200,12000; 5270400,9000; 7905600,3000; 10540800,-5000; - 13176000,-12000; 15811200,-12000; 18446400,-13000; 21081600,-5000; - 23716800,4000; 26352000,8000; 28987200,12000]), decisionVariables( - table=[0.0,50]), - percent(k=0.01)); - - extends ModelicaModels.Subsystems.Geo.BaseClasses.FieldBaseClass; - - Modelica.Blocks.Math.Product product1 - annotation (Placement(transformation(extent={{-78,0},{-58,20}}))); - Modelica.Blocks.Logical.LessEqualThreshold lessEqualThreshold - annotation (Placement(transformation(extent={{-60,70},{-40,90}}))); - Modelica.Blocks.Logical.Switch switch1 - annotation (Placement(transformation(extent={{-80,32},{-60,52}}))); - Modelica.Blocks.Math.Gain negate(k=-1) "negate" annotation (Placement( - transformation( - extent={{-6,-6},{6,6}}, - rotation=0, - origin={-48,42}))); -equation - connect(variation.y[1], lessEqualThreshold.u) annotation (Line(points={{-79, - 90},{-70,90},{-70,80},{-62,80}}, color={0,0,127})); - connect(variation.y[1], switch1.u3) annotation (Line(points={{-79,90},{-70,90}, - {-70,72},{-98,72},{-98,34},{-82,34}}, color={0,0,127})); - connect(variation.y[1], product1.u1) annotation (Line(points={{-79,90},{-70, - 90},{-70,72},{-98,72},{-98,16},{-80,16}}, color={0,0,127})); - connect(negate.y, prescribedHeatFlow.Q_flow) - annotation (Line(points={{-41.4,42},{-18,42}}, color={0,0,127})); - connect(prescribedHeatFlow.port, vol1.heatPort) - annotation (Line(points={{6,42},{20,42}}, color={191,0,0})); - connect(product1.y,switch1. u1) annotation (Line(points={{-57,10},{-52,10},{-52, - 26},{-90,26},{-90,50},{-82,50}}, color={0,0,127})); - connect(lessEqualThreshold.y,switch1. u2) annotation (Line(points={{-39,80},{-14, - 80},{-14,60},{-92,60},{-92,42},{-82,42}}, color={255,0,255})); - connect(negate.u,switch1. y) - annotation (Line(points={{-55.2,42},{-59,42}}, color={0,0,127})); - connect(percent.y, product1.u2) annotation (Line(points={{-57.4,-50},{-52,-50}, - {-52,-8},{-96,-8},{-96,4},{-80,4}}, color={0,0,127})); - annotation ( - experiment(StopTime=94672800, Interval=3600), - __Dymola_experimentSetupOutput, - __Dymola_experimentFlags( - Advanced(GenerateVariableDependencies=false, OutputModelicaCode=false), - Evaluate=false, - OutputCPUtime=false, - OutputFlatModelica=false)); -end Field; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/GeoCommunicationBaseClass.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/GeoCommunicationBaseClass.mo deleted file mode 100644 index 5832463..0000000 --- a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/GeoCommunicationBaseClass.mo +++ /dev/null @@ -1,47 +0,0 @@ -within ModelicaModels.SubsystemModels.DetailedModels.Geo; -model GeoCommunicationBaseClass - "Base class for the communication in geothermal models" - - replaceable package Water = AixLib.Media.Water; - - Modelica.Blocks.Sources.CombiTimeTable variation( - fileName="../../Geo_long/variation.mat", - extrapolation=Modelica.Blocks.Types.Extrapolation.HoldLastPoint, - tableName="tab1", - smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments, - tableOnFile=false, - table=[0,10000; 2635200,12000; 5270400,9000; 7905600,3000; 10540800,-5000; - 13176000,-12000; 15811200,-12000; 18446400,-13000; 21081600,-5000; - 23716800,4000; 26352000,8000; 28987200,12000; 31622400,10000; 34257600, - 12000; 36892800,9000; 39528000,3000; 42163200,-5000; 44798400,-12000; - 47433600,-12000; 50068800,-13000; 52704000,-5000; 55339200,4000; - 57974400,8000; 60609600,12000; 63244800,10000; 65880000,12000; 68515200, - 9000; 71150400,3000; 73785600,-5000; 76420800,-12000; 79056000,-12000; - 81691200,-13000; 84326400,-5000; 86961600,4000; 89596800,8000; 92232000, - 12000], - columns={2}) "Table with control input" annotation (Placement( - transformation( - extent={{-10,-10},{10,10}}, - rotation=0, - origin={-90,90}))); - Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow - annotation (Placement(transformation(extent={{-12,-12},{12,12}}, - rotation=0, - origin={-6,42}))); - Modelica.Blocks.Math.Gain percent(k=0.01) "Convert from percent" annotation ( - Placement(transformation( - extent={{-6,-6},{6,6}}, - rotation=0, - origin={-64,-50}))); - Modelica.Blocks.Sources.CombiTimeTable decisionVariables( - table=[0.0,0.0], - columns={2}, - smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments, - extrapolation=Modelica.Blocks.Types.Extrapolation.HoldLastPoint) - annotation (Placement(transformation(extent={{-100,-60},{-80,-40}}))); -equation - connect(decisionVariables.y[1], percent.u) - annotation (Line(points={{-79,-50},{-71.2,-50}}, color={0,0,127})); - annotation (experiment(StopTime=94608000, Interval=86400), - __Dymola_experimentSetupOutput); -end GeoCommunicationBaseClass; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/package.order b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/package.order deleted file mode 100644 index c0e9f42..0000000 --- a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Geo/package.order +++ /dev/null @@ -1,3 +0,0 @@ -Building -Field -GeoCommunicationBaseClass diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/HallLong.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/HallLong.mo new file mode 100644 index 0000000..116a6cd --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/HallLong.mo @@ -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; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/HallShort.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/HallShort.mo new file mode 100644 index 0000000..686bcf2 --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/HallShort.mo @@ -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; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/package.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/package.mo new file mode 100644 index 0000000..a6e7f19 --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/package.mo @@ -0,0 +1,3 @@ +within ModelicaModels.SubsystemModels; +package TestHall "Models for the test hall case study" +end TestHall; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/package.order b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/package.order new file mode 100644 index 0000000..3332780 --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/TestHall/package.order @@ -0,0 +1,2 @@ +HallLong +HallShort diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/package.order b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/package.order index e89ff18..34a3bbf 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/package.order +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/package.order @@ -1,2 +1,3 @@ BaseClasses DetailedModels +TestHall diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallBaseClass.mo b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallBaseClass.mo index ae88633..ef28298 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallBaseClass.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallBaseClass.mo @@ -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}}))); @@ -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})); @@ -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}})), diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallCalibrationBaseClass.mo b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallCalibrationBaseClass.mo index bfe69a0..8384440 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallCalibrationBaseClass.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallCalibrationBaseClass.mo @@ -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}}))); @@ -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)); diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallConnected.mo b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallConnected.mo new file mode 100644 index 0000000..744744e --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/HallConnected.mo @@ -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; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/package.order b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/package.order index 7b76ae8..f58a621 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/package.order +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/BaseClasses/package.order @@ -1,3 +1,4 @@ HallBaseClass HallCalibrationBaseClass SimpleAir +HallConnected diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/Hall.mo b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/Hall.mo new file mode 100644 index 0000000..d560a14 --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/Hall.mo @@ -0,0 +1,59 @@ +within ModelicaModels.Subsystems.TestHall; +model Hall + "Hall model that can be integrated into the controlled system model" + + extends ModelicaModels.Subsystems.TestHall.BaseClasses.HallConnected; + + 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.RealInput CCA_SEN_T__WS_SUP__AI_U_C + annotation (Placement(transformation(extent={{-120,-80},{-80,-40}}))); + Modelica.Blocks.Interfaces.RealInput AIR_AHU_SEN_T_AIR_ODA__AI_U__C + annotation (Placement(transformation(extent={{-120,20},{-80,60}}))); + Modelica.Blocks.Interfaces.RealOutput hallTemperature + "Absolute temperature as output signal" + annotation (Placement(transformation(extent={{90,50},{110,70}}))); + Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a heatPort + "Heat transfer into the working fluid" + annotation (Placement(transformation(extent={{30,86},{50,106}}))); + Modelica.Blocks.Interfaces.RealInput T_fluid + "External real input to set the temperature of the fluid" + annotation (Placement(transformation(extent={{-120,-30},{-80,10}}))); + Modelica.Blocks.Interfaces.RealOutput hallPower "The heat flux of the CCA" + annotation (Placement(transformation(extent={{90,-70},{110,-50}}))); + Modelica.Blocks.Interfaces.RealOutput hallEnergy "The total heat of the CCA" + annotation (Placement(transformation(extent={{90,-100},{110,-80}}))); + Modelica.Blocks.Sources.RealExpression heatFlux(y=hallBaseClass.floor.port_b.Q_flow) + "Measures the CCA heat flux" + annotation (Placement(transformation(extent={{0,-70},{22,-52}}))); + Modelica.Blocks.Continuous.Integrator integrator(k=1/3600000) + annotation (Placement(transformation(extent={{40,-100},{60,-80}}))); +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(hallBaseClass.CCA_SEN_T__WS_SUP__AI_U_C, CCA_SEN_T__WS_SUP__AI_U_C) + annotation (Line(points={{20,-14},{-20,-14},{-20,-60},{-100,-60}}, color={0, + 0,127})); + connect(hallBaseClass.AIR_AHU_SEN_T_AIR_ODA__AI_U__C, + AIR_AHU_SEN_T_AIR_ODA__AI_U__C) annotation (Line(points={{20,10},{0,10},{0, + 40},{-100,40}}, color={0,0,127})); + connect(hallBaseClass.hallTemperature, hallTemperature) annotation (Line( + points={{60,14},{80,14},{80,60},{100,60}}, color={0,0,127})); + connect(hallBaseClass.heatPort, heatPort) annotation (Line(points={{43.3333, + 19.6},{43.3333,40},{40,40},{40,96}}, color={191,0,0})); + connect(fluidSource.T_fluid, T_fluid) annotation (Line(points={{-18.2,-2.78}, + {-76,-2.78},{-76,-10},{-100,-10}}, color={0,0,127})); + connect(heatFlux.y, hallPower) annotation (Line(points={{23.1,-61},{67.55,-61}, + {67.55,-60},{100,-60}}, color={0,0,127})); + connect(integrator.y, hallEnergy) + annotation (Line(points={{61,-90},{100,-90}}, color={0,0,127})); + connect(heatFlux.y, integrator.u) annotation (Line(points={{23.1,-61},{28,-61}, + {28,-90},{38,-90}}, color={0,0,127})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end Hall; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/IdealHeater.mo b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/IdealHeater.mo new file mode 100644 index 0000000..faa3d3f --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/IdealHeater.mo @@ -0,0 +1,84 @@ +within ModelicaModels.Subsystems.TestHall; +model IdealHeater "Ideal heater or cooler for the hall" + + parameter Real setPoint_heating = 23 "The temperature set point of the controlled zone in heating mode"; + parameter Real setPoint_cooling = 25 "The temperature set point of the controlled zone in cooling mode"; + + Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow prescribedHeatFlow1 + annotation (Placement(transformation(extent={{24,-10},{44,10}}))); + Modelica.Blocks.Logical.OnOffController onOffController(bandwidth=1) + annotation (Placement(transformation(extent={{-46,24},{-34,36}}))); + Modelica.Blocks.Logical.Switch switch1 + annotation (Placement(transformation(extent={{-28,24},{-16,36}}))); + Modelica.Blocks.Sources.Constant minHeatMaxCool(k=0) + annotation (Placement(transformation(extent={{-48,4},{-38,14}}))); + Modelica.Blocks.Sources.Constant maxHeat(k=10000) + annotation (Placement(transformation(extent={{-48,48},{-38,58}}))); + Modelica.Blocks.Sources.Constant setPointHeating(k=setPoint_heating) + annotation (Placement(transformation(extent={{-76,42},{-66,52}}))); + Modelica.Blocks.Interfaces.RealInput T + "Connector of Real input signal used as measurement signal" + annotation (Placement(transformation(extent={{-120,6},{-80,46}}))); + Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b port1 + annotation (Placement(transformation(extent={{84,-10},{104,10}}))); + Modelica.Blocks.Logical.OnOffController onOffController1(bandwidth=0.5, + pre_y_start=true) + annotation (Placement(transformation(extent={{-44,-36},{-32,-24}}))); + Modelica.Blocks.Logical.Switch switch2 + annotation (Placement(transformation(extent={{-26,-36},{-14,-24}}))); + Modelica.Blocks.Sources.Constant setPointHeating1(k=setPoint_cooling) + annotation (Placement(transformation(extent={{-70,-24},{-60,-14}}))); + Modelica.Blocks.Sources.Constant maxHeat1(k=-10000) + annotation (Placement(transformation(extent={{-48,-56},{-38,-46}}))); + Modelica.Blocks.Math.Add add + annotation (Placement(transformation(extent={{-4,-10},{16,10}}))); + Modelica.Blocks.Math.Abs abs1 + annotation (Placement(transformation(extent={{24,-60},{44,-40}}))); + Modelica.Blocks.Interfaces.RealOutput energy + "Connector of Real output signal" + annotation (Placement(transformation(extent={{90,-60},{110,-40}}))); + Modelica.Blocks.Continuous.Integrator integrator(k=1/3600000) + annotation (Placement(transformation(extent={{62,-56},{74,-44}}))); + Modelica.Blocks.Interfaces.RealOutput power "Connector of Real output signal" + annotation (Placement(transformation(extent={{90,-90},{110,-70}}))); +equation + connect(minHeatMaxCool.y, switch1.u3) annotation (Line(points={{-37.5,9},{-32, + 9},{-32,25.2},{-29.2,25.2}}, color={0,0,127})); + connect(maxHeat.y, switch1.u1) annotation (Line(points={{-37.5,53},{-32,53},{ + -32,34.8},{-29.2,34.8}}, color={0,0,127})); + connect(setPointHeating.y, onOffController.reference) annotation (Line(points= + {{-65.5,47},{-58,47},{-58,33.6},{-47.2,33.6}}, color={0,0,127})); + connect(onOffController.u, T) annotation (Line(points={{-47.2,26.4},{-69.6, + 26.4},{-69.6,26},{-100,26}}, color={0,0,127})); + connect(onOffController.y, switch1.u2) + annotation (Line(points={{-33.4,30},{-29.2,30}}, color={255,0,255})); + connect(prescribedHeatFlow1.port, port1) + annotation (Line(points={{44,0},{94,0}}, color={191,0,0})); + connect(onOffController1.y, switch2.u2) + annotation (Line(points={{-31.4,-30},{-27.2,-30}}, color={255,0,255})); + connect(minHeatMaxCool.y, switch2.u1) annotation (Line(points={{-37.5,9},{-32, + 9},{-32,-25.2},{-27.2,-25.2}}, color={0,0,127})); + connect(setPointHeating1.y, onOffController1.reference) annotation (Line( + points={{-59.5,-19},{-52.75,-19},{-52.75,-26.4},{-45.2,-26.4}}, color={ + 0,0,127})); + connect(T, onOffController1.u) annotation (Line(points={{-100,26},{-76,26},{ + -76,-33.6},{-45.2,-33.6}}, color={0,0,127})); + connect(maxHeat1.y, switch2.u3) annotation (Line(points={{-37.5,-51},{-30,-51}, + {-30,-34.8},{-27.2,-34.8}}, color={0,0,127})); + connect(prescribedHeatFlow1.Q_flow, add.y) + annotation (Line(points={{24,0},{17,0}}, color={0,0,127})); + connect(switch1.y, add.u1) annotation (Line(points={{-15.4,30},{-10,30},{-10, + 6},{-6,6}}, color={0,0,127})); + connect(switch2.y, add.u2) annotation (Line(points={{-13.4,-30},{-10,-30},{ + -10,-6},{-6,-6}}, color={0,0,127})); + connect(add.y, abs1.u) + annotation (Line(points={{17,0},{17,-50},{22,-50}}, color={0,0,127})); + connect(abs1.y, integrator.u) + annotation (Line(points={{45,-50},{60.8,-50}}, color={0,0,127})); + connect(integrator.y, energy) + annotation (Line(points={{74.6,-50},{100,-50}}, color={0,0,127})); + connect(abs1.y, power) annotation (Line(points={{45,-50},{52,-50},{52,-80},{ + 100,-80}}, color={0,0,127})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end IdealHeater; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/Office.mo b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/Office.mo new file mode 100644 index 0000000..392c1dc --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/Office.mo @@ -0,0 +1,79 @@ +within ModelicaModels.Subsystems.TestHall; +model Office "Office within the test hall" + + parameter Real startTime = 0; + parameter Real offset_1 = -3; + parameter Real offset_2 = -1; + Modelica.Blocks.Interfaces.RealOutput thermostat + annotation (Placement(transformation(extent={{90,10},{110,30}}))); + Modelica.Blocks.Interfaces.RealOutput T_room + annotation (Placement(transformation(extent={{90,-30},{110,-10}}))); + Modelica.Blocks.Sources.Pulse pulse( + amplitude=6, + period=2*3600, + offset=offset_1, + startTime=startTime) + annotation (Placement(transformation(extent={{-20,40},{0,60}}))); + Modelica.Blocks.Sources.Pulse pulse1( + amplitude=2, + period=4*3600, + offset=offset_1, + startTime=startTime) + annotation (Placement(transformation(extent={{-20,0},{0,20}}))); + Modelica.Blocks.Math.Add add + annotation (Placement(transformation(extent={{20,20},{40,40}}))); + Modelica.Blocks.Sources.Sine sine( + amplitude=3, + freqHz=1/(6*3600), + offset=22, + startTime=startTime) + annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); + Modelica.Blocks.Sources.RealExpression calc(y=abs(T_in - T_set)*1.2*4000/3600 + *1000) + annotation (Placement(transformation(extent={{-14,-70},{42,-52}}))); + Modelica.Blocks.Interfaces.RealInput T_in "Prescribed fluid temperature" + annotation (Placement(transformation(extent={{-120,50},{-80,90}}))); + Modelica.Blocks.Interfaces.RealInput T_set + "Prescribed fluid temperature" + annotation (Placement(transformation(extent={{-120,-10},{-80,30}}))); + Modelica.Blocks.Interfaces.RealOutput energy "Value of Real output" + annotation (Placement(transformation(extent={{90,-72},{110,-52}}))); + Modelica.Blocks.Sources.RealExpression calc_ref(y=abs(T_in_ref - T_set)*1.2* + 4000/3600*1000) + annotation (Placement(transformation(extent={{-14,-94},{42,-76}}))); + Modelica.Blocks.Interfaces.RealInput T_in_ref "Prescribed fluid temperature" + annotation (Placement(transformation(extent={{-120,-70},{-80,-30}}))); + Modelica.Blocks.Interfaces.RealOutput energy_ref "Value of Real output" + annotation (Placement(transformation(extent={{90,-104},{110,-84}}))); + Modelica.Blocks.Continuous.Integrator integrator(k=1/3600000) + annotation (Placement(transformation(extent={{64,-68},{78,-54}}))); + Modelica.Blocks.Interfaces.RealOutput power "Value of Real output" + annotation (Placement(transformation(extent={{90,-52},{110,-32}}))); + Modelica.Blocks.Continuous.Integrator integrator1(k=1/3600000) + annotation (Placement(transformation(extent={{68,-100},{82,-86}}))); + Modelica.Blocks.Interfaces.RealOutput power_ref "Value of Real output" + annotation (Placement(transformation(extent={{90,-90},{110,-70}}))); +equation + connect(pulse.y, add.u1) + annotation (Line(points={{1,50},{8,50},{8,36},{18,36}}, color={0,0,127})); + connect(pulse1.y, add.u2) + annotation (Line(points={{1,10},{8,10},{8,24},{18,24}}, color={0,0,127})); + connect(add.y, thermostat) annotation (Line(points={{41,30},{62,30},{62,20},{100, + 20}}, color={0,0,127})); + connect(sine.y, T_room) annotation (Line(points={{1,-30},{40,-30},{40,-20},{100, + -20}}, color={0,0,127})); + connect(calc.y, integrator.u) + annotation (Line(points={{44.8,-61},{62.6,-61}}, color={0,0,127})); + connect(energy, integrator.y) annotation (Line(points={{100,-62},{90,-62},{90, + -61},{78.7,-61}}, color={0,0,127})); + connect(calc.y, power) annotation (Line(points={{44.8,-61},{54,-61},{54,-42},{ + 100,-42}}, color={0,0,127})); + connect(calc_ref.y, integrator1.u) annotation (Line(points={{44.8,-85},{58,-85}, + {58,-93},{66.6,-93}}, color={0,0,127})); + connect(energy_ref, integrator1.y) annotation (Line(points={{100,-94},{94,-94}, + {94,-93},{82.7,-93}}, color={0,0,127})); + connect(calc_ref.y, power_ref) annotation (Line(points={{44.8,-85},{56,-85},{56, + -80},{100,-80}}, color={0,0,127})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false))); +end Office; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/package.mo b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/package.mo index 7f58fa3..2dbb1ad 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/package.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/package.mo @@ -1,4 +1,4 @@ within ModelicaModels.Subsystems; package TestHall "Models of the test hall case study" - + end TestHall; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/package.order b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/package.order index 7d7064f..b3fa1d4 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/package.order +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/TestHall/package.order @@ -1 +1,4 @@ BaseClasses +Hall +IdealHeater +Office diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Tests/TestHall/HallCalibrationNominal.mo b/pyDMPC/ModelicaModels/ModelicaModels/Tests/TestHall/HallCalibrationNominal.mo index 4cfa315..80f2fc2 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/Tests/TestHall/HallCalibrationNominal.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/Tests/TestHall/HallCalibrationNominal.mo @@ -11,15 +11,16 @@ model HallCalibrationNominal Modelica.Blocks.Sources.Constant supplyAirVolumeFlow(k=8000) annotation (Placement(transformation(extent={{-100,0},{-80,20}}))); equation - connect(TABSTemperature.y, hall.CCA_SEN_T__WS_SUP__AI_U_C) annotation (Line( - points={{-79,-90},{-20.5,-90},{-20.5,-9.8},{-12,-9.8}}, color={0,0,127})); connect(supplyAirTemperature.y, toKelvin.Celsius) annotation (Line(points={{ -79,-50},{-48,-50},{-48,-31.2}}, color={0,0,127})); - connect(outdoorAirTemperature.y, hall.AIR_AHU_SEN_T_AIR_ODA__AI_U__C) - annotation (Line(points={{-79,50},{-20,50},{-20,7},{-12,7}}, color={0,0,127})); connect(supplyAirVolumeFlow.y, gain.u) annotation (Line(points={{-79,10},{-66, 10},{-66,12},{-54.8,12}}, color={0,0,127})); connect(supplyAirTemperature.y, feedback1.u1) annotation (Line(points={{-79,-50},{18,-50}}, color={0,0,127})); + connect(outdoorAirTemperature.y, hallBaseClass.AIR_AHU_SEN_T_AIR_ODA__AI_U__C) + annotation (Line(points={{-79,50},{0,50},{0,10},{20,10}}, color={0,0,127})); + connect(TABSTemperature.y, hallBaseClass.CCA_SEN_T__WS_SUP__AI_U_C) + annotation (Line(points={{-79,-90},{0,-90},{0,-14},{20,-14}}, color={0,0, + 127})); annotation (experiment(StopTime=300000, Interval=10)); end HallCalibrationNominal; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/package.mo b/pyDMPC/ModelicaModels/ModelicaModels/package.mo index bf37a0b..90b19a4 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/package.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/package.mo @@ -5,5 +5,7 @@ extends Modelica.Icons.VariantsPackage; annotation (uses(Modelica(version="3.2.2"), SimulationMPC(version="1"), Buildings(version="6.0.0"), - AixLib(version="0.7.3")), version="1"); + AixLib(version="0.7.3"), + OldModelicaModels(version="1")), + version="1"); end ModelicaModels;