diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/HRCML.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/HRCML.mo index fe5e0d2..689278e 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/HRCML.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/HRCML.mo @@ -142,10 +142,10 @@ equation connect(extractAirSource.ports[1], hex.port_a2) annotation (Line(points={{128, 70},{88,70},{88,64},{46,64}}, color={0,127,255})); connect(toTotAir.XiTotalAir, extractAirSource.X_in[1]) annotation (Line( - points={{-89,66},{-76,66},{-76,126},{168,126},{168,74},{150,74}}, color - ={0,0,127})); - connect(toTotAir.XNonVapor, extractAirSource.X_in[2]) annotation (Line(points - ={{-89,62},{-82,62},{-82,130},{176,130},{176,74},{150,74}}, color={0,0, + points={{-89,66},{-76,66},{-76,126},{168,126},{168,74},{150,74}}, color= + {0,0,127})); + connect(toTotAir.XNonVapor, extractAirSource.X_in[2]) annotation (Line(points= + {{-89,62},{-82,62},{-82,130},{176,130},{176,74},{150,74}}, color={0,0, 127})); connect(mflowExtract.y, extractAirSource.m_flow_in) annotation (Line(points={ {195,22},{172,22},{172,62},{148,62}}, color={0,0,127})); diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall.mo deleted file mode 100644 index 28b73d2..0000000 --- a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall.mo +++ /dev/null @@ -1,40 +0,0 @@ -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), - concreteFloor(T(fixed=true)), - wallMasses(T(fixed=true))); - - 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={-90,-70}))); -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})); - connect(weather.y[1], outdoorAir.T) annotation (Line(points={{-79,-70},{-32, - -70},{-32,-80},{-2,-80}}, color={0,0,127})); - annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( - coordinateSystem(preserveAspectRatio=false)), - experiment(StopTime=86400, Interval=10)); -end Hall; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall2.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall2.mo new file mode 100644 index 0000000..41de5ba --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall2.mo @@ -0,0 +1,80 @@ +within ModelicaModels.SubsystemModels.DetailedModels; +model Hall2 + extends ModelicaModels.Subsystems.BaseClasses.HallBaseClass( + concreteFloor(T(fixed=true)), + wallMasses(T(fixed=true)), + volume(nPorts=2), + wallConductor(G=30000), + FloorConductor(G=4000), + CCAConductor(G=5000), + SolarShare(k=50)); + + 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={-90,-70}))); + Modelica.Thermal.HeatTransfer.Celsius.ToKelvin waterTemperature1 + annotation (Placement(transformation(extent={{-28,-86},{-16,-74}}))); + Modelica.Fluid.Sources.MassFlowSource_T IntakeAirSource( + nPorts=1, + m_flow=0.5, + redeclare package Medium = MediumAir, + X={0.03,0.97}, + T=30 + 273.15, + use_T_in=true, + use_m_flow_in=true, + use_X_in=false) + annotation (Placement(transformation(extent={{-120,2},{-100,22}}))); + 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={{190,2},{170,22}}))); + Modelica.Blocks.Sources.Constant Pressure(k=23) + annotation (Placement(transformation(extent={{10,10},{-10,-10}}, + rotation=180, + origin={-80,-110}))); + Modelica.Thermal.HeatTransfer.Celsius.ToKelvin hallTemperature1 + annotation (Placement(transformation(extent={{-6,-6},{6,6}}, + rotation=180, + origin={-42,40}))); + Modelica.Blocks.Math.Gain gain(k=1.2/3600) annotation (Placement( + transformation( + extent={{-10,-10},{10,10}}, + rotation=180, + origin={-46,86}))); +equation + connect(outdoorAir.T, waterTemperature1.Kelvin) + annotation (Line(points={{-2,-80},{-15.4,-80}}, color={0,0,127})); + connect(combiTimeTable.y[5], waterTemperature1.Celsius) annotation (Line( + points={{-19,10},{-14,10},{-14,-32},{-46,-32},{-46,-80},{-29.2,-80}}, + color={0,0,127})); + connect(IntakeAirSource.ports[1], volume.ports[2]) annotation (Line(points={{ + -100,12},{-86,12},{-86,16},{-58,16},{-58,-66},{74,-66},{74,-90},{100, + -90}}, color={0,127,255})); + connect(res.port_b, IntakeAirSink.ports[1]) annotation (Line(points={{152, + -110},{166,-110},{166,12},{170,12}}, color={0,127,255})); + connect(Pressure.y, waterTemperature.Celsius) annotation (Line(points={{-69, + -110},{-50,-110},{-50,-100},{-29.2,-100}}, color={0,0,127})); + connect(hallTemperature1.Kelvin, IntakeAirSource.T_in) annotation (Line( + points={{-48.6,40},{-136,40},{-136,16},{-122,16}}, color={0,0,127})); + connect(combiTimeTable.y[3], hallTemperature1.Celsius) annotation (Line( + points={{-19,10},{-14,10},{-14,40},{-34.8,40}}, color={0,0,127})); + connect(combiTimeTable.y[2], gain.u) annotation (Line(points={{-19,10},{0,10}, + {0,86},{-34,86}}, color={0,0,127})); + connect(gain.y, IntakeAirSource.m_flow_in) annotation (Line(points={{-57,86}, + {-132,86},{-132,20},{-120,20}}, color={0,0,127})); + annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( + coordinateSystem(preserveAspectRatio=false)), + experiment(StopTime=86400, Interval=10)); +end Hall2; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall_long.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall_long.mo new file mode 100644 index 0000000..7aae4d9 --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall_long.mo @@ -0,0 +1,17 @@ +within ModelicaModels.SubsystemModels.DetailedModels; +model Hall_long + extends ModelicaModels.SubsystemModels.DetailedModels.BaseClasses.HallBaseClass; + + Modelica.Blocks.Sources.Constant Tnormal(k=273 + 22) + "Average Temperature of supply air or forecast" + annotation (Placement(transformation(extent={{-160,10},{-140,30}}))); + Modelica.Blocks.Sources.RealExpression realExpression(y=35 - + decisionVariables.y[1]) + annotation (Placement(transformation(extent={{-110,-110},{-44,-90}}))); +equation + connect(Tnormal.y, IntakeAirSource.T_in) annotation (Line(points={{-139,20},{ + -120,20},{-120,24},{-102,24}}, color={0,0,127})); + connect(realExpression.y, waterTemperature.Celsius) + annotation (Line(points={{-40.7,-100},{-29.2,-100}}, color={0,0,127})); + annotation (experiment(StopTime=172800, Interval=10)); +end Hall_long; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall_short.mo b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall_short.mo new file mode 100644 index 0000000..6a918b8 --- /dev/null +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/Hall_short.mo @@ -0,0 +1,28 @@ +within ModelicaModels.SubsystemModels.DetailedModels; +model Hall_short + extends ModelicaModels.SubsystemModels.DetailedModels.BaseClasses.HallBaseClass; + + 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={-150,18}))); + Modelica.Thermal.HeatTransfer.Celsius.ToKelvin hallTemperature1 + annotation (Placement(transformation(extent={{-128,12},{-116,24}}))); + Modelica.Blocks.Sources.Constant currentWaterTemperature(k=22) + "Can be an iniitial value" + annotation (Placement(transformation(extent={{-88,-110},{-68,-90}}))); +equation + connect(variation.y[1], hallTemperature1.Celsius) + annotation (Line(points={{-139,18},{-129.2,18}}, color={0,0,127})); + connect(IntakeAirSource.T_in, hallTemperature1.Kelvin) annotation (Line( + points={{-102,24},{-108,24},{-108,18},{-115.4,18}}, color={0,0,127})); + connect(waterTemperature.Celsius, currentWaterTemperature.y) + annotation (Line(points={{-29.2,-100},{-67,-100}}, color={0,0,127})); +end Hall_short; diff --git a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/package.order b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/package.order index de03da5..a051327 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/package.order +++ b/pyDMPC/ModelicaModels/ModelicaModels/SubsystemModels/DetailedModels/package.order @@ -7,4 +7,7 @@ CoolerML HeaterML HRCML HumidifierML -Hall +Hall_long +Hall2 +Hall_short +BaseClasses diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/BaseClasses/HallBaseClass.mo b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/BaseClasses/HallBaseClass.mo index 9ccbe63..9732162 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/BaseClasses/HallBaseClass.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/BaseClasses/HallBaseClass.mo @@ -19,8 +19,8 @@ model HallBaseClass "Simplified model of hall 1" m_flow_nominal=m_flow_nominal, dp_nominal=200) annotation (Placement(transformation(extent={{132,-120},{152,-100}}))); - Modelica.Thermal.HeatTransfer.Components.ThermalConductor outdoorAirConductor( - G=1600) "Conducts heat from/to outdoor air" + Modelica.Thermal.HeatTransfer.Components.ThermalConductor outdoorAirConductor(G=400) + "Conducts heat from/to outdoor air" annotation (Placement(transformation(extent={{30,-90},{50,-70}}))); Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature outdoorAir annotation (Placement(transformation(extent={{0,-90},{20,-70}}))); @@ -29,8 +29,8 @@ model HallBaseClass "Simplified model of hall 1" Modelica.Blocks.Math.Gain SolarShare(k=100) "Share of the total radiation that is actually transported into the hall" annotation (Placement(transformation(extent={{34,-46},{46,-34}}))); - ModelicaModels.BaseClasses.ThermalConductor - CCAConductor + Modelica.Thermal.HeatTransfer.Components.ThermalConductor + CCAConductor(G=8000) "Conducts heat from water to concrete" annotation (Placement(transformation(extent={{30,-160},{50,-140}}))); Modelica.Thermal.HeatTransfer.Components.HeatCapacitor wallMasses(C=100000000, @@ -42,7 +42,7 @@ model HallBaseClass "Simplified model of hall 1" Modelica.Thermal.HeatTransfer.Components.ThermalConductor wallConductor(G=8000) "Conducts heat from/to walls" annotation (Placement(transformation(extent={{108,-60},{128,-40}}))); - Modelica.Thermal.HeatTransfer.Components.ThermalConductor FloorConductor(G=100000) + Modelica.Thermal.HeatTransfer.Components.ThermalConductor FloorConductor(G=10000) "Conducts heat from floor to air" annotation (Placement(transformation(extent={{88,-158},{108,-138}}))); Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature SupplyWater @@ -797,14 +797,6 @@ model HallBaseClass "Simplified model of hall 1" 20.613,0,8.213,240.863,0; 3837600,19.733,9835.461,20.613,0,8.213,240.863, 0; 3841200,19.733,9835.461,20.613,0,8.213,240.863,0]) annotation (Placement(transformation(extent={{-40,0},{-20,20}}))); - Modelica.Blocks.Math.Gain valveEffect(k=25) - "Transforms the valve opening into thermal conductance" - annotation (Placement(transformation(extent={{4,-132},{16,-120}}))); - Modelica.Blocks.Math.Gain volumFlowConversion(k=1.4/3600) - "Convert the volume flow into mass flow" - annotation (Placement(transformation(extent={{4,-108},{16,-96}}))); - Modelica.Thermal.HeatTransfer.Celsius.ToKelvin supplyAir - annotation (Placement(transformation(extent={{-28,-126},{-16,-114}}))); Modelica.Thermal.HeatTransfer.Celsius.ToKelvin waterTemperature annotation (Placement(transformation(extent={{-28,-106},{-16,-94}}))); Modelica.Thermal.HeatTransfer.Celsius.ToKelvin hallTemperature @@ -841,20 +833,10 @@ equation -148},{120,-148},{120,-132},{92,-132},{92,-96},{78,-96},{78,-80},{90,-80}}, color= {191,0,0})); - connect(valveEffect.y, CCAConductor.G) annotation (Line(points={{16.6,-126},{26, - -126},{26,-141},{30,-141}},color={0,0,127})); connect(combiTimeTable.y[6], SolarShare.u) annotation (Line(points={{-19,10},{ -8,10},{-8,-40},{32.8,-40}}, color={0,0,127})); - connect(combiTimeTable.y[2], volumFlowConversion.u) annotation (Line(points={{-19,10}, - {-8,10},{-8,-102},{2.8,-102}}, color={0,0,127})); - connect(combiTimeTable.y[7], waterTemperature.Celsius) annotation (Line( - points={{-19,10},{-8,10},{-8,-40},{-40,-40},{-40,-100},{-29.2,-100}}, - color={0,0,127})); connect(waterTemperature.Kelvin, SupplyWater.T) annotation (Line(points={{-15.4, -100},{-14,-100},{-14,-150},{-2,-150}}, color={0,0,127})); - connect(combiTimeTable.y[3], supplyAir.Celsius) annotation (Line(points={{-19, - 10},{-8,10},{-8,-40},{-40,-40},{-40,-120},{-29.2,-120}}, color={0,0, - 127})); connect(combiTimeTable.y[1], hallTemperature.Celsius) annotation (Line(points={{-19,10},{14.8,10}}, color={0,0,127})); annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-140,-100}, diff --git a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/Hall.mo b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/Hall.mo index bbd39b3..7b546c0 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/Hall.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/Subsystems/Hall.mo @@ -20,9 +20,7 @@ equation -60},{60,-60},{60,-90},{100,-90}}, color={0,127,255})); connect(res.port_b, port_b) annotation (Line(points={{152,-110},{160,-110},{160, -56},{136,-56},{136,-20},{100,-20},{100,0}}, color={0,127,255})); - connect(valveEffect.u, u1) annotation (Line(points={{2.8,-126},{-80,-126},{-80, - -80},{-140,-80}}, color={0,0,127})); - connect(combiTimeTable.y[5], outdoorAir.T) annotation (Line(points={{-19,10}, - {-8,10},{-8,-80},{-2,-80}}, color={0,0,127})); + connect(u1, waterTemperature.Celsius) annotation (Line(points={{-140,-80},{ + -86,-80},{-86,-100},{-29.2,-100}}, color={0,0,127})); annotation (experiment(StartTime=1000)); end Hall;