Buildings.Templates.Plants.HeatPumps

Heat pump plants

Information

This package contains templates for heat pump plants.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

Name Description
Buildings.Templates.Plants.HeatPumps.AirToWater AirToWater Air-to-water heat pump plant
Buildings.Templates.Plants.HeatPumps.Components Components Package with component models
Buildings.Templates.Plants.HeatPumps.Configuration Configuration Records for configuration parameters
Buildings.Templates.Plants.HeatPumps.Data Data Records for design and operating parameters
Buildings.Templates.Plants.HeatPumps.Types Types Package with type definitions
Buildings.Templates.Plants.HeatPumps.Validation Validation Package with validation models
Buildings.Templates.Plants.HeatPumps.Interfaces Interfaces Interface classes

Buildings.Templates.Plants.HeatPumps.AirToWater Buildings.Templates.Plants.HeatPumps.AirToWater

Air-to-water heat pump plant

Buildings.Templates.Plants.HeatPumps.AirToWater

Information

Description

This template represents an air-to-water heat pump plant with closed-loop controls. While the heat pump plant configuration can be changed through parameters, the image below shows a typical configuration with two reversible air-to-water heat pumps, a primary-secondary distribution system and a sidestream heat recovery chiller. For a detailed schematic of the actual plant configuration, refer to the diagram view of the plant component. In Dymola, for example, you can access this by right-clicking the component pla in the model Buildings.Templates.Plants.HeatPumps.Validation.AirToWaterReversibleHeatRecovery and selecting "Show Component" from the context menu.

Image of heat pump plant

Currently, only identical heat pumps are supported. Although the template can accommodate any number of identical units, the graphical feedback for system configuration via the diagram layer is only accurate for up to 6 units.

The supported plant configurations are enumerated in the table below. The first option displayed in bold characters corresponds to the default configuration.

Configuration parameter Options Notes
Function and equipment type Heating and cooling with reversible heat pumps
Heating-only with non-reversible heat pumps
Heating and cooling with reversible heat pumps and heat recovery chiller
Heating and cooling with reversible (2-pipe) heat pumps and polyvalent (4-pipe) heat pumps
Heating and cooling with polyvalent (4-pipe) heat pumps
The plant always provides heating hot water.
For configurations without polyvalent heat pumps, the heat pumps may be unequally sized, with only a subset of the units participating in lead/lag alternation.
For configurations with polyvalent heat pumps, the reversible heat pumps must be equally sized among themselves, and the polyvalent heat pumps must be equally sized among themselves. All units are lead/lag alternated within their own pool.
For the configuration with a heat recovery chiller, the template includes a chiller and its associated dedicated primary CHW and CW pumps. The chiller is considered connected in a sidestream configuration to both the CHW return and the HW return.
Type of distribution Constant primary-variable secondary centralized
Variable primary-only
It is assumed that the HW and the CHW loops have the same type of distribution, as specified by this parameter.
Most AWHPs on the market use a reverse cycle for defrosting. This requires maximum primary flow during defrost cycles. Consequently, variable primary plants commonly adopt a high minimum flow setpoint, typically close to the design flow rate, effectively operating akin to constant primary plants but with variable speed pumps controlling the loop differential pressure. While the flow rate directed towards the loads varies, the bypass valve control loop ensures a constant primary flow for a given number of staged units.
"Centralized secondary pumps" refers to configurations with a single group of secondary pumps that is typically integrated into the plant.
Distributed secondary pumps with multiple secondary loops served by dedicated secondary pumps are currently not supported.
Type of primary pump arrangement Dedicated
Headered
It is assumed that the HW and the CHW loops have the same type of primary pump arrangement, as specified by this parameter.
Primary-secondary plants with both reversible and polyvalent heat pumps must have primary dedicated pumps: primary headered pumps are not supported for this configuration.
Separate dedicated primary pumps for the CHW and HW circuits False
True
This option is only available for reversible heat pumps with dedicated primary pumps. If this option is not selected (default setting), each AWHP uses a common dedicated primary pump for CHW and HW – this pump is then denoted as the primary HW pump. Otherwise, each AWHP relies on a separate dedicated HW pump and a separate dedicated CHW pump.
Type of primary pumps Variable speed
Constant speed
For constant primary-variable secondary distributions, the variable speed primary pumps are commanded at fixed speeds, determined during the Testing, Adjusting and Balancing phase to provide design AWHP flow in heating and cooling modes. The same intent is achieved with constant speed primary pumps through the use of balancing valves. It is assumed that the HW and the CHW loops have the same type of primary pumps, as specified by this parameter.
HW buffer tank HW buffer tank in the primary supply
HW buffer tank in the primary return
No HW buffer tank
By default, the HW buffer tank is considered integrated into the primary supply to mitigate the impact of defrost cycles on the temperature of the HW supplied to the loads. This assumes that the buffer tank is well-mixed.
The default sizing of the tank corresponds to 4 min of the design primary flow rate. This is based on manufacturer recommendations, which account for the fact that defrost cycles can take 3 to 5 min to complete.
CHW buffer tank CHW buffer tank in the primary return
CHW buffer tank in the primary supply
No CHW buffer tank
By default, the CHW buffer tank is considered integrated into the primary return to mitigate the impact of rapid load variations on the plant controls. This assumes that the buffer tank is well-mixed.
The default sizing of the tank corresponds to 2 min of the design primary flow rate, based on manufacturer recommendations.
Controller Closed-loop controls with supply temperature and differential pressure reset
Most parts of the sequence of operation are similar to that described in ASHRAE, 2024 for chiller plants.
See the documentation of Buildings.Templates.Plants.Controls.HeatPumps.AirToWater for more details.
An open loop controller is also available for validation purposes.

Control points

The control sequence implemented in this template requires the external input points specified in the documentation of the controller Buildings.Templates.Plants.HeatPumps.Components.Controls.AirToWater.

Implementation details

The pressure drops of the heat pump CHW and HW heat exchangers are calculated within the isolation valve component valIso based on lumped flow coefficients for the sake of computational efficiency.

The template uses a heat pump model that interpolates capacity and power from manufacturer data along the CHW/HW temperature, the outdoor air temperature and the part load ratio. The heat pump performance data are provided via the subrecords dat.hp.perHeaHp and dat.hp.perCooHp for the heating mode and the cooling mode, respectively. The polyvalent heat pump performance data are provided via the subrecord dat.hp.perPhp. For the required format of the performance data files, please refer to the documentation of the blocks Buildings.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.TableData2DLoadDep and Buildings.Fluid.HeatPumps.ModularReversible.RefrigerantCycle.BaseClasses.TableData2DLoadDepSHC.

References

Extends from Buildings.Templates.Plants.HeatPumps.Interfaces.PartialHeatPumpPlant (Interface class for heat pump plant).

Parameters

