From f23c7989b58c88a89746d7bfa6b0276b2ab70b32 Mon Sep 17 00:00:00 2001 From: Martin Stiller Date: Wed, 25 Sep 2019 16:53:21 +0200 Subject: [PATCH] * small corrections in Controlled System and Heat Pump Subsystem, added San Francisco weather data, #55 Note: weather datas relative path with "modelica://..." does not work! Total, local path has to be included to make it runnable! --- pyDMPC/ControlFramework/Init.py | 8 +- .../GeothermalHeatPumpControlledBase.mo | 5 +- .../GeothermalHeatPumpSystem.mo | 43 +- .../DetailedModels/Geo/GeothermalHeatPump.mo | 2 - ...A_CA_San.Francisco.Intl.AP.724940_TMY3.mos | 8800 +++++++++++++++++ 5 files changed, 8832 insertions(+), 26 deletions(-) create mode 100644 pyDMPC/ModelicaModels/ModelicaModels/Subsystems/Geo/BaseClasses/TEASER_BuildingSets/USA_CA_San.Francisco.Intl.AP.724940_TMY3.mos diff --git a/pyDMPC/ControlFramework/Init.py b/pyDMPC/ControlFramework/Init.py index 7ff63c5..222f7be 100644 --- a/pyDMPC/ControlFramework/Init.py +++ b/pyDMPC/ControlFramework/Init.py @@ -73,8 +73,8 @@ inputs.append(range(280,290,5)) output_names.append(["returnTemperature"]) #controlled System set_points.append([287]) -state_var_names.append(["negate1.y", "negate.y"]) #controlled System -model_state_var_names.append(["negate1.y", "negate2.y"]) #subsystem +state_var_names.append(["switch2.y"]) #controlled System +model_state_var_names.append(["const.k"]) #subsystem start.append(0.) stop.append(7200.) incr.append(10.) @@ -86,10 +86,10 @@ mod_path.append(r'ModelicaModels.SubsystemModels.DetailedModels.Geo.GeothermalHeatPump') command_names.append(["T_set_storage"]) #controlled System command_variables.append(["decisionVariables.table[1,2]"]) #subsystem -commands.append(range(273+35,273+40,5)) +commands.append(range(308,313,5)) traj_points.append([]) traj_var.append([]) -cost_fac.append([-1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 3000.0, -3000.0, 10.0, 2.0]) +cost_fac.append([-1.0, 0.0, 1000.0, -1000.0, 2000.0, -2000.0, 3000.0, -3000.0, 10.0, 2.0]) factors.append([1, -10./4.18/8./100.]) sys_id.append(1) diff --git a/pyDMPC/ModelicaModels/ModelicaModels/BaseClasses/GeothermalHeatPumpControlledBase.mo b/pyDMPC/ModelicaModels/ModelicaModels/BaseClasses/GeothermalHeatPumpControlledBase.mo index e5a4635..a579be3 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/BaseClasses/GeothermalHeatPumpControlledBase.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/BaseClasses/GeothermalHeatPumpControlledBase.mo @@ -124,7 +124,8 @@ partial model GeothermalHeatPumpControlledBase AixLib.BoundaryConditions.WeatherData.ReaderTMY3 weaDat( calTSky=AixLib.BoundaryConditions.Types.SkyTemperatureCalculation.HorizontalRadiation, computeWetBulbTemperature=false, - filNam=Modelica.Utilities.Files.loadResource("modelica://ModelicaModels/Subsystems/Geo/BaseClasses/TEASER_BuildingSets/DEU_BW_Mannheim_107290_TRY2010_12_Jahr_BBSR.mos")) + filNam=Modelica.Utilities.Files.loadResource( + "modelica://ModelicaModels/Subsystems/Geo/BaseClasses/TEASER_BuildingSets/DEU_BW_Mannheim_107290_TRY2010_12_Jahr_BBSR.mos")) "Weather data reader" annotation (Placement(transformation(extent={{248,28},{228,48}}))); @@ -232,7 +233,7 @@ partial model GeothermalHeatPumpControlledBase extent={{-6,-6},{6,6}}, rotation=0, origin={160,22}))); - Modelica.Blocks.Sources.RealExpression HeatFlowBuildingNeed(y= + Modelica.Blocks.Sources.RealExpression HeatFlowBuildingNeed(y=- idealConditioning.port.Q_flow) "Need of Building" annotation (Placement( transformation( extent={{-28,-11},{28,11}}, diff --git a/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/GeothermalHeatPumpSystem.mo b/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/GeothermalHeatPumpSystem.mo index 19bac71..49049cb 100644 --- a/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/GeothermalHeatPumpSystem.mo +++ b/pyDMPC/ModelicaModels/ModelicaModels/ControlledSystems/GeothermalHeatPumpSystem.mo @@ -7,37 +7,44 @@ model GeothermalHeatPumpSystem redeclare AixLib.Fluid.Examples.GeothermalHeatPump.Components.BoilerStandAlone PeakLoadDevice(redeclare package Medium = Water), - vol1(V=0.5, T_start=285.15), - vol2(V=0.5, T_start=285.15), + vol1(V=0.5, + nPorts=3, + T_start=279.15), + vol2(V=0.5, + nPorts=3, + T_start=318.15), resistanceGeothermalSource(m_flow_nominal=baseParam.m_flow_tot), pumpGeothermalSource(T_start=285.15), pumpHeatConsumer(T_start=285.15), pumpCondenser(T_start=285.15), pumpEvaporator(T_start=285.15), - pumpColdConsumer(T_start=285.15), - integrator(k=3600), - integrator1(k=3600), - heatPumpTab(tablePower=[0,266.15,275.15,280.15,283.15,293.15; 308.15,9900, - 10200,10500,11100,11400; 323.15,13500,13200,13800,15000,15300], - tableHeatFlowCondenser=[0,266.15,275.15,280.15,283.15,293.15; 308.15, - 29100,34800,39000,44400,48900; 323.15,30000,33600,38700,50100,52500]), + pumpColdConsumer(T_start=279.15), + heatPumpTab( + VolumeEvaporator=1, + VolumeCondenser=1, + tablePower=[0,266.15,275.15,280.15,283.15,293.15; 308.15,29700,30600, + 31500,33300,34200; 323.15,40500,39600,41400,45000,45900], + tableHeatFlowCondenser=[0,266.15,275.15,280.15,283.15,293.15; 308.15, + 87300,104400,117000,133200,146700; 323.15,90000,100800,116100,150300, + 157500]), thermalZone(zoneParam= Subsystems.Geo.BaseClasses.TEASER_DataBase.TEASER_Office())); AixLib.Fluid.Sources.Boundary_pT coldConsumerFlow(redeclare package Medium = - Water, nPorts=1, - T=285.15) annotation (Placement(transformation( + Water, + nPorts=1, + T=279.15) annotation (Placement(transformation( extent={{-6,-6},{6,6}}, rotation=180, - origin={94,-20}))); + origin={100,-20}))); AixLib.Fluid.Sources.Boundary_pT heatConsumerReturn( redeclare package Medium = Water, nPorts=1, - T=285.15) "Source representing heat consumer" annotation (Placement( + T=313.15) "Source representing heat consumer" annotation (Placement( transformation( extent={{-6,-6},{6,6}}, rotation=180, - origin={112,-106}))); + origin={118,-106}))); Modelica.Blocks.Sources.Constant pressureDifference(k=60000) "Pressure difference used for all pumps" annotation ( Placement(transformation( @@ -62,15 +69,11 @@ model GeothermalHeatPumpSystem "Connector of Real input signal 2" annotation (Placement(transformation(extent={{-102,62},{-90,74}}))); equation - connect(resistanceColdConsumerFlow.port_b,coldConsumerFlow. ports[1]) - annotation (Line(points={{80,-20},{88,-20}}, color={0,127,255})); connect(pressureDifference.y, pumpColdConsumer.dp_in) annotation (Line(points={{65.4,6}, {55,6},{55,-11.6}}, color={0,0,127})); connect(pressureDifference.y, pumpHeatConsumer.dp_in) annotation (Line(points={{65.4,6}, {62,6},{62,-36},{55,-36},{55,-41.6}}, color={0, 0,127})); - connect(resistanceHeatConsumerReturn.port_a,heatConsumerReturn. ports[1]) - annotation (Line(points={{100,-106},{106,-106}}, color={0,127,255})); connect(pressureDifference.y, pumpEvaporator.dp_in) annotation (Line(points={{65.4,6}, {56,6},{56,54},{7,54},{7,44.4}}, color={0,0, 127})); @@ -114,6 +117,10 @@ equation {{-139,74},{-108.5,74},{-108.5,76},{-78,76}}, color={0,0,127})); connect(T_set_storage, hPControllerOnOff.T_set) annotation (Line(points={{-96,68},{-78,68}}, color={0,0,127})); + connect(coldConsumerFlow.ports[1], vol1.ports[3]) annotation (Line(points={{ + 94,-20},{90,-20},{90,30},{86,30}}, color={0,127,255})); + connect(heatConsumerReturn.ports[1], vol2.ports[3]) annotation (Line(points={ + {112,-106},{110,-106},{110,-54},{106,-54}}, color={0,127,255})); annotation (experiment(StopTime=86400, Interval=10), Documentation(revisions="