Skip to content

Commit

Permalink
Revised models
Browse files Browse the repository at this point in the history
  • Loading branch information
mwetter committed Sep 29, 2023
1 parent 30fa9b4 commit 5d2d4e3
Show file tree
Hide file tree
Showing 4 changed files with 171 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ model DirectHeatExchangerWithAuxHeat
dp_nominal=dpEle_nominal,
QMax_flow=QMax_flow)
if have_eleHea == true "Supplemental electric resistance domestic hot water heater"
annotation (Placement(transformation(extent={{10,16},{30,-4}})));
annotation (Placement(transformation(extent={{10,-50},{30,-30}})));
Buildings.Fluid.Sensors.TemperatureTwoPort senTemHot(redeclare package Medium =
Medium, m_flow_nominal=mHotSou_flow_nominal)
"Temperature sensor for hot water supply"
annotation (Placement(transformation(extent={{60,-4},{80,16}})));
annotation (Placement(transformation(extent={{58,50},{78,70}})));
Fluid.HeatExchangers.ConstantEffectiveness hex(
redeclare package Medium1 = Medium,
redeclare package Medium2 = Medium,
Expand All @@ -28,11 +28,11 @@ model DirectHeatExchangerWithAuxHeat
dp1_nominal=dpHotSou_nominal,
dp2_nominal=dpDis_nominal,
eps=eps) "Domestic hot water heater heat exchanger"
annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
annotation (Placement(transformation(extent={{-80,-64},{-60,-44}})));
Fluid.Sensors.TemperatureTwoPort senTemHexOut(redeclare package Medium =
Medium, m_flow_nominal=mHotSou_flow_nominal)
"Temperature sensor for hot water leaving heat exchanger"
annotation (Placement(transformation(extent={{-40,-4},{-20,16}})));
annotation (Placement(transformation(extent={{-38,-50},{-18,-30}})));
parameter Modelica.Units.SI.PressureDifference dpHotSou_nominal=0
"Pressure difference in heat exchanger on hot water side";
parameter Modelica.Units.SI.PressureDifference dpDis_nominal=0
Expand All @@ -47,33 +47,37 @@ protected
redeclare final package Medium = Medium,
final m_flow_nominal=mHotSou_flow_nominal,
final show_T=false) if have_eleHea == false "Pipe without electric resistance"
annotation (Placement(transformation(extent={{10,44},{30,24}})));
annotation (Placement(transformation(extent={{10,10},{30,-10}})));

