Skip to content

Commit

Permalink
Issue3379 fac mul dhw (#3381)
Browse files Browse the repository at this point in the history
* Apply facMul to dhw load and double pump dp_nominal assignments
  • Loading branch information
dhblum authored May 22, 2023
1 parent 62d7b29 commit a4fb4e9
Show file tree
Hide file tree
Showing 14 changed files with 365 additions and 125 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
within Buildings.Experimental.DHC.EnergyTransferStations.Combined;
model HeatPumpHeatExchanger
"Model of a substation with heat pump and compressor-less cooling"
model HeatPumpHeatExchanger "Model of a substation with heat pump and compressor-less cooling"
extends Buildings.Experimental.DHC.EnergyTransferStations.BaseClasses.PartialETS(
final typ=Buildings.Experimental.DHC.Types.DistrictSystemType.CombinedGeneration5,
final have_weaBus=false,
Expand Down Expand Up @@ -56,27 +55,28 @@ model HeatPumpHeatExchanger
"Pressure difference at nominal flow rate (for each flow leg)"
annotation (Dialog(group="Nominal condition"));
final parameter Modelica.Units.SI.MassFlowRate mHeaWat_flow_nominal(min=0)=
abs(QHeaWat_flow_nominal/cpBui_default/(THeaWatSup_nominal -
THeaWatRet_nominal)) "Heating water mass flow rate"
abs(QHeaWat_flow_nominal/cpBui_default/(THeaWatSup_nominal - THeaWatRet_nominal))
"Heating water mass flow rate"
annotation (Dialog(group="Nominal condition"));
final parameter Modelica.Units.SI.MassFlowRate mChiWat_flow_nominal(min=0)=
abs(QChiWat_flow_nominal/cpBui_default/(TChiWatSup_nominal -
TChiWatRet_nominal)) "Chilled water mass flow rate"
abs(QChiWat_flow_nominal/cpBui_default/(TChiWatSup_nominal - TChiWatRet_nominal))
"Chilled water mass flow rate"
annotation (Dialog(group="Nominal conditions"));
final parameter Modelica.Units.SI.MassFlowRate mEvaHotWat_flow_nominal(min=0)=
QHotWat_flow_nominal*(COPHotWat_nominal - 1)/COPHotWat_nominal/
cpSer_default/dT_nominal
"Evaporator water mass flow rate of heat pump for hot water production"
QHotWat_flow_nominal*(COPHotWat_nominal - 1)/COPHotWat_nominal/cpSer_default/dT_nominal
"Evaporator water mass flow rate of heat pump for hot water production"
annotation (Dialog(group="Nominal condition", enable=have_hotWat));
final parameter Modelica.Units.SI.MassFlowRate mSerWat_flow_nominal(min=0)=
max(proHeaWat.m2_flow_nominal + mEvaHotWat_flow_nominal, hexChi.m1_flow_nominal)
"Service water mass flow rate"
annotation (Dialog(group="Nominal condition"));
constant Modelica.Units.SI.SpecificHeatCapacity cpBui_default=
MediumBui.specificHeatCapacityCp(MediumBui.setState_pTX(p=MediumBui.p_default,
MediumBui.specificHeatCapacityCp(MediumBui.setState_pTX(
p=MediumBui.p_default,
T=MediumBui.T_default)) "Specific heat capacity of the fluid";
constant Modelica.Units.SI.SpecificHeatCapacity cpSer_default=
MediumBui.specificHeatCapacityCp(MediumSer.setState_pTX(p=MediumSer.p_default,
MediumBui.specificHeatCapacityCp(MediumSer.setState_pTX(
p=MediumSer.p_default,
T=MediumSer.T_default)) "Specific heat capacity of the fluid";
// Heat pump for heating water production
parameter Real COPHeaWat_nominal(final unit="1")
Expand Down Expand Up @@ -190,7 +190,8 @@ model HeatPumpHeatExchanger
Buildings.Experimental.DHC.EnergyTransferStations.BaseClasses.Pump_m_flow pum1HexChi(
redeclare final package Medium = MediumSer,
final m_flow_nominal=m1HexChi_flow_nominal,
final allowFlowReversal=allowFlowReversalSer)
final allowFlowReversal=allowFlowReversalSer,
dp_nominal=dp_nominal)
"Chilled water HX primary pump"
annotation (Placement(transformation(extent={{110,-350},{90,-330}})));
Buildings.Fluid.HeatExchangers.DryCoilEffectivenessNTU hexChi(
Expand Down Expand Up @@ -294,9 +295,9 @@ model HeatPumpHeatExchanger
redeclare final package Medium = MediumSer,
final m_flow_nominal=mSerWat_flow_nominal) "Flow switch box"
annotation (Placement(transformation(extent={{-10,-390},{10,-370}})));
Buildings.Experimental.DHC.EnergyTransferStations.BaseClasses.Junction bypHeaWatSup(redeclare
final package
Medium = MediumBui, final m_flow_nominal=proHeaWat.m1_flow_nominal
Buildings.Experimental.DHC.EnergyTransferStations.BaseClasses.Junction bypHeaWatSup(
redeclare final package Medium = MediumBui,
final m_flow_nominal=proHeaWat.m1_flow_nominal
*{1,-1,-1}) "Bypass heating water (supply)" annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
Expand Down Expand Up @@ -397,8 +398,8 @@ model HeatPumpHeatExchanger
MediumBui, final allowFlowReversal=allowFlowReversalBui)
"Primary heating water mass flow rate"
annotation (Placement(transformation(extent={{30,270},{50,250}})));
Buildings.Controls.OBC.CDL.Logical.TrueFalseHold enaSHW(trueHoldDuration=15*
60) if have_hotWat "Enable SHW production"
Buildings.Controls.OBC.CDL.Logical.TrueFalseHold enaSHW(
trueHoldDuration=15*60) if have_hotWat "Enable SHW production"
annotation (Placement(transformation(extent={{-140,70},{-120,90}})));
Modelica.Blocks.Sources.Constant zer1(k=0) if not have_hotWat
"Replacement variable"
Expand Down Expand Up @@ -426,7 +427,7 @@ model HeatPumpHeatExchanger
"Heat flow rate at evaporator"
annotation (Placement(transformation(extent={{-100,230},{-80,250}})));
Buildings.Experimental.DHC.EnergyTransferStations.Combined.Controls.PrimaryVariableFlow conFloEvaSHW(
final Q_flow_nominal=-QHotWat_flow_nominal*(1 + 1/COPHotWat_nominal),
final Q_flow_nominal=-QHotWat_flow_nominal*(1 - 1/COPHotWat_nominal),
final dT_nominal=-dT_nominal,
final ratFloMin=ratFloMin,
final cp=cpSer_default) if have_hotWat and have_varFloEva
Expand All @@ -440,7 +441,7 @@ model HeatPumpHeatExchanger
"Mass flow rate control"
annotation (Placement(transformation(extent={{-100,270},{-80,290}})));
Buildings.Experimental.DHC.EnergyTransferStations.Combined.Controls.PrimaryVariableFlow conFloEvaHHW(
final Q_flow_nominal=-QHeaWat_flow_nominal*(1 + 1/COPHeaWat_nominal),
final Q_flow_nominal=-QHeaWat_flow_nominal*(1 - 1/COPHeaWat_nominal),
final dT_nominal=-dT_nominal,
final ratFloMin=ratFloMin,
final cp=cpSer_default) if have_varFloEva
Expand All @@ -453,15 +454,23 @@ model HeatPumpHeatExchanger
if have_varFloEva or have_varFloCon "Heating load"
annotation (Placement(transformation(extent={{-140,270},{-120,290}})));

Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter toSub(final k=-1)
if have_hotWat "Convert to subtraction"
annotation (Placement(transformation(extent={{-80,70},{-100,90}})));
Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter toSub1(final k=-1)
if have_hotWat "Convert to subtraction"
annotation (Placement(transformation(extent={{-80,216},{-100,236}})));
equation
connect(TChiWatSupSet, conTChiWat.u_s) annotation (Line(points={{-320,0},{-200,
0},{-200,-200},{-152,-200}}, color={0,0,127}));
connect(pum1HexChi.P, PPumCooTot.u[1]) annotation (Line(points={{89,-331},{84,
-331},{84,-322},{180,-322},{180,380},{188,380}}, color={0,0,127}));
connect(PPumHeaTot.y, PPumTot.u[1]) annotation (Line(points={{212,420},{216,420},
{216,401},{218,401}}, color={0,0,127}));
{216,399.5},{218,399.5}},
color={0,0,127}));
connect(PPumCooTot.y, PPumTot.u[2]) annotation (Line(points={{212,380},{216,380},
{216,399},{218,399}}, color={0,0,127}));
{216,400.5},{218,400.5}},
color={0,0,127}));
connect(pum1HexChi.port_b, hexChi.port_a1) annotation (Line(points={{90,-340},
{10,-340}}, color={0,127,255}));
connect(pum1HexChi.m_flow_actual, mCoo_flow) annotation (Line(points={{89,-335},
Expand Down Expand Up @@ -489,7 +498,7 @@ equation
connect(senTHeaWatSup.port_b, ports_bHeaWat[1])
annotation (Line(points={{150,260},{300,260}}, color={0,127,255}));
connect(bypHeaWatRet.port_2, volHeaWatRet.ports[1]) annotation (Line(points={{90,240},
{80,240},{80,177.333}}, color={0,127,255}));
{80,240},{80,178.667}}, color={0,127,255}));
connect(bouHeaWat.ports[1], volHeaWatRet.ports[2]) annotation (Line(points={{60,160},
{60,180},{80,180}}, color={0,127,255}));
connect(ports_aChiWat[1], senMasFloChiWat.port_a) annotation (Line(points={{-300,
Expand All @@ -499,7 +508,7 @@ equation
connect(bypHeaWatRet.port_3, bypHeaWatSup.port_3)
annotation (Line(points={{100,250},{100,250}}, color={0,127,255}));
connect(volHeaWatRet.ports[3], proHeaWat.port_a1) annotation (Line(points={{80,
182.667},{80,180},{-20,180},{-20,208},{-10,208}}, color={0,127,255}));
181.333},{80,180},{-20,180},{-20,208},{-10,208}}, color={0,127,255}));
connect(proHeaWat.port_b2, volMix_b.ports[3]) annotation (Line(points={{10,
220},{262,220},{262,-360},{260,-360}}, color={0,127,255}));
connect(volMix_a.ports[3], proHeaWat.port_a2) annotation (Line(points={{-260,
Expand All @@ -510,7 +519,8 @@ equation
-200,40},{-200,217},{-12,217}},
color={0,0,127}));
connect(proHeaWat.PPum, PPumHeaTot.u[1]) annotation (Line(points={{12,214},{172,
214},{172,421},{188,421}}, color={0,0,127}));
214},{172,419.5},{188,419.5}},
color={0,0,127}));
connect(volMix_a.ports[4], proHotWat.port_a2) annotation (Line(points={{-260,
-360},{-258,-360},{-258,20},{14,20},{14,28},{10,28}}, color={0,127,
255}));
Expand All @@ -529,15 +539,20 @@ equation
connect(masFloHeaTot.y, mHea_flow)
annotation (Line(points={{292,-140},{320,-140}}, color={0,0,127}));
connect(proHotWat.mEva_flow, masFloHeaTot.u[2]) annotation (Line(points={{12,31},
{218,31},{218,-141},{268,-141}}, color={0,0,127}));
{218,31},{218,-139.5},{268,-139.5}},
color={0,0,127}));
connect(zer.y, masFloHeaTot.u[2]) annotation (Line(points={{161,360},{216,360},
{216,-144},{268,-144},{268,-141}},color={0,0,127}));
{216,-144},{268,-144},{268,-139.5}},
color={0,0,127}));
connect(proHotWat.PPum, PPumHeaTot.u[2]) annotation (Line(points={{12,34},{176,
34},{176,420},{188,420},{188,419}}, color={0,0,127}));
34},{176,420},{188,420},{188,420.5}},
color={0,0,127}));
connect(proHeaWat.mEva_flow, masFloHeaTot.u[1]) annotation (Line(points={{12,211},
{220,211},{220,-139},{268,-139}}, color={0,0,127}));
{220,211},{220,-140.5},{268,-140.5}},
color={0,0,127}));
connect(zer.y, PPumHeaTot.u[2]) annotation (Line(points={{161,360},{174,360},{
174,418},{188,418},{188,419}}, color={0,0,127}));
174,418},{188,418},{188,420.5}},
color={0,0,127}));
connect(senMasFloHeaWat.port_b, senTHeaWatRet.port_a) annotation (Line(points={{-230,
260},{-220,260},{-220,300},{10,300}}, color={0,127,255}));
connect(senTHeaWatRet.port_b, bypHeaWatRet.port_1) annotation (Line(points={{30,300},
Expand Down Expand Up @@ -576,15 +591,15 @@ equation
connect(div1.y, souColWat.m_flow_in) annotation (Line(points={{-78,-40},{-68,-40},
{-68,-32},{-50,-32}}, color={0,0,127}));
connect(senTChiWatRet.port_b, volChiWat.ports[1]) annotation (Line(points={{50,-120},
{60,-120},{60,-280},{-102.667,-280}}, color={0,127,255}));
{60,-120},{60,-280},{-101.333,-280}}, color={0,127,255}));
connect(volChiWat.ports[2], hexChi.port_a2) annotation (Line(points={{-100,
-280},{-120,-280},{-120,-320},{-20,-320},{-20,-328},{-10,-328}},
color={0,127,255}));
connect(hexChi.port_b2, senTChiWatSup.port_a) annotation (Line(points={{10,
-328},{20,-328},{20,-320},{80,-320},{80,-280},{130,-280}}, color={0,
127,255}));
connect(bouChiWat.ports[1], volChiWat.ports[3])
annotation (Line(points={{-142,-280},{-97.3333,-280}}, color={0,127,255}));
annotation (Line(points={{-142,-280},{-98.6667,-280}}, color={0,127,255}));
connect(senTChiWatSup.T, conTChiWat.u_m) annotation (Line(points={{140,-269},
{140,-220},{-140,-220},{-140,-212}}, color={0,0,127}));
connect(zer1.y, masFloHea.u2) annotation (Line(points={{-19,-240},{-8,-240},{
Expand All @@ -596,28 +611,23 @@ equation
connect(masFloHea.y, swiFlo.mPos_flow) annotation (Line(points={{0,-276},{0,
-320},{-16,-320},{-16,-376},{-12,-376}}, color={0,0,127}));
connect(proHeaWat.PHea, PHeaTot.u[1]) annotation (Line(points={{12,217},{240,217},
{240,81},{268,81}}, color={0,0,127}));
{240,79.5},{268,79.5}}, color={0,0,127}));
connect(proHotWat.PHea, PHeaTot.u[2]) annotation (Line(points={{12,37},{240,37},
{240,79},{268,79}}, color={0,0,127}));
connect(zer.y, PHeaTot.u[2]) annotation (Line(points={{161,360},{242,360},{
242,78},{268,78},{268,79}}, color={0,0,127}));
{240,80.5},{268,80.5}},
color={0,0,127}));
connect(zer.y, PHeaTot.u[2]) annotation (Line(points={{161,360},{242,360},{242,
78},{268,78},{268,80.5}}, color={0,0,127}));
connect(PHeaTot.y, PHea)
annotation (Line(points={{292,80},{320,80}}, color={0,0,127}));
connect(loaSHW, heaFloEvaSHW.u1) annotation (Line(points={{-320,-120},{-288,
-120},{-288,-36},{-164,-36},{-164,106},{-102,106}},
color={0,0,127}));
connect(proHotWat.PHea, heaFloEvaSHW.u2) annotation (Line(points={{12,37},{18,
37},{18,80},{-108,80},{-108,94},{-102,94}},
color={0,0,127}));
connect(senTHeaWatRet.T, dTHHW.u2)
annotation (Line(points={{20,311},{20,314},{2,314}}, color={0,0,127}));
connect(senTHeaWatSup.T, dTHHW.u1)
annotation (Line(points={{140,271},{140,326},{2,326}}, color={0,0,127}));
connect(senMasFloHeaWat.m_flow, capFloHHW.u) annotation (Line(points={{-240,271},
{-240,320},{-222,320}}, color={0,0,127}));
connect(proHeaWat.PHea, heaFloEvaHHW.u2) annotation (Line(points={{12,217},{
20,217},{20,226},{-110,226},{-110,234},{-102,234}},
color={0,0,127}));
connect(conFloEvaSHW.m_flow, proHotWat.m2_flow) annotation (Line(points={{-38,100},
{-16,100},{-16,31},{-12,31}}, color={0,0,127}));
connect(conFloEvaHHW.m_flow, proHeaWat.m2_flow) annotation (Line(points={{-38,240},
Expand All @@ -640,6 +650,14 @@ equation
annotation (Line(points={{-118,280},{-102,280}}, color={0,0,127}));
connect(loaHHW.y, heaFloEvaHHW.u1) annotation (Line(points={{-118,280},{-110,
280},{-110,246},{-102,246}}, color={0,0,127}));
connect(proHotWat.PHea, toSub.u) annotation (Line(points={{12,37},{18,37},{18,
80},{-78,80}}, color={0,0,127}));
connect(toSub.y, heaFloEvaSHW.u2) annotation (Line(points={{-102,80},{-108,80},
{-108,94},{-102,94}}, color={0,0,127}));
connect(proHeaWat.PHea, toSub1.u) annotation (Line(points={{12,217},{20,217},
{20,226},{-78,226}}, color={0,0,127}));
connect(toSub1.y, heaFloEvaHHW.u2) annotation (Line(points={{-102,226},{-110,
226},{-110,234},{-102,234}}, color={0,0,127}));
annotation (
defaultComponentName="ets",
Documentation(info="<html>
Expand Down Expand Up @@ -730,6 +748,14 @@ Energy, Volume 199, 15 May 2020, 117418.
revisions="<html>
<ul>
<li>
May 17, 2023, by David Blum:<br/>
Assigned dp_nominal to <code>pum1HexChi</code>.<br/>
Corrected calculation of heat pump evaporator mass flow control.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3379\">
issue 3379</a>.
</li>
<li>
February 23, 2021, by Antoine Gautier:<br/>
Refactored with subsystem models and partial ETS base class.<br/>
This is for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ model HeatPump "Base subsystem with water-to-water heat pump"
Buildings.Experimental.DHC.EnergyTransferStations.BaseClasses.Pump_m_flow pumCon(
redeclare final package Medium = Medium1,
final m_flow_nominal=m1_flow_nominal,
final allowFlowReversal=allowFlowReversal1) if have_pumCon
final allowFlowReversal=allowFlowReversal1,
dp_nominal=dp1_nominal) if have_pumCon
"Heat pump condenser water pump"
annotation (Placement(transformation(extent={{-70,-60},{-50,-40}})));
Buildings.Controls.OBC.CDL.Continuous.Sources.Constant floConNom(
Expand Down Expand Up @@ -334,6 +335,13 @@ supply temperature set point at the condenser outlet.
</html>", revisions="<html>
<ul>
<li>
May 3, 2023, by David Blum:<br/>
Assigned <code>dp_nominal</code> to condenser pump.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3379\">
issue 3379</a>.
</li>
<li>
November 16, 2022, by Michael Wetter:<br/>
Set <code>pumEva.dp_nominal</code> to correct value.
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,12 +241,16 @@ model BuildingTimeSeries
Buildings.Controls.OBC.CDL.Continuous.Add addPFan
"Sum fan power"
annotation (Placement(transformation(extent={{240,110},{260,130}})));
Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter mulQReqHea_flow(u(
final unit="W"), final k=facMul) if have_heaLoa "Scaling"
Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter mulQReqHea_flow(
u(final unit="W"),
final k=facMul) if have_heaLoa "Scaling"
annotation (Placement(transformation(extent={{272,30},{292,50}})));
Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter mulQReqCoo_flow(u(
final unit="W"), final k=facMul) if have_cooLoa "Scaling"
annotation (Placement(transformation(extent={{272,-10},{292,10}})));
Buildings.Controls.OBC.CDL.Continuous.MultiplyByParameter mulQReqHot_flow(u(final
unit="W"), final k=facMul) if have_heaLoa "Scaling"
annotation (Placement(transformation(extent={{270,-130},{290,-110}})));
protected
parameter Modelica.Units.SI.AbsolutePressure pSat_nominal=
Buildings.Utilities.Psychrometrics.Functions.saturationPressure(T_aChiWat_nominal)
Expand Down Expand Up @@ -334,9 +338,6 @@ equation
annotation (Line(points={{90.8333,46},{160,46},{160,114},{238,114}},color={0,0,127}));
connect(terUniHea.PFan,addPFan.u1)
annotation (Line(points={{90.8333,-12},{180,-12},{180,126},{238,126}},color={0,0,127}));
connect(loa.y[3], QReqHotWat_flow) annotation (Line(points={{-259,0},{40,0},{
40,-120},{320,-120}},
color={0,0,127}));
connect(disFloCoo.port_b, mulChiWatOut[1].port_a)
annotation (Line(points={{140,-260},{260,-260}}, color={0,127,255}));
connect(disFloHea.port_b, mulHeaWatOut[1].port_a)
Expand All @@ -361,6 +362,10 @@ equation
-66},{220,-66},{220,280},{268,280}}, color={0,0,127}));
connect(disFloCoo.QActTot_flow, mulQCoo_flow.u) annotation (Line(points={{141,
-266},{224,-266},{224,240},{268,240}}, color={0,0,127}));
connect(mulQReqHot_flow.y, QReqHotWat_flow)
annotation (Line(points={{292,-120},{320,-120}}, color={0,0,127}));
connect(mulQReqHot_flow.u, loa.y[3]) annotation (Line(points={{268,-120},{40,-120},
{40,0},{-259,0}}, color={0,0,127}));
annotation (
Documentation(
info="<html>
Expand Down Expand Up @@ -460,6 +465,13 @@ as specified in the \"Advanced\" tab.
revisions="<html>
<ul>
<li>
May 3, 2023, by David Blum:<br/>
Applied <code>facMul</code> to domestic hot water load.<br/>
This is for
<a href=\"https://github.com/lbl-srg/modelica-buildings/issues/3379\">
issue 3379</a>.
</li>
<li>
November 21, 2022, by David Blum:<br/>
Scale <code>facMulHea</code> and <code>facMulCoo</code> with peak load.<br/>
This is for
Expand Down
Loading

0 comments on commit a4fb4e9

Please sign in to comment.