Skip to content

Commit

Permalink
Update validation models and doc
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineGautier committed Apr 27, 2023
1 parent 2a4fa24 commit bfd1e11
Show file tree
Hide file tree
Showing 37 changed files with 975 additions and 343 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ env:
# - TEST_ARG="make test-dymola PACKAGE=\"Buildings.Utilities\""
# - TEST_ARG="make test-openmodelica PACKAGE=\"Buildings.Utilities\""
# - TEST_ARG="make test-optimica PACKAGE=\"Buildings.Utilities\""
- TEST_ARG="make test-dymola PACKAGE=\"Buildings.Templates.AirHandlers\""
# - TEST_ARG="make test-dymola PACKAGE=\"Buildings.Templates.AirHandlers\""
# - TEST_ARG="make test-optimica PACKAGE=\"Buildings.Templates.AirHandlers\""
- TEST_ARG="make test-templates-optimica""
- TEST_ARG="make test-templates-optimica"

before_install:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
simulateModel("Buildings.Templates.Components.Validation.BoilerHotWater",
method="cvode",
tolerance=1e-6,
stopTime=2000.0,
resultFile="BoilerHotWater");
createPlot(id=1,
position={19, 10, 474, 390},
y={"THeaWatRet.y", "THeaWatSupSet.y", "boiTab.bus.THeaWatSup", "boiPol.bus.THeaWatSup"},
subPlot=1,
autoscale=true,
grid=true);
createPlot(id=1,
y={"boiTab.boi.Q_flow_nominal", "boiPol.boi.Q_flow_nominal", "boiTab.boi.QWat_flow", "boiPol.boi.QWat_flow"},
subPlot=2,
autoscale=true,
grid=true);
createPlot(id=1,
y={"boiTab.boi.m_flow_nominal", "boiPol.boi.m_flow_nominal", "boiTab.boi.m_flow", "boiPol.boi.m_flow"},
subPlot=3,
autoscale=true,
grid=true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
simulateModel("Buildings.Templates.Components.Validation.BoilerHotWaterRecord",
method="cvode",
tolerance=1e-6,
stopTime=2000.0,
resultFile="BoilerHotWaterRecord");
createPlot(id=1,
position={19, 10, 474, 390},
y={"per.Q_flow_nominal", "datBoiTab.per.Q_flow_nominal", "datBoiTabRed.per.Q_flow_nominal", "datBoiTabLoc.per.Q_flow_nominal"},
subPlot=1,
autoscale=true,
grid=true);
createPlot(id=1,
y={"per.effCur[4, 11]", "datBoiTab.per.effCur[4, 11]", "datBoiTabRed.per.effCur[4, 11]", "datBoiTabLoc.per.effCur[4, 11]"},
subPlot=2,
autoscale=true,
grid=true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
simulateModel("Buildings.Templates.Components.Validation.PumpMultipleRecord",
method="cvode",
tolerance=1e-6,
stopTime=2000.0,
resultFile="PumpMultipleRecord");
createPlot(id=1,
position={19, 10, 476, 550},
y={"V_flow_nominal[1]", "V_flow_nominal[2]"},
subPlot=1,
autoscale=true,
grid=true);
createPlot(id=1,
y={"datDef.per[1].pressure.V_flow[2]", "datDef.per[2].pressure.V_flow[2]"},
subPlot=2,
autoscale=true,
grid=true);
createPlot(id=1,
y={"datRed.per[1].pressure.V_flow[2]", "datRed.per[2].pressure.V_flow[2]"},
subPlot=3,
autoscale=true,
grid=true);
createPlot(id=1,
y={"datAss.per[1].pressure.V_flow[2]", "datAss.per[2].pressure.V_flow[2]"},
subPlot=4,
autoscale=true,
grid=true);
createPlot(id=1,
y={"datPre.per[1].pressure.V_flow[2]", "datPre.per[2].pressure.V_flow[2]"},
subPlot=5,
autoscale=true,
grid=true);
33 changes: 30 additions & 3 deletions Buildings/Templates/Components/Boilers/HotWaterPolynomial.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within Buildings.Templates.Components.Boilers;
model HotWaterPolynomial "Hot water boiler"
extends Buildings.Templates.Components.Interfaces.BoilerHotWater(
model HotWaterPolynomial "Hot water boiler with efficiency described by a polynomial"
extends Buildings.Templates.Components.Interfaces.PartialBoilerHotWater(
final typMod=Buildings.Templates.Components.Types.BoilerHotWaterModel.Polynomial,
redeclare Buildings.Fluid.Boilers.BoilerPolynomial boi(
final Q_flow_nominal = dat.cap_nominal,
Expand All @@ -11,5 +11,32 @@ model HotWaterPolynomial "Hot water boiler"
annotation (
defaultComponentName="boi",
Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
coordinateSystem(preserveAspectRatio=false)),
Documentation(info="<html>
<p>
This is a model for a hot water boiler where the efficiency is computed
based on a polynomial of the firing rate and optionally of the hot water
temperature.
This model is based on
<a href=\"modelica://Buildings.Fluid.Boilers.BoilerPolynomial\">
Buildings.Fluid.Boilers.BoilerPolynomial</a>.
The user may refer to the documentation of
<a href=\"modelica://Buildings.Fluid.Boilers.UsersGuide\">
Buildings.Fluid.Boilers.UsersGuide</a>
for the modeling assumptions.
</p>
<h4>Control points</h4>
<p>
See the documentation of
<a href=\"modelica://Buildings.Templates.Components.Interfaces.BoilerHotWater\">
Buildings.Templates.Components.Interfaces.BoilerHotWater</a>.
</p>
</html>", revisions="<html>
<ul>
<li>
April 28, 2023, by Antoine Gautier:<br/>
First implementation.
</li>
</ul>
</html>"));
end HotWaterPolynomial;
40 changes: 37 additions & 3 deletions Buildings/Templates/Components/Boilers/HotWaterTable.mo
Original file line number Diff line number Diff line change
@@ -1,11 +1,45 @@
within Buildings.Templates.Components.Boilers;
model HotWaterTable "Hot water boiler"
extends Buildings.Templates.Components.Interfaces.BoilerHotWater(
model HotWaterTable "Hot water boiler with efficiency described by a table"
extends Buildings.Templates.Components.Interfaces.PartialBoilerHotWater(
final typMod=Buildings.Templates.Components.Types.BoilerHotWaterModel.Table,
redeclare Buildings.Fluid.Boilers.BoilerTable boi(final per=dat.per));

annotation (
defaultComponentName="boi",
Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)));
coordinateSystem(preserveAspectRatio=false)),
Documentation(info="<html>
<p>
This is a model for a hot water boiler where the efficiency is computed
based on a lookup table indexed by the firing rate and the inlet temperature.
This model is based on
<a href=\"modelica://Buildings.Fluid.Boilers.BoilerTable\">
Buildings.Fluid.Boilers.BoilerTable</a>.
The user may refer to the documentation of
<a href=\"modelica://Buildings.Fluid.Boilers.UsersGuide\">
Buildings.Fluid.Boilers.UsersGuide</a>
for the modeling assumptions.
</p>
<h4>Control points</h4>
<p>
See the documentation of
<a href=\"modelica://Buildings.Templates.Components.Interfaces.BoilerHotWater\">
Buildings.Templates.Components.Interfaces.BoilerHotWater</a>.
</p>
<h4>Model parameters</h4>
<p>
The design parameters and the efficiency table are specified with an instance of
<a href=\"modelica://Buildings.Templates.Components.Data.BoilerHotWater\">
Buildings.Templates.Components.Data.BoilerHotWater</a>.
The documentation of this record class provides further details on how to
properly parameterize the model.
</p>
</html>", revisions="<html>
<ul>
<li>
April 28, 2023, by Antoine Gautier:<br/>
First implementation.
</li>
</ul>
</html>"));
end HotWaterTable;
48 changes: 37 additions & 11 deletions Buildings/Templates/Components/Data/BoilerHotWater.mo
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ record BoilerHotWater "Data for hot water boilers"
final min=0)
"HW mass flow rate"
annotation(Dialog(group="Nominal condition"));
parameter Modelica.Units.SI.HeatFlowRate cap_nominal(
final min=0)
parameter Modelica.Units.SI.HeatFlowRate cap_nominal
"Heating capacity"
annotation(Dialog(group="Nominal condition"));
parameter Modelica.Units.SI.PressureDifference dpHeaWat_nominal(
Expand All @@ -28,15 +27,13 @@ record BoilerHotWater "Data for hot water boilers"
"HW supply temperature"
annotation(Dialog(group="Nominal condition"));

/* FIXME: The following yields a final overriding message for fue with Dymola
when redeclaring per. Open ticket at DS.
*/
replaceable parameter Buildings.Fluid.Boilers.Data.Generic per
replaceable parameter Buildings.Fluid.Boilers.Data.Generic per(fue=fue)
constrainedby Buildings.Fluid.Boilers.Data.Generic(
fue=fue,
Q_flow_nominal=cap_nominal,
Q_flow_nominal=abs(cap_nominal),
TIn_nominal=THeaWatSup_nominal -
cap_nominal/Buildings.Utilities.Psychrometrics.Constants.cpWatLiq/mHeaWat_flow_nominal,
abs(cap_nominal)/
Buildings.Utilities.Psychrometrics.Constants.cpWatLiq/
mHeaWat_flow_nominal,
m_flow_nominal=mHeaWat_flow_nominal,
dp_nominal=dpHeaWat_nominal)
"Boiler performance data"
Expand All @@ -59,14 +56,43 @@ record BoilerHotWater "Data for hot water boilers"
typMod==Buildings.Templates.Components.Types.BoilerHotWaterModel.Polynomial and
(effCur==Buildings.Fluid.Types.EfficiencyCurves.QuadraticLinear)));

annotation (Dialog(enable=
typMod==Buildings.Templates.Components.Types.ModelBoilerHotWater.Table),
annotation (
defaultComponentName="datBoi", Documentation(info="<html>
<p>
This record provides the set of sizing and operating parameters for
the classes within
<a href=\"modelica://Buildings.Templates.Components.Boilers\">
Buildings.Templates.Components.Boilers</a>.
</p>
<p>
When using the boiler model where the efficiency is based on a lookup table
(<code>typMod=Buildings.Templates.Components.Types.BoilerHotWaterModel.Table</code>),
the design values declared at the top-level are propagated by default to the
performance data record <code>per</code> under the assumption that the nominal
conditions from the performance data match the design conditions.
Redeclaring the parameter <code>per</code> allows assigning a value to the efficiency curve
without overwriting the default bindings to the design values for the other parameters.
This is the recommended approach.
Alternatively, <i>assigning</i> the parameter <code>per</code> to a local instance of a
compatible record allows completely overwriting all the parameters inside <code>per</code>.
In this case, the consistency between the design parameters and the values from the
subrecord <code>per</code> is checked and a warning is issued if the design capacity or
HW flow rate (resp. pressure drop) is higher (resp. lower) than the value from the
performance data record.
This check is performed within
<a href=\"modelica://Buildings.Templates.Components.Interfaces.PartialBoilerHotWater\">
Buildings.Templates.Components.Interfaces.PartialBoilerHotWater</a>.
The validation model
<a href=\"modelica://Buildings.Templates.Components.Validation.BoilerHotWaterRecord\">
Buildings.Templates.Components.Validation.BoilerHotWater</a>
illustrates the different use cases of this record.
</p>
</html>", revisions="<html>
<ul>
<li>
April 28, 2023, by Antoine Gautier:<br/>
First implementation.
</li>
</ul>
</html>"));
end BoilerHotWater;
71 changes: 48 additions & 23 deletions Buildings/Templates/Components/Data/PumpMultiple.mo
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
within Buildings.Templates.Components.Data;
record PumpMultiple "Record for multiple pumps models"
record PumpMultiple "Record for multiple-pump models"
extends Modelica.Icons.Record;

parameter Buildings.Templates.Components.Types.Pump typ
Expand All @@ -10,56 +10,81 @@ record PumpMultiple "Record for multiple pumps models"
start=1)
"Number of pumps"
annotation (Dialog(group="Configuration", enable=false));
parameter Modelica.Units.SI.Density rho_default=
Modelica.Media.Water.ConstantPropertyLiquidWater.d_const
"Default medium density"
annotation(Dialog(enable=false));

parameter Modelica.Units.SI.MassFlowRate m_flow_nominal[nPum](
each start=1,
each final min=0)
"Individual pump nominal mass flow rate"
"Mass flow rate - Each pump"
annotation (
Dialog(group="Pump"));
Dialog(group="Nominal condition",
enable=typ<>Buildings.Templates.Components.Types.Pump.None));
parameter Modelica.Units.SI.PressureDifference dp_nominal[nPum](
each start=0,
each final min=0)
"Total pressure rise"
annotation (Dialog(group="Pump",
"Total pressure rise - Each pump"
annotation (Dialog(group="Nominal condition",
enable=typ<>Buildings.Templates.Components.Types.Pump.None));
// To avoid missing support for zero-sized record in case of nPum=0 we use max(nPum, 1).
replaceable parameter Fluid.Movers.Data.Generic per[max(nPum, 1)]
constrainedby Buildings.Fluid.Movers.Data.Generic(
pressure(
V_flow=if typ<>Buildings.Templates.Components.Types.Pump.None then
{{0, 1, 2} * m_flow_nominal[i] / rho_default for i in 1:nPum}
else [0],
dp=if typ<>Buildings.Templates.Components.Types.Pump.None then
{{1.14, 1, 0.42} * dp_nominal[i] for i in 1:nPum}
else [0]))
"Performance data"
annotation(Dialog(group="Pump",
enable=typ<>Buildings.Templates.Components.Types.Pump.None));
replaceable parameter Fluid.Movers.Data.Generic per[max(nPum, 1)](
pressure(
V_flow=if typ<>Buildings.Templates.Components.Types.Pump.None then
{{0, 1, 2} * m_flow_nominal[i] / rho_default for i in 1:nPum} else [0],
dp=if typ<>Buildings.Templates.Components.Types.Pump.None then
{{1.14, 1, 0.42} * dp_nominal[i] for i in 1:nPum} else [0]))
constrainedby Buildings.Fluid.Movers.Data.Generic
"Performance data - Each pump"
annotation(Dialog(enable=typ<>Buildings.Templates.Components.Types.Pump.None));

parameter Modelica.Units.SI.Density rho_default=
Modelica.Media.Water.ConstantPropertyLiquidWater.d_const
"Default medium density"
annotation(Dialog(enable=false));

annotation (
defaultComponentName="datPum", Documentation(info="<html>
<p>
This record provides the set of sizing and operating parameters for
the multiple pump model
the multiple-pump model
<a href=\"modelica://Buildings.Templates.Components.Pumps.Multiple\">
Buildings.Templates.Components.Pumps.Multiple</a>.
</p>
<p>
A default pump characteristic is provided, which goes through
A default flow characteristic is provided, which goes through
the design operating point and spans over
<i>0</i> and twice the design flow rate at maximum speed.
This default characteristic is based on a least squares
polynomial fit of the characteristics from
<a href=\"modelica://Buildings.Fluid.Movers.Data.Pumps.Wilo\">
Buildings.Fluid.Movers.Data.Pumps.Wilo</a>.
The user may refer to the documentation of
<a href=\"modelica://Buildings.Fluid.HydronicConfigurations.UsersGuide.ModelParameters\">
Buildings.Fluid.HydronicConfigurations.UsersGuide.ModelParameters</a>
for further details.
Note that a default medium density is used to parameterize
the pump characteristic. So models that use this record should
overwrite this default value with the density of the medium
in use, especially in the case of a water/glycol mix.
</p>
<p>
In order to modify the default characteristic, one may use either
of the following methods.
</p>
<ul>
<li>Assign the whole subrecord <code>per</code> or
only its component <code>per.pressure</code>.
In this case the elements <code>per[i]</code> may differ one from another.
This is the recommended approach for unequally sized units
such as dedicated pumps.</li>
<li>Redeclare the component <code>per</code>.
In this case the elements <code>per[i]</code> are all equal to the redeclared
record instance.
This is the recommended approach for equally sized units
such as headered pumps.</li>
</ul>
<p>
Those various use cases are illustrated in
<a href=\"modelica://Buildings.Templates.Components.Validation.PumpMultipleRecord\">
Buildings.Templates.Components.Validation.PumpMultipleRecord</a>.
</p>
</html>"));
end PumpMultiple;
Loading

0 comments on commit bfd1e11

Please sign in to comment.