Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue1287 DHW model #1355

Merged
merged 71 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
1942e4d
extends from ObsoleteModel icon to indicate depreciated models
lucasverleyen Mar 26, 2024
e1a2337
add partial tap model in new base classes package
lucasverleyen Mar 26, 2024
841d68e
add block operator for DHW comfort/discomfort
lucasverleyen Mar 26, 2024
9715494
update documentation for partial model
lucasverleyen Mar 26, 2024
0c46ebc
add new tap model (adopted from depreciated model)
lucasverleyen Mar 26, 2024
46dd6f9
add more updates
lucasverleyen Mar 26, 2024
ad2f71f
add depreciated icons to interfaces package and old example
lucasverleyen Mar 26, 2024
3e4e0e8
update documentation
lucasverleyen Mar 26, 2024
6b5921f
add example for Tap model
lucasverleyen Mar 26, 2024
fccb76d
add explicit boolean connector for dhw comfort/discomfort
lucasverleyen Mar 26, 2024
36598c7
first version of tap profile model
lucasverleyen Mar 27, 2024
780922a
add two example DHW profiles
lucasverleyen Mar 27, 2024
afdd6df
add readme file for DHW profiles
lucasverleyen Mar 27, 2024
6fc0950
improvements md file
lucasverleyen Mar 27, 2024
278bdeb
improve documentation
lucasverleyen Mar 27, 2024
648b720
add combitimetable to read profile
lucasverleyen Mar 27, 2024
cdd4021
rename mFlo to m_flow for consistent naming
lucasverleyen Mar 27, 2024
dfa0016
change default m_flow_nominal
lucasverleyen Mar 27, 2024
2745ef0
add example for TapProfile
lucasverleyen Mar 27, 2024
9540513
remove old unit tests (depreciated model)
lucasverleyen Mar 27, 2024
13b8fb1
add mos files for new unit tests
lucasverleyen Mar 27, 2024
1cd185c
update second mos file
lucasverleyen Mar 27, 2024
205610e
add reference results
lucasverleyen Mar 27, 2024
3d14965
remove max argument of TSet
lucasverleyen May 16, 2024
919cdff
change m flow nominal
lucasverleyen May 16, 2024
a3851b7
extend from partial two port interface
lucasverleyen May 16, 2024
523b3a0
remove m flow nominal parameter as already present in partial two por…
lucasverleyen May 16, 2024
9ad3eec
details
lucasverleyen May 16, 2024
f2b76ce
set final parameters
lucasverleyen May 16, 2024
79ea16b
naming conventions
lucasverleyen May 16, 2024
5142a77
naming conventions
lucasverleyen May 16, 2024
eb614f9
change mixing volume to bou pt's
lucasverleyen May 16, 2024
64165d2
update documentation and order in text file
lucasverleyen May 16, 2024
cf19c19
add second mFloSou to partial model to avoid singularities
lucasverleyen May 16, 2024
0e3c739
update tap model model accordingly
lucasverleyen May 16, 2024
0d2bb77
update tapProfile accordingly
lucasverleyen May 16, 2024
a4fcee7
update examples
lucasverleyen May 16, 2024
c01c7cb
update names in mos files
lucasverleyen May 16, 2024
fbe9a64
update reference results
lucasverleyen May 16, 2024
60e1d8a
Merge branch 'master' into issue1287_DHWmodel
lucasverleyen Jun 3, 2024
a2bc170
include steady state T sensor in partial model
lucasverleyen Jun 3, 2024
f00feab
update examples accordingly
lucasverleyen Jun 3, 2024
6a39f5a
update unit test mos files to new names
lucasverleyen Jun 3, 2024
1cb5a4a
update reference results
lucasverleyen Jun 3, 2024
a2e89bc
indentations and line lengths
lucasverleyen Jun 3, 2024
aba9a79
naming convention
lucasverleyen Jun 3, 2024
387d286
update naming
lucasverleyen Jun 3, 2024
af1c009
Merge remote-tracking branch 'origin/master' into issue1287_DHWmodel
lucasverleyen Jun 10, 2024
dced785
correction
lucasverleyen Jul 1, 2024
258d1a5
corrections documentation
lucasverleyen Jul 1, 2024
ca79103
improve default temperature declarations
lucasverleyen Jul 1, 2024
f640dea
remove medium declaration
lucasverleyen Jul 1, 2024
76c8422
change naming
lucasverleyen Jul 1, 2024
a4f19b0
specify occupants
lucasverleyen Jul 1, 2024
7b8ca79
flip icons
lucasverleyen Jul 1, 2024
8b0a799
improve icon
lucasverleyen Jul 25, 2024
e14bcb9
add final prefixes
lucasverleyen Jul 25, 2024
fdb05c3
take fluid sources from IDEAS library (and not from MSL)
lucasverleyen Jul 25, 2024
1ce018c
change mFloDis into mFloDisCom
lucasverleyen Jul 25, 2024
4869a23
line formatting
lucasverleyen Jul 25, 2024
b61fd7a
switch order in equation
lucasverleyen Jul 25, 2024
1c66d8f
change name
lucasverleyen Jul 25, 2024
ad73c4b
change name
lucasverleyen Jul 25, 2024
c0d61bb
update docstring
lucasverleyen Jul 26, 2024
3aee36a
Use smooth expression for hot water mass flow rate and add documentat…
jelgerjansen Sep 10, 2024
4339d8a
Add missing documentation for components and renamed "domestichotwate…
jelgerjansen Sep 10, 2024
1e774bd
Update scripts and add to annotation as a Dymola command
jelgerjansen Sep 10, 2024
d9ab9ac
Merge branch 'master' into issue1287_DHWmodel
lucasverleyen Oct 16, 2024
b28d869
improve documentation
lucasverleyen Oct 16, 2024
e70cbe1
add discomfort calculation
lucasverleyen Oct 16, 2024
115dfa1
update reference results
lucasverleyen Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
240 changes: 240 additions & 0 deletions IDEAS/Fluid/Taps/BaseClasses/PartialTap.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
within IDEAS.Fluid.Taps.BaseClasses;
partial model PartialTap "Partial model for a (DHW) tap"