equation
connect(senTemHexOut.port_a, hex.port_b1)
annotation (Line(points={{-40,6},{-60,6}}, color={0,127,255}));
annotation (Line(points={{-38,-40},{-50,-40},{-50,-48},{-60,-48}},
color={0,127,255}));
connect(senTemHexOut.port_b, heaEle.port_a)
annotation (Line(points={{-20,6},{10,6}}, color={0,127,255}));
connect(senTemHexOut.port_b, pip.port_a) annotation (Line(points={{-20,6},{0,
6},{0,34},{10,34}}, color={0,127,255}));
annotation (Line(points={{-18,-40},{10,-40}},
color={0,127,255}));
connect(senTemHexOut.port_b, pip.port_a) annotation (Line(points={{-18,-40},{0,
-40},{0,0},{10,0}}, color={0,127,255}));
connect(heaEle.port_b, senTemHot.port_a)
annotation (Line(points={{30,6},{60,6}}, color={0,127,255}));
connect(pip.port_b, senTemHot.port_a) annotation (Line(points={{30,34},{40,34},
{40,6},{60,6}}, color={0,127,255}));
connect(senTemHot.port_b, port_b1) annotation (Line(points={{80,6},{90,6},{90,
60},{100,60}}, color={0,127,255}));
annotation (Line(points={{30,-40},{40,-40},{40,60},{58,60}},
color={0,127,255}));
connect(pip.port_b, senTemHot.port_a) annotation (Line(points={{30,0},{40,0},{
40,60},{58,60}},color={0,127,255}));
connect(senTemHot.port_b, port_b1) annotation (Line(points={{78,60},{100,60}},
color={0,127,255}));
connect(port_a1, hex.port_a1)
annotation (Line(points={{-100,60},{-80,60},{-80,6}}, color={0,127,255}));
connect(heaEle.Q_flow,PHea) annotation (Line(points={{31,-2},{40,-2},{40,-20},
{90,-20},{90,0},{110,0}}, color={0,0,127}));
connect(TSetHotSou, heaEle.TSet) annotation (Line(points={{-110,0},{-90,0},{-90,
-20},{0,-20},{0,-2},{8,-2}}, color={0,0,127}));
connect(hex.port_b2, port_b2) annotation (Line(points={{-80,-6},{-80,-60},{-100,
-60}}, color={0,127,255}));
connect(port_a2, hex.port_a2) annotation (Line(points={{100,-60},{-60,-60},{-60,
-6}}, color={0,127,255}));
connect(senTemHexOut.T, THexOut) annotation (Line(points={{-30,17},{-30,18},{
-12,18},{-12,-22},{96,-22},{96,-20},{110,-20}}, color={0,0,127}));
annotation (Line(points={{-100,60},{-86,60},{-86,-48},{-80,-48}},
color={0,127,255}));
connect(heaEle.Q_flow,PHea) annotation (Line(points={{31,-32},{82,-32},{82,0},
{110,0}}, color={0,0,127}));
connect(TSetHotSou, heaEle.TSet) annotation (Line(points={{-110,0},{-12,0},{-12,
-32},{8,-32}}, color={0,0,127}));
connect(hex.port_b2, port_b2) annotation (Line(points={{-80,-60},{-100,-60}},
color={0,127,255}));
connect(port_a2, hex.port_a2) annotation (Line(points={{100,-60},{-60,-60}},
color={0,127,255}));
connect(senTemHexOut.T, THexOut) annotation (Line(points={{-28,-29},{-28,-20},
{110,-20}}, color={0,0,127}));
annotation (preferredView="info",Documentation(info="<html>
<p>
This model implements a basic domestic hot water source for a
Expand Down Expand Up @@ -106,10 +110,93 @@ Initial Implementation.
extent={{-100,-100},{100,100}},
lineColor={0,0,127},
fillColor={255,255,255},
fillPattern=FillPattern.Solid), Line(
points={{-80,0},{-70,0},{-60,20},{-40,-20},{-20,20},{0,-20},{20,20},{
40,-20},{60,20},{70,0},{80,0}},
color={238,46,47},
thickness=1)}), Diagram(
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-102,62},{-72,58}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-72,30},{-68,62}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-72,34},{-20,30}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{28,62},{100,58}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={238,46,47},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{28,30},{32,62}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={238,46,47},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-104,-58},{-74,-62}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-74,-62},{-70,-30}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{26,-62},{30,-30}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={238,46,47},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{26,-58},{98,-62}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={238,46,47},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-20,34},{28,30}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={238,46,47},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-20,-30},{28,-34}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={238,46,47},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-72,-30},{-20,-34}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={0,0,127},
fillPattern=FillPattern.Solid),Rectangle(
extent={{-60,40},{20,-40}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={95,95,95},
fillPattern=FillPattern.Solid),Rectangle(
extent={{40,80},{80,40}},
lineColor={0,0,255},
pattern=LinePattern.None,
fillColor={95,95,95},
fillPattern=FillPattern.Solid,
visible=have_eleHea), Text(
extent={{-58,-8},{18,-36}},
textColor={255,255,255},
textString="eps=%eps")}),
Diagram(
coordinateSystem(preserveAspectRatio=false)));
end DirectHeatExchangerWithAuxHeat;
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ model partialHeaterAndFixture
Fluid.Sources.MassFlowSource_T souDis(
redeclare package Medium = Medium,
m_flow=mDis_flow_nominal,
T(displayUnit="degC") = TDis)
"Source of district network water" annotation (
T(displayUnit="degC") = TDis) "Source of district network water" annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={-30,-50})));
Modelica.Blocks.Sources.Constant conTSetHotSou(k=TSetHotSou)
"Temperature setpoint for domestic hot water source supplied from heater"
annotation (Placement(transformation(extent={{-100,-10},{-80,10}})));
WaterDraw loa(redeclare package Medium = Medium, mHot_flow_nominal=
mHot_flow_nominal) "Tempered water draw"
annotation (Placement(transformation(extent={{-90,-10},{-70,10}})));
WaterDraw loa(
redeclare package Medium = Medium,
mHot_flow_nominal=mHot_flow_nominal) "Tempered water draw"
annotation (Placement(transformation(extent={{40,-10},{60,10}})));
Modelica.Blocks.Sources.CombiTimeTable sch(
tableOnFile=true,
Expand All @@ -48,31 +48,35 @@ model partialHeaterAndFixture
smoothness=Modelica.Blocks.Types.Smoothness.LinearSegments,
extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic)
"Domestic hot water fixture draw fraction schedule"
annotation (Placement(transformation(extent={{100,20},{80,40}})));
annotation (Placement(transformation(extent={{40,20},{60,40}})));