TypeNameDefaultDescription
replaceable package MediumHeaWatWaterHW medium
replaceable package MediumHotWatWaterDHW medium
replaceable package MediumChiWatWaterCHW medium
replaceable package MediumSouWaterSource-side medium
replaceable package MediumAirAirAir medium
PlantHeatPumptypBuildings.Templates.Plants.C...Type of plant
HeatPumpPlantdat Design and operating parameters
Configuration
DistributiontypDis_select1Buildings.Templates.Plants.H...Type of distribution system
DistributiontypDis_select2 Type of distribution system
Heat pumps
HeatPumptypHpBuildings.Templates.Componen...Type of heat pump
IntegernHp_select Number of heat pumps (excluding polyvalent HPs)
polyvalent heat pumps
IntegernPhp_select Number of polyvalent heat pumps
Primary loop
PumpArrangementtypArrPumPri_selectBuildings.Templates.Componen...Type of primary pump arrangement
PumpsPrimarytypPumPri_selectBuildings.Templates.Plants.H...Type of CHW/HW primary pumps
IntegernPumHeaWatPri_selectnHp + nPhpNumber of primary HW pumps
IntegrationPointtypTanHeaWat_selectBuildings.Templates.Componen...Specify if there is a HW buffer tank and where it is integrated into the system
Booleanhave_pumPriDedComHp_selecttrueSet to true for HP with single dedicated primary pump serving both CHW and HW circuits
IntegernPumChiWatPri_selectnHp + nPhpNumber of primary CHW pumps
IntegrationPointtypTanChiWat_selectBuildings.Templates.Componen...Specify if there is a CHW buffer tank and where it is integrated into the system
Secondary HW loop
IntegernPumHeaWatSec_select Number of secondary HW pumps
Secondary CHW loop
IntegernPumChiWatSec_select Number of secondary CHW pumps
Assumptions
BooleanallowFlowReversaltrue= true to allow flow reversal, false restricts to design direction (port_a -> port_b)
Advanced
Booleanlinearizedfalse= true, use linear relation between m_flow and dp for all valves
Booleanis_dpBalYPumSetCalfalseSet to true to automatically size balancing valves or evaluate pump speed providing design flow
PressureDifferencedpHeaWatLoo_nominal HW loop differential pressure at design flow rate [Pa]
PressureDifferencedpChiWatLoo_nominal CHW loop differential pressure at design flow rate [Pa]
Diagnostics
Booleanshow_Tfalse= true, if actual temperature at port is computed

Connectors

TypeNameDescription
replaceable package MediumChiWatCHW medium
replaceable package MediumSouSource-side medium
FluidPort_aport_aHeaWatHW return
FluidPort_bport_bHeaWatHW supply
FluidPort_aport_aChiWatCHW return
FluidPort_bport_bChiWatCHW supply
BusbusPlant control bus
BusbusAirHan[cfg.nAirHan]Air handling unit control bus
BusbusEquZon[cfg.nEquZon]Terminal unit control bus
BusbusWeaWeather bus

Modelica definition

