Package with base classes
Information
This package contains base classes that are used to construct the classes in
Buildings.DHC.Loads.
Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).
Package Content
Name |
Description |
BuildingRCZ1Valve
|
One-zone RC building model with distribution pumps and mixing valves |
BuildingRCZ6
|
Six-zone RC building model based on URBANopt GeoJSON export, with distribution pumps |
BuildingSpawnZ1
|
One-zone EnergyPlus building model |
BuildingSpawnZ6
|
Six-zone EnergyPlus building model based on URBANopt GeoJSON export, with distribution pumps |
BuildingTimeSeries
|
Building model with heating and/or cooling loads provided as time series |
ConstraintViolation
|
Block that outputs the fraction of time when a constraint is violated |
FanCoil4Pipe
|
Model of a sensible only four-pipe fan coil unit computing a required water mass flow rate |
FanCoil4PipeHeatPorts
|
Model of a sensible only four-pipe fan coil unit computing a required water mass flow rate |
FlowDistribution
|
Model of a building hydraulic distribution system |
PartialBuilding
|
Partial class for building model |
PartialBuildingWithPartialETS
|
Partial model of a building with an energy transfer station |
PartialFanCoil4Pipe
|
Partial model of a sensible only four-pipe fan coil unit computing a required water mass flow rate |
PartialTerminalUnit
|
Partial model for HVAC terminal unit |
SimpleRoomODE
|
Simplified model for assessing room air temperature variations around a set point |
getPeakLoad
|
Function that reads the peak load from the load profile |
Controls
|
Package of control sequences for DHC systems |
Types
|
Package with type definitions |
Examples
|
Example models integrating multiple components |
Validation
|
Collection of validation models |
One-zone RC building model with distribution pumps and mixing valves
Information
This is a simplified one-zone building model based on a one-element
reduced order room model.
The corresponding heating and cooling loads are computed with a four-pipe
fan coil unit model derived from
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit
and connected to the room model by means of fluid ports.
The heating and chilled water distribution to the terminal units is modeled
with an instance of
Buildings.DHC.Loads.BaseClasses.FlowDistribution
including a mixing valve to control the supply temperature.
Extends from Buildings.DHC.Loads.BaseClasses.PartialBuilding (Partial class for building model).
Parameters
Type | Name | Default | Description |
replaceable package Medium | Water | Medium in the building distribution system |
Integer | nZon | 1 | Number of thermal zones |
Configuration |
Boolean | have_heaWat | true | Set to true if the building has heating water system |
Boolean | have_chiWat | true | Set to true if the building has chilled water system |
Boolean | have_eleHea | false | Set to true if the building has decentralized electric heating system |
Boolean | have_eleCoo | false | Set to true if the building has decentralized electric cooling system |
Boolean | have_fan | false | Set to true if fan power is computed |
Boolean | have_pum | false | Set to true if pump power is computed |
Boolean | have_weaBus | true | Set to true to use a weather bus |
Scaling |
Real | facMul | 1 | Multiplier factor |
Assumptions |
Boolean | allowFlowReversal | false | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the building distribution system |
Bus | weaBus | Weather data bus |
FluidPorts_a | ports_aHeaWat[nPorts_aHeaWat] | Heating water inlet ports |
FluidPorts_b | ports_bHeaWat[nPorts_bHeaWat] | Heating water outlet ports |
FluidPorts_a | ports_aChiWat[nPorts_aChiWat] | Chilled water inlet ports |
FluidPorts_b | ports_bChiWat[nPorts_bChiWat] | Chilled water outlet ports |
output RealOutput | QHea_flow | Total heating heat flow rate transferred to the loads (>=0) [W] |
output RealOutput | QCoo_flow | Total cooling heat flow rate transferred to the loads (<=0) [W] |
output RealOutput | PHea | Power drawn by decentralized heating system [W] |
output RealOutput | PCoo | Power drawn by decentralized cooling system [W] |
output RealOutput | PFan | Power drawn by fan motors [W] |
output RealOutput | PPum | Power drawn by pump motors [W] |
Modelica definition
model BuildingRCZ1Valve
extends Buildings.DHC.Loads.BaseClasses.PartialBuilding(
redeclare package Medium=
Buildings.Media.Water,
final have_heaWat=true,
final have_chiWat=true,
final have_eleHea=false,
final have_eleCoo=false,
final have_weaBus=true);
package Medium2=
Buildings.Media.Air
;
parameter Integer nZon=1
;
Buildings.BoundaryConditions.SolarIrradiation.DiffusePerez HDifTil[2](
each outSkyCon=true,
each outGroCon=true,
each til=1.5707963267949,
azi={3.1415926535898,4.7123889803847})
;
Buildings.BoundaryConditions.SolarIrradiation.DirectTiltedSurface HDirTil[2](
each til=
1.5707963267949, azi={3.1415926535898,4.7123889803847})
;
Buildings.ThermalZones.ReducedOrder.SolarGain.CorrectionGDoublePane corGDouPan(
n=2,
UWin=2.1)
;
Buildings.ThermalZones.ReducedOrder.RC.OneElement thermalZoneOneElement(
VAir=52.5,
hRad=4.999999999999999,
hConWin=2.7000000000000006,
gWin=1,
ratioWinConRad=0.09,
hConExt=2.0490178828959134,
nExt=1,
RExt={0.00331421908725},
CExt={5259932.23},
RWin=0.01642857143,
RExtRem=0.1265217391,
nOrientations=2,
AWin={7,7},
ATransparent={7,7},
AExt={3.5,8},
redeclare package Medium=Medium2,
extWallRC(
thermCapExt(
each der_T(
fixed=true))),
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial,
T_start=295.15,
nPorts=2)
;
Buildings.ThermalZones.ReducedOrder.EquivalentAirTemperature.VDI6007WithWindow
eqAirTemp(
n=2,
wfGro=0,
wfWall={0.3043478260869566,0.6956521739130435},
wfWin={0.5,0.5},
withLongwave=true,
aExt=0.7,
hConWallOut=20.0,
hRad=5.0,
hConWinOut=20.0,
TGro=285.15)
;
Modelica.Blocks.Math.Add solRad[2]
;
Buildings.HeatTransfer.Sources.PrescribedTemperature preTem
;
Buildings.HeatTransfer.Sources.PrescribedTemperature preTem1
;
Modelica.Thermal.HeatTransfer.Components.Convection theConWin
;
Modelica.Thermal.HeatTransfer.Components.Convection theConWall
;
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow perRad
;
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow perCon
;
Modelica.Blocks.Sources.CombiTimeTable intGai(
table=[
0,0,0,0;
3600,0,0,0;
7200,0,0,0;
10800,0,0,0;
14400,0,0,0;
18000,0,0,0;
21600,0,0,0;
25200,0,0,0;
25200,80,80,200;
28800,80,80,200;
32400,80,80,200;
36000,80,80,200;
39600,80,80,200;
43200,80,80,200;
46800,80,80,200;
50400,80,80,200;
54000,80,80,200;
57600,80,80,200;
61200,80,80,200;
61200,0,0,0;
64800,0,0,0;
72000,0,0,0;
75600,0,0,0;
79200,0,0,0;
82800,0,0,0;
86400,0,0,0],
columns={2,3,4},
extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic)
;
Modelica.Blocks.Sources.Constant const[2](
each k=0)
;
Modelica.Thermal.HeatTransfer.Sources.PrescribedHeatFlow macConv
;
Modelica.Blocks.Sources.Constant hConWall(
k=25*11.5)
;
Modelica.Blocks.Sources.Constant hConWin(
k=20*14)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant minTSet(
k=293.15,
y(
final unit="K",
displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant maxTSet(
k=297.15,
y(
final unit="K",
displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Reals.MultiSum mulSum(
nin=2);
Buildings.DHC.Loads.BaseClasses.FanCoil4Pipe terUni(
redeclare package Medium1=
Medium,
redeclare package Medium2=Medium2,
QHea_flow_nominal=1000,
QCoo_flow_nominal=-5000,
T_aLoaHea_nominal=293.15,
T_aLoaCoo_nominal=297.15,
T_bHeaWat_nominal=308.15,
T_bChiWat_nominal=285.15,
T_aHeaWat_nominal=313.15,
T_aChiWat_nominal=280.15,
mLoaHea_flow_nominal=1,
mLoaCoo_flow_nominal=1)
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
redeclare package Medium=
Medium,
m_flow_nominal=terUni.mHeaWat_flow_nominal,
have_pum=true,
have_val=true,
dp_nominal=100000,
nPorts_a1=1,
nPorts_b1=1)
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
redeclare package Medium=
Medium,
m_flow_nominal=terUni.mChiWat_flow_nominal,
typDis=Buildings.DHC.Loads.BaseClasses.Types.DistributionType.ChilledWater,
have_pum=true,
have_val=true,
dp_nominal=100000,
nPorts_a1=1,
nPorts_b1=1)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant TSetSecHea(
k=308.15,
y(
final unit="K",
displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant TSetSecChi(
k=289.15,
y(
final unit="K",
displayUnit="degC"))
;
equation
connect(eqAirTemp.TEqAirWin,preTem1.T);
connect(eqAirTemp.TEqAir,preTem.T);
connect(intGai.y[1],perRad.Q_flow);
connect(intGai.y[2],perCon.Q_flow);
connect(intGai.y[3],macConv.Q_flow);
connect(const.y,eqAirTemp.sunblind);
connect(HDifTil.HSkyDifTil,corGDouPan.HSkyDifTil);
connect(HDirTil.H,corGDouPan.HDirTil);
connect(HDirTil.H,solRad.u1);
connect(HDirTil.inc,corGDouPan.inc);
connect(HDifTil.H,solRad.u2);
connect(HDifTil.HGroDifTil,corGDouPan.HGroDifTil);
connect(solRad.y,eqAirTemp.HSol);
connect(perRad.port,thermalZoneOneElement.intGainsRad);
connect(theConWin.solid,thermalZoneOneElement.window);
connect(preTem1.port,theConWin.fluid);
connect(thermalZoneOneElement.extWall,theConWall.solid);
connect(theConWall.fluid,preTem.port);
connect(hConWall.y,theConWall.Gc);
connect(hConWin.y,theConWin.Gc);
connect(macConv.port,thermalZoneOneElement.intGainsConv);
connect(perCon.port,thermalZoneOneElement.intGainsConv);
connect(corGDouPan.solarRadWinTrans,thermalZoneOneElement.solRad);
connect(weaBus.TBlaSky,eqAirTemp.TBlaSky);
connect(weaBus.TDryBul,eqAirTemp.TDryBul);
connect(weaBus,HDifTil[2].weaBus);
connect(weaBus,HDirTil[1].weaBus);
connect(weaBus,HDirTil[2].weaBus);
connect(weaBus,HDifTil[1].weaBus);
connect(thermalZoneOneElement.ports[1],terUni.port_aLoa);
connect(terUni.port_bLoa,thermalZoneOneElement.ports[2]);
connect(terUni.port_bChiWat,disFloCoo.ports_a1[1]);
connect(terUni.port_bHeaWat,disFloHea.ports_a1[1]);
connect(disFloHea.ports_b1[1],terUni.port_aHeaWat);
connect(disFloCoo.ports_b1[1],terUni.port_aChiWat);
connect(terUni.mReqHeaWat_flow,disFloHea.mReq_flow[1]);
connect(terUni.mReqChiWat_flow,disFloCoo.mReq_flow[1]);
connect(disFloHea.PPum,mulSum.u[1]);
connect(disFloCoo.PPum,mulSum.u[2]);
connect(thermalZoneOneElement.TAir,terUni.TSen);
connect(maxTSet.y,terUni.TSetCoo);
connect(minTSet.y,terUni.TSetHea);
connect(TSetSecChi.y,disFloCoo.TSupSet);
connect(TSetSecHea.y,disFloHea.TSupSet);
connect(mulSum.y, mulPPum.u);
connect(disFloHea.QActTot_flow, mulQHea_flow.u);
connect(disFloCoo.QActTot_flow, mulQCoo_flow.u);
connect(terUni.PFan, mulPFan.u);
connect(mulHeaWatInl[1].port_b, disFloHea.port_a);
connect(mulHeaWatOut[1].port_a, disFloHea.port_b);
connect(mulChiWatInl[1].port_b, disFloCoo.port_a);
connect(mulChiWatOut[1].port_a, disFloCoo.port_b);
end BuildingRCZ1Valve;
Six-zone RC building model based on URBANopt GeoJSON export, with distribution pumps
Information
This is a simplified six-zone building model based on two-element reduced order
model.
It was generated from translating a GeoJSON model specified within the URBANopt UI.
The heating and cooling loads are computed with a four-pipe
fan coil unit model derived from
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit
and connected to the room model by means of heat ports.
Extends from Buildings.DHC.Loads.BaseClasses.PartialBuilding (Partial class for building model).
Parameters
Type | Name | Default | Description |
replaceable package Medium | Water | Medium in the building distribution system |
Integer | nZon | 6 | Number of thermal zones |
Real | facMulTerUni[nZon] | {15 for i in 1:nZon} | Multiplier factor for terminal units |
Configuration |
Boolean | have_heaWat | true | Set to true if the building has heating water system |
Boolean | have_chiWat | true | Set to true if the building has chilled water system |
Boolean | have_eleHea | false | Set to true if the building has decentralized electric heating system |
Boolean | have_eleCoo | false | Set to true if the building has decentralized electric cooling system |
Boolean | have_fan | false | Set to true if fan power is computed |
Boolean | have_pum | true | Set to true if pump power is computed |
Boolean | have_weaBus | true | Set to true to use a weather bus |
Scaling |
Real | facMul | 1 | Multiplier factor |
Nominal condition |
MassFlowRate | mLoa_flow_nominal[nZon] | fill(1, nZon) | Load side mass flow rate at nominal conditions [kg/s] |
HeatFlowRate | QHea_flow_nominal[nZon] | fill(10000, nZon) ./ facMulT... | Design heating heat flow rate (>=0) [W] |
HeatFlowRate | QCoo_flow_nominal[nZon] | cat(1, fill(-10000, nZon - 1... | Design cooling heat flow rate (<=0) [W] |
Assumptions |
Boolean | allowFlowReversal | false | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the building distribution system |
Bus | weaBus | Weather data bus |
FluidPorts_a | ports_aHeaWat[nPorts_aHeaWat] | Heating water inlet ports |
FluidPorts_b | ports_bHeaWat[nPorts_bHeaWat] | Heating water outlet ports |
FluidPorts_a | ports_aChiWat[nPorts_aChiWat] | Chilled water inlet ports |
FluidPorts_b | ports_bChiWat[nPorts_bChiWat] | Chilled water outlet ports |
output RealOutput | QHea_flow | Total heating heat flow rate transferred to the loads (>=0) [W] |
output RealOutput | QCoo_flow | Total cooling heat flow rate transferred to the loads (<=0) [W] |
output RealOutput | PHea | Power drawn by decentralized heating system [W] |
output RealOutput | PCoo | Power drawn by decentralized cooling system [W] |
output RealOutput | PFan | Power drawn by fan motors [W] |
output RealOutput | PPum | Power drawn by pump motors [W] |
Modelica definition
model BuildingRCZ6
extends Buildings.DHC.Loads.BaseClasses.PartialBuilding(
redeclare package Medium=
Buildings.Media.Water,
final have_weaBus=true,
final have_heaWat=true,
final have_chiWat=true,
final have_eleHea=false,
final have_eleCoo=false,
final have_fan=false,
final have_pum=true);
package Medium2=
Buildings.Media.Air
;
parameter Integer nZon=6
;
parameter Real facMulTerUni[nZon]={15
for i
in 1:nZon}
;
parameter Modelica.Units.SI.MassFlowRate mLoa_flow_nominal[nZon]=
fill(1, nZon)
;
parameter Modelica.Units.SI.HeatFlowRate QHea_flow_nominal[nZon]=
fill(10000,
nZon) ./ facMulTerUni ;
parameter Modelica.Units.SI.HeatFlowRate QCoo_flow_nominal[nZon]=
cat(
1,
fill(-10000, nZon - 1),
{-50000}) ./ facMulTerUni ;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant minTSet[nZon](
k=
fill(
293.15,
nZon),
y(
each final unit="K",
each displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant maxTSet[nZon](
k=
fill(
297.15,
nZon),
y(
each final unit="K",
each displayUnit="degC"))
;
Buildings.DHC.Loads.BaseClasses.Examples.BaseClasses.GeojsonExportRC.OfficeBuilding.Office
office;
Buildings.DHC.Loads.BaseClasses.Examples.BaseClasses.GeojsonExportRC.OfficeBuilding.Floor
floor;
Buildings.DHC.Loads.BaseClasses.Examples.BaseClasses.GeojsonExportRC.OfficeBuilding.Storage
storage;
Buildings.DHC.Loads.BaseClasses.Examples.BaseClasses.GeojsonExportRC.OfficeBuilding.Meeting
meeting;
Buildings.DHC.Loads.BaseClasses.Examples.BaseClasses.GeojsonExportRC.OfficeBuilding.Restroom
restroom;
Buildings.DHC.Loads.BaseClasses.Examples.BaseClasses.GeojsonExportRC.OfficeBuilding.ICT
iCT;
Buildings.Controls.OBC.CDL.Reals.MultiSum mulSum(
nin=2);
Buildings.DHC.Loads.BaseClasses.FanCoil4PipeHeatPorts terUni[nZon](
redeclare each final package Medium1=
Medium,
redeclare each final package Medium2=Medium2,
final facMul=facMulTerUni,
final QHea_flow_nominal=QHea_flow_nominal,
final QCoo_flow_nominal=QCoo_flow_nominal,
each T_aLoaHea_nominal=293.15,
each T_aLoaCoo_nominal=297.15,
each T_bHeaWat_nominal=35+273.15,
each T_bChiWat_nominal=12+273.15,
each T_aHeaWat_nominal=40+273.15,
each T_aChiWat_nominal=7+273.15,
each mLoaHea_flow_nominal=5,
each mLoaCoo_flow_nominal=5)
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
redeclare package Medium=
Medium,
m_flow_nominal=
sum(
terUni.mHeaWat_flow_nominal .* terUni.facMul),
have_pum=true,
dp_nominal=100000,
nPorts_a1=nZon,
nPorts_b1=nZon)
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
redeclare package Medium=
Medium,
m_flow_nominal=
sum(
terUni.mChiWat_flow_nominal .* terUni.facMul),
typDis=Buildings.DHC.Loads.BaseClasses.Types.DistributionType.ChilledWater,
have_pum=true,
dp_nominal=100000,
nPorts_a1=nZon,
nPorts_b1=nZon)
;
equation
connect(terUni.port_bHeaWat,disFloHea.ports_a1);
connect(terUni.port_bChiWat,disFloCoo.ports_a1);
connect(disFloHea.ports_b1,terUni.port_aHeaWat);
connect(disFloCoo.ports_b1,terUni.port_aChiWat);
connect(weaBus,office.weaBus);
connect(weaBus,floor.weaBus);
connect(weaBus,storage.weaBus);
connect(weaBus,meeting.weaBus);
connect(weaBus,restroom.weaBus);
connect(weaBus,iCT.weaBus);
connect(terUni[1].heaPorCon,office.port_a);
connect(terUni[2].heaPorCon,floor.port_a);
connect(terUni[3].heaPorCon,storage.port_a);
connect(terUni[4].heaPorCon,meeting.port_a);
connect(terUni[5].heaPorCon,restroom.port_a);
connect(terUni[6].heaPorCon,iCT.port_a);
connect(terUni[1].heaPorRad,office.port_a);
connect(terUni[2].heaPorRad,floor.port_a);
connect(terUni[3].heaPorRad,storage.port_a);
connect(terUni[4].heaPorRad,meeting.port_a);
connect(terUni[5].heaPorRad,restroom.port_a);
connect(terUni[6].heaPorRad,iCT.port_a);
connect(terUni.mReqHeaWat_flow,disFloHea.mReq_flow);
connect(terUni.mReqChiWat_flow,disFloCoo.mReq_flow);
connect(disFloHea.PPum,mulSum.u[1]);
connect(disFloCoo.PPum,mulSum.u[2]);
connect(maxTSet.y,terUni.TSetCoo);
connect(minTSet.y,terUni.TSetHea);
connect(disFloHea.QActTot_flow, mulQHea_flow.u);
connect(disFloCoo.QActTot_flow, mulQCoo_flow.u);
connect(mulPPum.u, mulSum.y);
connect(mulHeaWatInl[1].port_b, disFloHea.port_a);
connect(mulHeaWatOut[1].port_a, disFloHea.port_b);
connect(mulChiWatInl[1].port_b, disFloCoo.port_a);
connect(mulChiWatOut[1].port_a, disFloCoo.port_b);
end BuildingRCZ6;
One-zone EnergyPlus building model
Information
This is a simplified one-zone building model based on EnergyPlus
building envelope model.
The heating and cooling loads are computed with a four-pipe
fan coil unit model derived from
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit
and connected to the room model by means of fluid ports.
Extends from Buildings.DHC.Loads.BaseClasses.PartialBuilding (Partial class for building model).
Parameters
Type | Name | Default | Description |
replaceable package Medium | Water | Medium in the building distribution system |
Integer | nZon | 1 | Number of thermal zones |
String | idfName | "modelica://Buildings/Resour... | Name of the IDF file |
String | epwName | "modelica://Buildings/Resour... | Name of the weather file |
String | weaName | "modelica://Buildings/Resour... | Name of the weather file |
Configuration |
Boolean | have_heaWat | true | Set to true if the building has heating water system |
Boolean | have_chiWat | true | Set to true if the building has chilled water system |
Boolean | have_eleHea | false | Set to true if the building has decentralized electric heating system |
Boolean | have_eleCoo | false | Set to true if the building has decentralized electric cooling system |
Boolean | have_fan | false | Set to true if fan power is computed |
Boolean | have_pum | false | Set to true if pump power is computed |
Boolean | have_weaBus | false | Set to true to use a weather bus |
Scaling |
Real | facMul | 1 | Multiplier factor |
Assumptions |
Boolean | allowFlowReversal | false | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the building distribution system |
Bus | weaBus | Weather data bus |
FluidPorts_a | ports_aHeaWat[nPorts_aHeaWat] | Heating water inlet ports |
FluidPorts_b | ports_bHeaWat[nPorts_bHeaWat] | Heating water outlet ports |
FluidPorts_a | ports_aChiWat[nPorts_aChiWat] | Chilled water inlet ports |
FluidPorts_b | ports_bChiWat[nPorts_bChiWat] | Chilled water outlet ports |
output RealOutput | QHea_flow | Total heating heat flow rate transferred to the loads (>=0) [W] |
output RealOutput | QCoo_flow | Total cooling heat flow rate transferred to the loads (<=0) [W] |
output RealOutput | PHea | Power drawn by decentralized heating system [W] |
output RealOutput | PCoo | Power drawn by decentralized cooling system [W] |
output RealOutput | PFan | Power drawn by fan motors [W] |
output RealOutput | PPum | Power drawn by pump motors [W] |
Modelica definition
model BuildingSpawnZ1
extends Buildings.DHC.Loads.BaseClasses.PartialBuilding(
redeclare package Medium=
Buildings.Media.Water,
final have_heaWat=true,
final have_chiWat=true,
final have_pum=false,
final have_eleHea=false,
final have_eleCoo=false);
package Medium2=
Buildings.Media.Air
;
parameter Integer nZon=1
;
parameter String idfName="modelica://Buildings/Resources/Data/ThermalZones/EnergyPlus_9_6_0/Examples/RefBldgSmallOffice/RefBldgSmallOfficeNew2004_Chicago.idf"
;
parameter String epwName="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"
;
parameter String weaName="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"
;
Modelica.Blocks.Sources.Constant qConGai_flow(
k=0)
;
Modelica.Blocks.Sources.Constant qRadGai_flow(
k=0)
;
Modelica.Blocks.Routing.Multiplex3 multiplex3_1;
Modelica.Blocks.Sources.Constant qLatGai_flow(
k=0)
;
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone zon(
redeclare package Medium=Medium2,
zoneName="Core_ZN",
nPorts=2)
;
inner Buildings.ThermalZones.EnergyPlus_9_6_0.Building building(
idfName=
Modelica.Utilities.Files.loadResource(
idfName),
epwName=
Modelica.Utilities.Files.loadResource(
epwName),
weaName=
Modelica.Utilities.Files.loadResource(
weaName))
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant minTSet(
k=293.15,
y(
final unit="K",
displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant maxTSet(
k=297.15,
y(
final unit="K",
displayUnit="degC"))
;
Buildings.DHC.Loads.BaseClasses.FanCoil4Pipe terUni(
redeclare package Medium1=
Medium,
redeclare package Medium2=Medium2,
QHea_flow_nominal=2000,
QCoo_flow_nominal=-2000,
T_aLoaHea_nominal=293.15,
T_aLoaCoo_nominal=297.15,
T_bHeaWat_nominal=308.15,
T_bChiWat_nominal=285.15,
T_aHeaWat_nominal=313.15,
T_aChiWat_nominal=280.15,
mLoaHea_flow_nominal=1,
mLoaCoo_flow_nominal=1)
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
redeclare package Medium=
Medium,
m_flow_nominal=terUni.mHeaWat_flow_nominal,
dp_nominal=100000,
nPorts_a1=nZon,
nPorts_b1=nZon)
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
redeclare package Medium=
Medium,
m_flow_nominal=terUni.mChiWat_flow_nominal,
typDis=Buildings.DHC.Loads.BaseClasses.Types.DistributionType.ChilledWater,
dp_nominal=100000,
nPorts_a1=nZon,
nPorts_b1=nZon)
;
equation
connect(qRadGai_flow.y,multiplex3_1.u1[1]);
connect(qConGai_flow.y,multiplex3_1.u2[1]);
connect(multiplex3_1.u3[1],qLatGai_flow.y);
connect(multiplex3_1.y,zon.qGai_flow);
connect(zon.ports[1],terUni.port_aLoa);
connect(terUni.port_bHeaWat,disFloHea.ports_a1[1]);
connect(terUni.port_bChiWat,disFloCoo.ports_a1[1]);
connect(disFloHea.ports_b1[1],terUni.port_aHeaWat);
connect(disFloCoo.ports_b1[1],terUni.port_aChiWat);
connect(terUni.mReqHeaWat_flow,disFloHea.mReq_flow[1]);
connect(terUni.mReqChiWat_flow,disFloCoo.mReq_flow[1]);
connect(terUni.port_bLoa,zon.ports[2]);
connect(zon.TAir,terUni.TSen);
connect(maxTSet.y,terUni.TSetCoo);
connect(minTSet.y,terUni.TSetHea);
connect(terUni.PFan, mulPFan.u);
connect(disFloHea.QActTot_flow, mulQHea_flow.u);
connect(disFloCoo.QActTot_flow, mulQCoo_flow.u);
connect(mulChiWatInl[1].port_b, disFloCoo.port_a);
connect(mulChiWatOut[1].port_a, disFloCoo.port_b);
connect(mulHeaWatInl[1].port_b, disFloHea.port_a);
connect(mulHeaWatOut[1].port_a, disFloHea.port_b);
end BuildingSpawnZ1;
Six-zone EnergyPlus building model based on URBANopt GeoJSON export, with distribution pumps
Information
This is a simplified six-zone building model based on an EnergyPlus
building envelope model.
It was generated from translating a GeoJSON model specified within the URBANopt UI.
The heating and cooling loads are computed with a four-pipe
fan coil unit model derived from
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit
and connected to the room model by means of fluid ports. The Attic
zone
is unconditionned, with a free floating temperature.
Extends from Buildings.DHC.Loads.BaseClasses.PartialBuilding (Partial class for building model).
Parameters
Type | Name | Default | Description |
replaceable package Medium | Water | Medium in the building distribution system |
Integer | nZon | 5 | Number of conditioned thermal zones |
Real | facMulTerUni[nZon] | {5 for i in 1:nZon} | Multiplier factor for terminal units |
String | idfName | "modelica://Buildings/Resour... | Name of the IDF file |
String | epwName | "modelica://Buildings/Resour... | Name of the weather file |
String | weaName | "modelica://Buildings/Resour... | Name of the weather file |
Configuration |
Boolean | have_heaWat | true | Set to true if the building has heating water system |
Boolean | have_chiWat | true | Set to true if the building has chilled water system |
Boolean | have_eleHea | false | Set to true if the building has decentralized electric heating system |
Boolean | have_eleCoo | false | Set to true if the building has decentralized electric cooling system |
Boolean | have_fan | false | Set to true if fan power is computed |
Boolean | have_pum | true | Set to true if pump power is computed |
Boolean | have_weaBus | false | Set to true to use a weather bus |
Scaling |
Real | facMul | 1 | Multiplier factor |
Nominal condition |
MassFlowRate | mLoa_flow_nominal[nZon] | fill(1, nZon) | Load side mass flow rate at nominal conditions (single terminal unit) [kg/s] |
HeatFlowRate | QHea_flow_nominal[nZon] | fill(2000, nZon) ./ facMulTe... | Design heating heat flow rate (single terminal unit) [W] |
HeatFlowRate | QCoo_flow_nominal[nZon] | fill(-2000, nZon) ./ facMulT... | Design cooling heat flow rate (single terminal unit) [W] |
Assumptions |
Boolean | allowFlowReversal | false | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the building distribution system |
Bus | weaBus | Weather data bus |
FluidPorts_a | ports_aHeaWat[nPorts_aHeaWat] | Heating water inlet ports |
FluidPorts_b | ports_bHeaWat[nPorts_bHeaWat] | Heating water outlet ports |
FluidPorts_a | ports_aChiWat[nPorts_aChiWat] | Chilled water inlet ports |
FluidPorts_b | ports_bChiWat[nPorts_bChiWat] | Chilled water outlet ports |
output RealOutput | QHea_flow | Total heating heat flow rate transferred to the loads (>=0) [W] |
output RealOutput | QCoo_flow | Total cooling heat flow rate transferred to the loads (<=0) [W] |
output RealOutput | PHea | Power drawn by decentralized heating system [W] |
output RealOutput | PCoo | Power drawn by decentralized cooling system [W] |
output RealOutput | PFan | Power drawn by fan motors [W] |
output RealOutput | PPum | Power drawn by pump motors [W] |
Modelica definition
model BuildingSpawnZ6
extends Buildings.DHC.Loads.BaseClasses.PartialBuilding(
redeclare package Medium=
Buildings.Media.Water,
final have_heaWat=true,
final have_chiWat=true,
final have_eleHea=false,
final have_eleCoo=false,
final have_pum=true,
final have_weaBus=false);
package Medium2=
Buildings.Media.Air
;
parameter Integer nZon=5
;
parameter Real facMulTerUni[nZon]={5
for i
in 1:nZon}
;
parameter Modelica.Units.SI.MassFlowRate mLoa_flow_nominal[nZon]=
fill(1, nZon)
;
parameter Modelica.Units.SI.HeatFlowRate QHea_flow_nominal[nZon]=
fill(2000,
nZon) ./ facMulTerUni
;
parameter Modelica.Units.SI.HeatFlowRate QCoo_flow_nominal[nZon]=
fill(-2000,
nZon) ./ facMulTerUni
;
parameter String idfName="modelica://Buildings/Resources/Data/ThermalZones/EnergyPlus_9_6_0/Examples/RefBldgSmallOffice/RefBldgSmallOfficeNew2004_Chicago.idf"
;
parameter String epwName="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw"
;
parameter String weaName="modelica://Buildings/Resources/weatherdata/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.mos"
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant minTSet[nZon](
k=
fill(
293.15,
nZon),
y(
each final unit="K",
each displayUnit="degC"))
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant maxTSet[nZon](
k=
fill(
297.15,
nZon),
y(
each final unit="K",
each displayUnit="degC"))
;
Modelica.Blocks.Sources.Constant qConGai_flow(
k=0)
;
Modelica.Blocks.Sources.Constant qRadGai_flow(
k=0)
;
Modelica.Blocks.Routing.Multiplex3 multiplex3_1;
Modelica.Blocks.Sources.Constant qLatGai_flow(
k=0)
;
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znAttic(
redeclare package Medium=Medium2,
zoneName="Attic")
;
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znCore_ZN(
redeclare package Medium=Medium2,
zoneName="Core_ZN",
nPorts=2)
;
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znPerimeter_ZN_1(
redeclare package Medium=Medium2,
zoneName="Perimeter_ZN_1",
nPorts=2)
;
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znPerimeter_ZN_2(
redeclare package Medium=Medium2,
zoneName="Perimeter_ZN_2",
nPorts=2)
;
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znPerimeter_ZN_3(
redeclare package Medium=Medium2,
zoneName="Perimeter_ZN_3",
nPorts=2)
;
Buildings.ThermalZones.EnergyPlus_9_6_0.ThermalZone znPerimeter_ZN_4(
redeclare package Medium=Medium2,
zoneName="Perimeter_ZN_4",
nPorts=2)
;
inner Buildings.ThermalZones.EnergyPlus_9_6_0.Building building(
idfName=
Modelica.Utilities.Files.loadResource(
idfName),
epwName=
Modelica.Utilities.Files.loadResource(
epwName),
weaName=
Modelica.Utilities.Files.loadResource(
weaName))
;
Buildings.Controls.OBC.CDL.Reals.MultiSum mulSum(
final nin=nZon);
Buildings.Controls.OBC.CDL.Reals.MultiSum mulSum3(
nin=2);
Buildings.DHC.Loads.BaseClasses.FanCoil4Pipe terUni[nZon](
redeclare each final package Medium1=
Medium,
redeclare each final package Medium2=Medium2,
final facMul=facMulTerUni,
final QHea_flow_nominal=QHea_flow_nominal,
final QCoo_flow_nominal=QCoo_flow_nominal,
each T_aLoaHea_nominal=293.15,
each T_aLoaCoo_nominal=297.15,
each T_bHeaWat_nominal=308.15,
each T_bChiWat_nominal=285.15,
each T_aHeaWat_nominal=313.15,
each T_aChiWat_nominal=280.15,
final mLoaHea_flow_nominal=mLoa_flow_nominal,
final mLoaCoo_flow_nominal=mLoa_flow_nominal)
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
redeclare package Medium=
Medium,
m_flow_nominal=
sum(
terUni.mHeaWat_flow_nominal .* terUni.facMul),
have_pum=true,
dp_nominal=100000,
nPorts_a1=nZon,
nPorts_b1=nZon)
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
redeclare package Medium=
Medium,
m_flow_nominal=
sum(
terUni.mChiWat_flow_nominal .* terUni.facMul),
typDis=Buildings.DHC.Loads.BaseClasses.Types.DistributionType.ChilledWater,
have_pum=true,
dp_nominal=100000,
nPorts_a1=nZon,
nPorts_b1=nZon)
;
equation
connect(qRadGai_flow.y,multiplex3_1.u1[1]);
connect(qConGai_flow.y,multiplex3_1.u2[1]);
connect(multiplex3_1.u3[1],qLatGai_flow.y);
connect(multiplex3_1.y,znAttic.qGai_flow);
connect(multiplex3_1.y,znCore_ZN.qGai_flow);
connect(multiplex3_1.y,znPerimeter_ZN_1.qGai_flow);
connect(multiplex3_1.y,znPerimeter_ZN_2.qGai_flow);
connect(multiplex3_1.y,znPerimeter_ZN_3.qGai_flow);
connect(multiplex3_1.y,znPerimeter_ZN_4.qGai_flow);
connect(znCore_ZN.ports[1],terUni[1].port_aLoa);
connect(terUni[1].port_bLoa,znCore_ZN.ports[2]);
connect(znPerimeter_ZN_1.ports[1],terUni[2].port_aLoa);
connect(terUni[2].port_bLoa,znPerimeter_ZN_1.ports[2]);
connect(znPerimeter_ZN_2.ports[1],terUni[3].port_aLoa);
connect(terUni[3].port_bLoa,znPerimeter_ZN_2.ports[2]);
connect(znPerimeter_ZN_3.ports[1],terUni[4].port_aLoa);
connect(terUni[4].port_bLoa,znPerimeter_ZN_3.ports[2]);
connect(znPerimeter_ZN_4.ports[1],terUni[5].port_aLoa);
connect(terUni[5].port_bLoa,znPerimeter_ZN_4.ports[2]);
connect(terUni.port_bHeaWat,disFloHea.ports_a1);
connect(disFloHea.ports_b1,terUni.port_aHeaWat);
connect(disFloCoo.ports_b1,terUni.port_aChiWat);
connect(terUni.port_bChiWat,disFloCoo.ports_a1);
connect(terUni.mReqChiWat_flow,disFloCoo.mReq_flow);
connect(terUni.mReqHeaWat_flow,disFloHea.mReq_flow);
connect(terUni.PFan,mulSum.u);
connect(disFloHea.PPum,mulSum3.u[1]);
connect(disFloCoo.PPum,mulSum3.u[2]);
connect(znCore_ZN.TAir,terUni[1].TSen);
connect(znPerimeter_ZN_1.TAir,terUni[2].TSen);
connect(znPerimeter_ZN_2.TAir,terUni[3].TSen);
connect(znPerimeter_ZN_3.TAir,terUni[4].TSen);
connect(znPerimeter_ZN_4.TAir,terUni[5].TSen);
connect(maxTSet.y,terUni.TSetCoo);
connect(minTSet.y,terUni.TSetHea);
connect(disFloHea.QActTot_flow, mulQHea_flow.u);
connect(mulSum3.y, mulPPum.u);
connect(mulSum.y, mulPFan.u);
connect(disFloCoo.QActTot_flow, mulQCoo_flow.u);
connect(mulHeaWatInl[1].port_b, disFloHea.port_a);
connect(mulChiWatInl[1].port_b, disFloCoo.port_a);
connect(mulChiWatOut[1].port_a, disFloCoo.port_b);
connect(mulHeaWatOut[1].port_a, disFloHea.port_b);
end BuildingSpawnZ6;
Building model with heating and/or cooling loads provided as time series
Information
This is a simplified building model where the space heating and cooling
loads are provided as time series. In order to approximate the emission
characteristic of the building HVAC system,
this model uses idealized fan coil models that are parameterized with
the peak load, determined from the provided time series, and design
values of the hot water and chilled water supply and return temperatures.
The time series that provide the loads are read from the file filNam
.
This file must have columns as shown in this example:
#1
#Heating, cooling and domestic hot water loads
#
#First column: Seconds in the year (loads are hourly)
#Second column: cooling loads in Watts (as negative numbers).
#Third column: space heating loads in Watts
#Fourth column: domestic hot water loads in Watts
#
#Peak space cooling load = -146960 Watts
#Peak space heating load = 167690 Watts
#Peak water heating load = 9390 Watts
double tab1(8760,4)
0;0;18230;0
3600;0;17520;0
7200;0;20170;0
10800;0;22450;0
[further rows omitted]
Specificallly, the format must be as follows:
-
The first column must be the time of the year in seconds.
-
If
have_chiWat = true
, then the next column must be the space cooling load in Watts.
Note that cooling is a negative number.
If have_chiWat = false
, this column must be present but it will be ignored, and hence
it can be set to any number such as 0
.
-
If
have_heaWat = true
, the next column must be the space heating load in Watts.
If have_heaWat = false
, this column must be present but it will be ignored, and hence
it can be set to any number such as 0
.
-
If
have_hotWat = true
, the next column must be the domestic hot water load in Watts.
If have_hotWat = false
, this column must be present but it will be ignored, and hence
it can be set to any number such as 0
.
The entry double tab1(8760,4)
shows how many columns and rows are present.
The header also needs to contain the lines that start with #Peak
as shown in the example above.
Implementation details
The total space heating (resp. cooling) load is split between
facMulHea
(resp. facMulCoo
)
identical terminal units with heat transfer performance approximated based on
design specifications of a reference terminal unit.
It is not expected that the user modifies the default values
that are proposed for facMulHea
and facMulCoo
unless detailed design data are available for the building
HVAC system.
In that latter case, the following set of parameters should be
modified consistently to match the design data.
- Hot water (resp. chilled water) supply and return temperature
T_aHeaWat_nominal
and T_bHeaWat_nominal
(resp. T_aChiWat_nominal
and T_bChiWat_nominal
)
- Terminal unit entering air temperature
T_aLoaHea_nominal
(resp. T_aLoaCoo_nominal
) and humidity ratio
w_aLoaCoo_nominal
- Terminal unit air mass flow rate
mLoaHea_flow_nominal
(resp. mLoaCoo_flow_nominal
)
- Terminal unit scaling factor
facMulHea
(resp. facMulCoo
)
For reference, the default reference terminal unit performance is based on
manufacturer data (Carrier fan coil model 42NL/NH) at selection conditions
as specified in the "Advanced" tab.
Extends from Buildings.DHC.Loads.BaseClasses.PartialBuilding (Partial class for building model).
Parameters
Type | Name | Default | Description |
replaceable package Medium | Water | Medium in the building distribution system |
replaceable package Medium2 | Buildings.Media.Air | Load side medium |
String | filNam | | File name with thermal loads as time series |
Real | k | 0.1 | Gain of controller |
Time | Ti | 10 | Time constant of integrator block [s] |
FanCoil2PipeHeating | terUniHea | terUniHea(final k=k, final T... | Heating terminal unit |
FanCoil2PipeCooling | terUniCoo | terUniCoo(final k=k, final T... | Cooling terminal unit |
Configuration |
Boolean | have_heaWat | true | Set to true if the building has heating water system |
Boolean | have_chiWat | true | Set to true if the building has chilled water system |
Boolean | have_eleHea | false | Set to true if the building has decentralized electric heating system |
Boolean | have_eleCoo | false | Set to true if the building has decentralized electric cooling system |
Boolean | have_fan | false | Set to true if fan power is computed |
Boolean | have_pum | true | Set to true if pump power is computed |
Boolean | have_weaBus | false | Set to true to use a weather bus |
Boolean | have_hotWat | false | Set to true if SHW load is included in the time series |
Scaling |
Real | facMul | 1 | Multiplier factor |
Nominal condition |
Temperature | T_aHeaWat_nominal | 323.15 | Heating water inlet temperature at nominal conditions [K] |
Temperature | T_bHeaWat_nominal | T_aHeaWat_nominal - 10 | Heating water outlet temperature at nominal conditions [K] |
Temperature | T_aChiWat_nominal | 280.15 | Chilled water inlet temperature at nominal conditions [K] |
Temperature | T_bChiWat_nominal | T_aChiWat_nominal + 5 | Chilled water outlet temperature at nominal conditions [K] |
HeatFlowRate | QCoo_flow_nominal | if have_chiWat then Building... | Design cooling heat flow rate (<=0) [W] |
HeatFlowRate | QHea_flow_nominal | if have_heaWat then Building... | Design heating heat flow rate (>=0) [W] |
MassFlowRate | mChiWat_flow_nominal | QCoo_flow_nominal/cp_default... | Chilled water mass flow rate at nominal conditions (all units) [kg/s] |
MassFlowRate | mHeaWat_flow_nominal | QHea_flow_nominal/cp_default... | Heating water mass flow rate at nominal conditions (all units) [kg/s] |
Assumptions |
Boolean | allowFlowReversal | false | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Advanced |
Scaling |
Real | facMulHea | QHea_flow_nominal/(QHea_flow... | Heating terminal unit multiplier factor |
Real | facMulCoo | QCoo_flow_nominal/(QCoo_flow... | Cooling terminal unit scaling factor |
Nominal condition |
Temperature | T_aLoaHea_nominal | 293.15 | Load side inlet temperature at nominal conditions in heating mode [K] |
Temperature | T_aLoaCoo_nominal | 298.15 | Load side inlet temperature at nominal conditions in cooling mode [K] |
MassFraction | w_aLoaCoo_nominal | 0.01 | Load side inlet humidity ratio at nominal conditions in cooling mode [1] |
MassFlowRate | mLoaHea_flow_nominal | 0.5 | Load side mass flow rate at nominal conditions in heating mode (single unit) [kg/s] |
MassFlowRate | mLoaCoo_flow_nominal | mLoaHea_flow_nominal | Load side mass flow rate at nominal conditions in cooling mode (single unit) [kg/s] |
Reference terminal unit performance |
Temperature | T_aHeaWat_nominal_ref | 323.15 | Heating water inlet temperature at nominal conditions of reference terminal unit [K] |
Temperature | T_aLoaHea_nominal_ref | 293.15 | Load side inlet temperature at nominal conditions in heating mode of reference terminal unit [K] |
MassFlowRate | mLoaHea_flow_nominal_ref | 0.5 | Load side mass flow rate at nominal conditions in heating mode of reference terminal unit [kg/s] |
HeatFlowRate | QHea_flow_nominal_ref | 4.5E3 | Heat flow at nominal conditions in heating mode of reference terminal unit [W] |
Temperature | T_aChiWat_nominal_ref | 279.15 | Chilled water inlet temperature at nominal conditions of reference terminal unit [K] |
Temperature | T_aLoaCoo_nominal_ref | 298.15 | Load side inlet temperature at nominal conditions in cooling mode of reference terminal unit [K] |
MassFraction | w_aLoaCoo_nominal_ref | 0.01 | Load side inlet humidity ratio at nominal conditions in cooling mode of reference terminal unit [1] |
MassFlowRate | mLoaCoo_flow_nominal_ref | 0.5 | Load side mass flow rate at nominal conditions in cooling mode of reference terminal unit [kg/s] |
HeatFlowRate | QCoo_flow_nominal_ref | -5.8E3 | Heat flow at nominal conditions in cooling mode of reference terminal unit [W] |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the building distribution system |
Bus | weaBus | Weather data bus |
FluidPorts_a | ports_aHeaWat[nPorts_aHeaWat] | Heating water inlet ports |
FluidPorts_b | ports_bHeaWat[nPorts_bHeaWat] | Heating water outlet ports |
FluidPorts_a | ports_aChiWat[nPorts_aChiWat] | Chilled water inlet ports |
FluidPorts_b | ports_bChiWat[nPorts_bChiWat] | Chilled water outlet ports |
output RealOutput | QHea_flow | Total heating heat flow rate transferred to the loads (>=0) [W] |
output RealOutput | QCoo_flow | Total cooling heat flow rate transferred to the loads (<=0) [W] |
output RealOutput | PHea | Power drawn by decentralized heating system [W] |
output RealOutput | PCoo | Power drawn by decentralized cooling system [W] |
output RealOutput | PFan | Power drawn by fan motors [W] |
output RealOutput | PPum | Power drawn by pump motors [W] |
replaceable package Medium2 | Load side medium |
output RealOutput | QReqHotWat_flow | SHW load [W] |
output RealOutput | QReqHea_flow | Heating load [W] |
output RealOutput | QReqCoo_flow | Cooling load [W] |
Modelica definition
model BuildingTimeSeries
extends Buildings.DHC.Loads.BaseClasses.PartialBuilding(
redeclare package Medium=
Buildings.Media.Water,
have_heaWat=true,
have_chiWat=true,
final have_fan=false,
final have_pum=true,
final have_eleHea=false,
final have_eleCoo=false,
final have_weaBus=false);
replaceable package Medium2=
Buildings.Media.Air
constrainedby Modelica.Media.Interfaces.PartialMedium
;
parameter Boolean have_hotWat = false
;
parameter String filNam
;
parameter Real facMulHea(min=0)=QHea_flow_nominal /
(QHea_flow_nominal_ref *
abs(T_aLoaHea_nominal - T_aHeaWat_nominal) /
abs(T_aLoaHea_nominal_ref - T_aHeaWat_nominal_ref) *
mLoaHea_flow_nominal / mLoaHea_flow_nominal_ref)
;
parameter Real facMulCoo(min=0)=QCoo_flow_nominal /
(QCoo_flow_nominal_ref *
abs(h_aLoaCoo_nominal - hSat_nominal) /
abs(h_aLoaCoo_nominal_ref - hSat_nominal_ref) *
mLoaCoo_flow_nominal / mLoaCoo_flow_nominal_ref)
;
parameter Modelica.Units.SI.Temperature T_aHeaWat_nominal=323.15
;
parameter Modelica.Units.SI.Temperature T_bHeaWat_nominal(
min=273.15,
displayUnit="degC") = T_aHeaWat_nominal - 10
;
parameter Modelica.Units.SI.Temperature T_aChiWat_nominal=280.15
;
parameter Modelica.Units.SI.Temperature T_bChiWat_nominal(
min=273.15,
displayUnit="degC") = T_aChiWat_nominal + 5
;
parameter Modelica.Units.SI.Temperature T_aLoaHea_nominal=293.15
;
parameter Modelica.Units.SI.Temperature T_aLoaCoo_nominal=298.15
;
parameter Modelica.Units.SI.MassFraction w_aLoaCoo_nominal=0.01
;
parameter Modelica.Units.SI.MassFlowRate mLoaHea_flow_nominal(min=Modelica.Constants.eps)=0.5
;
parameter Modelica.Units.SI.MassFlowRate mLoaCoo_flow_nominal(min=Modelica.Constants.eps)=
mLoaHea_flow_nominal
;
parameter Modelica.Units.SI.Temperature T_aHeaWat_nominal_ref=323.15
;
parameter Modelica.Units.SI.Temperature T_aLoaHea_nominal_ref=293.15
;
parameter Modelica.Units.SI.MassFlowRate mLoaHea_flow_nominal_ref(min=Modelica.Constants.eps) = 0.5
;
parameter Modelica.Units.SI.HeatFlowRate QHea_flow_nominal_ref(min=Modelica.Constants.eps) = 4.5E3
;
parameter Modelica.Units.SI.Temperature T_aChiWat_nominal_ref=279.15
;
parameter Modelica.Units.SI.Temperature T_aLoaCoo_nominal_ref=298.15
;
parameter Modelica.Units.SI.MassFraction w_aLoaCoo_nominal_ref=0.01
;
parameter Modelica.Units.SI.MassFlowRate mLoaCoo_flow_nominal_ref(min=Modelica.Constants.eps) = 0.5
;
parameter Modelica.Units.SI.HeatFlowRate QCoo_flow_nominal_ref(max=-Modelica.Constants.eps) = -5.8E3
;
parameter Modelica.Units.SI.HeatFlowRate QCoo_flow_nominal(max=0)=
if have_chiWat
then
Buildings.DHC.Loads.BaseClasses.getPeakLoad(string=
"#Peak space cooling load",
filNam=
Modelica.Utilities.Files.loadResource(filNam))
else 0
;
parameter Modelica.Units.SI.HeatFlowRate QHea_flow_nominal(min=0)=
if have_heaWat
then
Buildings.DHC.Loads.BaseClasses.getPeakLoad(string=
"#Peak space heating load",
filNam=
Modelica.Utilities.Files.loadResource(filNam))
else 0
;
parameter Modelica.Units.SI.MassFlowRate mChiWat_flow_nominal(min=0)=
QCoo_flow_nominal/cp_default/(T_aChiWat_nominal - T_bChiWat_nominal)
;
parameter Modelica.Units.SI.MassFlowRate mHeaWat_flow_nominal(min=0)=
QHea_flow_nominal/cp_default/(T_aHeaWat_nominal - T_bHeaWat_nominal)
;
parameter Real k(
min=0)=0.1
;
parameter Modelica.Units.SI.Time Ti(min=Modelica.Constants.small) = 10
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput QReqHotWat_flow(
final unit="W")
if have_hotWat
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput QReqHea_flow(
final quantity="HeatFlowRate",
final unit="W")
if have_heaLoa
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput QReqCoo_flow(
final quantity="HeatFlowRate",
final unit="W")
if have_cooLoa
;
Modelica.Blocks.Sources.CombiTimeTable loa(
tableOnFile=true,
tableName="tab1",
fileName=
Modelica.Utilities.Files.loadResource(
filNam),
extrapolation=Modelica.Blocks.Types.Extrapolation.Periodic,
y(
each unit="W"),
offset={0,0,0},
columns={2,3,4},
smoothness=Modelica.Blocks.Types.Smoothness.MonotoneContinuousDerivative1)
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant minTSet(
k=293.15,
y(
final unit="K",
displayUnit="degC"))
if have_heaWat
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant maxTSet(
k=297.15,
y(
final unit="K",
displayUnit="degC"))
if have_chiWat
;
replaceable Buildings.DHC.Loads.BaseClasses.Validation.BaseClasses.FanCoil2PipeHeating
terUniHea(
final k=k,
final Ti=Ti)
if have_heaWat
constrainedby Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit(
redeclare final package Medium1=
Medium,
redeclare final package Medium2=
Medium2,
final allowFlowReversal=allowFlowReversal,
final facMul=facMulHea,
final facMulZon=1,
final QHea_flow_nominal=QHea_flow_nominal/facMulHea,
final mLoaHea_flow_nominal=mLoaHea_flow_nominal,
final T_aHeaWat_nominal=T_aHeaWat_nominal,
final T_bHeaWat_nominal=T_bHeaWat_nominal,
final T_aLoaHea_nominal=T_aLoaHea_nominal)
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloHea(
redeclare final package Medium=
Medium,
final allowFlowReversal=allowFlowReversal,
m_flow_nominal=mHeaWat_flow_nominal,
have_pum=true,
typCtr=Buildings.DHC.Loads.BaseClasses.Types.PumpControlType.ConstantHead,
dp_nominal=100000,
nPorts_a1=1,
nPorts_b1=1)
if have_heaWat
;
Buildings.DHC.Loads.BaseClasses.FlowDistribution disFloCoo(
redeclare final package Medium=
Medium,
final allowFlowReversal=allowFlowReversal,
m_flow_nominal=mChiWat_flow_nominal,
typDis=Buildings.DHC.Loads.BaseClasses.Types.DistributionType.ChilledWater,
have_pum=true,
typCtr=Buildings.DHC.Loads.BaseClasses.Types.PumpControlType.ConstantHead,
dp_nominal=100000,
nPorts_b1=1,
nPorts_a1=1)
if have_chiWat
;
replaceable Buildings.DHC.Loads.BaseClasses.Validation.BaseClasses.FanCoil2PipeCooling
terUniCoo(
final k=k,
final Ti=Ti,
final QEnv_flow_nominal=
if have_heaWat
then QHea_flow_nominal/facMulHea
else -QCoo_flow_nominal/facMulCoo)
if have_chiWat
constrainedby Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit(
redeclare final package Medium1 =
Medium,
redeclare final package Medium2 =
Medium2,
final allowFlowReversal=allowFlowReversal,
final facMul=facMulCoo,
final facMulZon=1,
final QCoo_flow_nominal=QCoo_flow_nominal/facMulCoo,
final mLoaCoo_flow_nominal=mLoaCoo_flow_nominal,
final T_aChiWat_nominal=T_aChiWat_nominal,
final T_bChiWat_nominal=T_bChiWat_nominal,
final T_aLoaCoo_nominal=T_aLoaCoo_nominal,
final w_aLoaCoo_nominal=w_aLoaCoo_nominal) ;
Buildings.Controls.OBC.CDL.Reals.Add addPPum
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant noCoo(
k=0)
if not have_chiWat
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant noHea(
k=0)
if not have_heaWat
;
Buildings.Controls.OBC.CDL.Reals.Add addPFan
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQReqHea_flow(
u(
final unit="W"),
final k=facMul)
if have_heaLoa ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQReqCoo_flow(u(
final unit="W"),
final k=facMul)
if have_cooLoa ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQReqHot_flow(u(
final
unit="W"),
final k=facMul)
if have_heaLoa ;
protected
parameter Modelica.Units.SI.AbsolutePressure pSat_nominal=
Buildings.Utilities.Psychrometrics.Functions.saturationPressure(T_aChiWat_nominal)
;
parameter Modelica.Units.SI.AbsolutePressure pSat_nominal_ref=
Buildings.Utilities.Psychrometrics.Functions.saturationPressure(T_aChiWat_nominal_ref)
;
parameter Modelica.Units.SI.MassFraction X1_aLoaCoo_nominal=
w_aLoaCoo_nominal / (1 + w_aLoaCoo_nominal)
;
parameter Modelica.Units.SI.MassFraction X1Sat_nominal=
Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi(
pSat=pSat_nominal, p=Medium2.p_default, phi=1.0)
;
parameter Modelica.Units.SI.MassFraction X1_aLoaCoo_nominal_ref=
w_aLoaCoo_nominal_ref / (1 + w_aLoaCoo_nominal_ref)
;
parameter Modelica.Units.SI.MassFraction X1Sat_nominal_ref=
Buildings.Utilities.Psychrometrics.Functions.X_pSatpphi(
pSat=pSat_nominal_ref, p=Medium2.p_default, phi=1.0)
;
parameter Modelica.Units.SI.SpecificEnthalpy h_aLoaCoo_nominal=
Buildings.Media.Air.specificEnthalpy_pTX(
p=Medium2.p_default, T=T_aLoaCoo_nominal, X={X1_aLoaCoo_nominal, 1-X1_aLoaCoo_nominal})
;
parameter Modelica.Units.SI.SpecificEnthalpy hSat_nominal=
Buildings.Media.Air.specificEnthalpy_pTX(
p=Medium2.p_default, T=T_aChiWat_nominal, X={X1Sat_nominal, 1-X1Sat_nominal})
;
parameter Modelica.Units.SI.SpecificEnthalpy h_aLoaCoo_nominal_ref=
Buildings.Media.Air.specificEnthalpy_pTX(
p=Medium2.p_default, T=T_aLoaCoo_nominal_ref, X={X1_aLoaCoo_nominal_ref, 1-X1_aLoaCoo_nominal_ref})
;
parameter Modelica.Units.SI.SpecificEnthalpy hSat_nominal_ref=
Buildings.Media.Air.specificEnthalpy_pTX(
p=Medium2.p_default, T=T_aChiWat_nominal_ref, X={X1Sat_nominal_ref, 1-X1Sat_nominal_ref})
;
initial equation
if have_chiWat
then
assert(QCoo_flow_nominal < -Modelica.Constants.eps, "QCoo_flow_nominal must be negative.");
assert(T_aChiWat_nominal - T_bChiWat_nominal < 0, "Temperature difference (T_aChiWat_nominal - T_bChiWat_nominal) has wrong sign.");
end if;
if have_heaWat
then
assert(T_aHeaWat_nominal - T_bHeaWat_nominal > 0, "Temperature difference (T_aHeaWat_nominal - T_bHeaWat_nominal) has wrong sign.");
end if;
equation
connect(terUniHea.port_bHeaWat,disFloHea.ports_a1[1]);
connect(disFloHea.ports_b1[1],terUniHea.port_aHeaWat);
connect(terUniHea.mReqHeaWat_flow,disFloHea.mReq_flow[1]);
connect(loa.y[1],terUniCoo.QReqCoo_flow);
connect(loa.y[2],terUniHea.QReqHea_flow);
connect(disFloCoo.ports_b1[1],terUniCoo.port_aChiWat);
connect(terUniCoo.port_bChiWat,disFloCoo.ports_a1[1]);
connect(terUniCoo.mReqChiWat_flow,disFloCoo.mReq_flow[1]);
connect(minTSet.y,terUniHea.TSetHea);
connect(maxTSet.y,terUniCoo.TSetCoo);
connect(disFloHea.PPum,addPPum.u1);
connect(disFloCoo.PPum,addPPum.u2);
connect(noHea.y,addPPum.u1);
connect(noCoo.y,addPPum.u2);
connect(noHea.y,addPFan.u1);
connect(noCoo.y,addPFan.u2);
connect(terUniCoo.PFan,addPFan.u2);
connect(terUniHea.PFan,addPFan.u1);
connect(disFloCoo.port_b, mulChiWatOut[1].port_a);
connect(disFloHea.port_b, mulHeaWatOut[1].port_a);
connect(mulHeaWatInl[1].port_b, disFloHea.port_a);
connect(mulChiWatInl[1].port_b, disFloCoo.port_a);
connect(addPFan.y, mulPFan.u);
connect(addPPum.y, mulPPum.u);
connect(mulQReqCoo_flow.y, QReqCoo_flow);
connect(mulQReqHea_flow.y, QReqHea_flow);
connect(loa.y[1], mulQReqCoo_flow.u);
connect(loa.y[2], mulQReqHea_flow.u);
connect(disFloHea.QActTot_flow, mulQHea_flow.u);
connect(disFloCoo.QActTot_flow, mulQCoo_flow.u);
connect(mulQReqHot_flow.y, QReqHotWat_flow);
connect(mulQReqHot_flow.u, loa.y[3]);
end BuildingTimeSeries;
Block that outputs the fraction of time when a constraint is violated
Information
Block that outputs the running fractional time during which any element
ui of the input signal
is not within umin ≤ ui ≤ umax.
Parameters
Type | Name | Default | Description |
Real | uMin | | Minimum value for input |
Real | uMax | | Maximum value for input |
Connectors
Type | Name | Description |
input RealInput | u[nu] | Variables of interest |
output RealOutput | y | Fraction of time when the constraint is violated [1] |
Modelica definition
block ConstraintViolation
parameter Real uMin ;
parameter Real uMax ;
parameter Integer nu(min=0) = 0
;
Buildings.Controls.OBC.CDL.Interfaces.RealInput u[nu]
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput y(
final unit="1",
start=0,
fixed=true)
;
Modelica.Units.SI.Time t(
final start=0,
final fixed=true)
;
protected
parameter Modelica.Units.SI.Time t0(fixed=false) ;
Boolean vioMin ;
Boolean vioMax ;
initial equation
t0 = time - 1E-6;
equation
vioMin =
Modelica.Math.BooleanVectors.anyTrue({u[i] < uMin
for i
in 1:nu});
vioMax =
Modelica.Math.BooleanVectors.anyTrue({u[i] > uMax
for i
in 1:nu});
if vioMin
or vioMax
then
der(t) = 1;
else
der(t) = 0;
end if;
y = t / (time - t0);
end ConstraintViolation;
Model of a sensible only four-pipe fan coil unit computing a required water mass flow rate
Information
This is a simplified model of a sensible only four-pipe fan coil unit for heating and cooling.
It is intended to be coupled to a room model by means of fluid ports.
See
Buildings.DHC.Loads.BaseClasses.PartialFanCoil4Pipe
for a description of the modeling principles.
Extends from PartialFanCoil4Pipe (Partial model of a sensible only four-pipe fan coil unit computing a required water mass flow rate).
Parameters
Type | Name | Default | Description |
Scaling |
Real | facMul | 1 | Multiplier factor |
Real | facMulZon | 1 | Zone multiplier factor |
Configuration |
Boolean | have_heaPor | false | Set to true for heat ports on the load side |
Boolean | have_fluPor | true | Set to true for fluid ports on the load side |
Boolean | have_TSen | true | Set to true for measured temperature as an input |
Nominal condition |
HeatFlowRate | QHea_flow_nominal | 0 | Nominal heating capacity (>=0) [W] |
HeatFlowRate | QCoo_flow_nominal | 0 | Nominal cooling capacity (<=0) [W] |
MassFlowRate | mLoaHea_flow_nominal | 0 | Load side mass flow rate at nominal conditions in heating mode [kg/s] |
MassFlowRate | mLoaCoo_flow_nominal | 0 | Load side mass flow rate at nominal conditions in cooling mode [kg/s] |
Temperature | T_aHeaWat_nominal | 273.15 + 60 | Heating water inlet temperature at nominal conditions [K] |
Temperature | T_bHeaWat_nominal | T_aHeaWat_nominal - 22.2 | Heating water outlet temperature at nominal conditions [K] |
Temperature | T_aChiWat_nominal | 273.15 + 7.2 | Chilled water inlet temperature at nominal conditions [K] |
Temperature | T_bChiWat_nominal | T_aChiWat_nominal + 5.6 | Chilled water outlet temperature at nominal conditions [K] |
Temperature | T_aLoaHea_nominal | 273.15 + 21.1 | Load side inlet temperature at nominal conditions in heating mode [K] |
Temperature | T_aLoaCoo_nominal | 273.15 + 26.7 | Load side inlet temperature at nominal conditions in cooling mode [K] |
MassFraction | w_aLoaCoo_nominal | 0.011 | Load side inlet humidity ratio at nominal conditions in cooling mode [1] |
Connectors
Type | Name | Description |
input RealInput | TSen | Temperature (measured) [K] |
input RealInput | TSetHea | Heating set point [K] |
input RealInput | TSetCoo | Cooling set point [K] |
input RealInput | QReqHea_flow | Required heat flow rate to meet heating set point (>=0) [W] |
input RealInput | QReqCoo_flow | Required heat flow rate to meet cooling set point (<=0) [W] |
output RealOutput | QActHea_flow | Heating heat flow rate transferred to the load (>=0) [W] |
output RealOutput | QActCoo_flow | Cooling heat flow rate transferred to the load (<=0) [W] |
output RealOutput | PHea | Power drawn by heating system [W] |
output RealOutput | PCoo | Power drawn by cooling system [W] |
output RealOutput | PFan | Power drawn by fans motors [W] |
output RealOutput | PPum | Power drawn by pumps motors [W] |
output RealOutput | mReqHeaWat_flow | Required heating water flow rate to meet heating set point [kg/s] |
output RealOutput | mReqChiWat_flow | Required chilled water flow rate to meet cooling set point [kg/s] |
FluidPort_a | port_aLoa | Fluid stream inlet port on the load side |
FluidPort_b | port_bLoa | Fluid stream outlet port on the load side |
HeatPort_b | heaPorCon | Heat port transferring convective heat to the load |
HeatPort_b | heaPorRad | Heat port transferring radiative heat to the load |
Bus | weaBus | Weather data bus |
FluidPort_a | port_aHeaWat | Heating water inlet port |
FluidPort_a | port_aChiWat | Chilled water inlet port |
FluidPort_b | port_bHeaWat | Heating water outlet port |
FluidPort_b | port_bChiWat | Chilled water outlet port |
Modelica definition
model FanCoil4Pipe
extends PartialFanCoil4Pipe(
final have_TSen=true,
final have_fluPor=true,
final have_heaPor=false);
equation
connect(TSen,conCoo.u_m);
connect(TSen,conHea.u_m);
connect(hexHea.port_b2,mulLoaMasFloOut.port_a);
connect(mulLoaMasFloInl.port_b,fan.port_a);
end FanCoil4Pipe;
Model of a sensible only four-pipe fan coil unit computing a required water mass flow rate
Information
This is a simplified model of a sensible only four-pipe fan coil unit for heating and cooling.
It is intended to be coupled to a room model by means of heat ports.
See
Buildings.DHC.Loads.BaseClasses.PartialFanCoil4Pipe
for a description of the modeling principles.
Extends from PartialFanCoil4Pipe (Partial model of a sensible only four-pipe fan coil unit computing a required water mass flow rate).
Parameters
Type | Name | Default | Description |
Scaling |
Real | facMul | 1 | Multiplier factor |
Real | facMulZon | 1 | Zone multiplier factor |
Configuration |
Boolean | have_heaPor | true | Set to true for heat ports on the load side |
Boolean | have_fluPor | false | Set to true for fluid ports on the load side |
Boolean | have_TSen | false | Set to true for measured temperature as an input |
Nominal condition |
HeatFlowRate | QHea_flow_nominal | 0 | Nominal heating capacity (>=0) [W] |
HeatFlowRate | QCoo_flow_nominal | 0 | Nominal cooling capacity (<=0) [W] |
MassFlowRate | mLoaHea_flow_nominal | 0 | Load side mass flow rate at nominal conditions in heating mode [kg/s] |
MassFlowRate | mLoaCoo_flow_nominal | 0 | Load side mass flow rate at nominal conditions in cooling mode [kg/s] |
Temperature | T_aHeaWat_nominal | 273.15 + 60 | Heating water inlet temperature at nominal conditions [K] |
Temperature | T_bHeaWat_nominal | T_aHeaWat_nominal - 22.2 | Heating water outlet temperature at nominal conditions [K] |
Temperature | T_aChiWat_nominal | 273.15 + 7.2 | Chilled water inlet temperature at nominal conditions [K] |
Temperature | T_bChiWat_nominal | T_aChiWat_nominal + 5.6 | Chilled water outlet temperature at nominal conditions [K] |
Temperature | T_aLoaHea_nominal | 273.15 + 21.1 | Load side inlet temperature at nominal conditions in heating mode [K] |
Temperature | T_aLoaCoo_nominal | 273.15 + 26.7 | Load side inlet temperature at nominal conditions in cooling mode [K] |
MassFraction | w_aLoaCoo_nominal | 0.011 | Load side inlet humidity ratio at nominal conditions in cooling mode [1] |
Connectors
Type | Name | Description |
input RealInput | TSen | Temperature (measured) [K] |
input RealInput | TSetHea | Heating set point [K] |
input RealInput | TSetCoo | Cooling set point [K] |
input RealInput | QReqHea_flow | Required heat flow rate to meet heating set point (>=0) [W] |
input RealInput | QReqCoo_flow | Required heat flow rate to meet cooling set point (<=0) [W] |
output RealOutput | QActHea_flow | Heating heat flow rate transferred to the load (>=0) [W] |
output RealOutput | QActCoo_flow | Cooling heat flow rate transferred to the load (<=0) [W] |
output RealOutput | PHea | Power drawn by heating system [W] |
output RealOutput | PCoo | Power drawn by cooling system [W] |
output RealOutput | PFan | Power drawn by fans motors [W] |
output RealOutput | PPum | Power drawn by pumps motors [W] |
output RealOutput | mReqHeaWat_flow | Required heating water flow rate to meet heating set point [kg/s] |
output RealOutput | mReqChiWat_flow | Required chilled water flow rate to meet cooling set point [kg/s] |
FluidPort_a | port_aLoa | Fluid stream inlet port on the load side |
FluidPort_b | port_bLoa | Fluid stream outlet port on the load side |
HeatPort_b | heaPorCon | Heat port transferring convective heat to the load |
HeatPort_b | heaPorRad | Heat port transferring radiative heat to the load |
Bus | weaBus | Weather data bus |
FluidPort_a | port_aHeaWat | Heating water inlet port |
FluidPort_a | port_aChiWat | Chilled water inlet port |
FluidPort_b | port_bHeaWat | Heating water outlet port |
FluidPort_b | port_bChiWat | Chilled water outlet port |
Modelica definition
model FanCoil4PipeHeatPorts
extends PartialFanCoil4Pipe(
final have_heaPor=true,
final have_fluPor=false,
final have_TSen=false);
Buildings.HeatTransfer.Sources.PrescribedHeatFlow heaFloHeaCon
;
Buildings.HeatTransfer.Sources.PrescribedHeatFlow heaFloCooCon
;
Fluid.Sources.Boundary_pT retAir(
redeclare package Medium=
Medium2,
use_T_in=true,
nPorts=1)
;
Fluid.Sources.Boundary_pT sinAir(
redeclare package Medium=
Medium2,
use_T_in=false,
nPorts=1)
;
HeatTransfer.Sources.PrescribedHeatFlow heaFloHeaRad
;
HeatTransfer.Sources.PrescribedHeatFlow heaFloCooRad
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant zero(
k=0)
;
Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor senT
;
equation
connect(hexHea.port_b2,sinAir.ports[1]);
connect(Q_flowCoo.y,heaFloCooCon.Q_flow);
connect(Q_flowHea.y,heaFloHeaCon.Q_flow);
connect(zero.y,heaFloHeaRad.Q_flow);
connect(zero.y,heaFloCooRad.Q_flow);
connect(retAir.ports[1],fan.port_a);
connect(heaPorCon,senT.port);
connect(senT.T,retAir.T_in);
connect(senT.T,conCoo.u_m);
connect(senT.T,conHea.u_m);
connect(heaFloCooCon.port,mulHeaFloCon.port_a);
connect(heaFloHeaCon.port,mulHeaFloCon.port_a);
connect(heaFloHeaRad.port,mulHeaFloRad.port_a);
connect(heaFloCooRad.port,mulHeaFloRad.port_a);
end FanCoil4PipeHeatPorts;
Model of a building hydraulic distribution system
Information
This model represents a two-pipe hydraulic distribution system serving multiple
terminal units.
It is primarily intended to be used in conjunction with models that extend
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit.
The typical model structure for a whole building connected to an energy
transfer station (or a dedicated plant) is illustrated in the schematics in
the info section of
Buildings.DHC.Loads.BaseClasses.PartialBuilding.
The pipe network modeling is decoupled between a main distribution
loop and several terminal branch circuits:
-
The mass flow rate in each branch circuit is equal to the mass flow rate demand yielded
by the terminal unit model, constrained by the condition that the sum of all
demands is lower or equal to the flow rate in the main loop.
Additionally if the total flow rate demand exceeds the nominal mass flow rate
the model generates an error.
-
The inlet temperature in each branch circuit is equal to the supply temperature
in the main loop.
The outlet temperature in the main loop results from transferring the enthalpy
flow rate of each individual fluid stream to the main fluid stream.
-
The pressure drop in the main distribution loop corresponds to the pressure drop
over the whole distribution system (the pump head). It is governed by an equation
representing the control logic of the distribution pump.
Optionally:
-
A distribution pump can be modeled with a prescribed flow rate corresponding
to the total flow rate demand.
-
A mixing valve can be modeled (together with a distribution pump) with a
control loop tracking the supply temperature. Note that the nominal pressure
drop of the valve is not an exposed parameter: it is set by default to 10%
of the nominal total pressure drop.
Implementation
The modeling approach aims to minimize the number of algebraic
equations by avoiding an explicit modeling of the terminal actuators and
the whole flow network.
In addition, the assumption allowFlowReversal=false
is used
systematically together with boundary conditions which actually ensure that
no reverse flow conditions are encountered in simulation.
This allows directly accessing the inlet enthalpy value of a component from
the fluid port port_a
with the built-in function inStream
.
This approach is preferred to the use of two-port sensors which introduce a
state to ensure a smooth transition at flow reversal.
All connected components must meet the same requirements.
The impact on the computational performance is illustrated
below.
Pump head computation
The pump head is computed as follows (see also
Buildings.DHC.Loads.BaseClasses.Validation.FlowDistributionPumpControl
for a comparison with an explicit modeling of the piping network).
-
In case of a constant pump head,
dpPum = dp_nominal.
-
In case of a constant flow rate (three-way valves) the network flow
characteristics is considered independent from the actuator positions.
Hence,
dpPum = dp_nominal.
-
In case of a linear head,
dpPum = dpMin + (dp_nominal - dpMin) * m_flow / m_flow_nominal.
-
In case of a constant speed, the pump head is computed based on the pump pressure
curve and the total required mass flow rate.
-
In case of a constant pressure difference at a given location, the pump head
is computed according to the schematics hereunder, under the
assumption of a two-pipe distribution system,
dpPum = dpMin + dpVal + 2 * Σi dpDis[i],
where
-
dpMin is the differential pressure set point.
-
dpVal is the pressure drop across the optional mixing valve.
It is considered independent from the valve position, i.e.,
dpVal = dpVal_nominal,
-
dpDis[i] is the pressure drop in the supply pipe segment directly
upstream the ith connection,
dpDis[i] = 1 / K[i]2 * mDis_flow[i] 2,
where
mDis_flow[i] = Σi to nUni mReq_flow[i]
is the mass flow rate in the same pipe segment, and
K[i] = (Σi to nUni mUni_flow_nominal[i]) /
dpDis_nominal[i]0.5
is the corresponding flow coefficient (constant).
-
The pressure drop in the corresponding pipe segment of the return line
is considered equal, hence the factor of 2 in the above equation.
The default value for dpDis_nominal
corresponds to a configuration
where the differential pressure sensor is located before the most remote
connected unit, 20% of the nominal pressure drop in the distribution network
occurs between the pump and the first connected unit (supply and return),
the remaining pressure drop is evenly distributed over each pipe segment
between the other connected units.
The user can override these default values with the requirement that the
nominal pressure drop of each pipe segment downstream of the differential pressure
sensor must be set to zero.
Energy and mass dynamics
The energy dynamics and the time constant used in the ideal heater and cooler
model are exposed as advanced parameters.
They are used to represent the typical dynamics over the whole
piping network, from supply to return.
The mass dynamics are by default identical to the energy dynamics.
Simplifying assumptions are used otherwise, namely
-
the pump is modeled in steady-state, and
-
the valve and the flow splitter are modeled with fixed initial conditions.
This is because the temperature of the fluid leaving the valve is used
as a control input signal. If a steady-state model is used, that temperature
is computed by assuming ideal mixing at the inner fluid ports of the valve.
In case of zero flow rate, the temperature value results from regularizing
the corresponding equation that is not well defined in that domain.
That triggers non-physical temperature variations which themselves lead to
control transients when the flow rate gets reestablished. Those effects
turn out to be detrimental to computational performance.
Computational performance
The figure below compares the computational performance of this model
(labelled simple
, see model
Buildings.DHC.Loads.BaseClasses.Validation.BenchmarkFlowDistribution1)
with an explicit modeling of the distribution network and
the terminal unit actuators (labelled detailed
, see model
Buildings.DHC.Loads.BaseClasses.Validation.BenchmarkFlowDistribution2).
The models are simulated with the solver CVODE from Sundials.
The impact of a varying number of connected loads, nLoa
, is
assessed on
-
the total time for all model evaluations,
-
the total time spent between model evaluations, and
-
the number of continuous state variables.
A linear, resp. quadratic, regression line and the corresponding confidence interval are
also plotted for the model labelled simple
, resp. detailed
.
Extends from Buildings.Fluid.Interfaces.PartialTwoPortInterface (Partial model with two ports and declaration of quantities that are used by many models).
Parameters
Type | Name | Default | Description |
replaceable package Medium | PartialMedium | Medium in the component |
Boolean | have_pum | false | Set to true if the system has a pump |
Boolean | have_val | false | Set to true if the system has a mixing valve |
DistributionType | typDis | Type_dis.HeatingWater | Type of distribution system |
PumpControlType | typCtr | Type_ctr.ConstantHead | Type of distribution pump control |
PressureDifference | dpMin | dp_nominal/2 | Pressure difference set point for ConstantDp or at zero flow for LinearHead [Pa] |
Nominal condition |
MassFlowRate | m_flow_nominal | | Nominal mass flow rate [kg/s] |
Real | spePum_nominal | 1 | Pump speed at nominal conditions [1] |
PressureDifference | dp_nominal | | Pressure drop at nominal conditions [Pa] |
PressureDifference | dpDis_nominal[:] | if nUni == 1 then {1/2*(dp_n... | Pressure drop between each connected unit at nominal conditions (supply line):
use zero for each connection downstream the differential pressure sensor [Pa] |
MassFlowRate | mUni_flow_nominal[:] | fill(m_flow_nominal/nUni, nU... | Mass flow rate of each connected unit at nominal conditions [kg/s] |
Assumptions |
Boolean | allowFlowReversal | false | = false to simplify equations, assuming, but not enforcing, no flow reversal |
Advanced |
MassFlowRate | m_flow_small | 1E-4*abs(m_flow_nominal) | Small mass flow rate for regularization of zero flow [kg/s] |
Diagnostics |
Boolean | show_T | false | = true, if actual temperature at port is computed |
Dynamics |
Conservation equations |
Dynamics | energyDynamics | Modelica.Fluid.Types.Dynamic... | Type of energy balance (except for the pump always modeled in steady state) |
Nominal condition |
Time | tau | 120 | Time constant of fluid temperature variation at nominal flow rate [s] |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the component |
FluidPort_a | port_a | Fluid connector a (positive design flow direction is from port_a to port_b) |
FluidPort_b | port_b | Fluid connector b (positive design flow direction is from port_a to port_b) |
FluidPorts_a | ports_a1[nPorts_a1] | Terminal units return ports |
FluidPorts_b | ports_b1[nPorts_b1] | Terminal units supply ports |
input RealInput | mReq_flow[nUni] | Heating or chilled water flow rate required to meet the load |
input IntegerInput | modChaOve | Operating mode in change-over (1 for heating, 2 for cooling) |
input RealInput | TSupSet | Supply temperature set point [K] |
output RealOutput | mReqTot_flow | Total heating or chilled water flow rate required to meet the loads [kg/s] |
output RealOutput | QActTot_flow | Total heat flow rate transferred to the loads (>=0 for heating) [W] |
output RealOutput | PPum | Power drawn by pump motor [W] |
Modelica definition
model FlowDistribution
extends Buildings.Fluid.Interfaces.PartialTwoPortInterface(
redeclare replaceable package Medium=
Buildings.Media.Water,
allowFlowReversal=false);
import Type_dis=
Buildings.DHC.Loads.BaseClasses.Types.DistributionType
;
import Type_ctr=
Buildings.DHC.Loads.BaseClasses.Types.PumpControlType
;
parameter Integer nPorts_a1=0
;
parameter Integer nPorts_b1=0
;
final parameter Integer nUni=nPorts_a1
;
parameter Boolean have_pum=false
;
parameter Boolean have_val=false
;
parameter Type_dis typDis=Type_dis.HeatingWater
;
parameter Type_ctr typCtr=Type_ctr.ConstantHead
;
parameter Real spePum_nominal(
final unit="1",
final min=0,
final max=1)=1
;
parameter Modelica.Units.SI.PressureDifference dp_nominal(
final min=0,
displayUnit="Pa") ;
final parameter Modelica.Units.SI.PressureDifference dpVal_nominal(
final min=0,
displayUnit="Pa") =
if have_val
then 0.1*dp_nominal
else 0
;
parameter Modelica.Units.SI.PressureDifference dpDis_nominal[:](
each final min=0,
each displayUnit="Pa") =
if nUni == 1
then {1/2*(dp_nominal - dpVal_nominal
- dpMin)}
else 1/2 .*
cat(
1,
{(dp_nominal - dpVal_nominal - dpMin)*0.2},
fill((dp_nominal - dpVal_nominal - dpMin)*0.8/(nUni - 1), nUni - 1)) ;
parameter Modelica.Units.SI.PressureDifference dpMin(
final min=0,
displayUnit="Pa") = dp_nominal/2
;
parameter Modelica.Units.SI.MassFlowRate mUni_flow_nominal[:](
each final min=
0) =
fill(m_flow_nominal/nUni, nUni)
;
parameter Modelica.Fluid.Types.Dynamics energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial
;
final parameter Modelica.Fluid.Types.Dynamics massDynamics=energyDynamics
;
parameter Modelica.Units.SI.Time tau=120
;
Modelica.Fluid.Interfaces.FluidPorts_a ports_a1[nPorts_a1](
redeclare each final package Medium=
Medium,
each m_flow(
min=
if allowFlowReversal
then
-Modelica.Constants.inf
else
0),
each h_outflow(
start=Medium.h_default,
nominal=Medium.h_default))
;
Modelica.Fluid.Interfaces.FluidPorts_b ports_b1[nPorts_b1](
redeclare each final package Medium=
Medium,
each m_flow(
max=
if allowFlowReversal
then
+Modelica.Constants.inf
else
0),
each h_outflow(
start=Medium.h_default,
nominal=Medium.h_default))
;
Modelica.Blocks.Interfaces.RealInput mReq_flow[nUni](
each final quantity="MassFlowRate")
;
Modelica.Blocks.Interfaces.IntegerInput modChaOve
if have_val
and typDis == Type_dis.ChangeOver
;
Modelica.Blocks.Interfaces.RealInput TSupSet(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
if have_val
;
Modelica.Blocks.Interfaces.RealOutput mReqTot_flow(
final quantity="MassFlowRate",
final unit="kg/s")
;
Modelica.Blocks.Interfaces.RealOutput QActTot_flow(
final quantity="HeatFlowRate",
final unit="W")
;
Modelica.Blocks.Interfaces.RealOutput PPum(
final quantity="Power",
final unit="W")
if have_pum
;
Buildings.Controls.OBC.CDL.Reals.MultiSum sumMasFloReq(
final k=
fill(
1,
nUni),
final nin=nUni)
;
Buildings.Fluid.Sources.MassFlowSource_T sou_m_flow[nUni](
redeclare each final package Medium=
Medium,
each final use_m_flow_in=true,
each final use_T_in=true,
each final nPorts=1)
;
Buildings.Fluid.Sources.Boundary_pT sin(
redeclare final package Medium=
Medium,
final nPorts=nUni)
;
Buildings.Controls.OBC.CDL.Reals.MultiSum Q_flowSum(
final nin=nUni)
;
Modelica.Blocks.Sources.RealExpression mAct_flow[nUni](
final y(
each final unit="kg/s")=
if have_pum
then
mReq_flow
else
mReq_flow .* senMasFlo.m_flow/
Buildings.Utilities.Math.Functions.smoothLimit(
x=mReqTot_flow,
l=m_flow_small,
u=senMasFlo.m_flow,
deltaX=m_flow_small))
;
Modelica.Blocks.Sources.RealExpression QAct_flow[nUni](
final y(
each final unit="W")=mAct_flow.y .*(ports_b1.h_outflow-
inStream(
ports_a1.h_outflow)))
;
Buildings.Fluid.Actuators.Valves.ThreeWayEqualPercentageLinear val(
redeclare final package Medium=
Medium,
final portFlowDirection_1=
if allowFlowReversal
then
Modelica.Fluid.Types.PortFlowDirection.Bidirectional
else
Modelica.Fluid.Types.PortFlowDirection.Entering,
final portFlowDirection_2=
if allowFlowReversal
then
Modelica.Fluid.Types.PortFlowDirection.Bidirectional
else
Modelica.Fluid.Types.PortFlowDirection.Leaving,
final portFlowDirection_3=
if allowFlowReversal
then
Modelica.Fluid.Types.PortFlowDirection.Bidirectional
else
Modelica.Fluid.Types.PortFlowDirection.Entering,
final dpValve_nominal=dpVal_nominal,
final use_inputFilter=false,
final m_flow_nominal=m_flow_nominal,
final linearized={true,true},
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
if have_val
;
Buildings.Fluid.Movers.BaseClasses.IdealSource pipPre(
redeclare final package Medium=
Medium,
final dp_start=dp_nominal-dpVal_nominal,
final m_flow_start=m_flow_nominal,
final show_T=false,
final show_V_flow=false,
final control_m_flow=typCtr == Type_ctr.ConstantSpeed,
final control_dp=typCtr <> Type_ctr.ConstantSpeed,
final allowFlowReversal=allowFlowReversal,
final m_flow_small=m_flow_small)
;
Buildings.Fluid.HeatExchangers.HeaterCooler_u heaCoo(
redeclare final package Medium=
Medium,
final dp_nominal=0,
final m_flow_nominal=m_flow_nominal,
final Q_flow_nominal=-1,
final allowFlowReversal=allowFlowReversal,
final energyDynamics=energyDynamics,
final tau=tau)
;
Buildings.Fluid.FixedResistances.Junction spl(
redeclare final package Medium=
Medium,
final portFlowDirection_1=
if allowFlowReversal
then
Modelica.Fluid.Types.PortFlowDirection.Bidirectional
else
Modelica.Fluid.Types.PortFlowDirection.Entering,
final portFlowDirection_2=
if allowFlowReversal
then
Modelica.Fluid.Types.PortFlowDirection.Bidirectional
else
Modelica.Fluid.Types.PortFlowDirection.Leaving,
final portFlowDirection_3=
if allowFlowReversal
then
Modelica.Fluid.Types.PortFlowDirection.Bidirectional
else
Modelica.Fluid.Types.PortFlowDirection.Leaving,
final m_flow_nominal=m_flow_nominal*{1,1,1},
final dp_nominal=0*{1,1,1},
energyDynamics=Modelica.Fluid.Types.Dynamics.FixedInitial)
if have_val
;
Buildings.Fluid.Sensors.MassFlowRate senMasFlo(
redeclare final package Medium=
Medium,
final allowFlowReversal=allowFlowReversal)
;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaRep(
final nout=nUni)
;
Buildings.DHC.Loads.BaseClasses.Controls.MixingValveControl conVal(
final typDis=typDis)
if have_val
;
Modelica.Blocks.Sources.RealExpression dpNetVal(
final y(
final unit="Pa")=dpPum-dpVal_nominal)
;
Modelica.Blocks.Sources.RealExpression masFloPum(
final y(
final unit="kg/s")=mPum_flow)
;
Modelica.Blocks.Sources.RealExpression spePum(
final y(
final unit="1")=spePum_nominal)
;
Buildings.Fluid.Movers.Preconfigured.FlowControlled_m_flow pumFlo(
redeclare final package Medium=
Medium,
final m_flow_nominal=m_flow_nominal,
final dp_nominal=dp_nominal,
final allowFlowReversal=allowFlowReversal,
addPowerToMedium=false,
use_inputFilter=false,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)
if have_pum
and typCtr <> Type_ctr.ConstantSpeed
;
Buildings.Fluid.Movers.Preconfigured.SpeedControlled_y pumSpe(
redeclare final package Medium=
Medium,
final m_flow_nominal=m_flow_nominal,
final dp_nominal=dp_nominal,
final allowFlowReversal=allowFlowReversal,
addPowerToMedium=false,
use_inputFilter=false,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState)
if have_pum
and typCtr == Type_ctr.ConstantSpeed
;
Fluid.Sensors.TemperatureTwoPort senTSup(
redeclare final package Medium=
Medium,
final allowFlowReversal=allowFlowReversal,
final m_flow_nominal=m_flow_nominal,
initType=Modelica.Blocks.Types.Init.InitialState)
;
protected
final parameter Modelica.Units.SI.MassFlowRate mDis_flow_nominal[nUni]={
sum(
mUni_flow_nominal[i:nUni])
for i
in 1:nUni}
;
final parameter Real kDis[nUni]={
if dpDis_nominal[i] > Modelica.Constants.eps
then
mDis_flow_nominal[i]/
sqrt(dpDis_nominal[i])
else
Modelica.Constants.inf
for i
in 1:nUni}
;
Modelica.Units.SI.MassFlowRate mDis_flow[nUni]={
sum(mReq_flow[i:nUni])
for i
in
1:nUni} ;
Modelica.Units.SI.PressureDifference dpDis[nUni]=(mDis_flow ./ kDis) .^ 2
;
Modelica.Units.SI.PressureDifference dpPum(displayUnit="Pa") =
if typCtr ==
Type_ctr.LinearHead
then dpMin + mPum_flow/m_flow_nominal*dp_nominal
elseif typCtr == Type_ctr.ConstantDp
then 2*
sum(dpDis) + dpMin +
dpVal_nominal
else dp_nominal ;
Modelica.Units.SI.MassFlowRate mPum_flow=
if typCtr == Type_ctr.ConstantFlow
then m_flow_nominal
else sum(mReq_flow) ;
parameter Medium.ThermodynamicState sta_default=
Medium.setState_pTX(
T=Medium.T_default,
p=Medium.p_default,
X=Medium.X_default);
parameter Modelica.Units.SI.Density rho_default=
Medium.density(sta_default)
;
initial equation
assert(
nPorts_a1 == nPorts_b1,
"In "+
getInstanceName()+": The numbers of terminal units return ports ("+
String(
nPorts_a1)+") and supply ports ("+
String(
nPorts_b1)+") must be equal.");
assert(
if have_val
then
have_pum
else
true,
"In "+
getInstanceName()+": The configuration where have_val is true and have_pum is false is not allowed.");
equation
if not have_val
then
connect(heaCoo.port_b,port_b);
connect(port_a,pumFlo.port_a);
connect(port_a,pumSpe.port_a);
end if;
if not have_pum
then
connect(port_a,senTSup.port_a);
end if;
connect(sumMasFloReq.y,mReqTot_flow);
connect(mReq_flow,sumMasFloReq.u);
connect(mAct_flow.y,sou_m_flow.m_flow_in);
connect(ports_a1,sin.ports);
connect(sou_m_flow.ports[1],ports_b1);
connect(senMasFlo.port_b,heaCoo.port_a);
connect(Q_flowSum.y,QActTot_flow);
connect(QAct_flow.y,Q_flowSum.u);
connect(Q_flowSum.y,heaCoo.u);
connect(reaRep.y,sou_m_flow.T_in);
connect(port_a,val.port_1);
connect(heaCoo.port_b,spl.port_1);
connect(spl.port_2,port_b);
connect(spl.port_3,val.port_3);
connect(TSupSet,conVal.TSupSet);
connect(conVal.yVal,val.y);
connect(modChaOve,conVal.modChaOve);
connect(val.port_2,pumFlo.port_a);
connect(val.port_2,pumSpe.port_a);
connect(pumFlo.P,PPum);
connect(pumSpe.P,PPum);
connect(dpNetVal.y,pipPre.dp_in);
connect(masFloPum.y,pipPre.m_flow_in);
connect(masFloPum.y,pumFlo.m_flow_in);
connect(spePum.y,pumSpe.y);
connect(pipPre.port_a,senTSup.port_b);
connect(pumSpe.port_b,senTSup.port_a);
connect(pumFlo.port_b,senTSup.port_a);
connect(senTSup.T,reaRep.u);
connect(senTSup.T,conVal.TSupMes);
connect(pipPre.port_b,senMasFlo.port_a);
end FlowDistribution;
Partial class for building model
Information
Partial model to be used for modeling the thermal loads on an energy
transfer station or a dedicated plant.
Models extending this class are typically used in conjunction with
Buildings.DHC.Loads.BaseClasses.FlowDistribution
and models extending
Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit
as described in the schematics here under.
The fluid ports represent the connection between the production system and
the building distribution system.
Scaling
Scaling is implemented by means of a multiplier factor facMul
.
Each extensive quantity (mass and heat flow rate, electric power)
flowing out through fluid ports, or connected to an
output connector is multiplied by facMul
.
Each extensive quantity (mass and heat flow rate, electric power)
flowing in through fluid ports, or connected to an
input connector is multiplied by 1/facMul
.
This allows modeling, with a single instance,
multiple identical buildings served by the same energy transfer station.
Examples
See various use cases in
Buildings.DHC.Loads.BaseClasses.Examples.
Parameters
Type | Name | Default | Description |
replaceable package Medium | Buildings.Media.Water | Medium in the building distribution system |
Configuration |
Boolean | have_heaWat | false | Set to true if the building has heating water system |
Boolean | have_chiWat | false | Set to true if the building has chilled water system |
Boolean | have_eleHea | false | Set to true if the building has decentralized electric heating system |
Boolean | have_eleCoo | false | Set to true if the building has decentralized electric cooling system |
Boolean | have_fan | false | Set to true if fan power is computed |
Boolean | have_pum | false | Set to true if pump power is computed |
Boolean | have_weaBus | false | Set to true to use a weather bus |
Scaling |
Real | facMul | 1 | Multiplier factor |
Assumptions |
Boolean | allowFlowReversal | false | = true to allow flow reversal, false restricts to design direction (port_a -> port_b) |
Connectors
Type | Name | Description |
replaceable package Medium | Medium in the building distribution system |
Bus | weaBus | Weather data bus |
FluidPorts_a | ports_aHeaWat[nPorts_aHeaWat] | Heating water inlet ports |
FluidPorts_b | ports_bHeaWat[nPorts_bHeaWat] | Heating water outlet ports |
FluidPorts_a | ports_aChiWat[nPorts_aChiWat] | Chilled water inlet ports |
FluidPorts_b | ports_bChiWat[nPorts_bChiWat] | Chilled water outlet ports |
output RealOutput | QHea_flow | Total heating heat flow rate transferred to the loads (>=0) [W] |
output RealOutput | QCoo_flow | Total cooling heat flow rate transferred to the loads (<=0) [W] |
output RealOutput | PHea | Power drawn by decentralized heating system [W] |
output RealOutput | PCoo | Power drawn by decentralized cooling system [W] |
output RealOutput | PFan | Power drawn by fan motors [W] |
output RealOutput | PPum | Power drawn by pump motors [W] |
Modelica definition
partial model PartialBuilding
replaceable package Medium=
Buildings.Media.Water
constrainedby Modelica.Media.Interfaces.PartialMedium
;
parameter Integer nPorts_aHeaWat=0
;
parameter Integer nPorts_bHeaWat=0
;
parameter Integer nPorts_aChiWat=0
;
parameter Integer nPorts_bChiWat=0
;
parameter Boolean have_heaWat=false
;
parameter Boolean have_chiWat=false
;
parameter Boolean have_eleHea=false
;
parameter Boolean have_eleCoo=false
;
parameter Boolean have_fan=false
;
parameter Boolean have_pum=false
;
parameter Boolean have_weaBus=false
;
parameter Real facMul(min=Modelica.Constants.eps)=1
;
parameter Boolean allowFlowReversal=false
;
final parameter Boolean have_heaLoa=have_heaWat
or have_eleHea
;
final parameter Boolean have_cooLoa=have_chiWat
or have_eleCoo
;
Buildings.BoundaryConditions.WeatherData.Bus weaBus
if have_weaBus
;
Modelica.Fluid.Interfaces.FluidPorts_a ports_aHeaWat[nPorts_aHeaWat](
redeclare each package Medium=
Medium,
each m_flow(
min=
if allowFlowReversal
then
-Modelica.Constants.inf
else
0),
each h_outflow(
start=Medium.h_default,
nominal=Medium.h_default))
if have_heaWat
;
Modelica.Fluid.Interfaces.FluidPorts_b ports_bHeaWat[nPorts_bHeaWat](
redeclare each package Medium=
Medium,
each m_flow(
max=
if allowFlowReversal
then
+Modelica.Constants.inf
else
0),
each h_outflow(
start=Medium.h_default,
nominal=Medium.h_default))
if have_heaWat
;
Modelica.Fluid.Interfaces.FluidPorts_a ports_aChiWat[nPorts_aChiWat](
redeclare each package Medium=
Medium,
each m_flow(
min=
if allowFlowReversal
then
-Modelica.Constants.inf
else
0),
each h_outflow(
start=Medium.h_default,
nominal=Medium.h_default))
if have_chiWat
;
Modelica.Fluid.Interfaces.FluidPorts_b ports_bChiWat[nPorts_bChiWat](
redeclare each package Medium=
Medium,
each m_flow(
max=
if allowFlowReversal
then
+Modelica.Constants.inf
else
0),
each h_outflow(
start=Medium.h_default,
nominal=Medium.h_default))
if have_chiWat
;
Modelica.Blocks.Interfaces.RealOutput QHea_flow(
final unit="W")
if have_heaLoa
;
Modelica.Blocks.Interfaces.RealOutput QCoo_flow(
final unit="W")
if have_cooLoa
;
Modelica.Blocks.Interfaces.RealOutput PHea(
final unit="W")
if have_eleHea
;
Modelica.Blocks.Interfaces.RealOutput PCoo(
final unit="W")
if have_eleCoo
;
Modelica.Blocks.Interfaces.RealOutput PFan(
final quantity="Power",
final unit="W")
if have_fan
;
Modelica.Blocks.Interfaces.RealOutput PPum(
final quantity="Power",
final unit="W")
if have_pum
;
Fluid.BaseClasses.MassFlowRateMultiplier mulHeaWatInl[nPorts_aHeaWat](
redeclare each final package Medium =
Medium,
each final k=1/facMul,
each final allowFlowReversal=allowFlowReversal)
if have_heaWat
;
Fluid.BaseClasses.MassFlowRateMultiplier mulChiWatInl[nPorts_aChiWat](
redeclare each final package Medium =
Medium,
each final k=1/facMul,
each final allowFlowReversal=allowFlowReversal)
if have_chiWat
;
Fluid.BaseClasses.MassFlowRateMultiplier mulHeaWatOut[nPorts_bHeaWat](
redeclare each final package Medium =
Medium,
each final k=facMul,
each final allowFlowReversal=allowFlowReversal)
if have_heaWat
;
Fluid.BaseClasses.MassFlowRateMultiplier mulChiWatOut[nPorts_bChiWat](
redeclare each final package Medium =
Medium,
each final k=facMul,
each final allowFlowReversal=allowFlowReversal)
if have_chiWat
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQHea_flow(u(
final unit="W"),
final k=facMul)
if have_heaLoa ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQCoo_flow(u(
final unit="W"),
final k=facMul)
if have_cooLoa ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPHea(u(
final
unit="W"),
final k=facMul)
if have_eleHea ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPCoo(u(
final
unit="W"),
final k=facMul)
if have_eleCoo ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPFan(u(
final
unit="W"),
final k=facMul)
if have_fan ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPPum(u(
final
unit="W"),
final k=facMul)
if have_pum ;
protected
final parameter Modelica.Units.SI.SpecificHeatCapacity cp_default=
Medium.specificHeatCapacityCp(
Medium.setState_pTX(
p=Medium.p_default,
T=Medium.T_default,
X=Medium.X_default))
;
initial equation
assert(
nPorts_aHeaWat == nPorts_bHeaWat,
"In "+
getInstanceName()+": The numbers of heating water inlet ports ("+
String(
nPorts_aHeaWat)+") and outlet ports ("+
String(
nPorts_bHeaWat)+") must be equal.");
assert(
nPorts_aChiWat == nPorts_bChiWat,
"In "+
getInstanceName()+": The numbers of chilled water inlet ports ("+
String(
nPorts_aChiWat)+") and outlet ports ("+
String(
nPorts_bChiWat)+") must be equal.");
equation
connect(mulQHea_flow.y, QHea_flow);
connect(mulQCoo_flow.y, QCoo_flow);
connect(mulPHea.y, PHea);
connect(mulPCoo.y, PCoo);
connect(mulPFan.y, PFan);
connect(mulPPum.y, PPum);
connect(ports_aChiWat,mulChiWatInl. port_a);
connect(ports_aHeaWat,mulHeaWatInl. port_a);
connect(mulHeaWatOut.port_b, ports_bHeaWat);
connect(mulChiWatOut.port_b, ports_bChiWat);
end PartialBuilding;
Partial model of a building with an energy transfer station
Information
Partial model to be used for modeling
See the schematics below for a description of the physical boundaries
of the composing systems.
The parameters defining the set of outside connectors of this class
are propagated up from the ETS and building components.
The connect clauses between the ETS and the building connectors
are automatically generated based on the previous parameters and the
additional parameters nPorts_heaWat
and nPorts_chiWat
that need to be specified.
In case of a heating service line, the model allows for using two
different media at the inlet port_aSerHea
and at the oulet
port_bSerHea
to represent a steam supply and condensate
return.
Scaling
Scaling is implemented by means of a multiplier factor facMul
.
Each extensive quantity (mass and heat flow rate, electric power)
flowing out through fluid ports, or connected to an
output connector is multiplied by facMul
.
Each extensive quantity (mass and heat flow rate, electric power)
flowing in through fluid ports, or connected to an
input connector is multiplied by 1/facMul
.
This allows modeling, with a single instance,
multiple identical buildings with identical energy transfer stations,
served by the same service line.
Parameters
Type | Name | Default | Description |
replaceable package MediumSer | Buildings.Media.Water | Service side medium |
replaceable package MediumSerHea_a | Buildings.Media.Water | Service side medium at heating inlet |
replaceable package MediumBui | Buildings.Media.Water | Building side medium |
PartialBuilding | bui | bui(redeclare final package ... | Building model |
PartialETS | ets | ets(redeclare final package ... | Energy transfer station model |
Configuration |
Integer | nPorts_heaWat | 0 | Number of heating water fluid ports |
Integer | nPorts_chiWat | 0 | Number of chilled water fluid ports |
Scaling |
Real | facMul | 1 | Multiplier factor |
Assumptions |
Boolean | allowFlowReversalSer | false | Set to true to allow flow reversal on service side |
Boolean | allowFlowReversalBui | false | Set to true to allow flow reversal on building side |
Connectors
Type | Name | Description |
replaceable package MediumSer | Service side medium |
replaceable package MediumSerHea_a | Service side medium at heating inlet |
replaceable package MediumBui | Building side medium |
FluidPort_a | port_aSerAmb | Fluid connector for ambient water service supply line |
FluidPort_b | port_bSerAmb | Fluid connector for ambient water service return line |
FluidPort_a | port_aSerHea | Fluid connector for heating service supply line |
FluidPort_b | port_bSerHea | Fluid connector for heating service return line |
FluidPort_a | port_aSerCoo | Fluid connector for cooling service supply line |
FluidPort_b | port_bSerCoo | Fluid connector for cooling service return line |
Bus | weaBus | Weather data bus |
output RealOutput | QHea_flow | Total heating heat flow rate transferred to the loads (>=0) [W] |
output RealOutput | QCoo_flow | Total cooling heat flow rate transferred to the loads (<=0) [W] |
output RealOutput | PHea | Power drawn by heating system [W] |
output RealOutput | PCoo | Power drawn by cooling system [W] |
output RealOutput | PFan | Power drawn by fan motors [W] |
output RealOutput | PPum | Power drawn by pump motors [W] |
output RealOutput | QFue_flow[nFue] | Fuel energy input rate [W] |
Modelica definition
partial model PartialBuildingWithPartialETS
import TypDisSys=
Buildings.DHC.Types.DistrictSystemType
;
replaceable package MediumSer=
Buildings.Media.Water
constrainedby Modelica.Media.Interfaces.PartialMedium
;
replaceable package MediumSerHea_a=
Buildings.Media.Water
constrainedby Modelica.Media.Interfaces.PartialMedium
;
replaceable package MediumBui=
Buildings.Media.Water
constrainedby Modelica.Media.Interfaces.PartialMedium
;
parameter Integer nPorts_heaWat=0
;
parameter Integer nPorts_chiWat=0
;
parameter Real facMul = 1
;
parameter Boolean allowFlowReversalSer=false
;
parameter Boolean allowFlowReversalBui=false
;
final parameter TypDisSys typ=ets.typ
;
final parameter Boolean have_heaWat=ets.have_heaWat
;
final parameter Boolean have_hotWat=ets.have_hotWat
;
final parameter Boolean have_chiWat=ets.have_chiWat
;
final parameter Boolean have_eleHea=bui.have_eleHea
or ets.have_eleHea
;
final parameter Integer nFue=ets.nFue
;
final parameter Boolean have_eleCoo=bui.have_eleCoo
or ets.have_eleCoo
;
final parameter Boolean have_fan=bui.have_fan
or ets.have_fan
;
final parameter Boolean have_pum=bui.have_pum
or ets.have_pum
;
final parameter Boolean have_weaBus=bui.have_weaBus
or ets.have_weaBus
;
final parameter Modelica.Units.SI.HeatFlowRate QHeaWat_flow_nominal(min=0)=
ets.QHeaWat_flow_nominal ;
final parameter Modelica.Units.SI.HeatFlowRate QHotWat_flow_nominal(min=0)=
ets.QHotWat_flow_nominal
;
final parameter Modelica.Units.SI.HeatFlowRate QChiWat_flow_nominal(max=0)=
ets.QChiWat_flow_nominal ;
final parameter Integer idxPHeaETS=
max(
Modelica.Math.BooleanVectors.countTrue(
{bui.have_eleHea,ets.have_eleHea}),
1)
;
final parameter Integer idxPCooETS=
max(
Modelica.Math.BooleanVectors.countTrue(
{bui.have_eleCoo,ets.have_eleCoo}),
1)
;
final parameter Integer idxPFanETS=
max(
Modelica.Math.BooleanVectors.countTrue(
{bui.have_fan,ets.have_fan}),
1)
;
final parameter Integer idxPPumETS=
max(
Modelica.Math.BooleanVectors.countTrue(
{bui.have_pum,ets.have_pum}),
1)
;
Modelica.Fluid.Interfaces.FluidPort_a port_aSerAmb(
redeclare package Medium =
MediumSer,
m_flow(min=
if allowFlowReversalSer
then -Modelica.Constants.inf
else 0),
h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default))
if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5
;
Modelica.Fluid.Interfaces.FluidPort_b port_bSerAmb(
redeclare package Medium =
MediumSer,
m_flow(max=
if allowFlowReversalSer
then +Modelica.Constants.inf
else 0),
h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default))
if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5
;
Modelica.Fluid.Interfaces.FluidPort_a port_aSerHea(
redeclare package Medium =
MediumSerHea_a,
m_flow(min=
if allowFlowReversalSer
then -Modelica.Constants.inf
else 0),
h_outflow(start=MediumSerHea_a.h_default, nominal=MediumSerHea_a.h_default))
if typ <> Buildings.DHC.Types.DistrictSystemType.Cooling
and
typ <> Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5
;
Modelica.Fluid.Interfaces.FluidPort_b port_bSerHea(
redeclare package Medium =
MediumSer,
m_flow(max=
if allowFlowReversalSer
then +Modelica.Constants.inf
else 0),
h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default))
if typ <> Buildings.DHC.Types.DistrictSystemType.Cooling
and
typ <> Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5
;
Modelica.Fluid.Interfaces.FluidPort_a port_aSerCoo(
redeclare package Medium =
MediumSer,
m_flow(min=
if allowFlowReversalSer
then -Modelica.Constants.inf
else 0),
h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default))
if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration1
or
typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration2to4
or
typ == Buildings.DHC.Types.DistrictSystemType.Cooling
;
Modelica.Fluid.Interfaces.FluidPort_b port_bSerCoo(
redeclare package Medium =
MediumSer,
m_flow(max=
if allowFlowReversalSer
then +Modelica.Constants.inf
else 0),
h_outflow(start=MediumSer.h_default, nominal=MediumSer.h_default))
if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration1
or
typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration2to4
or
typ == Buildings.DHC.Types.DistrictSystemType.Cooling
;
BoundaryConditions.WeatherData.Bus weaBus
if have_weaBus
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput QHea_flow(
final unit="W")
if bui.have_heaLoa
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput QCoo_flow(
final unit="W")
if bui.have_cooLoa
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput PHea(
final unit="W")
if have_eleHea
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput PCoo(
final unit="W")
if have_eleCoo
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput PFan(
final unit="W")
if have_fan
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput PPum(
final unit="W")
if have_pum
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput QFue_flow[nFue](
each final unit="W")
if nFue>0
;
replaceable Buildings.DHC.Loads.BaseClasses.PartialBuilding bui(
redeclare final package Medium=
MediumBui,
final nPorts_aHeaWat=nPorts_heaWat,
final nPorts_bHeaWat=nPorts_heaWat,
final nPorts_aChiWat=nPorts_chiWat,
final nPorts_bChiWat=nPorts_chiWat,
final allowFlowReversal=allowFlowReversalBui)
;
replaceable Buildings.DHC.ETS.BaseClasses.PartialETS ets(
redeclare final package MediumBui=
MediumBui,
redeclare final package MediumSer=
MediumSer,
redeclare final package MediumSerHea_a=
MediumSerHea_a,
final nPorts_aHeaWat=nPorts_heaWat,
final nPorts_bHeaWat=nPorts_heaWat,
final nPorts_aChiWat=nPorts_chiWat,
final nPorts_bChiWat=nPorts_chiWat,
final allowFlowReversalSer=allowFlowReversalSer,
final allowFlowReversalBui=allowFlowReversalBui)
;
Buildings.Controls.OBC.CDL.Reals.MultiSum totPHea(
final nin=
Modelica.Math.BooleanVectors.countTrue(
{bui.have_eleHea,ets.have_eleHea}))
;
Buildings.Controls.OBC.CDL.Reals.MultiSum totPCoo(
final nin=
Modelica.Math.BooleanVectors.countTrue(
{bui.have_eleCoo,ets.have_eleCoo}))
;
Buildings.Controls.OBC.CDL.Reals.MultiSum totPFan(
final nin=
Modelica.Math.BooleanVectors.countTrue(
{bui.have_fan,ets.have_fan}))
;
Buildings.Controls.OBC.CDL.Reals.MultiSum totPPum(
final nin=
Modelica.Math.BooleanVectors.countTrue(
{bui.have_pum,ets.have_pum}))
if have_pum
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQHea_flow(u(
final unit="W"),
final k=facMul)
if bui.have_heaLoa ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQCoo_flow(u(
final unit="W"),
final k=facMul)
if bui.have_cooLoa ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPHea(u(
final
unit="W"),
final k=facMul)
if have_eleHea ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPCoo(u(
final
unit="W"),
final k=facMul)
if have_eleCoo ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPFan(u(
final
unit="W"),
final k=facMul)
if have_fan ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPPum(u(
final
unit="W"),
final k=facMul)
if have_pum ;
Fluid.BaseClasses.MassFlowRateMultiplier mulSerAmbInl(
redeclare final package Medium =
MediumSer,
final k=1/facMul,
final allowFlowReversal=allowFlowReversalSer)
if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5 ;
Fluid.BaseClasses.MassFlowRateMultiplier mulSerAmbOut(
redeclare final package Medium =
MediumSer,
final k=facMul,
final allowFlowReversal=allowFlowReversalSer)
if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5 ;
Fluid.BaseClasses.MassFlowRateMultiplier mulSerHeaInl(
redeclare final package Medium =
MediumSerHea_a,
final k=1/facMul,
final allowFlowReversal=allowFlowReversalSer)
if typ <> Buildings.DHC.Types.DistrictSystemType.Cooling
and
typ <> Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5 ;
Fluid.BaseClasses.MassFlowRateMultiplier mulSerHeaOut(
redeclare final package Medium =
MediumSer,
final k=facMul,
final allowFlowReversal=allowFlowReversalSer)
if typ <> Buildings.DHC.Types.DistrictSystemType.Cooling
and
typ <> Buildings.DHC.Types.DistrictSystemType.CombinedGeneration5 ;
Fluid.BaseClasses.MassFlowRateMultiplier mulSerCooInl(
redeclare final package Medium =
MediumSer,
final k=1/facMul,
final allowFlowReversal=allowFlowReversalSer)
if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration1
or
typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration2to4
or
typ == Buildings.DHC.Types.DistrictSystemType.Cooling ;
Fluid.BaseClasses.MassFlowRateMultiplier mulSerCooOut(
redeclare final package Medium =
MediumSer,
final k=facMul,
final allowFlowReversal=allowFlowReversalSer)
if typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration1
or
typ == Buildings.DHC.Types.DistrictSystemType.CombinedGeneration2to4
or
typ == Buildings.DHC.Types.DistrictSystemType.Cooling ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQFue_flow[nFue](
u(
each final unit="W"),
each final k=facMul)
if nFue > 0 ;
initial equation
assert(ets.have_heaWat == bui.have_heaWat,
"In "+
getInstanceName()+": The ETS component is configured with have_heaWat="+
String(ets.have_heaWat)+" whereas the building is configured with have_heaWat="+
String(bui.have_heaWat));
assert(ets.have_chiWat == bui.have_chiWat,
"In "+
getInstanceName()+": The ETS component is configured with have_chiWat="+
String(ets.have_chiWat)+" whereas the building is configured with have_chiWat="+
String(bui.have_chiWat));
if have_heaWat
then
assert(nPorts_heaWat > 0,
"In "+
getInstanceName()+": The ETS component is configured with have_heaWat="+
String(ets.have_heaWat)+" but the number of fluid ports for chilled water
(nPorts_heaWat) is zero.");
end if;
if have_chiWat
then
assert(nPorts_chiWat > 0,
"In "+
getInstanceName()+": The ETS component is configured with have_chiWat="+
String(ets.have_chiWat)+" but the number of fluid ports for chilled water
(nPorts_chiWat) is zero.");
end if;
equation
connect(bui.ports_bHeaWat,ets.ports_aHeaWat);
connect(ets.ports_bHeaWat,bui.ports_aHeaWat);
connect(bui.ports_bChiWat,ets.ports_aChiWat);
connect(ets.ports_bChiWat,bui.ports_aChiWat);
connect(weaBus,bui.weaBus);
connect(weaBus,ets.weaBus);
connect(bui.PHea,totPHea.u[1]);
connect(ets.PHea,totPHea.u[idxPHeaETS]);
connect(bui.PCoo,totPCoo.u[1]);
connect(ets.PCoo,totPCoo.u[idxPCooETS]);
connect(bui.PFan,totPFan.u[1]);
connect(ets.PFan,totPFan.u[idxPFanETS]);
connect(bui.PPum,totPPum.u[1]);
connect(ets.PPum,totPPum.u[idxPPumETS]);
connect(bui.QHea_flow, mulQHea_flow.u);
connect(mulQHea_flow.y, QHea_flow);
connect(bui.QCoo_flow, mulQCoo_flow.u);
connect(mulQCoo_flow.y, QCoo_flow);
connect(totPHea.y, mulPHea.u);
connect(mulPHea.y, PHea);
connect(totPCoo.y, mulPCoo.u);
connect(mulPCoo.y, PCoo);
connect(totPFan.y, mulPFan.u);
connect(mulPFan.y, PFan);
connect(totPPum.y, mulPPum.u);
connect(mulPPum.y, PPum);
connect(port_aSerCoo,mulSerCooInl. port_a);
connect(mulSerCooInl.port_b, ets.port_aSerCoo);
connect(mulSerCooOut.port_b, port_bSerCoo);
connect(ets.port_bSerCoo,mulSerCooOut. port_a);
connect(port_aSerHea,mulSerHeaInl. port_a);
connect(mulSerHeaInl.port_b, ets.port_aSerHea);
connect(port_aSerAmb,mulSerAmbInl. port_a);
connect(mulSerAmbInl.port_b, ets.port_aSerAmb);
connect(ets.port_bSerHea,mulSerHeaOut. port_a);
connect(mulSerHeaOut.port_b, port_bSerHea);
connect(ets.port_bSerAmb,mulSerAmbOut. port_a);
connect(mulSerAmbOut.port_b, port_bSerAmb);
connect(mulQFue_flow.y, QFue_flow);
connect(ets.QFue_flow, mulQFue_flow.u);
end PartialBuildingWithPartialETS;
Partial model of a sensible only four-pipe fan coil unit computing a required water mass flow rate
Information
This is a simplified partial model of a sensible only four-pipe fan coil unit
for heating and cooling.
It is intended to be used in conjunction with
Buildings.DHC.Loads.BaseClasses.FlowDistribution,
and hence it computes the water mass flow rate required to meet the temperature
set point.
For the sake of simplicity, a sensible only heat exchanger model is considered.
For the sake of computational performance, a PI controller is used instead of an inverse
model of the heat exchanger to assess the required water mass flow rate.
Each controller output signal is mapped linearly to the water mass flow rate,
from zero to its nominal value.
The maximum of the two output signals is mapped linearly to the air mass
flow rate, from zero to its nominal value.
The model takes the measured room air temperature as an input (as opposed to
the fan inlet temperature) to maintain a valid control loop output in case
of zero air flow rate.
The model is partial to allow various connectivity options on the load side:
either with fluid ports or with heat ports.
Extends from Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit (Partial model for HVAC terminal unit).
Parameters
Type | Name | Default | Description |
replaceable package Medium1 | Water | Medium in the building distribution system |
replaceable package Medium2 | Air | Load side medium |
Scaling |
Real | facMul | 1 | Multiplier factor |
Real | facMulZon | 1 | Zone multiplier factor |
Configuration |
Boolean | have_heaWat | true | Set to true if the system uses heating water |
Boolean | have_chiWat | true | Set to true if the system uses chilled water |
Boolean | have_chaOve | false | Set to true if the chilled water based heat exchanger operates in change-over |
Boolean | have_eleHea | false | Set to true if the system has electric heating system |
Boolean | have_eleCoo | false | Set to true if the system has electric cooling system |
Boolean | have_heaPor | false | Set to true for heat ports on the load side |
Boolean | have_fluPor | false | Set to true for fluid ports on the load side |
Boolean | have_TSen | false | Set to true for measured temperature as an input |
Boolean | have_QReq_flow | false | Set to true for required heat flow rate as an input |
Boolean | have_weaBus | false | Set to true to use a weather bus |
Boolean | have_fan | true | Set to true if fan power is computed |
Boolean | have_pum | false | Set to true if pump power is computed |
Nominal condition |
HeatFlowRate | QHea_flow_nominal | 0 | Nominal heating capacity (>=0) [W] |
HeatFlowRate | QCoo_flow_nominal | 0 | Nominal cooling capacity (<=0) [W] |
MassFlowRate | mHeaWat_flow_nominal | abs(QHea_flow_nominal/cpHeaW... | Heating water mass flow rate at nominal conditions [kg/s] |
MassFlowRate | mChiWat_flow_nominal | abs(QCoo_flow_nominal/cpChiW... | Chilled water mass flow rate at nominal conditions [kg/s] |
MassFlowRate | mLoaHea_flow_nominal | 0 | Load side mass flow rate at nominal conditions in heating mode [kg/s] |
MassFlowRate | mLoaCoo_flow_nominal | 0 | Load side mass flow rate at nominal conditions in cooling mode [kg/s] |
Temperature | T_aHeaWat_nominal | 273.15 + 60 | Heating water inlet temperature at nominal conditions [K] |
Temperature | T_bHeaWat_nominal | T_aHeaWat_nominal - 22.2 | Heating water outlet temperature at nominal conditions [K] |
Temperature | T_aChiWat_nominal | 273.15 + 7.2 | Chilled water inlet temperature at nominal conditions [K] |
Temperature | T_bChiWat_nominal | T_aChiWat_nominal + 5.6 | Chilled water outlet temperature at nominal conditions [K] |
Temperature | T_aLoaHea_nominal | 273.15 + 21.1 | Load side inlet temperature at nominal conditions in heating mode [K] |
Temperature | T_aLoaCoo_nominal | 273.15 + 26.7 | Load side inlet temperature at nominal conditions in cooling mode [K] |
MassFraction | w_aLoaCoo_nominal | 0.011 | Load side inlet humidity ratio at nominal conditions in cooling mode [1] |
Assumptions |
Boolean | allowFlowReversal | false | Set to true to allow flow reversal in building distribution system |
Boolean | allowFlowReversalLoa | true | Set to true to allow flow reversal on the load side |
Connectors
Type | Name | Description |
replaceable package Medium1 | Medium in the building distribution system |
replaceable package Medium2 | Load side medium |
input RealInput | TSen | Temperature (measured) [K] |
input RealInput | TSetHea | Heating set point [K] |
input RealInput | TSetCoo | Cooling set point [K] |
input RealInput | QReqHea_flow | Required heat flow rate to meet heating set point (>=0) [W] |
input RealInput | QReqCoo_flow | Required heat flow rate to meet cooling set point (<=0) [W] |
output RealOutput | QActHea_flow | Heating heat flow rate transferred to the load (>=0) [W] |
output RealOutput | QActCoo_flow | Cooling heat flow rate transferred to the load (<=0) [W] |
output RealOutput | PHea | Power drawn by heating system [W] |
output RealOutput | PCoo | Power drawn by cooling system [W] |
output RealOutput | PFan | Power drawn by fans motors [W] |
output RealOutput | PPum | Power drawn by pumps motors [W] |
output RealOutput | mReqHeaWat_flow | Required heating water flow rate to meet heating set point [kg/s] |
output RealOutput | mReqChiWat_flow | Required chilled water flow rate to meet cooling set point [kg/s] |
FluidPort_a | port_aLoa | Fluid stream inlet port on the load side |
FluidPort_b | port_bLoa | Fluid stream outlet port on the load side |
HeatPort_b | heaPorCon | Heat port transferring convective heat to the load |
HeatPort_b | heaPorRad | Heat port transferring radiative heat to the load |
Bus | weaBus | Weather data bus |
FluidPort_a | port_aHeaWat | Heating water inlet port |
FluidPort_a | port_aChiWat | Chilled water inlet port |
FluidPort_b | port_bHeaWat | Heating water outlet port |
FluidPort_b | port_bChiWat | Chilled water outlet port |
Modelica definition
partial model PartialFanCoil4Pipe
extends Buildings.DHC.Loads.BaseClasses.PartialTerminalUnit(
redeclare package Medium1=
Buildings.Media.Water,
redeclare package Medium2=
Buildings.Media.Air,
final have_heaWat=true,
final have_chiWat=true,
final have_fan=true,
final allowFlowReversal=false,
final allowFlowReversalLoa=true,
final have_chaOve=false,
final have_eleHea=false,
final have_eleCoo=false,
final have_QReq_flow=false,
final have_weaBus=false,
final have_pum=false,
final mHeaWat_flow_nominal=
abs(
QHea_flow_nominal/cpHeaWat_nominal/(T_aHeaWat_nominal-T_bHeaWat_nominal)),
final mChiWat_flow_nominal=
abs(
QCoo_flow_nominal/cpChiWat_nominal/(T_aChiWat_nominal-T_bChiWat_nominal)));
import hexConfiguration=
Buildings.Fluid.Types.HeatExchangerConfiguration;
final parameter hexConfiguration hexConHea=hexConfiguration.CounterFlow
;
final parameter hexConfiguration hexConCoo=hexConfiguration.CounterFlow
;
Buildings.Controls.OBC.CDL.Reals.PID conHea(
Ti=10,
yMax=1,
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
reverseActing=true,
yMin=0)
;
Buildings.Fluid.Movers.FlowControlled_m_flow fan(
redeclare final package Medium=
Medium2,
final m_flow_nominal=
max(
{mLoaHea_flow_nominal,mLoaCoo_flow_nominal}),
redeclare final Fluid.Movers.Data.Generic per,
nominalValuesDefineDefaultPressureCurve=true,
energyDynamics=Modelica.Fluid.Types.Dynamics.SteadyState,
use_inputFilter=false,
dp_nominal=400,
final allowFlowReversal=allowFlowReversalLoa);
Buildings.Fluid.HeatExchangers.DryCoilEffectivenessNTU hexHea(
redeclare final package Medium1=
Medium1,
redeclare final package Medium2=
Medium2,
final configuration=hexConHea,
final m1_flow_nominal=mHeaWat_flow_nominal,
final m2_flow_nominal=mLoaHea_flow_nominal,
final dp1_nominal=0,
dp2_nominal=200,
final Q_flow_nominal=QHea_flow_nominal,
final T_a1_nominal=T_aHeaWat_nominal,
final T_a2_nominal=T_aLoaHea_nominal,
final allowFlowReversal1=allowFlowReversal,
final allowFlowReversal2=allowFlowReversalLoa);
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter gaiHeaFloNom(k=
mHeaWat_flow_nominal);
Modelica.Blocks.Sources.RealExpression Q_flowHea(
y=hexHea.Q2_flow);
Fluid.HeatExchangers.WetCoilEffectivenessNTU hexWetNtu(
redeclare final package Medium1=
Medium1,
redeclare final package Medium2=
Medium2,
final configuration=hexConCoo,
final m1_flow_nominal=mChiWat_flow_nominal,
final m2_flow_nominal=mLoaCoo_flow_nominal,
final dp1_nominal=0,
dp2_nominal=200,
use_Q_flow_nominal=true,
final Q_flow_nominal=QCoo_flow_nominal,
final T_a1_nominal=T_aChiWat_nominal,
final T_a2_nominal=T_aLoaCoo_nominal,
final allowFlowReversal1=allowFlowReversal,
final allowFlowReversal2=allowFlowReversalLoa,
final w_a2_nominal=w_aLoaCoo_nominal);
Modelica.Blocks.Sources.RealExpression Q_flowCoo(y=hexWetNtu.Q2_flow);
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter gaiFloNom2(k=
max({
mLoaHea_flow_nominal,mLoaCoo_flow_nominal}));
Buildings.Controls.OBC.CDL.Reals.PID conCoo(
Ti=10,
yMax=1,
controllerType=Buildings.Controls.OBC.CDL.Types.SimpleController.PI,
reverseActing=false,
yMin=0)
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter gaiCooFloNom(k=
mChiWat_flow_nominal) ;
Utilities.Math.SmoothMax smoothMax(
deltaX=1E-2)
;
equation
connect(hexWetNtu.port_b2, hexHea.port_a2);
connect(fan.port_b, hexWetNtu.port_a2);
connect(gaiFloNom2.y,fan.m_flow_in);
connect(conHea.y,gaiHeaFloNom.u);
connect(conCoo.y,gaiCooFloNom.u);
connect(gaiHeaFloNom.y,mulMasFloReqHeaWat.u);
connect(gaiCooFloNom.y,mulMasFloReqChiWat.u);
connect(fan.P,mulPFan.u);
connect(Q_flowHea.y,mulQActHea_flow.u);
connect(Q_flowCoo.y,mulQActCoo_flow.u);
connect(TSetCoo,conCoo.u_s);
connect(TSetHea,conHea.u_s);
connect(smoothMax.y,gaiFloNom2.u);
connect(conHea.y,smoothMax.u1);
connect(conCoo.y,smoothMax.u2);
connect(mulChiWatFloInl.port_b, hexWetNtu.port_a1);
connect(hexWetNtu.port_b1, mulChiWatFloOut.port_a);
connect(hexHea.port_b1,mulHeaWatFloOut.port_a);
connect(mulHeaWatFloInl.port_b,hexHea.port_a1);
end PartialFanCoil4Pipe;
Partial model for HVAC terminal unit
Information
Partial model to be used for modeling an HVAC terminal unit.
The models inheriting from this class are typically used in conjunction with
Buildings.DHC.Loads.BaseClasses.FlowDistribution. They must
compute a so-called required mass flow rate defined as the heating or chilled
water mass flow rate needed to meet the load.
It can be approximated using a control loop to avoid inverting a heat
exchanger model as illustrated in
Buildings.DHC.Loads.BaseClasses.Examples.
The model connectivity can be modified to address various use cases:
-
On the source side (typically connected to
Buildings.DHC.Loads.BaseClasses.FlowDistribution):
-
Fluid ports for chilled water and heating water can be conditionally
instantiated by respectively setting
have_chiWat
and
have_heaWat
to true.
-
On the load side (typically connected to a room model):
-
Fluid ports can be conditionally instantiated by setting
have_fluPor
to true.
-
Alternatively heat ports (for convective and radiative heat transfer)
can be conditionally instantiated by setting
have_heaPor
to true.
-
Real input connectors can be conditionally instantiated by setting
have_QReq_flow
to true. Those connectors can be used to provide
heating and cooling loads as time series, see
Buildings.DHC.Loads.BaseClasses.Examples.CouplingTimeSeries
for an illustration of that use case.
The impact on the room air temperature of an unmet load can be assessed with
Buildings.DHC.Loads.BaseClasses.SimpleRoomODE.
The heating or cooling nominal capacity is provided for the water based heat
exchangers only. Electric heating or cooling systems are supposed to have
an infinite capacity.
Connection with the flow distribution model
When connecting the model to
Buildings.DHC.Loads.BaseClasses.FlowDistribution:
-
The nominal pressure drop on the source side (heating or chilled water) is
irrelevant as the computation of the pump head relies on a specific algorithm
described in
Buildings.DHC.Loads.BaseClasses.FlowDistribution.
-
The parameter
allowFlowReversal
must be set to false
(default)
in consistency with
Buildings.DHC.Loads.BaseClasses.FlowDistribution.
This requirement only applies to the source side.
On the load side one is free to use whatever option suitable for the modeling needs.
Note that typically for an air flow network connected to the outdoor air
(either at the room level for modeling infiltration or at the system level
for the fresh air source), the unidirectional air flow condition cannot be guaranteed.
The reason is the varying pressure of the outdoor air that can lead to a negative
pressure difference at the terminal unit boundaries when the fan is off.
Scaling
Scaling is implemented by means of two multiplier factors.
-
The parameter
facMul
serves as a terminal unit multiplier.
Each extensive quantity (mass and heat flow rate, electric power)
flowing out through fluid or heat ports, or connected to an
output connector is multiplied by facMul
.
Each extensive quantity (mass and heat flow rate, electric power)
flowing in through fluid or heat ports, or connected to an
input connector is multiplied by 1/facMul
.
This parameter allows modeling, with a single instance,
multiple identical units served by the same distribution system,
and serving an aggregated load (e.g., a thermal zone representing several rooms).
-
The parameter
facMulZon
serves as a thermal zone multiplier.
Except for the variables connected to the load side, which are not affected by
facMulZon
, the logic is otherwise identical to the one described
for facMul
.
This parameter allows modeling, with a single instance (of both the terminal
unit model and the load model),
multiple identical units served by the same distribution system,
and serving multiple identical loads (e.g., a thermal zone representing a single room).
Note that the two multiplier factors serve different modeling purposes.
As such they typically should not be used simultaneously.
Both multiplier factors are of type real (as opposed to integer) to allow
for instance modeling a set of terminal units based on manufacturer data,
while still being able to size the full set based on a peak load.
See
Buildings.DHC.Loads.BaseClasses.Validation.TerminalUnitScaling
for an illustration of the use case when heating and cooling loads are
provided as time series.
Change-over mode
When modeling a change-over system:
-
The parameters
have_chiWat
and have_chaOve
must both be set to
true
and have_heaWat
must be set to false
.
-
The heat exchanger is sized by providing the nominal parameters for the cooling
configuration (suffix
ChiWat
). The nominal mass flow rate on the
source and the load side must also be provided for the heating configuration
(suffix HeaWat
) as it can differ from the cooling configuration.
-
The computed heat flow rate must be split into its positive part that gets
connected to
QActHea_flow
and its negative part that gets connected
to QActCoo_flow
.
-
The computed required mass flow rate must be connected to
mReqChiWat_flow
.
Base class parameters
All the parameters of this base class that pertain to the nominal conditions
shall not be exposed in the derived class, as this would lead to an
overdetermined model.
For instance, the nominal mass flow rate may not be exposed but rather
computed from the nominal heat flow rate, entering and leaving fluid temperature.
However, those parameters are included in the base class because other components
are likely to reference them. For instance the distribution system model
may use the nominal mass flow rate of each terminal unit to compute
the nominal mass flow rate of the circulation pump.
Parameters
Type | Name | Default | Description |
replaceable package Medium1 | Buildings.Media.Water | Medium in the building distribution system |
replaceable package Medium2 | Buildings.Media.Air | Load side medium |
Scaling |
Real | facMul | 1 | Multiplier factor |
Real | facMulZon | 1 | Zone multiplier factor |
Configuration |
Boolean | have_heaWat | false | Set to true if the system uses heating water |
Boolean | have_chiWat | false | Set to true if the system uses chilled water |
Boolean | have_chaOve | false | Set to true if the chilled water based heat exchanger operates in change-over |
Boolean | have_eleHea | false | Set to true if the system has electric heating system |
Boolean | have_eleCoo | false | Set to true if the system has electric cooling system |
Boolean | have_heaPor | false | Set to true for heat ports on the load side |
Boolean | have_fluPor | false | Set to true for fluid ports on the load side |
Boolean | have_TSen | false | Set to true for measured temperature as an input |
Boolean | have_QReq_flow | false | Set to true for required heat flow rate as an input |
Boolean | have_weaBus | false | Set to true to use a weather bus |
Boolean | have_fan | false | Set to true if fan power is computed |
Boolean | have_pum | false | Set to true if pump power is computed |
Nominal condition |
HeatFlowRate | QHea_flow_nominal | 0 | Nominal heating capacity (>=0) [W] |
HeatFlowRate | QCoo_flow_nominal | 0 | Nominal cooling capacity (<=0) [W] |
MassFlowRate | mHeaWat_flow_nominal | 0 | Heating water mass flow rate at nominal conditions [kg/s] |
MassFlowRate | mChiWat_flow_nominal | 0 | Chilled water mass flow rate at nominal conditions [kg/s] |
MassFlowRate | mLoaHea_flow_nominal | 0 | Load side mass flow rate at nominal conditions in heating mode [kg/s] |
MassFlowRate | mLoaCoo_flow_nominal | 0 | Load side mass flow rate at nominal conditions in cooling mode [kg/s] |
Temperature | T_aHeaWat_nominal | 273.15 + 60 | Heating water inlet temperature at nominal conditions [K] |
Temperature | T_bHeaWat_nominal | T_aHeaWat_nominal - 22.2 | Heating water outlet temperature at nominal conditions [K] |
Temperature | T_aChiWat_nominal | 273.15 + 7.2 | Chilled water inlet temperature at nominal conditions [K] |
Temperature | T_bChiWat_nominal | T_aChiWat_nominal + 5.6 | Chilled water outlet temperature at nominal conditions [K] |
Temperature | T_aLoaHea_nominal | 273.15 + 21.1 | Load side inlet temperature at nominal conditions in heating mode [K] |
Temperature | T_aLoaCoo_nominal | 273.15 + 26.7 | Load side inlet temperature at nominal conditions in cooling mode [K] |
MassFraction | w_aLoaCoo_nominal | 0.011 | Load side inlet humidity ratio at nominal conditions in cooling mode [1] |
Assumptions |
Boolean | allowFlowReversal | false | Set to true to allow flow reversal in building distribution system |
Boolean | allowFlowReversalLoa | true | Set to true to allow flow reversal on the load side |
Connectors
Type | Name | Description |
replaceable package Medium1 | Medium in the building distribution system |
replaceable package Medium2 | Load side medium |
input RealInput | TSen | Temperature (measured) [K] |
input RealInput | TSetHea | Heating set point [K] |
input RealInput | TSetCoo | Cooling set point [K] |
input RealInput | QReqHea_flow | Required heat flow rate to meet heating set point (>=0) [W] |
input RealInput | QReqCoo_flow | Required heat flow rate to meet cooling set point (<=0) [W] |
output RealOutput | QActHea_flow | Heating heat flow rate transferred to the load (>=0) [W] |
output RealOutput | QActCoo_flow | Cooling heat flow rate transferred to the load (<=0) [W] |
output RealOutput | PHea | Power drawn by heating system [W] |
output RealOutput | PCoo | Power drawn by cooling system [W] |
output RealOutput | PFan | Power drawn by fans motors [W] |
output RealOutput | PPum | Power drawn by pumps motors [W] |
output RealOutput | mReqHeaWat_flow | Required heating water flow rate to meet heating set point [kg/s] |
output RealOutput | mReqChiWat_flow | Required chilled water flow rate to meet cooling set point [kg/s] |
FluidPort_a | port_aLoa | Fluid stream inlet port on the load side |
FluidPort_b | port_bLoa | Fluid stream outlet port on the load side |
HeatPort_b | heaPorCon | Heat port transferring convective heat to the load |
HeatPort_b | heaPorRad | Heat port transferring radiative heat to the load |
Bus | weaBus | Weather data bus |
FluidPort_a | port_aHeaWat | Heating water inlet port |
FluidPort_a | port_aChiWat | Chilled water inlet port |
FluidPort_b | port_bHeaWat | Heating water outlet port |
FluidPort_b | port_bChiWat | Chilled water outlet port |
Modelica definition
partial model PartialTerminalUnit
replaceable package Medium1=
Buildings.Media.Water
constrainedby Modelica.Media.Interfaces.PartialMedium
;
replaceable package Medium2=
Buildings.Media.Air
constrainedby Modelica.Media.Interfaces.PartialMedium
;
parameter Boolean allowFlowReversal=false
;
parameter Boolean allowFlowReversalLoa=true
;
parameter Real facMul(min=Modelica.Constants.eps)=1
;
parameter Real facMulZon(min=Modelica.Constants.eps)=1
;
parameter Boolean have_heaWat=false
;
parameter Boolean have_chiWat=false
;
parameter Boolean have_chaOve=false
;
parameter Boolean have_eleHea=false
;
parameter Boolean have_eleCoo=false
;
parameter Boolean have_heaPor=false
;
parameter Boolean have_fluPor=false
;
parameter Boolean have_TSen=false
;
parameter Boolean have_QReq_flow=false
;
parameter Boolean have_weaBus=false
;
parameter Boolean have_fan=false
;
parameter Boolean have_pum=false
;
parameter Modelica.Units.SI.HeatFlowRate QHea_flow_nominal(min=0) = 0
;
parameter Modelica.Units.SI.HeatFlowRate QCoo_flow_nominal(max=0) = 0
;
parameter Modelica.Units.SI.MassFlowRate mHeaWat_flow_nominal(min=0) = 0
;
parameter Modelica.Units.SI.MassFlowRate mChiWat_flow_nominal(min=0) = 0
;
parameter Modelica.Units.SI.MassFlowRate mLoaHea_flow_nominal(min=0) = 0
;
parameter Modelica.Units.SI.MassFlowRate mLoaCoo_flow_nominal(min=0) = 0
;
parameter Modelica.Units.SI.Temperature T_aHeaWat_nominal=273.15 + 60
;
parameter Modelica.Units.SI.Temperature T_bHeaWat_nominal(
min=273.15,
displayUnit="degC") = T_aHeaWat_nominal - 22.2
;
parameter Modelica.Units.SI.Temperature T_aChiWat_nominal=273.15 + 7.2
;
parameter Modelica.Units.SI.Temperature T_bChiWat_nominal(
min=273.15,
displayUnit="degC") = T_aChiWat_nominal + 5.6
;
parameter Modelica.Units.SI.Temperature T_aLoaHea_nominal=273.15 + 21.1
;
parameter Modelica.Units.SI.Temperature T_aLoaCoo_nominal=273.15 + 26.7
;
parameter Modelica.Units.SI.MassFraction w_aLoaCoo_nominal=0.011
;
Modelica.Blocks.Interfaces.RealInput TSen(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
if have_TSen
;
Modelica.Blocks.Interfaces.RealInput TSetHea(
quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
if have_heaWat
or have_chaOve
or have_eleHea
;
Modelica.Blocks.Interfaces.RealInput TSetCoo(
final quantity="ThermodynamicTemperature",
final unit="K",
displayUnit="degC")
if have_chiWat
or have_eleCoo
;
Modelica.Blocks.Interfaces.RealInput QReqHea_flow(
final quantity="HeatFlowRate",
final unit="W")
if have_QReq_flow
and (have_heaWat
or have_chaOve
or have_eleHea)
;
Modelica.Blocks.Interfaces.RealInput QReqCoo_flow(
final quantity="HeatFlowRate",
final unit="W")
if have_QReq_flow
and (have_chiWat
or have_eleCoo)
;
Modelica.Blocks.Interfaces.RealOutput QActHea_flow(
final quantity="HeatFlowRate",
final unit="W")
if have_heaWat
or have_chaOve
or have_eleHea
;
Modelica.Blocks.Interfaces.RealOutput QActCoo_flow(
final quantity="HeatFlowRate",
final unit="W")
if have_chiWat
or have_eleCoo
;
Modelica.Blocks.Interfaces.RealOutput PHea(
final quantity="Power",
final unit="W")
if have_eleHea
;
Modelica.Blocks.Interfaces.RealOutput PCoo(
final quantity="Power",
final unit="W")
if have_eleCoo
;
Modelica.Blocks.Interfaces.RealOutput PFan(
final quantity="Power",
final unit="W")
if have_fan
;
Modelica.Blocks.Interfaces.RealOutput PPum(
final quantity="Power",
final unit="W")
if have_pum
;
Modelica.Blocks.Interfaces.RealOutput mReqHeaWat_flow(
final quantity="MassFlowRate",
final unit="kg/s")
if have_heaWat
;
Modelica.Blocks.Interfaces.RealOutput mReqChiWat_flow(
final quantity="MassFlowRate",
final unit="kg/s")
if have_chiWat
;
Modelica.Fluid.Interfaces.FluidPort_a port_aLoa(
redeclare final package Medium=
Medium2,
p(start=Medium2.p_default),
m_flow(
min=
if allowFlowReversalLoa
then
-Modelica.Constants.inf
else
0),
h_outflow(
start=Medium2.h_default,
nominal=Medium2.h_default))
if have_fluPor
;
Modelica.Fluid.Interfaces.FluidPort_b port_bLoa(
redeclare final package Medium=
Medium2,
p(start=Medium2.p_default),
m_flow(
max=
if allowFlowReversalLoa
then
+Modelica.Constants.inf
else
0),
h_outflow(
start=Medium2.h_default,
nominal=Medium2.h_default))
if have_fluPor
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b heaPorCon
if have_heaPor
;
Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_b heaPorRad
if have_heaPor
;
BoundaryConditions.WeatherData.Bus weaBus
if have_weaBus
;
Modelica.Fluid.Interfaces.FluidPort_a port_aHeaWat(
p(start=Medium1.p_default),
redeclare final package Medium=
Medium1,
m_flow(
min=
if allowFlowReversal
then
-Modelica.Constants.inf
else
0),
h_outflow(
start=Medium1.h_default,
nominal=Medium1.h_default))
if have_heaWat
;
Modelica.Fluid.Interfaces.FluidPort_a port_aChiWat(
p(start=Medium1.p_default),
redeclare final package Medium=
Medium1,
m_flow(
min=
if allowFlowReversal
then
-Modelica.Constants.inf
else
0),
h_outflow(
start=Medium1.h_default,
nominal=Medium1.h_default))
if have_chiWat
;
Modelica.Fluid.Interfaces.FluidPort_b port_bHeaWat(
p(start=Medium1.p_default),
redeclare final package Medium=
Medium1,
m_flow(
max=
if allowFlowReversal
then
+Modelica.Constants.inf
else
0),
h_outflow(
start=Medium1.h_default,
nominal=Medium1.h_default))
if have_heaWat
;
Modelica.Fluid.Interfaces.FluidPort_b port_bChiWat(
p(start=Medium1.p_default),
redeclare final package Medium=
Medium1,
m_flow(
max=
if allowFlowReversal
then
+Modelica.Constants.inf
else
0),
h_outflow(
start=Medium1.h_default,
nominal=Medium1.h_default))
if have_chiWat
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQReqHea_flow(u(
final unit="W"),
final k=1/facMul)
if have_QReq_flow
and (have_heaWat
or have_chaOve
or have_eleHea) ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQReqCoo_flow(u(
final unit="W"),
final k=1/facMul)
if have_QReq_flow
and (have_chiWat
or have_eleCoo) ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQActHea_flow(u(
final unit="W"),
final k=facMul*facMulZon)
if have_heaWat
or have_chaOve
or have_eleHea ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulQActCoo_flow(u(
final unit="W"),
final k=facMul*facMulZon)
if have_chiWat
or
have_eleCoo ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPHea(u(
final
unit="W"),
final k=facMul*facMulZon)
if have_eleHea ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPCoo(u(
final
unit="W"),
final k=facMul*facMulZon)
if have_eleCoo ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPFan(u(
final
unit="W"),
final k=facMul*facMulZon)
if have_fan ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulPPum(u(
final
unit="W"),
final k=facMul*facMulZon)
if have_pum ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulMasFloReqHeaWat(
u(
final unit="kg/s"),
final k=facMul*facMulZon)
if have_heaWat ;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter mulMasFloReqChiWat(
u(
final unit="kg/s"),
final k=facMul*facMulZon)
if have_chiWat ;
Fluid.BaseClasses.MassFlowRateMultiplier mulHeaWatFloInl(
redeclare final package Medium=
Medium1,
final k=1/facMul/facMulZon,
final allowFlowReversal=allowFlowReversal)
if have_heaWat
;
Fluid.BaseClasses.MassFlowRateMultiplier mulHeaWatFloOut(
redeclare final package Medium=
Medium1,
final k=facMul*facMulZon,
final allowFlowReversal=allowFlowReversal)
if have_heaWat
;
Fluid.BaseClasses.MassFlowRateMultiplier mulChiWatFloInl(
redeclare final package Medium=
Medium1,
final k=1/facMul/facMulZon,
final allowFlowReversal=allowFlowReversal)
if have_chiWat
;
Fluid.BaseClasses.MassFlowRateMultiplier mulChiWatFloOut(
redeclare final package Medium=
Medium1,
final k=facMul*facMulZon,
final allowFlowReversal=allowFlowReversal)
if have_chiWat
;
Fluid.BaseClasses.MassFlowRateMultiplier mulLoaMasFloOut(
redeclare final package Medium=
Medium2,
final k=facMul,
final allowFlowReversal=allowFlowReversalLoa)
if have_fluPor
;
Fluid.BaseClasses.MassFlowRateMultiplier mulLoaMasFloInl(
redeclare final package Medium=
Medium2,
final k=1/facMul,
final allowFlowReversal=allowFlowReversalLoa)
if have_fluPor
;
Fluid.HeatExchangers.RadiantSlabs.BaseClasses.HeatFlowRateMultiplier mulHeaFloCon(
final k=
facMul)
if have_heaPor ;
Fluid.HeatExchangers.RadiantSlabs.BaseClasses.HeatFlowRateMultiplier mulHeaFloRad(
final k=
facMul)
if have_heaPor ;
protected
parameter Modelica.Units.SI.SpecificHeatCapacity cpHeaWat_nominal=
Medium1.specificHeatCapacityCp(
Medium1.setState_pTX(Medium1.p_default,
T_aHeaWat_nominal))
;
parameter Modelica.Units.SI.SpecificHeatCapacity cpChiWat_nominal=
Medium1.specificHeatCapacityCp(
Medium1.setState_pTX(Medium1.p_default,
T_aChiWat_nominal))
;
parameter Modelica.Units.SI.SpecificHeatCapacity cpLoaHea_nominal=
Medium2.specificHeatCapacityCp(
Medium2.setState_pTX(Medium2.p_default,
T_aLoaHea_nominal))
;
parameter Modelica.Units.SI.SpecificHeatCapacity cpLoaCoo_nominal=
Medium2.specificHeatCapacityCp(
Medium2.setState_pTX(Medium2.p_default,
T_aLoaCoo_nominal))
;
equation
connect(QReqHea_flow,mulQReqHea_flow.u);
connect(QReqCoo_flow,mulQReqCoo_flow.u);
connect(mulQActHea_flow.y,QActHea_flow);
connect(mulQActCoo_flow.y,QActCoo_flow);
connect(mulPHea.y,PHea);
connect(mulPCoo.y,PCoo);
connect(mulPFan.y,PFan);
connect(mulPPum.y,PPum);
connect(mulMasFloReqHeaWat.y,mReqHeaWat_flow);
connect(mulMasFloReqChiWat.y,mReqChiWat_flow);
connect(port_aHeaWat,mulHeaWatFloInl.port_a);
connect(mulHeaWatFloOut.port_b,port_bHeaWat);
connect(port_aChiWat,mulChiWatFloInl.port_a);
connect(mulChiWatFloOut.port_b,port_bChiWat);
connect(mulLoaMasFloOut.port_b,port_bLoa);
connect(port_aLoa,mulLoaMasFloInl.port_a);
connect(mulHeaFloCon.port_b,heaPorCon);
connect(mulHeaFloRad.port_b,heaPorRad);
end PartialTerminalUnit;
Simplified model for assessing room air temperature variations around a set point
Information
This is a first order ODE model assessing the indoor air temperature variations
around a set point, based on the difference between the required and actual
heating or cooling heat flow rate and a minimum set of parameters at nominal conditions.
The lumped thermal conductance G representing all heat transfer mechanisms
that depend on the temperature difference with the outside (transmission,
infiltration and ventilation) is assessed from the steady-state energy balance
at heating nominal conditions as
0 = Q̇heating, nom + G (Tout, heating, nom - Tind, heating, nom).
Note that for model representativeness, it is important
for Q̇heating, nom to be evaluated in close to steady-state conditions
with no internal heat gains and no solar heat gains.
The lumped thermal conductance G is then considered constant for all operating conditions.
The required heating or cooling heat flow rate (i.e. the space load)
Q̇heat_cool, req corresponds to
a steady-state control error equal to zero,
0 = Q̇heat_cool, req +
G (Tout - Tind, set) +
Q̇various,
where Q̇various represents the miscellaneous heat gains.
The indoor temperature variation rate due to an unmet load is given by
C ∂Tind / ∂t = Q̇heat_cool, act +
G (Tout - Tind) + Q̇various,
where
Q̇heat_cool, act is the actual heating or cooling heat flow rate and
C is the thermal capacitance of the indoor volume.
The two previous equations yield
τ ∂Tind / ∂t = (Q̇heat_cool, act - Q̇heat_cool, req) / G
- Tind + Tind, set,
where τ = C / G is the time constant of the indoor temperature.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
Type | Name | Default | Description |
Time | tau | 1800 | Time constant of the indoor temperature [s] |
Nominal condition |
TemperatureDifference | dTEnv_nominal | | Design temperature difference at which envelope heat loss is QEnv_flow_nominal [K] |
Temperature | TAir_start | | Initial air temperature [K] |
HeatFlowRate | QEnv_flow_nominal | | Envelope heat loss at temperature difference of dTEnv_nominal (with no internal gains, no solar radiation) [W] |
Initialization |
Boolean | steadyStateInitial | false | true initializes T with dT(0)/dt=0, false initializes T with T(0)=TIndHea_nominal |
Connectors
Type | Name | Description |
input RealInput | TSet | Temperature set point for heating or cooling [K] |
input RealInput | QReq_flow | Required heat flow rate to meet temperature set point (>=0 for heating) [W] |
input RealInput | QAct_flow | Actual heating or cooling heat flow rate (>=0 for heating) [W] |
output RealOutput | TAir | Room air temperature [K] |
Modelica definition
Function that reads the peak load from the load profile
Information
Function that reads a double value from a text file.
This function scans a file that has a format such as
#1
#Some other text
#Peak space cooling load = -383165.6989 Watts
#Peak space heating load = 893931.4335 Watts
double tab1(8760,4)
0,0,5972.314925,16
3600,0,4925.839944,1750.915684
...
The parameter string
is a string that the function
searches for, starting at the first line.
If it finds the string, it expects an equality sign, and
returns the double value after this equality sign.
If the function encounters the end of the file, it
terminates the simulation with an assertion.
See
Buildings.DHC.Loads.BaseClasses.Validation.GetPeakLoad
for how to invoke this function.
Extends from Modelica.Icons.Function (Icon for functions).
Inputs
Outputs
Type | Name | Description |
Real | number | Number that is read from the file |
Modelica definition
pure function getPeakLoad
extends Modelica.Icons.Function;
input String string
;
input String filNam
;
output Real number
;
protected
String lin
;
Integer iLin
;
Integer index=0
;
Integer staInd
;
Integer nexInd
;
Boolean found
;
Boolean EOF
;
String del
;
pure function pureReadLine
extends Modelica.Icons.Function;
input String fileName ;
input Integer lineNumber(min=1) ;
output String string ;
output Boolean endOfFile
;
external"C" string =
ModelicaInternal_readLine(
fileName,
lineNumber,
endOfFile);
end pureReadLine;
algorithm
iLin := 0;
EOF := false;
while
(
not EOF)
and
(index == 0)
loop
iLin := iLin+1;
(lin,EOF) :=
pureReadLine(
fileName=filNam,
lineNumber=iLin);
index :=
Modelica.Utilities.Strings.find(
string=lin,
searchString=string,
startIndex=1,
caseSensitive=true);
end while;
assert(
not EOF,
"Error: Did not find '"+string+"' when scanning '"+filNam+"'."+"\n Check for correct file syntax.");
(del,nexInd) :=
Modelica.Utilities.Strings.scanDelimiter(
string=lin,
startIndex=
Modelica.Utilities.Strings.length(string)+1,
requiredDelimiters={"="},
message="Failed to find '=' when reading peak load in '"+filNam+"'.");
number :=
Modelica.Utilities.Strings.scanReal(
string=lin,
startIndex=nexInd,
message="Failed to read double value when reading peak load in '"+filNam+"'.");
end getPeakLoad;