Package of models for domestic hot water generation and loads served by district networks
Information
This package contains models for building domestic hot water loads served by a district heating network.
These loads are typically charactersized as being from fixtures in kitchens,
bathrooms, and laundry, and typically require a higher temperature water than
space heating.
Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).
Package Content
Name |
Description |
DirectHeatExchangerWithElectricHeat
|
A model for generating hot water using a district heat exchanger and supplemental electric resistance |
StorageTankWithExternalHeatExchanger
|
A model of a storage tank with external heat exchanger to produce hot water |
ThermostaticMixingValve
|
A model for a thermostatic mixing valve |
Data
|
Package for data related to hot water generation |
Examples
|
Example implementations of district-integrated DHW models |
BaseClasses
|
Package with base classes that are used by multiple models |
A model for generating hot water using a district heat exchanger and supplemental electric resistance
Information
This model implements a basic domestic hot water source for a
district heating network. It includes heating by the
district through a heat-exchanger and optional electric resistance to bring
the temperature of produced hot water to setpoint, if the district supply
water is not hot enough.
It is based on Fig. 5 in Evaluations of different domestic hot water
preparing methods with ultra-low-temperature district heating by X. Yang,
H. Li, and S. Svendsen at
doi.org/10.1016/j.energy.2016.04.109.
Extends from Buildings.DHC.Loads.HotWater.BaseClasses.PartialFourPortDHW (A partial model for domestic water heating).
Parameters
Type | Name | Default | Description |
replaceable package MediumDom | PartialMedium | Medium for domestic water in the component |
replaceable package MediumHea | PartialMedium | Medium for heating source in the component |
Efficiency | eps | 0.8 | Heat exchanger effectiveness [1] |
Boolean | have_eleHea | true | True if has auxiliary electric heater |
HeatFlowRate | QMax_flow | Modelica.Constants.inf | Maximum heat flow rate for electric heater (positive) [W] |
MassFlowRate | mDom_flow_nominal | | Nominal flow rate of domestic hot water [kg/s] |
MassFlowRate | mHea_flow_nominal | | Nominal flow rate of heating source water [kg/s] |
PressureDifference | dpDom_nominal | 0 | Pressure difference in heat exchanger on domestic water side [Pa] |
PressureDifference | dpHea_nominal | 0 | Pressure difference in heat exchanger on heating water side [Pa] |
PressureDifference | dpEle_nominal | 0 | Pressure difference in electric reheater for domestic water [Pa] |
Assumptions |
Boolean | allowFlowReversalDom | true | = false to simplify equations, assuming, but not enforcing, no flow reversal for domestic water |
Boolean | allowFlowReversalHea | true | = false to simplify equations, assuming, but not enforcing, no flow reversal for heating water |
Connectors
Type | Name | Description |
FluidPort_a | port_aDom | Fluid connector for cold water (or recirculation water) |
FluidPort_b | port_bDom | Fluid connector for heated domestic hot water |
FluidPort_a | port_aHea | Fluid connector for heating water (positive design flow direction is from port_a to port_b) |
FluidPort_b | port_bHea | Fluid connector b for heating water (positive design flow direction is from port_a to port_b) |
input RealInput | TDomSet | Temperature setpoint for heated domestic water [K] |
output RealOutput | THexOut | Temperature of hot water leaving heat exchanger |
output RealOutput | PEle | Electric power required for electric heater [W] |
Modelica definition
model DirectHeatExchangerWithElectricHeat
extends Buildings.DHC.Loads.HotWater.BaseClasses.PartialFourPortDHW;
parameter Modelica.Units.SI.Efficiency eps(min=0,max=1) = 0.8 ;
parameter Boolean have_eleHea = true ;
parameter Modelica.Units.SI.HeatFlowRate QMax_flow(min=0) = Modelica.Constants.inf ;
parameter Modelica.Units.SI.MassFlowRate mDom_flow_nominal ;
parameter Modelica.Units.SI.MassFlowRate mHea_flow_nominal ;
Buildings.Fluid.HeatExchangers.Heater_T heaEle(
redeclare package Medium =
MediumDom,
m_flow_nominal=mDom_flow_nominal,
dp_nominal=dpEle_nominal,
QMax_flow=QMax_flow)
if have_eleHea == true
;
Buildings.Fluid.Sensors.TemperatureTwoPort senTemHot(
redeclare package Medium =
MediumDom,
m_flow_nominal=mDom_flow_nominal)
;
Buildings.Fluid.HeatExchangers.ConstantEffectiveness hex(
redeclare package Medium1 =
MediumDom,
redeclare package Medium2 =
MediumHea,
m1_flow_nominal=mDom_flow_nominal,
m2_flow_nominal=mHea_flow_nominal,
dp1_nominal=dpDom_nominal,
dp2_nominal=dpHea_nominal,
eps=eps) ;
Buildings.Fluid.Sensors.TemperatureTwoPort senTemHexOut(
redeclare package Medium =
MediumDom,
m_flow_nominal=mDom_flow_nominal)
;
parameter Modelica.Units.SI.PressureDifference dpDom_nominal=0
;
parameter Modelica.Units.SI.PressureDifference dpHea_nominal=0
;
parameter Modelica.Units.SI.PressureDifference dpEle_nominal=0
;
Modelica.Blocks.Interfaces.RealOutput THexOut
;
Modelica.Blocks.Interfaces.RealOutput PEle(unit="W")
;
Modelica.Blocks.Sources.Constant zero(k=0)
if have_eleHea == false ;
protected
Buildings.Fluid.FixedResistances.LosslessPipe pip(
redeclare package Medium =
MediumDom,
final m_flow_nominal=mDom_flow_nominal,
final show_T=false)
if have_eleHea == false
;
equation
connect(senTemHexOut.port_a, hex.port_b1);
connect(senTemHexOut.port_b, heaEle.port_a);
connect(senTemHexOut.port_b, pip.port_a);
connect(heaEle.port_b, senTemHot.port_a);
connect(pip.port_b, senTemHot.port_a);
connect(TDomSet, heaEle.TSet);
connect(senTemHexOut.T, THexOut);
connect(heaEle.Q_flow, PEle);
connect(zero.y, PEle);
connect(port_aDom, hex.port_a1);
connect(hex.port_a2, port_aHea);
connect(senTemHot.port_b, port_bDom);
connect(hex.port_b2, port_bHea);
end DirectHeatExchangerWithElectricHeat;
A model of a storage tank with external heat exchanger to produce hot water
Information
This model implements a heating hot water tank with external heat exchanger that heats domestic hot water.
The storage tank model is described in
Buildings.Fluid.Storage.StratifiedEnhancedInternalHex.
The heat pump and storage tank system should be parameterized altogether using
Buildings.DHC.Loads.HotWater.Data.GenericDomesticHotWaterWithHeatExchanger.
It is based on Fig. 3 in Evaluations of different domestic hot water
preparing methods with ultra-low-temperature district heating by X. Yang,
H. Li, and S. Svendsen at
doi.org/10.1016/j.energy.2016.04.109, as well as the
Advanced Energy Design Guide for Multifamily Buildings-Achieving Zero Energy
published by ASHRAE in 2022 at
https://www.ashrae.org/technical-resources/aedgs/zero-energy-aedg-free-download.
For a model that connects this hot water system to a heat pump, see
Buildings.DHC.ETS.Combined.Subsystems.HeatPumpDHWTank.
Extends from Buildings.DHC.Loads.HotWater.BaseClasses.PartialFourPortDHW (A partial model for domestic water heating).
Parameters
Type | Name | Default | Description |
replaceable package MediumDom | PartialMedium | Medium for domestic water in the component |
replaceable package MediumHea | PartialMedium | Medium for heating source in the component |
GenericDomesticHotWaterWithHeatExchanger | dat | | Performance data |
Real | k | 0.1 | Proportional gain of circulation pump controller |
Real | Ti | 60 | Integrator time constant of circulation pump controller |
Assumptions |
Boolean | allowFlowReversalDom | true | = false to simplify equations, assuming, but not enforcing, no flow reversal for domestic water |
Boolean | allowFlowReversalHea | false | = false to simplify equations, assuming, but not enforcing, no flow reversal for heating water |
Initialization |
Temperature | TTan_start | 323.15 | Start value of tank temperature [K] |
Connectors
Type | Name | Description |
FluidPort_a | port_aDom | Fluid connector for cold water (or recirculation water) |
FluidPort_b | port_bDom | Fluid connector for heated domestic hot water |
FluidPort_a | port_aHea | Fluid connector for heating water (positive design flow direction is from port_a to port_b) |
FluidPort_b | port_bHea | Fluid connector b for heating water (positive design flow direction is from port_a to port_b) |
input RealInput | TDomSet | Temperature setpoint for heated domestic water [K] |
output RealOutput | PEle | Electric power required for pumping equipment [W] |
output BooleanOutput | charge | Output true if tank needs to be charged, false if it is sufficiently charged |
Modelica definition
model StorageTankWithExternalHeatExchanger
extends Buildings.DHC.Loads.HotWater.BaseClasses.PartialFourPortDHW(
final allowFlowReversalHea=false);
parameter Buildings.DHC.Loads.HotWater.Data.GenericDomesticHotWaterWithHeatExchanger
dat ;
parameter Real k=0.1 ;
parameter Real Ti=60 ;
parameter Modelica.Media.Interfaces.Types.Temperature TTan_start=323.15
;
final parameter Real eps =
dat.QHex_flow_nominal / CMin_flow_nominal / ( dat.TDom_nominal + dat.dTHexApp_nominal - dat.TCol_nominal)
;
Buildings.Fluid.Movers.Preconfigured.FlowControlled_dp pumHex(
redeclare package Medium =
MediumHea,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
use_inputFilter=false,
riseTime=10,
m_flow_nominal=dat.mHex_flow_nominal,
dp_nominal=dat.dpHexHea_nominal) ;
Buildings.Fluid.Storage.Stratified tan(
redeclare package Medium =
MediumHea,
kIns=dat.kIns,
final T_start=TTan_start,
hTan=dat.hTan,
dIns=dat.dIns,
VTan=dat.VTan,
nSeg=dat.nSeg,
m_flow_nominal=dat.mHex_flow_nominal)
;
Modelica.Blocks.Interfaces.RealOutput PEle(unit="W")
;
Buildings.Fluid.Sensors.TemperatureTwoPort senTemHot(
redeclare package Medium =
MediumDom,
final allowFlowReversal=allowFlowReversalDom,
m_flow_nominal=dat.mDom_flow_nominal)
;
Buildings.Fluid.HeatExchangers.ConstantEffectiveness hex(
redeclare package Medium1 =
MediumDom,
redeclare package Medium2 =
MediumHea,
final allowFlowReversal1=allowFlowReversalDom,
m1_flow_nominal=dat.mDom_flow_nominal,
m2_flow_nominal=dat.mHex_flow_nominal,
dp1_nominal=dat.dpHexHea_nominal,
from_dp2=true,
dp2_nominal=dat.dpHexDom_nominal,
eps=eps);
Buildings.Fluid.FixedResistances.Junction junTop(
redeclare package Medium =
MediumHea,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
m_flow_nominal=dat.mHex_flow_nominal*{1,1,1},
dp_nominal=
zeros(3)) ;
Buildings.Fluid.Sensors.MassFlowRate senMasFlo(
redeclare package Medium =
MediumDom)
;
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TTanTop(
T(displayUnit="degC"))
;
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TTanBot(
T(displayUnit="degC"))
;
Buildings.DHC.Loads.HotWater.BaseClasses.HeatExchangerPumpController conPum(
final mDom_flow_nominal=dat.mDom_flow_nominal,
final dpPum_nominal=dat.dpHexHea_nominal)
;
Buildings.DHC.Loads.HotWater.BaseClasses.TankChargingController conCha ;
Buildings.Fluid.Actuators.Valves.ThreeWayLinear divVal(
redeclare package Medium =
MediumHea,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
use_inputFilter=false,
m_flow_nominal=dat.mHex_flow_nominal,
dpValve_nominal=1000) ;
Buildings.Fluid.Sensors.TemperatureTwoPort senTemRet(
redeclare package Medium =
MediumHea,
final allowFlowReversal=allowFlowReversalDom,
m_flow_nominal=dat.mHex_flow_nominal)
;
Buildings.DHC.Loads.HotWater.BaseClasses.TankValveController conVal ;
Buildings.Controls.OBC.CDL.Reals.AddParameter dTHexApp(p=dat.dTHexApp_nominal)
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput charge
;
protected
parameter Modelica.Units.SI.SpecificHeatCapacity cpHea_default =
MediumHea.specificHeatCapacityCp(
MediumHea.setState_pTX(
MediumHea.p_default,
MediumHea.T_default,
MediumHea.X_default))
;
parameter Modelica.Units.SI.SpecificHeatCapacity cpDom_default =
MediumDom.specificHeatCapacityCp(
MediumDom.setState_pTX(
MediumDom.p_default,
MediumDom.T_default,
MediumDom.X_default))
;
parameter Modelica.Units.SI.ThermalConductance CMin_flow_nominal =
min(dat.mHex_flow_nominal*cpHea_default, dat.mDom_flow_nominal*cpDom_default)
;
initial equation
assert(eps < 1, "In " +
getInstanceName() + ": Heat exchanger effectivness must be below 1, received eps = " +
String(eps) + ". Check sizing.");
equation
connect(tan.port_a, junTop.port_3);
connect(pumHex.P, PEle);
connect(junTop.port_2, port_aHea);
connect(hex.port_b1, senMasFlo.port_a);
connect(senMasFlo.port_b, senTemHot.port_a);
connect(TTanTop.port, tan.heaPorVol[1]);
connect(senMasFlo.m_flow, conPum.mDom_flow);
connect(senTemHot.T, conPum.TDom);
connect(conPum.TDomSet, TDomSet);
connect(conCha.TTanTop, TTanTop.T);
connect(conCha.charge, charge);
connect(senTemHot.port_b, port_bDom);
connect(conPum.dpPumHex, pumHex.dp_in);
connect(port_aDom, hex.port_a1);
connect(junTop.port_1, hex.port_a2);
connect(hex.port_b2, pumHex.port_a);
connect(senTemRet.port_b, divVal.port_2);
connect(divVal.port_1, tan.fluPorVol[
integer(dat.nSeg/2)]);
connect(senTemRet.T, conVal.TRet);
connect(conVal.y, divVal.y);
connect(TTanBot.port, tan.heaPorVol[dat.nSeg]);
connect(conCha.TTanTopSet, dTHexApp.y);
connect(dTHexApp.u, TDomSet);
connect(divVal.port_3, tan.fluPorVol[dat.nSeg]);
connect(tan.port_b, port_bHea);
connect(pumHex.port_b, senTemRet.port_a);
connect(TTanBot.T, conCha.TTanBot);
end StorageTankWithExternalHeatExchanger;
A model for a thermostatic mixing valve
Information
This model implements a thermostatic mixing valve, which uses
a PI feedback controller to mix hot and cold fluid to achieve a specified
mixed water outlet temperature.
If the mixed water temperature cannot be provided within a tolerance of relTol
,
averaged over the whole simulation period,
then an assertion warning will be written at the end of the simulation.
Parameters
Type | Name | Default | Description |
replaceable package Medium | Buildings.Media.Water | Water media model |
MassFlowRate | mMix_flow_nominal | | Nominal mixed water flow rate to fixture [kg/s] |
SimpleController | controllerType | Buildings.Controls.OBC.CDL.T... | Type of controller |
Control gains |
Real | k | 1 | Gain of controller |
Real | Ti | 0.5 | Time constant of integrator block [s] |
Real | Td | 0.1 | Time constant of derivative block [s] |
Advanced |
Real | relTol | 0.005 | Relative tolerance on energy balance, if not met, a warning will be issued at end of simulation |
Connectors
Type | Name | Description |
replaceable package Medium | Water media model |
FluidPort_a | port_hot | Port for hot water supply |
FluidPort_a | port_col | Port for domestic cold water supply |
input RealInput | TMixSet | Temperature setpoint of mixed water outlet [K] |
input RealInput | yMixSet | Mixed water fractional flow rate at TMixSet, as fraction of mMix_flow_nominal [1] |
Modelica definition
model ThermostaticMixingValve
replaceable package Medium =
Buildings.Media.Water ;
parameter Modelica.Units.SI.MassFlowRate mMix_flow_nominal
;
parameter Buildings.Controls.OBC.CDL.Types.SimpleController controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI
;
parameter Real k(
min=100*Buildings.Controls.OBC.CDL.Constants.eps)=1
;
parameter Real Ti(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)=0.5
;
parameter Real Td(
final quantity="Time",
final unit="s",
min=100*Buildings.Controls.OBC.CDL.Constants.eps)=0.1
;
parameter Real relTol = 0.005 ;
Modelica.Fluid.Interfaces.FluidPort_a port_hot(
redeclare package Medium =
Medium) ;
Modelica.Fluid.Interfaces.FluidPort_a port_col(
redeclare package Medium =
Medium) ;
Modelica.Blocks.Interfaces.RealInput TMixSet(
final unit="K",
displayUnit="degC") ;
Modelica.Blocks.Interfaces.RealInput yMixSet(
final min=0,
final unit="1")
;
Buildings.Fluid.Sensors.TemperatureTwoPort senTHot(
redeclare final package Medium =
Medium,
allowFlowReversal=false,
final m_flow_nominal=mMix_flow_nominal,
tau=0) ;
Buildings.Fluid.Sensors.TemperatureTwoPort senTCol(
redeclare final package Medium =
Medium,
allowFlowReversal=false,
final m_flow_nominal=mMix_flow_nominal,
tau=0) ;
Buildings.Fluid.Sensors.TemperatureTwoPort senTMix(
redeclare final package Medium =
Medium,
allowFlowReversal=false,
final m_flow_nominal=mMix_flow_nominal,
tau=0) ;
Buildings.Controls.OBC.CDL.Reals.PID conPID(
final controllerType=controllerType,
final k=k,
final Ti=Ti,
final Td=Td,
yMax=1,
yMin=0);
Buildings.Controls.OBC.CDL.Reals.Divide ratEne
;
Buildings.Fluid.FixedResistances.Junction jun(
redeclare package Medium =
Medium,
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
tau=1,
m_flow_nominal={-mMix_flow_nominal,mMix_flow_nominal,mMix_flow_nominal},
dp_nominal={0,0,0}) ;
protected
Buildings.Controls.OBC.CDL.Reals.Multiply mulMHot_flow
;
EnergyMeter eneMetReq ;
EnergyMeter eneMetAct ;
block EnergyMeter
extends Modelica.Blocks.Icons.Block;
Modelica.Blocks.Interfaces.RealInput TMix(
final unit="K", displayUnit="degC")
;
Modelica.Blocks.Interfaces.RealInput TCol(
final unit="K", displayUnit="degC")
;
Modelica.Blocks.Interfaces.RealInput m_flow(
final unit="kg/s")
;
Modelica.Blocks.Interfaces.RealOutput E(
final unit="J") ;
Modelica.Units.SI.Energy EInt(
start=0,
fixed=true,
unbounded=true,
nominal=1E9) ;
Modelica.Units.SI.HeatFlowRate H_flow ;
equation
der(EInt) = H_flow;
H_flow = m_flow * Buildings.Utilities.Psychrometrics.Constants.cpWatLiq * (TMix-TCol);
E =
max(Buildings.Utilities.Psychrometrics.Constants.cpWatLiq*1, EInt);
end EnergyMeter;
protected
parameter Modelica.Units.SI.Temperature dTSmall = 0.1 ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter gaiMMix_flow(
final k=mMix_flow_nominal)
;
Buildings.Fluid.Movers.BaseClasses.IdealSource floSouHot(
redeclare final package Medium =
Medium,
allowFlowReversal=false,
m_flow_small=1E-4*mMix_flow_nominal,
final control_m_flow=true,
final control_dp=false)
;
Buildings.Fluid.Sources.MassFlowSource_T sinMMix(
redeclare final package Medium =
Medium,
use_m_flow_in=true,
nPorts=1) ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter gaiMMix_sign(
final k=-1)
;
equation
connect(senTHot.port_a, port_hot);
connect(port_col, senTCol.port_a);
connect(yMixSet, gaiMMix_flow.u);
connect(floSouHot.port_a, senTHot.port_b);
connect(conPID.u_s, TMixSet);
connect(senTMix.T, conPID.u_m);
connect(sinMMix.m_flow_in, gaiMMix_sign.y);
connect(mulMHot_flow.y, floSouHot.m_flow_in);
connect(gaiMMix_flow.y, mulMHot_flow.u1);
connect(conPID.y, mulMHot_flow.u2);
connect(gaiMMix_flow.y, gaiMMix_sign.u);
connect(senTMix.port_b, sinMMix.ports[1]);
connect(eneMetReq.TMix, TMixSet);
connect(eneMetReq.TCol, senTCol.T);
connect(gaiMMix_flow.y, eneMetReq.m_flow);
connect(eneMetAct.TMix, senTMix.T);
connect(eneMetAct.TCol, senTCol.T);
connect(eneMetAct.m_flow, gaiMMix_flow.y);
connect(eneMetReq.E, ratEne.u2);
connect(eneMetAct.E, ratEne.u1);
when terminal()
then
assert(
abs(1-ratEne.y) < relTol,
"In " +
getInstanceName() + ": Required domestic hot water flow rate is not met. Ratio of actual over required energy = " +
String(ratEne.y),
level=AssertionLevel.warning);
end when;
connect(floSouHot.port_b, jun.port_3);
connect(senTCol.port_b, jun.port_2);
connect(jun.port_1, senTMix.port_a);
end ThermostaticMixingValve;
Block that outputs integrated energy, bounded away from zero
Information
Block that outputs the integrated enthalpy flow rate.
To avoid division by zero in downstream blocks, the output is bounded away from zero.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Connectors
Type | Name | Description |
input RealInput | TMix | Temperature of mixed water outlet [K] |
input RealInput | TCol | Temperature of cold water [K] |
input RealInput | m_flow | Mass flow rate [kg/s] |
output RealOutput | E | Consumed energy [J] |
Modelica definition