parameter Modelica.Units.SI.Temperature TSet(max=273.15 + 60) = 273.15 +
45 "Temperature setpoint of DHW at tap";
parameter Modelica.Units.SI.Temperature TCold=273.15 + 10
"Temperature of cold water";

parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=0.05
"Nominal mass flow rate";

protected
Modelica.Units.SI.MassFlowRate m_flow_Set "DHW mass flow rate at TSet";

public
replaceable package Medium = Modelica.Media.Interfaces.PartialMedium annotation (
choicesAllMatching=true);

Modelica.Fluid.Interfaces.FluidPort_a port_hot(redeclare package Medium = Medium)
annotation (Placement(transformation(extent={{-110,-10},{-90,10}}),
iconTransformation(extent={{-110,-10},{-90,10}})));
Modelica.Fluid.Interfaces.FluidPort_b port_cold(redeclare package Medium = Medium)
annotation (Placement(transformation(extent={{90,-10},{110,10}})));

IDEAS.Fluid.Interfaces.IdealSource idealSource(
redeclare package Medium = Medium,
control_m_flow=true,
allowFlowReversal=false,
control_dp=false)
annotation (Placement(transformation(extent={{20,-10},{40,10}})));
IDEAS.Fluid.MixingVolumes.MixingVolume vol(
redeclare package Medium = Medium,
allowFlowReversal=false,
m_flow_nominal=m_flow_nominal,
nPorts=2,
final energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
final massDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
V=1) "Mixing volume for heat injection"
annotation (Placement(transformation(extent={{60,0},{80,-20}})));

Modelica.Thermal.HeatTransfer.Sources.PrescribedTemperature preTem
annotation (Placement(transformation(extent={{20,-50},{40,-30}})));
Modelica.Blocks.Sources.RealExpression TCold_expr(y=TCold)
annotation (Placement(transformation(extent={{-20,-50},{0,-30}})));