model AirToWater "Air-to-water heat pump plant" extends Buildings.Templates.Plants.HeatPumps.Interfaces.PartialHeatPumpPlant( redeclare final package MediumChiWat=MediumHeaWat, redeclare final package MediumSou=MediumAir, redeclare Buildings.Templates.Plants.HeatPumps.Components.Controls.AirToWater ctl( ctl( final yPumHeaWatPriDedHpSet=yPumHeaWatPriDedHpSet, final yPumHeaWatPriDedPhpSet=yPumHeaWatPriDedPhpSet, final yPumHeaWatPriHdrSet=yPumHeaWatPriHdrSet, final yPumChiWatPriDedHpSet=yPumChiWatPriDedHpSet, final yPumChiWatPriDedPhpSet=yPumChiWatPriDedPhpSet, final yPumChiWatPriHdrSet=yPumChiWatPriHdrSet)), final typHp=Buildings.Templates.Components.Types.HeatPump.AirToWater); parameter Boolean is_dpBalYPumSetCal = false "Set to true to automatically size balancing valves or evaluate pump speed providing design flow"; final parameter Boolean is_dpBalCal = is_dpBalYPumSetCal and (typPumPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.Constant or have_hp and have_php and typDis == Buildings.Templates.Plants.HeatPumps.Types.Distribution.Variable1Only) "Set to true to automatically size balancing valves"; final parameter Boolean is_yPumSetCal = is_dpBalYPumSetCal and typDis == Buildings.Templates.Plants.HeatPumps.Types.Distribution.Constant1Variable2 and typPumPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.Variable "Set to true to automatically evaluate pump speed providing design flow"; // To size the HP balancing valves, we first need to scale the pump check valve // pressure drop for configurations with common dedicated CHW and HW pumps. final parameter Modelica.Units.SI.PressureDifference dpValCheHeaWatBalHp_nominal = if have_heaWat and have_hp then (if have_pumPriDedComHp then dat.dpValCheHeaWat_nominal[1] * (hp.mHeaWatHp_flow_nominal / dat.pumHeaWatPri.m_flow_nominal[1]) ^ 2 elseif typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.dpValCheHeaWat_nominal[1] else dpValCheHeaWatBalHdr_nominal) else 0 "HP primary (HW or common HW and CHW) pump check valve pressure drop at design HW flow rate"; final parameter Modelica.Units.SI.PressureDifference dpValCheChiWatBalHp_nominal = if have_chiWat and have_hp then (if have_pumPriDedComHp then dat.dpValCheHeaWat_nominal[1] * (hp.mChiWatHp_flow_nominal / dat.pumHeaWatPri.m_flow_nominal[1]) ^ 2 elseif typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.dpValCheChiWat_nominal[1] else dpValCheChiWatBalHdr_nominal) else 0 "HP primary (CHW or common HW and CHW) pump check valve pressure drop at design CHW flow rate"; final parameter Modelica.Units.SI.PressureDifference dpValCheHeaWatBalPhp_nominal = if have_php then (if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.dpValCheHeaWat_nominal[nPumHeaWatPri] else dpValCheHeaWatBalHdr_nominal) else 0 "Polyvalent HP primary HW pump check valve pressure drop at design HW flow rate"; final parameter Modelica.Units.SI.PressureDifference dpValCheChiWatBalPhp_nominal = if have_php then (if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.dpValCheChiWat_nominal[nPumChiWatPri] else dpValCheChiWatBalHdr_nominal) else 0 "Polyvalent HP primary CHW pump check valve pressure drop at design CHW flow rate"; // To size the HP balancing valves in case of headered pumps, where the number of pumps may not match // the number of heat pumps, we use the *total* pump flow and *equivalent* pressure curve. final parameter Modelica.Units.SI.VolumeFlowRate VHeaWatBalHdr_nominal = (nHp * dat.hp.mHeaWatHp_flow_nominal + nPhp * dat.hp.mHeaWatPhp_flow_nominal) / rhoHeaWat_default "Total design HW flow rate for balancing valve and pump speed calculation – Headered pumps"; final parameter Modelica.Units.SI.VolumeFlowRate VChiWatBalHdr_nominal = (nHp * dat.hp.mChiWatHp_flow_nominal + nPhp * dat.hp.mChiWatPhp_flow_nominal) / rhoChiWat_default "Total design CHW flow rate for balancing valve and pump speed calculation – Headered pumps"; final parameter Modelica.Units.SI.VolumeFlowRate VHeaWatBalHp_nominal = if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.hp.mHeaWatHp_flow_nominal / rhoHeaWat_default else VHeaWatBalHdr_nominal "Target HW flow rate for HP balancing valve and pump speed calculation"; final parameter Modelica.Units.SI.VolumeFlowRate VChiWatBalHp_nominal = if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.hp.mChiWatHp_flow_nominal / rhoChiWat_default else VChiWatBalHdr_nominal "Target CHW flow rate for HP balancing valve and pump speed calculation"; final parameter Modelica.Units.SI.VolumeFlowRate VHeaWatBalPhp_nominal = if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.hp.mHeaWatPhp_flow_nominal / rhoHeaWat_default else VHeaWatBalHdr_nominal "Target HW flow rate for polyvalent HP balancing valve and pump speed calculation"; final parameter Modelica.Units.SI.VolumeFlowRate VChiWatBalPhp_nominal = if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.hp.mChiWatPhp_flow_nominal / rhoChiWat_default else VChiWatBalHdr_nominal "Target CHW flow rate for polyvalent HP balancing valve and pump speed calculation"; final parameter Modelica.Units.SI.PressureDifference dpValCheHeaWatBalHdr_nominal = if typPumHeaWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then 0 else max(dat.dpValCheHeaWat_nominal) * (VHeaWatBalHdr_nominal * rhoHeaWat_default / sum( dat.pumHeaWatPri.m_flow_nominal)) ^ 2 "Primary HW pump check valve pressure drop at design HW flow rate – Headered pumps"; final parameter Modelica.Units.SI.PressureDifference dpValCheChiWatBalHdr_nominal = if typPumChiWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then 0 else max(dat.dpValCheChiWat_nominal) * (VChiWatBalHdr_nominal * rhoChiWat_default / sum( dat.pumChiWatPri.m_flow_nominal)) ^ 2 "Primary CHW pump check valve pressure drop at design CHW flow rate – Headered pumps"; final parameter Integer nPoiPrePumHeaWat = size( dat.pumHeaWatPri.per.pressure.V_flow, 2) "Number of points in primary HW pump pressure curve"; final parameter Integer nPoiPrePumChiWat = size( dat.pumChiWatPri.per.pressure.V_flow, 2) "Number of points in primary CHW pump pressure curve"; final parameter Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters prePumHeaWatBalHdr( V_flow=if typPumHeaWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else {sum( dat.pumHeaWatPri.per[:].pressure.V_flow[i]) for i in 1:nPoiPrePumHeaWat}, dp=if typPumHeaWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else {max( dat.pumHeaWatPri.per[:].pressure.dp[i]) for i in 1:nPoiPrePumHeaWat}) "Equivalent pressure curve of parallel primary HW pumps – Headered pumps"; final parameter Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters prePumChiWatBalHdr( V_flow=if typPumChiWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else {sum( dat.pumChiWatPri.per[:].pressure.V_flow[i]) for i in 1:nPoiPrePumChiWat}, dp=if typPumChiWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else {max( dat.pumChiWatPri.per[:].pressure.dp[i]) for i in 1:nPoiPrePumChiWat}) "Equivalent pressure curve of parallel primary CHW pumps – Headered pumps"; final parameter Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters prePumHeaWatBalHp = if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters( V_flow=if typPumHeaWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else dat.pumHeaWatPri.per[1].pressure.V_flow, dp=if typPumHeaWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else dat.pumHeaWatPri.per[1].pressure.dp) else prePumHeaWatBalHdr "Pump pressure curve for HP HW balancing valve and pump speed calculation"; final parameter Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters prePumChiWatBalHp = if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then (if have_pumPriDedComHp then prePumHeaWatBalHp else Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters( V_flow=if typPumChiWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else dat.pumChiWatPri.per[1].pressure.V_flow, dp=if typPumChiWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else dat.pumChiWatPri.per[1].pressure.dp)) else prePumChiWatBalHdr "Pump pressure curve for HP CHW balancing valve and pump speed calculation"; final parameter Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters prePumHeaWatBalPhp = if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters( V_flow=if typPumHeaWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else dat.pumHeaWatPri.per[nPumHeaWatPri].pressure.V_flow, dp=if typPumHeaWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else dat.pumHeaWatPri.per[nPumHeaWatPri].pressure.dp) else prePumHeaWatBalHdr "Pump pressure curve for polyvalent HP HW balancing valve and pump speed calculation"; final parameter Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters prePumChiWatBalPhp = if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then Buildings.Fluid.Movers.BaseClasses.Characteristics.flowParameters( V_flow=if typPumChiWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else dat.pumChiWatPri.per[nPumChiWatPri].pressure.V_flow, dp=if typPumChiWatPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.None then {0, 0, 0} else dat.pumChiWatPri.per[nPumChiWatPri].pressure.dp) else prePumChiWatBalHdr "Pump pressure curve for polyvalent HP CHW balancing valve and pump speed calculation"; // To size the HP balancing valves in case of primary-only plants, we must // also consider the HW/CHW loop pressure drop. parameter Modelica.Units.SI.PressureDifference dpHeaWatLoo_nominal(start=0) "HW loop differential pressure at design flow rate"; parameter Modelica.Units.SI.PressureDifference dpChiWatLoo_nominal(start=0) "CHW loop differential pressure at design flow rate"; final parameter Modelica.Units.SI.PressureDifference dpHeaWatLooBal_nominal = if typDis == Buildings.Templates.Plants.HeatPumps.Types.Distribution.Variable1Only then (if cfg.typCtl == Buildings.Templates.Plants.HeatPumps.Types.Controller.AirToWater and not cfg.have_senDpHeaWatRemWir then dat.ctl.dpHeaWatLocSet_max else dpHeaWatLoo_nominal) else 0 "HW loop differential pressure at design flow rate used for balancing valve and pump speed calculation"; final parameter Modelica.Units.SI.PressureDifference dpChiWatLooBal_nominal = if typDis == Buildings.Templates.Plants.HeatPumps.Types.Distribution.Variable1Only then (if cfg.typCtl == Buildings.Templates.Plants.HeatPumps.Types.Controller.AirToWater and not cfg.have_senDpChiWatRemWir then dat.ctl.dpChiWatLocSet_max else dpChiWatLoo_nominal) else 0 "CHW loop differential pressure at design flow rate used for balancing valve and pump speed calculation"; final parameter Modelica.Units.SI.PressureDifference dpBalHeaWatHp_nominal = if have_hp then (if is_dpBalCal then Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VHeaWatBalHp_nominal, dp_nominal=hp.dpHeaWatHp_nominal + max( valIso.dpValveHeaWat_nominal[1:nHp]) * ((if have_valHpInlIso then 1 else 0) + (if have_valHpOutIso then 1 else 0)) + dpValCheHeaWatBalHp_nominal + dpHeaWatLooBal_nominal, prePum=prePumHeaWatBalHp) else dat.dpBalHeaWatHp_nominal) else 0 "HP HW balancing valve pressure drop at design HW flow"; final parameter Modelica.Units.SI.PressureDifference dpBalChiWatHp_nominal = if have_hp and have_chiWat then (if is_dpBalCal then Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VChiWatBalHp_nominal, dp_nominal=hp.dpChiWatHp_nominal + max( valIso.dpValveChiWat_nominal[1:nHp]) * ((if have_valHpInlIso then 1 else 0) + (if have_valHpOutIso then 1 else 0)) + dpValCheChiWatBalHp_nominal + dpChiWatLooBal_nominal, prePum=prePumChiWatBalHp) else dat.dpBalChiWatHp_nominal) else 0 "HP CHW balancing valve pressure drop at design CHW flow"; final parameter Modelica.Units.SI.PressureDifference dpBalHeaWatPhp_nominal = if have_php then (if is_dpBalCal then Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VHeaWatBalPhp_nominal, dp_nominal=dat.hp.dpHeaWatPhp_nominal + max( valIso.dpValveHeaWat_nominal[nHp + 1:nHp + nPhp]) * ((if have_valPhpInlIso then 1 else 0) + (if have_valPhpOutIso then 1 else 0)) + dpValCheHeaWatBalPhp_nominal + dpHeaWatLooBal_nominal, prePum=prePumHeaWatBalPhp) else dat.dpBalHeaWatPhp_nominal) else 0 "Polyvalent unit HW balancing valve pressure drop at design HW flow"; final parameter Modelica.Units.SI.PressureDifference dpBalChiWatPhp_nominal = if have_php then (if is_dpBalCal then Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VChiWatBalPhp_nominal, dp_nominal=dat.hp.dpChiWatPhp_nominal + max( valIso.dpValveChiWat_nominal[nHp + 1:nHp + nPhp]) * ((if have_valPhpInlIso then 1 else 0) + (if have_valPhpOutIso then 1 else 0)) + dpValCheChiWatBalPhp_nominal + dpChiWatLooBal_nominal, prePum=prePumChiWatBalPhp) else dat.dpBalChiWatPhp_nominal) else 0 "Polyvalent unit CHW balancing valve pressure drop at design CHW flow"; final parameter Real yPumHeaWatPriHdrSet( final fixed=false, final max=2, final min=0, start=1, final unit="1") "Primary HW pump speed providing design flow – Headered pumps"; final parameter Real yPumChiWatPriHdrSet( final fixed=false, final max=2, final min=0, start=1, final unit="1") "Primary CHW pump speed providing design flow – Headered pumps"; final parameter Real yPumHeaWatPriDedHpSet( final fixed=false, final max=2, final min=0, start=1, final unit="1") "Primary pump speed providing design flow in heating mode – HP dedicated pumps"; final parameter Real yPumChiWatPriDedHpSet( final fixed=false, final max=2, final min=0, start=1, final unit="1") "Primary pump speed providing design flow in cooling mode – HP dedicated pumps"; final parameter Real yPumHeaWatPriDedPhpSet( final fixed=false, final max=2, final min=0, start=1, final unit="1") "Primary HW pump speed providing design flow – Polyvalent HP dedicated pumps"; final parameter Real yPumChiWatPriDedPhpSet( final fixed=false, final max=2, final min=0, start=1, final unit="1") "Primary CHW pump speed providing design flow – HP dedicated pumps"; // Heat pumps, dedicated primary pumps and isolation valves // The handling of HP pressure drop is accounted for within the isolation valve component. Buildings.Templates.Plants.HeatPumps.Components.HeatPumpGroups.AirToWater hp( redeclare final package MediumHeaWat=MediumHeaWat, redeclare final package MediumAir=MediumAir, final have_hp=have_hp, final have_php=have_php, final nHp=nHp, final nPhp=nPhp, final is_rev=is_rev, final energyDynamics=energyDynamics, final have_dpChiHeaWat=false, final have_dpSou=false, final dat=dat.hp, final allowFlowReversal=allowFlowReversal, final allowFlowReversalSou=false, final show_T=show_T) "Heat pump group"; Components.PumpsPrimaryDedicated pumPri( redeclare final package Medium=MediumHeaWat, final have_hp=have_hp, final have_php=have_php, final have_pumHeaWatPriVar=typPumPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.Variable, final have_pumChiWatPriVar=typPumPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.Variable, final nHp=nHp, final nPhp=nPhp, final nPumHeaWat=if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then nPumHeaWatPri else 0, final nPumChiWat=if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then nPumChiWatPri else 0, final typArrPumPri=typArrPumPri, final have_pumPriComHp=have_pumPriDedComHp, final datPumHeaWat=dat.pumHeaWatPri, final datPumChiWat=dat.pumChiWatPri, final dpValCheHeaWat_nominal=if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.dpValCheHeaWat_nominal else fill(0, 0), final dpValCheChiWat_nominal=if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then dat.dpValCheChiWat_nominal else fill(0, 0), final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal) "Dedicated primary pumps"; Components.ValvesIsolation valIso( redeclare final package Medium=MediumHeaWat, final have_hp=have_hp, final have_php=have_php, final nHp=nHp, final have_chiWat=have_chiWat, final nPhp=nPhp, final have_valHpInlIso=have_valHpInlIso, final have_valHpOutIso=have_valHpOutIso, final have_valPhpInlIso=have_valPhpInlIso, final have_valPhpOutIso=have_valPhpOutIso, final have_pumChiWatDedHp=have_pumChiWatPriDedHp, final mHeaWatUni_flow_nominal=cat( 1, fill(dat.hp.mHeaWatHp_flow_nominal, nHp), fill(dat.hp.mHeaWatPhp_flow_nominal, nPhp)), final dpHeaWatUni_nominal=cat( 1, fill(dat.hp.dpHeaWatHp_nominal, nHp), fill(dat.hp.dpHeaWatPhp_nominal, nPhp)), final dpBalHeaWatUni_nominal=cat( 1, fill(dpBalHeaWatHp_nominal, nHp), fill(dpBalHeaWatPhp_nominal, nPhp)), final mChiWatUni_flow_nominal=cat( 1, fill(dat.hp.mChiWatHp_flow_nominal, nHp), fill(dat.hp.mChiWatPhp_flow_nominal, nPhp)), final dpChiWatPhp_nominal=fill(dat.hp.dpChiWatPhp_nominal, nPhp), final dpBalChiWatUni_nominal=cat( 1, fill(dpBalChiWatHp_nominal, nHp), fill(dpBalChiWatPhp_nominal, nPhp)), final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, linearized=linearized) "Heat pump isolation valves"; // Primary CHW loop Buildings.Templates.Components.Pumps.Multiple pumChiWatPri( final energyDynamics=energyDynamics, redeclare final package Medium=MediumChiWat, final dat=dat.pumChiWatPri, final dpValChe_nominal=dat.dpValCheChiWat_nominal, final nPum=nPumChiWatPri, final have_var=typPumPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.Variable, final have_varCom=true, final allowFlowReversal=allowFlowReversal) if have_chiWat and typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Headered "Headered primary CHW pumps"; Buildings.Templates.Components.Routing.SingleToMultiple inlPumChiWatPri( redeclare final package Medium=MediumChiWat, final nPorts=nPumChiWatPri, final m_flow_nominal=mChiWatPri_flow_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final icon_dy=300) if have_chiWat and typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Headered "Primary CHW pumps inlet manifold"; Buildings.Templates.Components.Routing.MultipleToSingle outPumChiWatPri( redeclare final package Medium=MediumChiWat, final nPorts=nPumChiWatPri, final m_flow_nominal=mChiWatPri_flow_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final icon_dy=300) if have_chiWat and typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Headered "Primary CHW pumps outlet manifold"; Buildings.Templates.Components.Routing.PassThroughFluid supChiWatPri( redeclare final package Medium=MediumChiWat, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final allowFlowReversal=allowFlowReversal) if have_chiWat and typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated "Primary CHW supply pipe - Plant with dedicated primary CHW pumps"; Buildings.Templates.Components.Sensors.VolumeFlowRate VChiWatPri_flow( redeclare final package Medium=MediumChiWat, final m_flow_nominal=mChiWatPri_flow_nominal, final allowFlowReversal=allowFlowReversal, final have_sen=ctl.have_senVChiWatPri, final text_flip=false, final typ=Buildings.Templates.Components.Types.SensorVolumeFlowRate.FlowMeter, icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply) if have_chiWat "Primary CHW volume flow rate"; Buildings.Templates.Components.Routing.Junction junChiWatBypSup( redeclare final package Medium=MediumChiWat, final m_flow_nominal=mChiWatPri_flow_nominal * {1, -1, -1}, final energyDynamics=energyDynamics, dp_nominal=fill(0, 3), 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) if have_chiWat "Fluid junction"; Buildings.Templates.Components.Sensors.Temperature TChiWatPriSup( redeclare final package Medium=MediumChiWat, final have_sen=true, final m_flow_nominal=mChiWatPri_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final allowFlowReversal=allowFlowReversal) if have_chiWat "Primary CHW supply temperature"; Buildings.Templates.Components.Routing.Junction junChiWatBypRet( redeclare final package Medium=MediumChiWat, final m_flow_nominal=mChiWatPri_flow_nominal * {1, -1, 1}, final energyDynamics=energyDynamics, dp_nominal=fill(0, 3), 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, icon_pipe1=Buildings.Templates.Components.Types.IntegrationPoint.Return, icon_pipe3=Buildings.Templates.Components.Types.IntegrationPoint.Supply) if have_chiWat "Fluid junction"; Buildings.Templates.Components.Sensors.Temperature TChiWatPriRet( redeclare final package Medium=MediumChiWat, final have_sen=ctl.have_senTChiWatPriRet, final m_flow_nominal=mChiWatPri_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Return, final allowFlowReversal=allowFlowReversal) if have_chiWat "Primary CHW return temperature"; Buildings.Templates.Components.Actuators.Valve valChiWatMinByp( redeclare final package Medium=MediumChiWat, final dat=dat.valChiWatMinByp, final typ=if have_valChiWatMinByp then Buildings.Templates.Components.Types.Valve.TwoWayModulating else Buildings.Templates.Components.Types.Valve.None, final chaTwo=Buildings.Templates.Components.Types.ValveCharacteristicTwoWay.Linear, final allowFlowReversal=allowFlowReversal, final energyDynamics=energyDynamics, linearized=linearized, from_dp=true) if have_valChiWatMinByp or have_bypChiWatFix "CHW minimum flow bypass valve or fixed bypass depending on type of distribution"; Buildings.Templates.Components.Tanks.Buffer tanChiWatSup( redeclare final package Medium=MediumChiWat, final have_tan=typTanChiWat == Buildings.Templates.Components.Types.IntegrationPoint.Supply, final V=dat.VTanChiWat, final m_flow_nominal=mChiWatPri_flow_nominal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal) if have_chiWat "CHW buffer tank"; Buildings.Templates.Components.Tanks.Buffer tanChiWatRet( redeclare final package Medium=MediumChiWat, final have_tan=typTanChiWat == Buildings.Templates.Components.Types.IntegrationPoint.Return, final V=dat.VTanChiWat, final m_flow_nominal=mChiWatPri_flow_nominal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Return, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal) if have_chiWat "CHW buffer tank"; // Secondary CHW loop Buildings.Templates.Components.Pumps.Multiple pumChiWatSec( final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, redeclare final package Medium=MediumChiWat, final nPum=nPumChiWatSec, final have_var=true, final have_varCom=true, final dat=dat.pumChiWatSec) if have_chiWat and typPumChiWatSec == Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized "Secondary CHW pumps"; Buildings.Templates.Components.Routing.SingleToMultiple inlPumChiWatSec( redeclare final package Medium=MediumChiWat, final nPorts=nPumChiWatSec, final m_flow_nominal=mChiWat_flow_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final icon_dy=300) if have_chiWat and typPumChiWatSec == Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized "Secondary CHW pumps inlet manifold"; Buildings.Templates.Components.Routing.MultipleToSingle outPumChiWatSec( redeclare final package Medium=MediumChiWat, final nPorts=nPumChiWatSec, final m_flow_nominal=mChiWat_flow_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final icon_dy=300) if have_chiWat and typPumChiWatSec == Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized "Secondary CHW pumps outlet manifold"; Buildings.Templates.Components.Routing.PassThroughFluid supChiWatSec( redeclare final package Medium=MediumChiWat, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final allowFlowReversal=allowFlowReversal) if have_chiWat and typPumChiWatSec <> Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized "Secondary CHW supply pipe - Plant without secondary CHW pumps"; Buildings.Templates.Components.Sensors.VolumeFlowRate VChiWatLooOrSec_flow( redeclare final package Medium=MediumChiWat, final m_flow_nominal=mChiWat_flow_nominal, final allowFlowReversal=allowFlowReversal, final have_sen=ctl.have_senVChiWatSec or ctl.have_senVChiWatLoo, final text_flip=false, final typ=Buildings.Templates.Components.Types.SensorVolumeFlowRate.FlowMeter, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply) if have_chiWat "CHW loop (primary-only) or secondary (primary-secondary) volume flow rate"; Buildings.Templates.Components.Sensors.Temperature TChiWatSecSup( redeclare final package Medium=MediumChiWat, final have_sen=ctl.have_senTChiWatSecSup, final m_flow_nominal=mChiWat_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final allowFlowReversal=allowFlowReversal) if have_chiWat "Secondary CHW supply temperature"; Buildings.Templates.Components.Sensors.Temperature TChiWatLooOrSecRet( redeclare final package Medium=MediumChiWat, final have_sen=ctl.have_senTChiWatSecRet or ctl.have_senTChiWatLooRet, final m_flow_nominal=mChiWat_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Return, final allowFlowReversal=allowFlowReversal) if have_chiWat "CHW loop (primary-only) or secondary (primary-secondary) return temperature"; Buildings.Templates.Components.Sensors.DifferentialPressure dpChiWatLoc( redeclare final package Medium=MediumChiWat, text_rotation=90) if have_chiWat and not ctl.have_senDpChiWatRemWir "Local CHW ∆p sensor"; // Primary HW loop Buildings.Templates.Components.Routing.SingleToMultiple inlPumHeaWatPri( redeclare final package Medium=MediumHeaWat, final nPorts=nPumHeaWatPri, final m_flow_nominal=mHeaWatPri_flow_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final icon_dy=300) if have_heaWat and typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Headered "Primary HW pumps inlet manifold"; Buildings.Templates.Components.Pumps.Multiple pumHeaWatPri( final energyDynamics=energyDynamics, redeclare final package Medium=MediumHeaWat, final dat=dat.pumHeaWatPri, final dpValChe_nominal=dat.dpValCheHeaWat_nominal, final nPum=nPumHeaWatPri, final have_var=typPumPri == Buildings.Templates.Plants.HeatPumps.Types.PumpsPrimary.Variable, final have_varCom=true, final allowFlowReversal=allowFlowReversal) if have_heaWat and typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Headered "Headered primary HW pumps"; Buildings.Templates.Components.Routing.MultipleToSingle outPumHeaWatPri( redeclare final package Medium=MediumHeaWat, final nPorts=nPumHeaWatPri, final m_flow_nominal=mHeaWatPri_flow_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final icon_dy=300) if have_heaWat and typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Headered "Primary HW pumps outlet manifold"; Buildings.Templates.Components.Routing.PassThroughFluid supHeaWatPri( redeclare final package Medium=MediumHeaWat, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final allowFlowReversal=allowFlowReversal) if have_heaWat and typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated "Primary HW supply pipe - Plant with dedicated primary HW pumps"; Buildings.Templates.Components.Sensors.VolumeFlowRate VHeaWatPri_flow( redeclare final package Medium=MediumHeaWat, final m_flow_nominal=mHeaWatPri_flow_nominal, final allowFlowReversal=allowFlowReversal, final have_sen=ctl.have_senVHeaWatPri, final text_flip=false, final typ=Buildings.Templates.Components.Types.SensorVolumeFlowRate.FlowMeter, icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply) "Primary HW volume flow rate"; Buildings.Templates.Components.Routing.Junction junHeaWatBypSup( redeclare final package Medium=MediumHeaWat, final m_flow_nominal=mHeaWatPri_flow_nominal * {1, -1, -1}, final energyDynamics=energyDynamics, dp_nominal=fill(0, 3), 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) if have_heaWat "Fluid junction"; Buildings.Templates.Components.Sensors.Temperature THeaWatPriSup( redeclare final package Medium=MediumHeaWat, final have_sen=true, final m_flow_nominal=mHeaWatPri_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final allowFlowReversal=allowFlowReversal) "Primary HW supply temperature"; Buildings.Templates.Components.Sensors.Temperature THeaWatPriRet( redeclare final package Medium=MediumHeaWat, final have_sen=ctl.have_senTHeaWatPriRet, final m_flow_nominal=mHeaWatPri_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Return, final allowFlowReversal=allowFlowReversal) "Primary HW return temperature"; Buildings.Templates.Components.Routing.Junction junHeaWatBypRet( redeclare final package Medium=MediumHeaWat, final m_flow_nominal=mHeaWatPri_flow_nominal * {1, -1, 1}, final energyDynamics=energyDynamics, dp_nominal=fill(0, 3), 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, icon_pipe1=Buildings.Templates.Components.Types.IntegrationPoint.Return, icon_pipe3=Buildings.Templates.Components.Types.IntegrationPoint.Supply) if have_heaWat "Fluid junction"; Buildings.Templates.Components.Actuators.Valve valHeaWatMinByp( redeclare final package Medium=MediumHeaWat, final dat=dat.valHeaWatMinByp, final typ=if have_valHeaWatMinByp then Buildings.Templates.Components.Types.Valve.TwoWayModulating else Buildings.Templates.Components.Types.Valve.None, final chaTwo=Buildings.Templates.Components.Types.ValveCharacteristicTwoWay.Linear, final allowFlowReversal=allowFlowReversal, final energyDynamics=energyDynamics, linearized=linearized, from_dp=true) if have_valHeaWatMinByp or have_bypHeaWatFix "HW minimum flow bypass valve or fixed bypass depending on type of distribution"; Buildings.Templates.Components.Tanks.Buffer tanHeaWatSup( redeclare final package Medium=MediumHeaWat, final have_tan=typTanHeaWat == Buildings.Templates.Components.Types.IntegrationPoint.Supply, final V=dat.VTanHeaWat, final m_flow_nominal=mHeaWatPri_flow_nominal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal) if have_heaWat "HW buffer tank"; Buildings.Templates.Components.Tanks.Buffer tanHeaWatRet( redeclare final package Medium=MediumHeaWat, final have_tan=typTanHeaWat == Buildings.Templates.Components.Types.IntegrationPoint.Return, final V=dat.VTanHeaWat, final m_flow_nominal=mHeaWatPri_flow_nominal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Return, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal) if have_heaWat "HW buffer tank"; // Secondary HW loop Buildings.Templates.Components.Pumps.Multiple pumHeaWatSec( final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, redeclare final package Medium=MediumHeaWat, final nPum=nPumHeaWatSec, final have_var=true, final have_varCom=true, final dat=dat.pumHeaWatSec) if typPumHeaWatSec == Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized "Secondary HW pumps"; Buildings.Templates.Components.Routing.SingleToMultiple inlPumHeaWatSec( redeclare final package Medium=MediumHeaWat, final nPorts=nPumHeaWatSec, final m_flow_nominal=mHeaWat_flow_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final icon_dy=300) if typPumHeaWatSec == Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized "Secondary HW pumps inlet manifold"; Buildings.Templates.Components.Routing.MultipleToSingle outPumHeaWatSec( redeclare final package Medium=MediumHeaWat, final nPorts=nPumHeaWatSec, final m_flow_nominal=mHeaWat_flow_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final icon_dy=300) if typPumHeaWatSec == Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized "Secondary HW pumps outlet manifold"; Buildings.Templates.Components.Routing.PassThroughFluid supHeaWatSec( redeclare final package Medium=MediumHeaWat, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final allowFlowReversal=allowFlowReversal) if have_heaWat and typPumHeaWatSec <> Buildings.Templates.Plants.HeatPumps.Types.PumpsSecondary.Centralized "Secondary HW supply pipe - Plant without secondary HW pumps"; Buildings.Templates.Components.Sensors.VolumeFlowRate VHeaWatLooOrSec_flow( redeclare final package Medium=MediumHeaWat, final m_flow_nominal=mHeaWat_flow_nominal, final allowFlowReversal=allowFlowReversal, final have_sen=ctl.have_senVHeaWatSec or ctl.have_senVHeaWatLoo, final text_flip=false, final typ=Buildings.Templates.Components.Types.SensorVolumeFlowRate.FlowMeter, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply) "HW loop (primary-only) or secondary (primary-secondary) volume flow rate"; Buildings.Templates.Components.Sensors.Temperature THeaWatSecSup( redeclare final package Medium=MediumHeaWat, final have_sen=ctl.have_senTHeaWatSecSup, final m_flow_nominal=mHeaWat_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Supply, final allowFlowReversal=allowFlowReversal) "Secondary HW supply temperature"; Buildings.Templates.Components.Sensors.Temperature THeaWatLooOrSecRet( redeclare final package Medium=MediumHeaWat, final have_sen=ctl.have_senTHeaWatSecRet or ctl.have_senTHeaWatLooRet, final m_flow_nominal=mHeaWat_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Return, final allowFlowReversal=allowFlowReversal) "HW loop (primary-only) or secondary (primary-secondary) return temperature"; Buildings.Templates.Components.Sensors.DifferentialPressure dpHeaWatLoc( redeclare final package Medium=MediumHeaWat, text_rotation=90) if have_heaWat and not ctl.have_senDpHeaWatRemWir "Local HW ∆p sensor"; Components.HeatRecoveryChiller hrc( redeclare final package MediumChiWat=MediumChiWat, redeclare final package MediumHeaWat=MediumHeaWat, final allowFlowReversal1=allowFlowReversal, final allowFlowReversal2=allowFlowReversal, final show_T=show_T, final datPumChiWat=dat.pumChiWatHrc, final datPumHeaWat=dat.pumHeaWatHrc, final datHrc=dat.hrc, final energyDynamics=energyDynamics) if have_hrc "Sidestream heat recovery chiller"; Buildings.Templates.Components.Routing.Junction junHeaWatHrcEnt( redeclare final package Medium=MediumHeaWat, final m_flow_nominal=mHeaWat_flow_nominal * {1, -1, -1}, final energyDynamics=energyDynamics, dp_nominal=fill(0, 3), 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, icon_pipe1=Buildings.Templates.Components.Types.IntegrationPoint.Return, icon_pipe3=if have_hrc then Buildings.Templates.Components.Types.IntegrationPoint.Return else Buildings.Templates.Components.Types.IntegrationPoint.None) if have_heaWat "Fluid junction"; Buildings.Templates.Components.Routing.Junction junHeaWatHrcLvg( redeclare final package Medium=MediumHeaWat, final m_flow_nominal=mHeaWat_flow_nominal * {1, -1, 1}, final energyDynamics=energyDynamics, dp_nominal=fill(0, 3), 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, icon_pipe1=Buildings.Templates.Components.Types.IntegrationPoint.Return, icon_pipe3=if have_hrc then Buildings.Templates.Components.Types.IntegrationPoint.Supply else Buildings.Templates.Components.Types.IntegrationPoint.None) if have_heaWat "Fluid junction"; Buildings.Templates.Components.Routing.Junction junChiWatHrcEnt( redeclare final package Medium=MediumChiWat, final m_flow_nominal=mChiWat_flow_nominal * {1, -1, -1}, final energyDynamics=energyDynamics, dp_nominal=fill(0, 3), 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, icon_pipe1=Buildings.Templates.Components.Types.IntegrationPoint.Return, icon_pipe3=if have_hrc then Buildings.Templates.Components.Types.IntegrationPoint.Return else Buildings.Templates.Components.Types.IntegrationPoint.None) if have_chiWat "Fluid junction"; Buildings.Templates.Components.Routing.Junction junChiWatHrcLvg( redeclare final package Medium=MediumChiWat, final m_flow_nominal=mChiWat_flow_nominal * {1, -1, 1}, final energyDynamics=energyDynamics, dp_nominal=fill(0, 3), 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, icon_pipe1=Buildings.Templates.Components.Types.IntegrationPoint.Return, icon_pipe3=if have_hrc then Buildings.Templates.Components.Types.IntegrationPoint.Supply else Buildings.Templates.Components.Types.IntegrationPoint.None) if have_chiWat "Fluid junction"; Buildings.Templates.Components.Sensors.Temperature TChiWatRetUpsHrc( redeclare final package Medium=MediumChiWat, final have_sen=have_hrc, final m_flow_nominal=mChiWat_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Return, final allowFlowReversal=allowFlowReversal) if have_chiWat "CHW return temperature upstream of HRC"; Buildings.Templates.Components.Sensors.Temperature THeaWatRetUpsHrc( redeclare final package Medium=MediumHeaWat, final have_sen=have_hrc, final m_flow_nominal=mHeaWat_flow_nominal, final typ=Buildings.Templates.Components.Types.SensorTemperature.InWell, final icon_pipe=Buildings.Templates.Components.Types.IntegrationPoint.Return, final allowFlowReversal=allowFlowReversal) "HW return temperature upstream of HRC"; Fluid.Sources.Boundary_pT bouHeaWat( redeclare final package Medium=MediumHeaWat, p=Buildings.Templates.Data.Defaults.pHeaWat_rel_nominal + 101325, nPorts=1) if have_heaWat "Pressure boundary condition mimicking expansion tank"; Fluid.Sources.Boundary_pT bouChiWat( redeclare final package Medium=MediumChiWat, p=Buildings.Templates.Data.Defaults.pChiWat_rel_nominal + 101325, nPorts=1) if typ == Buildings.Templates.Plants.Controls.Types.PlantHeatPump.Polyvalent "Pressure boundary condition mimicking expansion tank"; initial equation // Calculation of pump speed providing design flow if have_heaWat then if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then yPumHeaWatPriHdrSet = 0; // Not used if have_hp then if is_yPumSetCal then 0 = Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VHeaWatBalHp_nominal, dp_nominal=max(valIso.dpHeaWat_nominal[1:nHp]) + dpValCheHeaWatBalHp_nominal + dpHeaWatLooBal_nominal, prePum=prePumHeaWatBalHp, r_N=yPumHeaWatPriDedHpSet); assert( yPumHeaWatPriDedHpSet >= 0.1 and yPumHeaWatPriDedHpSet <= 2, "In " + getInstanceName() + ": " + "The calculated primary pump speed to provide the design HW flow is out of bounds, " + "indicating that the primary pump curve needs to be revised."); else // Pump speed not calculated: assign value from data record yPumHeaWatPriDedHpSet = dat.ctl.yPumHeaWatPriDedHpSet; end if; else // No HP yPumHeaWatPriDedHpSet = 0; // Not used end if; if have_php then if is_yPumSetCal then 0 = Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VHeaWatBalPhp_nominal, dp_nominal=max(valIso.dpHeaWat_nominal[nHp + 1:nHp + nPhp]) + dpValCheHeaWatBalPhp_nominal + dpHeaWatLooBal_nominal, prePum=prePumHeaWatBalPhp, r_N=yPumHeaWatPriDedPhpSet); assert( yPumHeaWatPriDedPhpSet >= 0.1 and yPumHeaWatPriDedPhpSet <= 2, "In " + getInstanceName() + ": " + "The calculated primary pump speed to provide the polyvalent HP design HW flow is out of bounds, " + "indicating that the primary pump curve needs to be revised."); else // Pump speed not calculated: assign value from data record yPumHeaWatPriDedPhpSet = dat.ctl.yPumHeaWatPriDedPhpSet; end if; else // No polyvalent HP yPumHeaWatPriDedPhpSet = 0; // Not used end if; else // Headered pumps yPumHeaWatPriDedHpSet = 0; // Not used yPumHeaWatPriDedPhpSet = 0; // Not used if is_yPumSetCal then 0 = Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VHeaWatBalHdr_nominal, dp_nominal=max(valIso.dpHeaWat_nominal) + dpValCheHeaWatBalHdr_nominal + dpHeaWatLooBal_nominal, prePum=prePumHeaWatBalHdr, r_N=yPumHeaWatPriHdrSet); assert( yPumHeaWatPriHdrSet >= 0.1 and yPumHeaWatPriHdrSet <= 2, "In " + getInstanceName() + ": " + "The calculated primary pump speed to provide the design HW flow is out of bounds, " + "indicating that the primary pump curve needs to be revised."); else // Pump speed not calculated: assign value from data record yPumHeaWatPriHdrSet = dat.ctl.yPumHeaWatPriHdrSet; end if; end if; else // No HW circuit yPumHeaWatPriHdrSet = 0; // Not used yPumHeaWatPriDedHpSet = 0; // Not used yPumHeaWatPriDedPhpSet = 0; // Not used end if; if have_chiWat then if typArrPumPri == Buildings.Templates.Components.Types.PumpArrangement.Dedicated then yPumChiWatPriHdrSet = 0; // Not used if have_hp then if is_yPumSetCal then 0 = Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VChiWatBalHp_nominal, dp_nominal=max(valIso.dpChiWat_nominal[1:nHp]) + dpValCheChiWatBalHp_nominal + dpChiWatLooBal_nominal, prePum=prePumChiWatBalHp, r_N=yPumChiWatPriDedHpSet); assert( yPumChiWatPriDedHpSet >= 0.1 and yPumChiWatPriDedHpSet <= 2, "In " + getInstanceName() + ": " + "The calculated primary pump speed to provide the HP design CHW flow is out of bounds, " + "indicating that the primary pump curve needs to be revised."); else // Pump speed not calculated: assign value from data record yPumChiWatPriDedHpSet = dat.ctl.yPumChiWatPriDedHpSet; end if; else // No HP yPumChiWatPriDedHpSet = 0; // Not used end if; if have_php then if is_yPumSetCal then 0 = Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VChiWatBalPhp_nominal, dp_nominal=max(valIso.dpChiWat_nominal[nHp + 1:nHp + nPhp]) + dpValCheChiWatBalPhp_nominal + dpChiWatLooBal_nominal, prePum=prePumChiWatBalPhp, r_N=yPumChiWatPriDedPhpSet); assert( yPumChiWatPriDedPhpSet >= 0.1 and yPumChiWatPriDedPhpSet <= 2, "In " + getInstanceName() + ": " + "The calculated primary pump speed to provide the polyvalent HP design HW flow is out of bounds, " + "indicating that the primary pump curve needs to be revised."); else // Pump speed not calculated: assign value from data record yPumChiWatPriDedPhpSet = dat.ctl.yPumChiWatPriDedPhpSet; end if; else // NO polyvalent HP yPumChiWatPriDedPhpSet = 0; // Not used end if; else // Headered pumps yPumChiWatPriDedHpSet = 0; // Not used yPumChiWatPriDedPhpSet = 0; // Not used if is_yPumSetCal then 0 = Buildings.Templates.Utilities.computeBalancingPressureDrop( V_flow_nominal=VChiWatBalHdr_nominal, dp_nominal=max(valIso.dpChiWat_nominal) + dpValCheChiWatBalHdr_nominal + dpChiWatLooBal_nominal, prePum=prePumChiWatBalHdr, r_N=yPumChiWatPriHdrSet); assert( yPumChiWatPriHdrSet >= 0.1 and yPumChiWatPriHdrSet <= 2, "In " + getInstanceName() + ": " + "The calculated primary pump speed to provide the design HW flow is out of bounds, " + "indicating that the primary pump curve needs to be revised."); else // Pump speed not calculated: assign value from data record yPumChiWatPriHdrSet = dat.ctl.yPumChiWatPriHdrSet; end if; end if; else // No CHW circuit yPumChiWatPriHdrSet = 0; // Not used yPumChiWatPriDedHpSet = 0; // Not used yPumChiWatPriDedPhpSet = 0; // Not used end if; if is_dpBalCal then if have_heaWat then if have_hp then assert( dpBalHeaWatHp_nominal >= 0, "In " + getInstanceName() + ": " + "The calculated pressure drop for the HP HW balancing valve is negative, " + "indicating that the primary pump curve needs to be revised."); end if; if have_php then assert( dpBalHeaWatPhp_nominal >= 0, "In " + getInstanceName() + ": " + "The calculated pressure drop for the polyvalent HP HW balancing valve is negative, " + "indicating that the primary pump curve needs to be revised."); end if; end if; if have_chiWat then if have_hp then assert( dpBalChiWatHp_nominal >= 0, "In " + getInstanceName() + ": " + "The calculated pressure drop for the HP CHW balancing valve is negative, " + "indicating that the primary pump curve needs to be revised."); end if; if have_php then assert( dpBalChiWatPhp_nominal >= 0, "In " + getInstanceName() + ": " + "The calculated pressure drop for the polyvalent HP CHW balancing valve is negative, " + "indicating that the primary pump curve needs to be revised."); end if; end if; end if; equation /* Control point connection - start */ if typDis == Buildings.Templates.Plants.HeatPumps.Types.Distribution.Constant1Variable2 then connect(TChiWatLooOrSecRet.y, bus.TChiWatSecRet); connect(THeaWatLooOrSecRet.y, bus.THeaWatSecRet); connect(VChiWatLooOrSec_flow.y, bus.VChiWatSec_flow); connect(VHeaWatLooOrSec_flow.y, bus.VHeaWatSec_flow); else connect(TChiWatLooOrSecRet.y, bus.TChiWatLooRet); connect(THeaWatLooOrSecRet.y, bus.THeaWatLooRet); connect(VChiWatLooOrSec_flow.y, bus.VChiWatLoo_flow); connect(VHeaWatLooOrSec_flow.y, bus.VHeaWatLoo_flow); end if; connect(busWea, hp.busWea); connect(bus, hp.bus); connect(bus, hrc.bus); connect(bus, pumPri.bus); connect(bus, valIso.bus); connect(bus.pumChiWatPri, pumChiWatPri.bus); connect(bus.pumHeaWatPri, pumHeaWatPri.bus); connect(bus.pumChiWatSec, pumChiWatSec.bus); connect(bus.pumHeaWatSec, pumHeaWatSec.bus); connect(bus.valChiWatMinByp, valChiWatMinByp.bus); connect(bus.valHeaWatMinByp, valHeaWatMinByp.bus); connect(VChiWatPri_flow.y, bus.VChiWatPri_flow); connect(VHeaWatPri_flow.y, bus.VHeaWatPri_flow); connect(TChiWatPriSup.y, bus.TChiWatPriSup); connect(THeaWatPriSup.y, bus.THeaWatPriSup); connect(TChiWatPriRet.y, bus.TChiWatPriRet); connect(THeaWatPriRet.y, bus.THeaWatPriRet); connect(TChiWatSecSup.y, bus.TChiWatSecSup); connect(THeaWatSecSup.y, bus.THeaWatSecSup); connect(THeaWatRetUpsHrc.y, bus.THeaWatRetUpsHrc); connect(TChiWatRetUpsHrc.y, bus.TChiWatRetUpsHrc); connect(dpHeaWatLoc.y, bus.dpHeaWatLoc); connect(dpChiWatLoc.y, bus.dpChiWatLoc); /* Control point connection - stop */ connect(pumChiWatPri.ports_b, outPumChiWatPri.ports_a); connect(inlPumChiWatPri.ports_b, pumChiWatPri.ports_a); connect(valIso.port_bChiWat, inlPumChiWatPri.port_a); connect(hp.ports_bChiHeaWatHp, pumPri.ports_aChiHeaWatHp); connect(pumPri.ports_bChiHeaWat, valIso.ports_aChiHeaWatHp); connect(pumPri.ports_bHeaWat, valIso.ports_aHeaWatHp); connect(pumPri.ports_bChiWat, valIso.ports_aChiWatHp); connect(outPumChiWatPri.port_b, VChiWatPri_flow.port_a); connect(VChiWatPri_flow.port_b, TChiWatPriSup.port_a); connect(pumChiWatSec.ports_b, outPumChiWatSec.ports_a); connect(inlPumChiWatSec.ports_b, pumChiWatSec.ports_a); connect(valIso.port_bChiWat, supChiWatPri.port_a); connect(supChiWatPri.port_b, VChiWatPri_flow.port_a); connect(valIso.ports_bChiHeaWatHp, pumPri.ports_aChiHeaWat); connect(pumPri.ports_bChiHeaWatHp, hp.ports_aChiHeaWatHp); connect(supChiWatSec.port_b, VChiWatLooOrSec_flow.port_a); connect(port_bChiWat, dpChiWatLoc.port_a); connect(dpChiWatLoc.port_b, port_aChiWat); connect(port_bHeaWat, dpHeaWatLoc.port_a); connect(dpHeaWatLoc.port_b, port_aHeaWat); connect(pumHeaWatPri.ports_b, outPumHeaWatPri.ports_a); connect(inlPumHeaWatPri.ports_b, pumHeaWatPri.ports_a); connect(outPumHeaWatPri.port_b, VHeaWatPri_flow.port_a); connect(VHeaWatPri_flow.port_b, THeaWatPriSup.port_a); connect(pumHeaWatSec.ports_b, outPumHeaWatSec.ports_a); connect(inlPumHeaWatSec.ports_b, pumHeaWatSec.ports_a); connect(supHeaWatPri.port_b, VHeaWatPri_flow.port_a); connect(supHeaWatSec.port_b, VHeaWatLooOrSec_flow.port_a); connect(outPumHeaWatSec.port_b, VHeaWatLooOrSec_flow.port_a); connect(valIso.port_bHeaWat, inlPumHeaWatPri.port_a); connect(VHeaWatLooOrSec_flow.port_b, port_bHeaWat); connect(valIso.port_bHeaWat, supHeaWatPri.port_a); connect(junChiWatBypSup.port_2, TChiWatSecSup.port_a); connect(TChiWatSecSup.port_b, inlPumChiWatSec.port_a); connect(junChiWatBypRet.port_1, TChiWatLooOrSecRet.port_b); connect(junHeaWatBypSup.port_2, THeaWatSecSup.port_a); connect(THeaWatSecSup.port_b, inlPumHeaWatSec.port_a); connect(THeaWatSecSup.port_b, supHeaWatSec.port_a); connect(bouChiWat.ports[1], TChiWatPriRet.port_b); connect(TChiWatSecSup.port_b, supChiWatSec.port_a); connect(junHeaWatBypRet.port_1, THeaWatLooOrSecRet.port_b); connect(outPumChiWatSec.port_b, VChiWatLooOrSec_flow.port_a); connect(TChiWatPriRet.port_b, valIso.port_aChiWat); connect(junHeaWatHrcEnt.port_2, junHeaWatHrcLvg.port_1); connect(junHeaWatHrcLvg.port_2, THeaWatLooOrSecRet.port_a); connect(junHeaWatHrcEnt.port_3, hrc.port_a1); connect(hrc.port_b1, junHeaWatHrcLvg.port_3); connect(junChiWatHrcEnt.port_3, hrc.port_a2); connect(junChiWatHrcEnt.port_2, junChiWatHrcLvg.port_1); connect(junChiWatHrcLvg.port_2, TChiWatLooOrSecRet.port_a); connect(hrc.port_b2, junChiWatHrcLvg.port_3); connect(port_aChiWat, TChiWatRetUpsHrc.port_a); connect(TChiWatRetUpsHrc.port_b, junChiWatHrcEnt.port_1); connect(port_aHeaWat, THeaWatRetUpsHrc.port_a); connect(THeaWatRetUpsHrc.port_b, junHeaWatHrcEnt.port_1); connect(junChiWatBypSup.port_3, valChiWatMinByp.port_a); connect(valChiWatMinByp.port_b, junChiWatBypRet.port_3); connect(junHeaWatBypSup.port_3, valHeaWatMinByp.port_a); connect(valHeaWatMinByp.port_b, junHeaWatBypRet.port_3); connect(VChiWatLooOrSec_flow.port_b, port_bChiWat); connect(TChiWatPriSup.port_b, tanChiWatSup.port_a); connect(tanChiWatSup.port_b, junChiWatBypSup.port_1); connect(junChiWatBypRet.port_2, tanChiWatRet.port_a); connect(tanChiWatRet.port_b, TChiWatPriRet.port_a); connect(THeaWatPriSup.port_b, tanHeaWatSup.port_a); connect(tanHeaWatSup.port_b, junHeaWatBypSup.port_1); connect(junHeaWatBypRet.port_2, tanHeaWatRet.port_a); connect(tanHeaWatRet.port_b, THeaWatPriRet.port_a); connect(bouHeaWat.ports[1], THeaWatPriRet.port_b); connect(THeaWatPriRet.port_b, valIso.port_aHeaWat); connect(pumPri.ports_bHeaWatRetShc, hp.ports_aHeaWatPhp); connect(pumPri.ports_bChiWatRetShc, hp.ports_aChiWatPhp); connect(hp.ports_bHeaWatPhp, pumPri.ports_aHeaWatPhp); connect(hp.ports_bChiWatPhp, pumPri.ports_aChiWatPhp); connect(pumPri.ports_bHeaWatSupShc, valIso.ports_aHeaWatPhp); connect(pumPri.ports_bChiWatSupShc, valIso.ports_aChiWatPhp); connect(pumPri.ports_aChiWat, valIso.ports_bChiWatPhp); connect(pumPri.ports_aHeaWat, valIso.ports_bHeaWatPhp); end AirToWater;