-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1355 from open-ideas/issue1287_DHWmodel
Issue1287 DHW model
- Loading branch information
Showing
21 changed files
with
70,624 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,213 @@ | ||
within IDEAS.Fluid.Taps.BaseClasses; | ||
partial model PartialTap "Partial model for a (DHW) tap" | ||
extends IDEAS.Fluid.Interfaces.PartialTwoPortInterface(m_flow_nominal=0.2); | ||
|
||
parameter Modelica.Units.SI.Temperature TSet=318.15 | ||
"Temperature setpoint of DHW at the tap"; | ||
parameter Modelica.Units.SI.Temperature TCol=283.15 | ||
"Temperature of cold supply water"; | ||
|
||
protected | ||
Modelica.Units.SI.MassFlowRate m_flow_set "DHW mass flow rate at TSet"; | ||
|
||
public | ||
IDEAS.Fluid.Interfaces.IdealSource mFloSouHot( | ||
redeclare final package Medium = Medium, | ||
final control_m_flow=true, | ||
final allowFlowReversal=false, | ||
final control_dp=false) | ||
"Ideal mass flow source to model the hot water offtake from the system" | ||
annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); | ||
IDEAS.Fluid.Sources.Boundary_pT bouHot( | ||
redeclare final package Medium = Medium, | ||
nPorts=1) "Sink to model the hot water offtake from the system" | ||
annotation (Placement(transformation( | ||
extent={{-10,-10},{10,10}}, | ||
rotation=90, | ||
origin={20,-30}))); | ||
Modelica.Blocks.Sources.RealExpression TCol_in(y=TCol) | ||
"Temperature of the cold water injected into the system" | ||
annotation (Placement(transformation(extent={{30,-70},{50,-50}}))); | ||
IDEAS.Fluid.Sources.Boundary_pT bouCol( | ||
redeclare final package Medium = Medium, | ||
use_T_in=true, | ||
nPorts=1) "Supply to model the cold water injection into the system" | ||
annotation (Placement(transformation( | ||
extent={{-10,-10},{10,10}}, | ||
rotation=90, | ||
origin={60,-30}))); | ||
IDEAS.Fluid.Interfaces.IdealSource mFloSouCol( | ||
redeclare final package Medium = Medium, | ||
final control_m_flow=true, | ||
final allowFlowReversal=false, | ||
final control_dp=false) | ||
"Ideal mass flow source to model the cold water injection into the system" | ||
annotation (Placement(transformation(extent={{70,-10},{90,10}}))); | ||
Modelica.Blocks.Sources.RealExpression mFloHot( | ||
y=smooth(2, if noEvent(THot.T <= TSet) then m_flow_set else m_flow_set*(TSet - TCol)/(THot.T - TCol))) | ||
"Required flow rate from the hot water source" | ||
annotation (Placement(transformation(extent={{-40,20},{-20,40}}))); | ||
IDEAS.Fluid.Sensors.TemperatureTwoPort THot( | ||
redeclare final package Medium = Medium, | ||
final allowFlowReversal=false, | ||
m_flow_nominal=m_flow_nominal, | ||
tau=0) "Temperature sensor" | ||
annotation (Placement(transformation(extent={{-90,-10},{-70,10}}))); | ||
Modelica.Blocks.Logical.GreaterEqualThreshold com(threshold=TSet) | ||
"Block operator to check whether there is DHW comfort or not. True = comfort, false = discomfort." | ||
annotation (Placement(transformation(extent={{-20,60},{0,80}}))); | ||
Modelica.Blocks.Interfaces.BooleanOutput DHWCom | ||
"Boolean output signal to indicate whether there is DHW comfort (true) or discomfort (false)" | ||
annotation (Placement(transformation(extent={{100,60},{120,80}}))); | ||
|
||
equation | ||
connect(mFloSouHot.port_b, bouHot.ports[1]) | ||
annotation (Line(points={{0,0},{20,0},{20,-20}}, color={0,127,255})); | ||
connect(TCol_in.y,bouCol. T_in) | ||
annotation (Line(points={{51,-60},{56,-60},{56,-42}}, color={0,0,127})); | ||
connect(com.y,DHWCom) | ||
annotation (Line(points={{1,70},{110,70}}, color={255,0,255})); | ||
connect(bouCol.ports[1], mFloSouCol.port_a) | ||
annotation (Line(points={{60,-20},{60,0},{70,0}}, color={0,127,255})); | ||
connect(mFloSouCol.port_b, port_b) | ||
annotation (Line(points={{90,0},{100,0}}, color={0,127,255})); | ||
connect(THot.port_a, port_a) | ||
annotation (Line(points={{-90,0},{-100,0}}, color={0,127,255})); | ||
connect(THot.port_b, mFloSouHot.port_a) | ||
annotation (Line(points={{-70,0},{-20,0}}, color={0,127,255})); | ||
connect(THot.T, com.u) | ||
annotation (Line(points={{-80,11},{-80,70},{-22,70}}, color={0,0,127})); | ||
connect(mFloHot.y, mFloSouCol.m_flow_in) | ||
annotation (Line(points={{-19,30},{74,30},{74,8}}, color={0,0,127})); | ||
connect(mFloHot.y, mFloSouHot.m_flow_in) | ||
annotation (Line(points={{-19,30},{-16,30},{-16,8}}, color={0,0,127})); | ||
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, including a cold water | ||
supply to have a closed system. The tap is modelled as a thermostatic mixing | ||
valve.</p> | ||
<p>The model has two flowPorts and a realInput: </p> | ||
<ul> | ||
<li><i>port_a</i>: connection to the hot water source (designation: <i>hot</i>)</li> | ||
<li><i>port_b</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 DHW mass flow rate, 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 flow rate (<i>mFloHot</i>) will be extracted automatically from the hot | ||
source (via <i>port_a </i>). This same flow rate will be injected at <i>TCol</i> | ||
in the production system through the connection of <i>port_b</i> to the hot | ||
source. </p> | ||
<p><b>Assumptions and limitations </b></p> | ||
<ol> | ||
<li>No heat losses.</li> | ||
<li>If <i>THot</i> is smaller than <i>TSet</i>, there is no mixing and the | ||
supply temperature at the tap equals <i>THot</i>.</li> | ||
<li>Fixed <i>TSet</i> and <i>TCol</i> as parameters.</li> | ||
<li>The mixed DHW is not available as an outlet or flowPort. It is assumed to be | ||
'consumed'. </li> | ||
</ol> | ||
<p><b>Model use</b></p> | ||
<ol> | ||
<li>Set the parameters for cold water supply temperature <i>TCol</i> and the DHW | ||
setpoint temperature <i>TSet</i> (mixed, at the tap).</li> | ||
<li>Connect <i>port_a</i> to the hot water source.</li> | ||
<li>Connect <i>port_b</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>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>Major refactoring. | ||
<br>See <a href=\"https://github.com/open-ideas/IDEAS/issues/1287\">#1287</a> for more information.</li> | ||
<li>June, 2013, by Roel De Coninck:<br>Documentation.</li> | ||
<li>September, 2012, by Roel De Coninck:<br> simplification of equations.</li> | ||
<li>August, 2012, by Roel De Coninck:<br>Initial implementation.</li> | ||
</ul> | ||
</html>")); | ||
end PartialTap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PartialTap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
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) | ||
"DHW demand (mass flow rate) for tap 1" | ||
annotation (Placement(transformation(extent={{-30,50},{-10,70}}))); | ||
Modelica.Blocks.Sources.Ramp step( | ||
startTime=86400, | ||
height=-30, | ||
duration=50000, | ||
offset=273.15 + 70) | ||
"Hot water supply temperature" | ||
annotation (Placement(transformation(extent={{-90,-14},{-70,6}}))); | ||
IDEAS.Fluid.Taps.Tap tap1(redeclare package Medium = Medium) "DHW tap 1" | ||
annotation (Placement(transformation(extent={{-10,10},{10,30}}))); | ||
IDEAS.Fluid.Taps.Tap tap2(redeclare package Medium = Medium) "DHW tap 2" | ||
annotation (Placement(transformation(extent={{-10,-30},{10,-10}}))); | ||
IDEAS.Fluid.Sources.Boundary_pT bou1( | ||
redeclare package Medium = Medium, use_T_in=true, | ||
nPorts=2) | ||
"Fluid source" | ||
annotation (Placement(transformation(extent={{-60,10},{-40,-10}}))); | ||
IDEAS.Fluid.Sources.Boundary_pT bou2(redeclare package Medium = Medium, | ||
nPorts=2) | ||
"Fluid sink" | ||
annotation (Placement(transformation(extent={{60,10},{40,-10}}))); | ||
Modelica.Blocks.Sources.Pulse m_flow_set2( | ||
amplitude=0.1, | ||
width=5, | ||
period=10000, | ||
startTime=2500, | ||
offset=0) | ||
"DHW demand (mass flow rate) for tap 2" | ||
annotation (Placement(transformation(extent={{-60,-70},{-40, | ||
-50}}))); | ||
Modelica.Blocks.Sources.RealExpression DHWDisCom1_K(y=if tap1.mFloHot.y > 0 | ||
and (tap1.TSet - tap1.THot.T) > 0 then (tap1.TSet - tap1.THot.T) else | ||
0) "Instantaneous DHW discomfort in [K] for tap1" | ||
annotation (Placement(transformation(extent={{40,70},{60,90}}))); | ||
Modelica.Blocks.Continuous.Integrator DHWDisCom1_Kh | ||
"Total DHW discomfort in [K.s] for tap1" | ||
annotation (Placement(transformation(extent={{70,70},{90,90}}))); | ||
equation | ||
|
||
connect(step.y, bou1.T_in) | ||
annotation (Line(points={{-69,-4},{-62,-4}}, color={0,0,127})); | ||
connect(m_flow_set1.y,tap1.mFloSet) | ||
annotation (Line(points={{-9,60},{0,60},{0,30}}, color={0,0,127})); | ||
connect(m_flow_set2.y,tap2.mFloSet) | ||
annotation (Line(points={{-39,-60},{-20,-60},{-20,-4},{0,-4},{0,-10}}, | ||
color={0,0,127})); | ||
connect(tap1.port_b, bou2.ports[1]) annotation (Line(points={{10,20},{30,20}, | ||
{30,1},{40,1}}, color={0,127,255})); | ||
connect(tap2.port_b, bou2.ports[2]) annotation (Line(points={{10,-20},{30,-20}, | ||
{30,-1},{40,-1}}, color={0,127,255})); | ||
connect(tap1.port_a, bou1.ports[1]) annotation (Line(points={{-10,20},{-30,20}, | ||
{-30,1},{-40,1}}, color={0,127,255})); | ||
connect(tap2.port_a, bou1.ports[2]) annotation (Line(points={{-10,-20},{-30, | ||
-20},{-30,-1},{-40,-1}}, color={0,127,255})); | ||
connect(DHWDisCom1_K.y, DHWDisCom1_Kh.u) | ||
annotation (Line(points={{61,80},{68,80}}, color={0,0,127})); | ||
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( | ||
coordinateSystem(preserveAspectRatio=false)), | ||
experiment( | ||
StopTime=259200, | ||
Tolerance=1e-06, | ||
__Dymola_Algorithm="Dassl"), | ||
__Dymola_Commands(file="modelica://IDEAS/Resources/Scripts/Dymola/Fluid/Taps/Examples/Tap.mos" | ||
"Simulate and plot"), | ||
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
within IDEAS.Fluid.Taps.Examples; | ||
model TapProfile "Example with two 'TapProfile' models" | ||
extends Modelica.Icons.Example; | ||
package Medium = IDEAS.Media.Water; | ||
|
||
IDEAS.Fluid.Taps.TapProfile tap1(redeclare package Medium = Medium) | ||
"DHW tap 1" | ||
annotation (Placement(transformation(extent={{-10,10},{10,30}}))); | ||
IDEAS.Fluid.Taps.TapProfile tap2(redeclare package Medium = Medium, loadFile= | ||
Modelica.Utilities.Files.loadResource( | ||
"modelica://IDEAS/Resources/DHW/DHW_1year_2adults_2children.txt")) | ||
"DHW tap 2" | ||
annotation (Placement(transformation(extent={{-10,-30},{10,-10}}))); | ||
IDEAS.Fluid.Sources.Boundary_pT bou1( | ||
redeclare package Medium = Medium, use_T_in=true, | ||
nPorts=2) | ||
"Fluid source" | ||
annotation (Placement(transformation(extent={{-60,10},{-40,-10}}))); | ||
IDEAS.Fluid.Sources.Boundary_pT bou2(redeclare package Medium = Medium, | ||
nPorts=2) | ||
"Fluid sink" | ||
annotation (Placement(transformation(extent={{60,10},{40,-10}}))); | ||
Modelica.Blocks.Sources.Sine sine( | ||
amplitude=10, | ||
f=1/24/3600, | ||
offset=273.15 + 45) | ||
"Hot water supply temperature" | ||
annotation (Placement(transformation(extent={{-90,-14},{-70,6}}))); | ||
equation | ||
|
||
connect(sine.y, bou1.T_in) | ||
annotation (Line(points={{-69,-4},{-62,-4}}, color={0,0,127})); | ||
connect(tap1.port_b, bou2.ports[1]) annotation (Line(points={{10,20},{30,20}, | ||
{30,1},{40,1}}, color={0,127,255})); | ||
connect(tap2.port_b, bou2.ports[2]) annotation (Line(points={{10,-20},{30,-20}, | ||
{30,-1},{40,-1}}, color={0,127,255})); | ||
connect(tap1.port_a, bou1.ports[1]) annotation (Line(points={{-10,20},{-30,20}, | ||
{-30,1},{-40,1}}, color={0,127,255})); | ||
connect(tap2.port_a, bou1.ports[2]) annotation (Line(points={{-10,-20},{-30,-20}, | ||
{-30,-1},{-40,-1}}, color={0,127,255})); | ||
annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram( | ||
coordinateSystem(preserveAspectRatio=false)), | ||
experiment( | ||
StopTime=864000, | ||
Tolerance=1e-06, | ||
__Dymola_Algorithm="Dassl"), | ||
__Dymola_Commands(file="modelica://IDEAS/Resources/Scripts/Dymola/Fluid/Taps/Examples/TapProfile.mos" | ||
"Simulate and plot"), | ||
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 TapProfile; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
Tap | ||
TapProfile | ||
DHW_example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
within IDEAS.Fluid.Taps; | ||
package Interfaces | ||
extends Modelica.Icons.InterfacesPackage; | ||
package Interfaces | ||
extends Modelica.Icons.InterfacesPackage; | ||
|
||
extends Modelica.Icons.ObsoleteModel; | ||
end Interfaces; |
Oops, something went wrong.