Modelica.Blocks.Sources.RealExpression m_flow_Discomfort(y=m_flow_Set)
"DHW mass flow rate if THot < TSet. If the temperature of the hot water supply
is lower than the set point temperature of the DHW, the mass flow from the tank
to the tap equals the mass flow rate at the set point temperature. In this case,
the user will experience discomfort at the tap."
annotation (Placement(transformation(extent={{-40,30},{-20,50}})));
Modelica.Blocks.Sources.RealExpression m_flow_Comfort(y=m_flow_Set*(TSet-TCold)/(
deltaT_for_scaling.y))
"Required mass flow rate from the tank based on current THot. If THot > TSet
mixing will occur and cold water will be mixed with hot water from the tank.
m_flow_Comfort is the required mass flow rate from the tank at Thot and is related
to m_flow_Set at TSet via conservation of energy."
annotation (Placement(transformation(extent={{-40,10},{-20,30}})));
IDEAS.Utilities.Math.SmoothMin m_flow_Hot(deltaX=1e-3*m_flow_nominal)
"Hot water mass flow rate. If THot > TSet, m_flow_Hot = m_flow_Comfort.
If THot < TSet, m_flow_Hot = m_flow_Discomfort."
annotation (Placement(transformation(extent={{0,20},{20,40}})));

Modelica.Blocks.Sources.RealExpression deltaT(y=THot - TCold) "THot-TCold"
annotation (Placement(transformation(extent={{-40,80},{-20,100}})));
Modelica.Blocks.Sources.RealExpression deltaT_min(y=0.1)
"Minimal value of the temperature difference, to avoid division by zero."
annotation (Placement(transformation(extent={{-40,60},{-20,80}})));
IDEAS.Utilities.Math.SmoothMax deltaT_for_scaling(deltaX=0.1)
annotation (Placement(transformation(extent={{0,70},{20,90}})));

Modelica.Blocks.Interfaces.RealInput THot(
each final quantity="ThermodynamicTemperature",
each unit="K",
each displayUnit="degC",
each min=0)
"Temperature measurement of domestic hot water supply (e.g. temperature in DHW storage tank)"
annotation (Placement(transformation(
extent={{-20,-20},{20,20}},
rotation=0,
origin={-100,70}),
iconTransformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-100,70})));
Modelica.Blocks.Logical.GreaterEqualThreshold comfort(threshold=TSet)
"Block operator to check whether there is DHW comfort or not. True = comfort, false = discomfort."
annotation (Placement(transformation(extent={{-80,40},{-60,60}})));
Modelica.Blocks.Interfaces.BooleanOutput DHW_comfort
"Boolean output signal to indicate whether there is DHW comfort (true) or discomfort (false)"
annotation (Placement(transformation(extent={{90,60},{110,80}})));
equation
connect(preTem.port, vol.heatPort) annotation (Line(
points={{40,-40},{60,-40},{60,-10}},
color={191,0,0},
smooth=Smooth.None));
connect(TCold_expr.y, preTem.T) annotation (Line(
points={{1,-40},{18,-40}},
color={0,0,127},
smooth=Smooth.None));
connect(m_flow_Hot.y, idealSource.m_flow_in) annotation (Line(
points={{21,30},{24,30},{24,8}},
color={0,0,127},
smooth=Smooth.None));
connect(idealSource.port_b, vol.ports[1]) annotation (Line(points={{40,0},{69,0}}, color={0,127,255}));
connect(vol.ports[2], port_cold) annotation (Line(points={{71,0},{100,0}}, color={0,127,255}));
connect(m_flow_Comfort.y, m_flow_Hot.u2) annotation (Line(points={{-19,20},{-10,20},
{-10,24},{-2,24}}, color={0,0,127}));
connect(m_flow_Discomfort.y, m_flow_Hot.u1) annotation (Line(points={{-19,40},{-10,
40},{-10,36},{-2,36}},
color={0,0,127}));
connect(deltaT.y, deltaT_for_scaling.u1) annotation (Line(points={{-19,90},{
-12,90},{-12,86},{-2,86}},
color={0,0,127}));
connect(deltaT_min.y, deltaT_for_scaling.u2) annotation (Line(points={{-19,70},
{-10,70},{-10,74},{-2,74}}, color={0,0,127}));

