Skip to content

Commit

Permalink
Merge branch 'issue1171_StorageSpringCleaning' into issue1223_NewStor…
Browse files Browse the repository at this point in the history
…ageExamples #1223
  • Loading branch information
LauraMaier committed Jul 14, 2022
2 parents c5d5eb2 + 8bda225 commit 4f46a9a
Show file tree
Hide file tree
Showing 28 changed files with 428 additions and 238 deletions.
2 changes: 1 addition & 1 deletion AixLib/DataBase/Storage/Generic_New_2000l.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within AixLib.DataBase.Storage;
record Generic_New_2000l "Pseudo storage with 2000 l (standing)"
extends BufferStorageBaseDataDefinition(
extends StorageDetailedBaseDataDefinition(
hTank=2.145,
hLowerPortDemand=0.1,
hUpperPortDemand=2.1,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
within AixLib.DataBase.Storage;
record BufferStorageBaseDataDefinition
record StorageDetailedBaseDataDefinition
"Base data definition for Buffer storage records"
extends Modelica.Icons.Record;
///////////input parameters////////////
Expand All @@ -17,9 +17,9 @@ record BufferStorageBaseDataDefinition
parameter SI.Diameter dTank "Inner diameter of storage";
parameter SI.Length sWall "Thickness of storage Wall";
parameter SI.Length sIns "Thickness of storage insulation";
parameter Modelica.Units.SI.ThermalConductivity lambdaWall
parameter SI.ThermalConductivity lambdaWall
"thermal conductivity of storage wall";
parameter Modelica.Units.SI.ThermalConductivity lambdaIns
parameter SI.ThermalConductivity lambdaIns
"thermal conductivity of storage insulation";
//parameter SI.CoefficientOfHeatTransfer alpha
//"Coefficient of heat transfer air <-> insulation of tank";
Expand All @@ -38,8 +38,8 @@ record BufferStorageBaseDataDefinition
parameter DataBase.Pipes.PipeBaseDataDefinition pipeHC2
"Type of Pipe for HR2";

parameter Modelica.Units.SI.Length lengthHC1 "Length of Pipe for HR1";
parameter Modelica.Units.SI.Length lengthHC2 "Length of Pipe for HR2";
parameter SI.Length lengthHC1 "Length of Pipe for HR1";
parameter SI.Length lengthHC2 "Length of Pipe for HR2";

annotation (Icon(graphics), Documentation(info="<html><h4>
<span style=\"color:#008000\">Overview</span>
Expand Down Expand Up @@ -72,4 +72,4 @@ record BufferStorageBaseDataDefinition
</li>
</ul>
</html>"));
end BufferStorageBaseDataDefinition;
end StorageDetailedBaseDataDefinition;
2 changes: 1 addition & 1 deletion AixLib/DataBase/Storage/package.order
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
BufferStorageBaseDataDefinition
StorageDetailedBaseDataDefinition
Generic_New_2000l
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ partial model GeothermalHeatPumpBase
AixLib.Fluid.Interfaces.PartialTwoPort
annotation (Placement(transformation(extent={{108,-56},{120,-44}})));

Storage.BufferStorage
Storage.StorageDetailed
coldStorage(
redeclare package Medium = Medium,
redeclare package MediumHC1 = Medium,
Expand Down Expand Up @@ -86,7 +86,7 @@ partial model GeothermalHeatPumpBase
extent={{-6,-7},{6,7}},
rotation=90,
origin={-60,1})));
Storage.BufferStorage
Storage.StorageDetailed
heatStorage(
redeclare package Medium = Medium,
redeclare package MediumHC1 = Medium,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ partial model PartialHeatTransferLayers "Partial for storage heat transfer model
Modelica.Media.Interfaces.PartialMedium "Medium model" annotation(choicesAllMatching);

replaceable parameter
AixLib.DataBase.Storage.BufferStorageBaseDataDefinition data=
AixLib.DataBase.Storage.StorageDetailedBaseDataDefinition data=
AixLib.DataBase.Storage.Generic_New_2000l()
"Storage data record"
annotation (choicesAllMatching);
Expand Down
105 changes: 57 additions & 48 deletions AixLib/Fluid/Storage/Examples/StorageBoiler.mo
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ model StorageBoiler
Modelica.Media.Water.ConstantPropertyLiquidWater
constrainedby Modelica.Media.Interfaces.PartialMedium;

AixLib.Fluid.Storage.BufferStorage
bufferStorage(
AixLib.Fluid.Storage.StorageDetailed bufferStorage(
redeclare package MediumHC1 = Medium,
redeclare package MediumHC2 = Medium,
m1_flow_nominal=pipe1.m_flow_nominal,
Expand All @@ -27,82 +26,92 @@ model StorageBoiler
hConIn=1500,
hConOut=15,
redeclare package Medium = Medium,
hConHC1=300) annotation (Placement(transformation(extent={{6,8},{
-18,38}})));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(T = 283.15) annotation(Placement(transformation(extent={{-56,12},
{-36,32}})));
AixLib.Obsolete.Year2021.Fluid.Movers.Pump pump(redeclare package Medium = Medium, m_flow_small=1e-4) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={6,60})));
hConHC1=300) annotation (Placement(transformation(extent={{6,-14},
{-18,16}})));
Modelica.Thermal.HeatTransfer.Sources.FixedTemperature fixedTemperature(T = 283.15) annotation(Placement(transformation(extent={{-56,-10},
{-36,10}})));
AixLib.Fluid.Sources.Boundary_pT
boundary_p(nPorts=1, redeclare package Medium = Medium)
annotation(Placement(transformation(extent={{-48,68},
{-28,88}})));
Modelica.Blocks.Sources.BooleanExpression booleanExpression annotation(Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 180, origin={46,48})));
Modelica.Blocks.Sources.Constant const(k = 273.15 + 80) annotation(Placement(transformation(extent = {{-3, -3}, {3, 3}}, rotation = 180, origin={61,67})));
boundary_p( redeclare package Medium = Medium,
nPorts=1) annotation(Placement(transformation(extent={{-48,46},
{-28,66}})));
Modelica.Blocks.Sources.Constant SetTemp(k=273.15 + 80) annotation (Placement(
transformation(
extent={{-7,-7},{7,7}},
rotation=180,
origin={65,69})));
AixLib.Fluid.FixedResistances.PressureDrop pipe(
redeclare package Medium = Medium,
m_flow_nominal=0.5,
dp_nominal=200)
annotation (Placement(transformation(extent={{12,-12},{32,8}})));
annotation (Placement(transformation(extent={{18,-34},{38,-14}})));
AixLib.Fluid.FixedResistances.HydraulicResistance
hydraulicResistance(zeta = 1000,
redeclare package Medium = Medium,
diameter=0.05,
m_flow_nominal=0.001) annotation(Placement(transformation(extent={{46,-12},
{66,8}})));
m_flow_nominal=0.001) annotation(Placement(transformation(extent={{46,-34},
{66,-14}})));
AixLib.Fluid.Sources.Boundary_ph
boundary_ph1(use_p_in = true, h = 0.8e5,
nPorts=1,
redeclare package Medium = Medium) annotation(Placement(transformation(extent={{-66,-22},
{-46,-2}})));
redeclare package Medium = Medium) annotation(Placement(transformation(extent={{-66,-44},
{-46,-24}})));
Modelica.Blocks.Sources.Ramp ramp(duration = 1000, height = 0.00001e5,
offset=101325) annotation(Placement(transformation(extent={{-96,-14},
{-76,6}})));
offset=101325) annotation(Placement(transformation(extent={{-96,-36},
{-76,-16}})));
AixLib.Fluid.Sources.Boundary_pT
boundary_ph2(nPorts=1, redeclare package Medium = Medium)
annotation(Placement(transformation(extent = {{10, -10}, {-10, 10}}, rotation = 180, origin={-38,56})));
annotation(Placement(transformation(extent = {{10, -10}, {-10, 10}}, rotation = 180, origin={-38,34})));
AixLib.Fluid.FixedResistances.PressureDrop pipe1(
redeclare package Medium = Medium,
m_flow_nominal=0.5,
dp_nominal=200)
annotation (Placement(transformation(extent={{-36,-22},{-16,-2}})));
annotation (Placement(transformation(extent={{-36,-44},{-16,-24}})));
AixLib.Fluid.HeatExchangers.Heater_T hea(
redeclare package Medium = Medium,
m_flow_nominal=0.01,
dp_nominal=0)
annotation (Placement(transformation(extent={{42,68},{22,88}})));
annotation (Placement(transformation(extent={{42,46},{22,66}})));
AixLib.Fluid.Movers.FlowControlled_dp pump(redeclare package Medium = Medium,
m_flow_nominal=pipe1.m_flow_nominal) annotation (Placement(transformation(
extent={{10,10},{-10,-10}},
rotation=90,
origin={2,42})));
Modelica.Blocks.Sources.Constant dpSet(k=40000)
"Constant set pressure difference for pump" annotation (Placement(
transformation(
extent={{-7,-7},{7,7}},
rotation=180,
origin={37,27})));
equation
connect(booleanExpression.y, pump.IsNight) annotation(Line(points={{35,48},{
24,48},{24,60},{16.2,60}}, color = {255, 0, 255}));
connect(pipe.port_b, hydraulicResistance.port_a) annotation(Line(points={{32,-2},
{46,-2}}, color = {0, 127, 255}));
connect(ramp.y, boundary_ph1.p_in) annotation(Line(points={{-75,-4},{-68,-4}}, color = {0, 0, 127}));
connect(pipe.port_b, hydraulicResistance.port_a) annotation(Line(points={{38,-24},
{46,-24}}, color = {0, 127, 255}));
connect(ramp.y, boundary_ph1.p_in) annotation(Line(points={{-75,-26},{-68,-26}}, color = {0, 0, 127}));
connect(boundary_ph1.ports[1], pipe1.port_a) annotation (Line(
points={{-46,-12},{-36,-12}},
points={{-46,-34},{-36,-34}},
color={0,127,255}));
connect(boundary_p.ports[1], pump.port_a) annotation (Line(
points={{-28,78},{6,78},{6,70}},
color={0,127,255}));
connect(pump.port_a, hea.port_b) annotation (Line(points={{6,70},{6,70},{6,78},
{6,78},{22,78}}, color={0,127,255}));
connect(hydraulicResistance.port_b, hea.port_a) annotation (Line(points={{66,
-2},{80,-2},{80,78},{42,78}}, color={0,127,255}));
connect(const.y, hea.TSet) annotation (Line(points={{57.7,67},{52,67},{52,86},
{44,86}}, color={0,0,127}));
connect(hydraulicResistance.port_b, hea.port_a) annotation (Line(points={{66,-24},
{80,-24},{80,56},{42,56}}, color={0,127,255}));
connect(SetTemp.y, hea.TSet) annotation (Line(points={{57.3,69},{52,69},{52,
64},{44,64}}, color={0,0,127}));
connect(boundary_ph2.ports[1], bufferStorage.fluidportTop2) annotation (Line(
points={{-28,56},{-9.75,56},{-9.75,38.15}}, color={0,127,255}));
connect(bufferStorage.fluidportBottom2, pipe1.port_b) annotation (Line(points=
{{-9.45,7.85},{-9.45,-2},{-10,-2},{-10,-12},{-16,-12}}, color={0,127,
points={{-28,34},{-9.75,34},{-9.75,16.15}}, color={0,127,255}));
connect(bufferStorage.fluidportBottom2, pipe1.port_b) annotation (Line(points={{-9.45,
-14.15},{-9.45,-24},{-10,-24},{-10,-34},{-16,-34}}, color={0,127,
255}));
connect(pipe.port_a, bufferStorage.portHC1Out) annotation (Line(points={{12,
-2},{14,-2},{14,26.9},{6.15,26.9}}, color={0,127,255}));
connect(pump.port_b, bufferStorage.portHC1In) annotation (Line(points={{6,50},
{6,44},{12,44},{12,31.55},{6.3,31.55}}, color={0,127,255}));
connect(pipe.port_a, bufferStorage.portHC1Out) annotation (Line(points={{18,-24},
{18,4.9},{6.15,4.9}}, color={0,127,255}));
connect(fixedTemperature.port, bufferStorage.heatportOutside) annotation (
Line(points={{-36,22},{-28,22},{-28,23.9},{-17.7,23.9}}, color={191,0,0}));
Line(points={{-36,0},{-28,0},{-28,1.9},{-17.7,1.9}}, color={191,0,0}));
connect(pump.port_b, bufferStorage.portHC1In) annotation (Line(points={{2,32},
{2,26},{14,26},{14,9.55},{6.3,9.55}}, color={0,127,255}));
connect(pump.port_a, hea.port_b)
annotation (Line(points={{2,52},{2,56},{22,56}}, color={0,127,255}));
connect(boundary_p.ports[1], pump.port_a) annotation (Line(points={{-28,56},{
-18,56},{-18,58},{0,58},{0,52},{2,52}}, color={0,127,255}));
connect(dpSet.y, pump.dp_in) annotation (Line(points={{29.3,27},{30,27},{30,
28},{24,28},{24,42},{14,42}}, color={0,0,127}));
annotation (experiment(Tolerance=1e-6, StopTime=86400, Interval=60),
__Dymola_Commands(file="modelica://AixLib/Resources/Scripts/Dymola/Fluid/Storage/Examples/StorageBoiler.mos" "Simulate and plot"),
Documentation(info = "<html><h4>
<span style=\"color:#008000\">Overview</span>
</h4>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
within AixLib.Fluid.Storage.Examples;
model BufferStorage
model StorageDetailedExample "Simple usage example for StorageDetailed"

extends Modelica.Icons.Example;
import AixLib;
replaceable package Medium =
Modelica.Media.Water.ConstantPropertyLiquidWater
constrainedby Modelica.Media.Interfaces.PartialMedium;
AixLib.Fluid.Storage.BufferStorage bufferStorage(
AixLib.Fluid.Storage.StorageDetailed bufferStorage(
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
massDynamics=Modelica.Fluid.Types.Dynamics.SteadyStateInitial,
m1_flow_nominal=const.k,
Expand Down Expand Up @@ -74,7 +74,8 @@ model BufferStorage
equation
connect(boundary.m_flow_in, const.y)
annotation (Line(points={{34,38},{34,38},{51,38}}, color={0,0,127}));
connect(boundary1.ports[1], bufferStorage.fluidportTop2) annotation (Line(points={{-34,46},{-14,46},{-14,24.12},{-13.125,24.12}}, color={0,127,255}));
connect(boundary1.ports[1], bufferStorage.fluidportTop2) annotation (Line(points={{-34,46},
{-14,46},{-14,24.12},{-13.125,24.12}}, color={0,127,255}));
connect(bufferStorage.fluidportTop1, boundary.ports[1]) annotation (Line(points={{-6.5,24.12},{-6.5,45.06},{12,45.06},{12,46}}, color={0,127,255}));
connect(bufferStorage.fluidportBottom1, boundary_ph5.ports[1]) annotation (Line(points={{-6.625,-0.24},{-6.625,-20.12},{2,-20.12},{2,-20}}, color={0,127,255}));
connect(boundary2.ports[1], bufferStorage.fluidportBottom2) annotation (Line(points={{-36,-20},{-14,-20},{-14,-0.12},{-12.875,-0.12}}, color={0,127,255}));
Expand All @@ -85,7 +86,7 @@ equation
Icon(coordinateSystem(preserveAspectRatio=false)),
Diagram(coordinateSystem(preserveAspectRatio=false)),
experiment(Tolerance=1e-6, StopTime=86400, Interval=60),
__Dymola_Commands(file="modelica://AixLib/Resources/Scripts/Dymola/Fluid/Storage/Examples/BufferStorage.mos" "Simulate and plot"),
__Dymola_Commands(file="modelica://AixLib/Resources/Scripts/Dymola/Fluid/Storage/Examples/StorageDetailedExample.mos" "Simulate and plot"),
Documentation(info="<html><p>
<b><span style=\"color: #008000;\">Overview</span></b>
</p>
Expand All @@ -104,4 +105,4 @@ equation
</li>
</ul>
</html>"));
end BufferStorage;
end StorageDetailedExample;

0 comments on commit 4f46a9a

Please sign in to comment.