Fluid.Sources.Boundary_pT sinDis(redeclare package Medium = Medium, T(
displayUnit="degC")) "Sink of district network water" annotation (
Fluid.Sources.Boundary_pT sinDis(
redeclare package Medium = Medium,
T(final unit="K",
displayUnit="degC")) "Sink of district network water" annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={-70,-50})));
Modelica.Blocks.Interfaces.RealOutput PEle
origin={-60,-50})));
Modelica.Blocks.Interfaces.RealOutput PEle(final unit="W")
"Electric power required for generation equipment"
annotation (Placement(transformation(extent={{100,70},{120,90}})));
Modelica.Blocks.Sources.Constant conTSetHot(k=TSetHot)
Modelica.Blocks.Sources.Constant conTSetHot(k(final unit="K")=TSetHot)
"Temperature setpoint for hot water supply to fixture"
annotation (Placement(transformation(extent={{-100,20},{-80,40}})));
annotation (Placement(transformation(extent={{-90,20},{-70,40}})));
equation
connect(tmv.THot,THot) annotation (Line(points={{21,6},{30,6},{30,60},{110,60}},
color={0,0,127}));
connect(loa.sch, sch.y[1])
annotation (Line(points={{61,3},{74,3},{74,30},{79,30}}, color={0,0,127}));
annotation (Line(points={{39,6},{34,6},{34,16},{70,16},{70,30},{61,30}},
color={0,0,127}));
connect(conTSetHot.y, tmv.TSet)
annotation (Line(points={{-79,30},{-2,30},{-2,8}}, color={0,0,127}));
annotation (Line(points={{-69,30},{-10,30},{-10,8},{-2,8}},
color={0,0,127}));
connect(tmv.port_hot, loa.port_hot)
annotation (Line(points={{20,0},{39.8,0}}, color={0,127,255}));
connect(tmv.port_col, souCol.ports[1]) annotation (Line(points={{0,-4},{-10,
-4},{-10,-26},{10,-26},{10,-40}}, color={0,127,255}));
annotation (Line(points={{20,0},{40,0}}, color={0,127,255}));
connect(tmv.port_col, souCol.ports[1]) annotation (Line(points={{0,-4},{-10,-4},
{-10,-26},{10,-26},{10,-40}}, color={0,127,255}));
annotation (preferredView="info",Documentation(info="<html>
<p>
Partial base class for hot water source, thermostatic mixing, and fixture load examples.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ equation

connect(gen.port_b1, tmv.port_hotsou) annotation (Line(points={{-30,6},{-10,6},
{-10,4},{0,4}}, color={0,127,255}));
connect(gen.port_a1, souCol.ports[2]) annotation (Line(points={{-50,6},{-60,6},
{-60,-20},{10,-20},{10,-40}}, color={0,127,255}));
connect(gen.port_a1, souCol.ports[2]) annotation (Line(points={{-50,6},{-54,6},
{-54,-20},{10,-20},{10,-40}}, color={0,127,255}));
connect(gen.port_a2, souDis.ports[1]) annotation (Line(points={{-30,-6},{-20,
-6},{-20,-32},{-30,-32},{-30,-40}}, color={0,127,255}));
connect(gen.port_b2, sinDis.ports[1])
annotation (Line(points={{-50,-6},{-70,-6},{-70,-40}}, color={0,127,255}));
annotation (Line(points={{-50,-6},{-60,-6},{-60,-40}}, color={0,127,255}));
connect(conTSetHotSou.y, gen.TSetHotSou)
annotation (Line(points={{-79,0},{-51,0}}, color={0,0,127}));
annotation (Line(points={{-69,0},{-51,0}}, color={0,0,127}));
connect(gen.PHea, PEle) annotation (Line(points={{-29,0},{-20,0},{-20,80},{
110,80}}, color={0,0,127}));
annotation (experiment(
Expand Down
54 changes: 29 additions & 25 deletions Buildings/Experimental/DHC/Loads/HotWater/WaterDraw.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,43 @@ model WaterDraw "A model for hot water draws from fixture(s)"
replaceable package Medium = Buildings.Media.Water "Water media model";
parameter Modelica.Units.SI.MassFlowRate mHot_flow_nominal "Nominal hot water flow rate to fixture";

Modelica.Fluid.Interfaces.FluidPort_a port_hot(redeclare package Medium =
Medium) "Port for hot water supply to fixture"
annotation (Placement(transformation(extent={{-112,-10},{-92,10}})));
Modelica.Fluid.Interfaces.FluidPort_a port_hot(
redeclare package Medium = Medium) "Port for hot water supply to fixture"
annotation (Placement(transformation(extent={{-110,-10},{-90,10}}),
iconTransformation(extent={{-110,-10},{-90,10}})));
Fluid.Sources.MassFlowSource_T sinHot(
redeclare package Medium = Medium,
use_m_flow_in=true,
nPorts=1) "Sink for hot water supply"
annotation (Placement(transformation(extent={{-46,-10},{-66,10}})));
Modelica.Blocks.Math.Gain gaiDhw(k=-mHot_flow_nominal) "Gain for multiplying domestic hot water schedule"
annotation (Placement(transformation(extent={{60,10},{40,30}})));
Modelica.Blocks.Continuous.Integrator watCon(k=-1) "Integrated hot water consumption"
annotation (Placement(transformation(extent={{40,-90},{60,-70}})));
Modelica.Blocks.Interfaces.RealOutput MHot "Mass of hot water used"
annotation (Placement(transformation(extent={{100,-82},{120,-62}}),
iconTransformation(extent={{100,-82},{120,-62}})));
Modelica.Blocks.Interfaces.RealInput sch "Hot water to fixture draw fraction"
annotation (Placement(transformation(extent={{120,20},{100,40}}),
iconTransformation(extent={{120,20},{100,40}})));
Modelica.Blocks.Math.Gain gaiDhw(final k=-mHot_flow_nominal) "Gain for multiplying domestic hot water schedule"
annotation (Placement(transformation(extent={{10,-10},{-10,10}},
rotation=180,
origin={-70,60})));
Modelica.Blocks.Interfaces.RealInput sch(
final min=0,
final unit="1") "Hot water to fixture draw fraction"
annotation (Placement(transformation(extent={{10,-10},{-10,10}},
rotation=180,
origin={-110,60}),
iconTransformation(extent={{10,-10},{-10,10}},
rotation=180,
origin={-110,60})));
equation
connect(watCon.u,gaiDhw. y) annotation (Line(points={{38,-80},{20,-80},{20,20},
{39,20}}, color={0,0,127}));
connect(sch, gaiDhw.u) annotation (Line(points={{110,30},{86,30},{86,20},{62,
20}}, color={0,0,127}));
connect(sch, gaiDhw.u) annotation (Line(points={{-110,60},{-82,60}},
color={0,0,127}));
connect(port_hot, sinHot.ports[1])
annotation (Line(points={{-102,0},{-66,0}}, color={0,127,255}));
connect(sinHot.m_flow_in, gaiDhw.y) annotation (Line(points={{-44,8},{-20,8},
{-20,20},{39,20}}, color={0,0,127}));
connect(watCon.y, MHot) annotation (Line(points={{61,-80},{80,-80},{80,-72},{
110,-72}}, color={0,0,127}));
annotation (preferredView="info",Documentation(info="<html>
annotation (Line(points={{-100,0},{-66,0}}, color={0,127,255}));
connect(sinHot.m_flow_in, gaiDhw.y) annotation (Line(points={{-44,8},{-20,8},{
-20,60},{-59,60}}, color={0,0,127}));
annotation (
defaultComponentName="watDra",
Documentation(info="<html>
<p>
This model implements a hot water sink, representing a fixturs(s),
where the flow rate of hot water draw can be specified as an input fraction
This model implements a hot water sink, representing one or several fixtures.
</p>
<p>
Input to the model is the flow rate of hot water draw, specified as an input fraction
of a nominal value.
</p>
</html>", revisions="<html>
Expand Down

0 comments on commit 5d2d4e3

Please sign in to comment.