connect(idealSource.port_a, port_hot)
annotation (Line(points={{20,0},{-100,0}}, color={0,127,255}));
connect(THot, comfort.u) annotation (Line(points={{-100,70},{-92,70},{-92,50},
{-82,50}}, color={0,0,127}));
connect(comfort.y, DHW_comfort) annotation (Line(points={{-59,50},{-50,50},{
-50,60},{80,60},{80,70},{100,70}}, color={255,0,255}));
annotation (
Diagram(coordinateSystem(extent={{-100,-100},{100,100}}, preserveAspectRatio=false)),
Icon(coordinateSystem(extent={{-100,-100},{100,100}}, preserveAspectRatio=
false), graphics={
Line(
points={{0,40},{0,0}},
color={0,0,0},
thickness=1),
Line(
points={{-20,0},{20,0}},
color={244,125,35},
thickness=1),
Polygon(
points={{-80,20},{-80,-20},{-20,20},{-20,-20},{-80,20}},
lineColor={238,46,47},
fillColor={238,46,47},
fillPattern=FillPattern.Solid,
lineThickness=1),
Polygon(
points={{20,20},{20,-20},{80,20},{80,-20},{20,20}},
lineColor={28,108,200},
fillColor={28,108,200},
fillPattern=FillPattern.Solid,
lineThickness=1),
Line(
points={{-90,0},{-80,0}},
color={238,46,47},
thickness=1),
Line(
points={{80,0},{90,0}},
color={28,108,200},
thickness=1),
Polygon(
points={{-20,40},{20,40},{12,80},{-12,80},{-20,40}},
lineColor={0,0,0},
fillColor={240,240,240},
fillPattern=FillPattern.Solid,
lineThickness=1),
Line(points={{-8,80},{-14,40}}, color={162,162,162}),
Line(points={{0,80},{0,78},{0,40}}, color={162,162,162}),
Line(points={{8,80},{14,40}}, color={162,162,162}),
Line(points={{-4,80},{-8,40}}, color={162,162,162}),
Line(points={{4,80},{8,40}}, color={162,162,162}),
Polygon(
points={{-70,68},{-70,48},{-76,42},{-76,32},{-70,26},{-62,26},{-56,32},
{-56,42},{-62,48},{-62,68},{-70,68}},
fillColor={238,46,47},
fillPattern=FillPattern.Solid,
pattern=LinePattern.None),
Polygon(
points={{-70,86},{-70,48},{-76,42},{-76,32},{-70,26},{-62,26},{-56,32},
{-56,42},{-62,48},{-62,86},{-66,90},{-70,86}},
lineColor={0,0,0},
lineThickness=0.5),
Line(
points={{-70,76},{-66,76}},
color={0,0,0},
thickness=0.5),
Line(
points={{-66,72},{-70,72}},
color={0,0,0},
thickness=0.5),
Line(
points={{-66,68},{-70,68}},
color={0,0,0},
thickness=0.5),
Line(
points={{-70,64},{-66,64}},
color={0,0,0},
thickness=0.5),
Line(
points={{-70,60},{-66,60}},
color={0,0,0},
thickness=0.5),
Line(
points={{-70,56},{-66,56}},
color={0,0,0},
thickness=0.5)}),
Documentation(info="<html>
<p><b>Description</b></p>
<p>Partial model of a domestic hot water (DHW) tap. The tap is modelled as a thermostatic mixing valve.</p>
<p>The model has two flowPorts and a realInput: </p>
<ul>
<li><i>port_hot</i>: connection to the hot water source (designation: <i>hot</i> )</li>
<li><i>port_cold</i>: connection to the inlet of cold water in the hot water source (designation: <i>cold </i>)</li>
<li><i>m_flow_Set</i>: desired flowrate of DHW water, equivalent at a user defined set point temperature</li>
</ul>
<p>The model tries to reach the given DHW flow rate at a the desired mixing temperature <i>TSet </i>by mixing the hot water with cold water. The resulting hot flowrate (<i>m_flow_Hot </i>) will be extracted automatically from the hot source (via <i>port_hot </i>). This same flow rate will be injected at <i>TCold</i> in the production system through the connection of <i>port_cold</i> to the hot source. </p>
<p><b>Assumptions and limitations </b></p>
<ol>
<li>No heat losses.</li>
<li>Inertia is foreseen through the inclusion of a water volume on the hot water side (default=1 m3). <br>This parameter is not propagated to the interface, but it can be changed by modifying vol.V. <br>Putting this water content to zero may lead to numerical problems (not tested)</li>
<li>If <i>THot</i> is smaller than <i>TSet</i>, there is no mixing and <i>TMixed</i> = <i>THot</i>.</li>
<li>Fixed <i>TSet</i> and <i>TCold </i>as parameters.</li>
<li>The mixed DHW is not available as an outlet or flowPort. It is assumed to be &apos;consumed&apos;. </li>
</ol>
<p><b>Model use</b></p>
<ol>
<li>Set the parameters for cold water supply temperature <i>TCold</i> and the DHW set temperature <i>TSet</i> (mixed).</li>
<li>Connect <i>port_hot </i>to the hot water source.</li>
<li>Connect <i>port_</i>c<i>old</i> to the cold water inlet of the hot water source.</li>
<li>Depending on the implementation: fill out the table or provide a realInput for <i>m_flow_Set.</i></li>
<li>Thanks to the use of an <a href=\"IDEAS.Fluid.Interfaces.IdealSource\">IdealSource</a> in this model, it is <b>NOT</b> required to add additional pumps, ambients or AbsolutePressure to the DHW circuit.</li>
</ol>
<p><b>Validation </b></p>
<p>The model is verified to work properly by simulation of the different operating conditions.</p>
<p><b>Examples</b></p>
<p>An example of this model is given in <a href=\"IDEAS.Fluid.Taps.Examples.DHW_example\">IDEAS.Fluid.Taps.Examples.DHW_example</a>.</p>
</html>", revisions="<html>
<ul>
<li>March 26, 2024, by Lucas Verleyen:<br>Adaptations to make the model more clear (change variable names, set allowFlowReversal=false, update icon).<br>Include a user-defined DHW setpoint temperature.<br>Add indicator for comfort or discomfort at DHW tap.<br>Update documentation. <br>See <a href=\"https://github.com/open-ideas/IDEAS/issues/1287\">#1287</a> for more information. </li>
<li>2013 June, Roel De Coninck: documentation.</li>
<li>2012 September, Roel De Coninck, simplification of equations.</li>
<li>2012 August, Roel De Coninck, first implementation.</li>
</ul>
</html>"));
end PartialTap;
5 changes: 5 additions & 0 deletions IDEAS/Fluid/Taps/BaseClasses/package.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
within IDEAS.Fluid.Taps;
package BaseClasses
extends Modelica.Icons.BasesPackage;

end BaseClasses;
1 change: 1 addition & 0 deletions IDEAS/Fluid/Taps/BaseClasses/package.order
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PartialTap
1 change: 1 addition & 0 deletions IDEAS/Fluid/Taps/Examples/DHW_example.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
within IDEAS.Fluid.Taps.Examples;
model DHW_example
extends Modelica.Icons.Example;
extends Modelica.Icons.ObsoleteModel;
BalancedTap_m_flow dHW_RealInput(
redeclare package Medium = Medium,
tau=1,
Expand Down
79 changes: 79 additions & 0 deletions IDEAS/Fluid/Taps/Examples/Tap.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
within IDEAS.Fluid.Taps.Examples;
model Tap "Example with two 'Tap' models"
extends Modelica.Icons.Example;
package Medium = IDEAS.Media.Water;

Modelica.Blocks.Sources.Pulse m_flow_Set1(
amplitude=0.1,
width=5,
period=10000,
startTime=5000,
offset=0) annotation (Placement(transformation(extent={{0,50},{20,70}})));
Modelica.Blocks.Sources.Ramp step(
startTime=86400,
height=-30,
duration=50000,
offset=273.15 + 70)
annotation (Placement(transformation(extent={{-90,-14},{-70,6}})));
IDEAS.Fluid.Taps.Tap tap1(redeclare package Medium = Medium)
annotation (Placement(transformation(extent={{20,10},{40,30}})));
IDEAS.Fluid.Taps.Tap tap2(redeclare package Medium = Medium)
annotation (Placement(transformation(extent={{20,-10},{40,-30}})));
IDEAS.Fluid.Sources.Boundary_pT bou1(
redeclare package Medium = Medium, use_T_in=true,
nPorts=2)
annotation (Placement(transformation(extent={{-60,10},{-40,-10}})));
IDEAS.Fluid.Sources.Boundary_pT bou2(redeclare package Medium = Medium,
nPorts=2)
annotation (Placement(transformation(extent={{90,10},{70,-10}})));
Modelica.Blocks.Sources.Pulse m_flow_Set2(
amplitude=0.1,
width=5,
period=10000,
startTime=2500,
offset=0) annotation (Placement(transformation(extent={{0,-70},{20,
-50}})));
IDEAS.Fluid.Sensors.TemperatureTwoPort senTem2(redeclare package Medium =
Medium, m_flow_nominal=tap2.m_flow_nominal)
annotation (Placement(transformation(extent={{-20,-10},{0,-30}})));
IDEAS.Fluid.Sensors.TemperatureTwoPort senTem1(redeclare package Medium =
Medium, m_flow_nominal=tap1.m_flow_nominal)
annotation (Placement(transformation(extent={{-20,10},{0,30}})));
equation

connect(tap1.port_cold, bou2.ports[1]) annotation (Line(points={{40,20},{58,
20},{58,1},{70,1}},
color={0,127,255}));
connect(tap2.port_cold, bou2.ports[2]) annotation (Line(points={{40,-20},{58,
-20},{58,-1},{70,-1}},
color={0,127,255}));
connect(step.y, bou1.T_in)
annotation (Line(points={{-69,-4},{-62,-4}}, color={0,0,127}));
connect(senTem1.port_b, tap1.port_hot)
annotation (Line(points={{0,20},{20,20}}, color={0,127,255}));
connect(senTem1.T, tap1.THot) annotation (Line(points={{-10,31},{-10,36},{12,
36},{12,27},{20,27}}, color={0,0,127}));
connect(senTem2.port_b, tap2.port_hot)
annotation (Line(points={{0,-20},{20,-20}}, color={0,127,255}));
connect(senTem2.T, tap2.THot) annotation (Line(points={{-10,-31},{-10,-36},{
12,-36},{12,-27},{20,-27}}, color={0,0,127}));
connect(senTem1.port_a, bou1.ports[1]) annotation (Line(points={{-20,20},{-34,
20},{-34,1},{-40,1}}, color={0,127,255}));
connect(senTem2.port_a, bou1.ports[2]) annotation (Line(points={{-20,-20},{
-34,-20},{-34,-1},{-40,-1}}, color={0,127,255}));
connect(m_flow_Set1.y, tap1.mDHWSet)
annotation (Line(points={{21,60},{30,60},{30,30}}, color={0,0,127}));
connect(m_flow_Set2.y, tap2.mDHWSet)
annotation (Line(points={{21,-60},{30,-60},{30,-30}}, color={0,0,127}));
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
coordinateSystem(preserveAspectRatio=false)),
experiment(
StopTime=259200,
Tolerance=1e-06,
__Dymola_Algorithm="Dassl"),
Documentation(revisions="<html>
<ul>
<li>March 26, 2024, by Lucas Verleyen:<br>Initial implementation.<br>See <a href=\"https://github.com/open-ideas/IDEAS/issues/1287\">#1287</a> for more information. </li>
</ul>
</html>"));
end Tap;
Loading
Loading