Buildings.Experimental.DHC.Plants.Combined

Package of models for central plants that provide heating and cooling

Information

This package contains models for combined heating and cooling plants used in DHC systems.

Extends from Modelica.Icons.VariantsPackage (Icon for package containing variants).

Package Content

Name Description
Buildings.Experimental.DHC.Plants.Combined.AllElectricCWStorage AllElectricCWStorage All-electric CHW and HW plant with CW storage
Buildings.Experimental.DHC.Plants.Combined.Controls Controls Package of control blocks for combined plants
Buildings.Experimental.DHC.Plants.Combined.Subsystems Subsystems Package of models for subsystems of combined plants
Buildings.Experimental.DHC.Plants.Combined.Examples Examples This package holds example models using plants providing district heating and cooling
Buildings.Experimental.DHC.Plants.Combined.Validation Validation Package with validation models

Buildings.Experimental.DHC.Plants.Combined.AllElectricCWStorage Buildings.Experimental.DHC.Plants.Combined.AllElectricCWStorage

All-electric CHW and HW plant with CW storage

Buildings.Experimental.DHC.Plants.Combined.AllElectricCWStorage

Information

This model represents a combined heating and cooling plant where chilled water is produced by cooling-only chillers and heat recovery chillers, hot water is produced by heat recovery chillers, and a thermal energy storage tank is integrated in the condenser water circuit to maximize heat recovery ("Tank Charge/Discharge" operating mode). Cooling towers allow rejecting excess heat from the condenser loop ("Heat Rejection" operating mode). Air-source heat pumps allow injecting heat into the condenser loop ("Charge Assist" operating mode).

This model has been developed based on the publication by B. Gill (2021) and further discussions with Taylor Engineers.

Abbreviations and naming conventions

The following abbreviations are used in the documentation of this model and of its components.

AbbreviationDescription
AIAnalog input (integer or real)
AOAnalog output (integer or real)
CHWChilled water
CTCooling tower
CWCondenser water
CWCCondenser water circuit serving chiller and HRC condenser barrel
CWECondenser water circuit serving HRC evaporator barrel
DIDigital input (Boolean)
DODigital output (Boolean)
HPHeat pump
HRHeat recovery
HRCHeat recovery chiller
HWHot water
VFDVariable frequency drive

To clearly distinguish cooling-only chillers from heat recovery chillers, the term "chiller" is used systematically to refer to cooling-only chillers whereas the abbreviation "HRC" is used systematically to refer to heat recovery chillers.

Each HRC can operate under the following modes. In cascading heating mode, the condenser barrel is connected to the HW loop and the evaporator barrel is connected to the CW loop (CWE circuit). The onboard controller controls the HRC to track a HW supply temperature setpoint at condenser outlet. In cascading cooling mode, the condenser barrel is connected to the CW loop (CWC circuit) and the evaporator barrel is connected to the CHW loop. The onboard controller controls the HRC to track a CHW supply temperature setpoint at evaporator outlet. In direct heat recovery mode, the condenser barrel is connected to the HW loop and the evaporator barrel is connected to the CHW loop. The onboard controller controls the HRC to track a HW supply temperature setpoint at condenser outlet while the plant supervisory controller maintains the CHW supply temperature at setpoint by modulating the evaporator flow rate or the condenser entering temperature.

System schematic

The schematic below represents a configuration of the system with two chillers and three HRCs. The equipment tags correspond to the component names in the plant model. The control points used by each control function are represented at the intersection of the gray area that describes the function and the four bus lines corresponding to the different control point categories (AI, DI, AO, DO). For the sake of clarity, control logic that is duplicated between multiple units (for instance the chiller isolation valve control) is only illustrated for one unit. The detailed description of each control function is available in the documentation of Buildings.Experimental.DHC.Plants.Combined.Controls.Controller. For an overview of the different operating modes and the design principles of such a system, the user may refer to the article by B. Gill (2021).

System schematic

Control points

Cooling and heating Enable signals

The cooling and heating Enable signals u1Coo and u1Hea shall be computed outside of the plant model, for instance based on a time schedule.

CHW and HW supply temperature and differential pressure setpoint

Those setpoints are provided as control inputs. Ideally, a reset logic based on consumer valve requests should be implemented to adapt those setpoints to the demand.

Details

Sizing considerations

Sizing the TES tank and the heat pumps is a joint optimization problem under the constraint that on a design heating day, heating loads can be met using both the recovered heat and the heat added to the tank by the heat pumps. As stated by B. Gill (2021), increasing the tank capacity generally improves plant efficiency by providing more opportunity for heat recovery. Tank capacity should therefore be maximized under the limit corresponding to the amount of heat that can be recovered over the day.

The model is configured by default with a tank that is sized to store the heat needed to operate the HRCs during h at peak heating load with a ΔT covering the two temperature cycles specified with the parameter TTanSet (heels and thermocline neglected). This default can be overwritten.

TES tank

The tank is assumed to be integrated without pressure separation, i.e., the operating level of the tank sets the system pressure and no pressure sustaining valve or discharge pump is included. The operating level is approximated as equal to the tank height. A default height to diameter ratio of 2 is also taken into account (designers tend to favor a height to diameter ratio above 1.5 in order to minimize the volume of the thermocline which is considered useless). No high limit is considered for the tank mass flow rate.

CHW and HW minimum flow bypass valve

As per standard practice, the bypass valve is sized for the highest chiller minimum flow. The bypass valve model is configured with a pressure drop varying linearly with the flow rate, as opposed to a quadratic dependency usually considered for a turbulent flow regime. This is because the whole plant model contains large nonlinear systems of equations, and this configuration limits the risk of solver failure while reducing the time to solution. This has no significant impact on the operating point of the circulation pumps due to the control loop that modulates the valve opening to generate enough pressure differential at the chiller boundaries to allow for minimum flow circulation. So whatever the modeling assumptions for the bypass valve, the control loop ensures that the valve creates the adequate pressure drop and bypass flow, which will simply be reached at a different valve opening with the above simplification.

Cooling tower circuit

The design heat flow rate used to size the cooling towers and the intermediary heat exchanger corresponds to the heat flow rate rejected by all HRCs operating in cascading cooling mode and all chillers operating at design conditions. The cooling towers are sized with a default approach of K to the design wetbulb temperature. The intermediary heat exchanger is sized with a default approach of K.

Chiller and HRC performance data

The chiller performance data should cover the CW temperature levels reached when the plant is operating in Heat Rejection mode. The parameter TCasConEnt_nominal (set with a final assignment) provides the maximum CW supply (condenser entering) temperature in this operating mode. The HRC performance data should cover the HRC lift envelope, that is when the HRC is operating in direct heat recovery mode, producing CHW and HW at their setpoint value at full load.

References

Brandon Gill, P.E., Taylor Engineers, Alameda, CA, USA.
Solving the large building all-electric heating problem.
ASHRAE Journal, October 2021.

Extends from BaseClasses.PartialPlant (Partial class for modeling a plant).

Parameters

TypeNameDefaultDescription
replaceable package MediumWaterService side medium
replaceable package MediumHea_bWaterService side medium at heating supply
Genericfue[nFue] Fuel type
replaceable package MediumAirBuildings.Media.AirAir medium
replaceable package MediumConWatCooBuildings.Media.WaterMedium model for cooling tower circuit
Configuration
DistrictSystemTypetypBuildings.Experimental.DHC.T...Type of district system
Booleanhave_fantrueSet to true if fan power is computed
Booleanhave_pumtrueSet to true if pump power is computed
Booleanhave_eleHeatrueSet to true if the plant has electric heating system
IntegernFue0Number of fuel types (0 means no combustion system)
Booleanhave_eleCootrueSet to true if the plant has electric cooling system
Booleanhave_weaBustrueSet to true to use a weather bus
CHW loop and cooling-only chillers
IntegernChi Number of units operating at design conditions
IntegernPumChiWatmax(nChi, nChiHea)Number of CHW pumps operating at design conditions
MassFlowRatemChiWatChi_flow_min0.6*mChiWatChi_flow_nominalChiller CHW minimum mass flow rate (each unit) [kg/s]
PressureDifferencedpChiWatSet_max Design (maximum) CHW differential pressure setpoint [Pa]
PressureDifferencedpEvaChi_nominal5E4Design evaporator pressure drop (each unit) [Pa]
PressureDifferencedpConChi_nominal5E4Design condenser pressure drop (each unit) [Pa]
PressureDifferencedpPumChiWat_nominal1.1*(dpChiWatSet_max + max(d...Design head of CHW pump(each unit) [Pa]
GenericdatChiredeclare parameter Fluid.Ch...Chiller parameters (each unit)
TemperatureDifferencedTLifChi_min10Minimum chiller lift at minimum load [K]
TemperatureDifferencedTLifChi_nominalTTanSet[1, 2] + 5 - TChiWatS...Design chiller lift [K]
HW loop and heat recovery chillers
IntegernChiHea Number of units operating at design conditions
IntegernPumHeaWatnChiHeaNumber of HW pumps operating at design conditions
MassFlowRatemChiWatChiHea_flow_min0.6*mChiWatChiHea_flow_nominalHRC CHW minimum mass flow rate (each unit) [kg/s]
MassFlowRatemHeaWatChiHea_flow_min0.6*mConWatChiHea_flow_nominalHRC HW minimum mass flow rate (each unit) [kg/s]
PressureDifferencedpHeaWatSet_max Design (maximum) HW differential pressure setpoint [Pa]
PressureDifferencedpEvaChiHea_nominal5E4Design evaporator pressure drop (each unit) [Pa]
PressureDifferencedpConChiHea_nominal5E4Design condenser pressure drop (each unit) [Pa]
PressureDifferencedpPumHeaWat_nominal1.1*(dpHeaWatSet_max + dpCon...Design head of HW pump(each unit) [Pa]
GenericdatChiHearedeclare parameter Fluid.Ch...HRC parameters (each unit)
CW loop, TES tank and heat pumps
IntegernHeaPum Number of heat pumps operating at design conditions
IntegernPumConWatConmax(nChi, nChiHea)Number of CW pumps serving condenser barrels at design conditions
IntegernPumConWatEvanChiHeaNumber of CW pumps serving evaporator barrels at design conditions
PressureDifferencedpConWatConSet_maxmax(dpConChi_nominal + chi.v...Design (maximum) CW condenser loop differential pressure setpoint [Pa]
PressureDifferencedpConWatEvaSet_maxdpEvaChiHea_nominal + max(ch...Design (maximum) CW evaporator loop differential pressure setpoint [Pa]
PressureDifferencedpPumConWatCon_nominal1.1*(dpConWatConSet_max + ma...Design head of CW pump serving condenser barrels (each unit) [Pa]
PressureDifferencedpPumConWatEva_nominal1.1*(dpConWatEvaSet_max + dp...Design head of CW pump serving evaporator barrels (each unit) [Pa]
VolumeVTan-chiHea.QEvaCasHea_flow_nomi...Tank volume [m3]
LengthhTan(16*VTan/Modelica.Constants....Height of tank (without insulation) [m]
RealfraUslTan((max(TTanSet[2]) - min(TTan...Useless fraction of TES [1]
LengthdInsTan Thickness of insulation [m]
ThermalConductivitykInsTan0.04Specific heat conductivity of insulation [W/(m.K)]
TemperatureTTanSet[2, 2]{{15 + 273.15,25 + 273.15},{...Tank temperature setpoints: 2 cycles with 2 setpoints [K]
PressureDifferencedpTan_nominal1E3Design pressure drop through TES tank [Pa]
GenericdatHeaPumredeclare parameter Fluid.He...Heat pump parameters (each unit)
Cooling tower loop
IntegernCoo Number of cooling tower cells operating at design conditions
MassFlowRatemConWatCoo_flow_nominalmConWatCon_flow_nominalDesign CT CW mass flow rate (all units) [kg/s]
PressureDifferencedpConWatCooFri_nominal Design CW flow-friction losses through tower and piping only (without elevation head or valve) [Pa]
MassFlowRatemAirCooUni_flow_nominal Design CT air mass flow rate (each unit) [kg/s]
TemperatureTWetBulCooEnt_nominal Design CT entering air wetbulb temperature [K]
TemperatureTConWatCooRet_nominalTConWatCooSup_nominal + abs(...Design CT CW return temperature (tower entering) [K]
TemperatureTConWatCooSup_nominalTWetBulCooEnt_nominal + 3Design CT CW supply temperature (tower leaving) [K]
PowerPFanCoo_nominal CT fan power (each unit) [W]
IntegernPumConWatCoonCooNumber of CW pumps serving cooling towers at design conditions
PressureDifferencedpPumConWatCoo_nominal1.1*(dpHexCoo_nominal + dpCo...Design head of CW pump serving cooling towers (each unit) [Pa]
TemperatureDifferencedTHexCoo_nominal2Design heat exchanger approach [K]
PressureDifferencedpHexCoo_nominal3E4Design pressure drop through heat exchanger (same on both sides) [Pa]
HeatFlowRateQHexCoo_flow_nominal-(chi.QConWat_flow_nominal +...Design cooling heat flow rate of heat exchanger (<0) [W]
Assumptions
BooleanallowFlowReversalfalseSet to true to allow flow reversal in service lines
Advanced
CW loop, TES tank and heat pumps
IntegernSegTan10Number of volume segments
Dynamics
Conservation equations
DynamicsenergyDynamicsModelica.Fluid.Types.Dynamic...Type of energy balance: dynamic (3 initialization options) or steady state
Filtered signal for actuators and movers
Booleanuse_inputFilterenergyDynamics <> Modelica.F...= true, if control signal is filtered with a 2nd order CriticalDamping filter

Connectors

TypeNameDescription
FluidPort_aport_aSerAmbFluid connector for ambient water service supply line
FluidPort_bport_bSerAmbFluid connector for ambient water service return line
FluidPort_aport_aSerHeaFluid connector for heating service supply line
FluidPort_bport_bSerHeaFluid connector for heating service return line
FluidPort_aport_aSerCooFluid connector for cooling service supply line
FluidPort_bport_bSerCooFluid connector for cooling service return line
BusweaBusWeather data bus
output RealOutputPHeaPower drawn by heating system [W]
output RealOutputPCooPower drawn by cooling system [W]
output RealOutputPFanPower drawn by fan motors [W]
output RealOutputPPumPower drawn by pump motors [W]
output RealOutputQFue_flowFuel energy input rate [W]
replaceable package MediumAirAir medium
replaceable package MediumConWatCooMedium model for cooling tower circuit
input BooleanInputu1CooCooling enable signal
input BooleanInputu1HeaHeating enable signal
input RealInputTChiWatSupSetCHW supply temperature setpoint [K]
input RealInputdpChiWatSetCHW differential pressure setpoint (for local dp sensor) [Pa]
input RealInputTHeaWatSupSetHW supply temperature setpoint [K]
input RealInputdpHeaWatSetHW differential pressure setpoint (for local dp sensor) [Pa]

Modelica definition

model AllElectricCWStorage "All-electric CHW and HW plant with CW storage" extends BaseClasses.PartialPlant( final typ=Buildings.Experimental.DHC.Types.DistrictSystemType.CombinedGeneration2to4, final have_weaBus=true, final have_fan=true, final have_pum=true, final have_eleHea=true, final have_eleCoo=true); replaceable package MediumAir=Buildings.Media.Air "Air medium"; replaceable package MediumConWatCoo=Buildings.Media.Water constrainedby Modelica.Media.Interfaces.PartialMedium "Medium model for cooling tower circuit"; // CHW loop and cooling-only chillers parameter Integer nChi(final min=1, start=1) "Number of units operating at design conditions"; parameter Integer nPumChiWat(final min=1, start=1)=max(nChi, nChiHea) "Number of CHW pumps operating at design conditions"; final parameter Modelica.Units.SI.MassFlowRate mChiWatChi_flow_nominal( final min=0)=datChi.mEva_flow_nominal "Design chiller CHW mass flow rate (each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChi_flow_min( final min=0)=0.6 * mChiWatChi_flow_nominal "Chiller CHW minimum mass flow rate (each unit)"; final parameter Modelica.Units.SI.MassFlowRate mConWatChi_flow_nominal( final min=0)=datChi.mCon_flow_nominal "Design chiller CW mass flow rate (each unit)"; parameter Modelica.Units.SI.PressureDifference dpChiWatSet_max( final min=0, displayUnit="Pa") "Design (maximum) CHW differential pressure setpoint"; parameter Modelica.Units.SI.PressureDifference dpEvaChi_nominal( final min=0, displayUnit="Pa")=5E4 "Design evaporator pressure drop (each unit)"; parameter Modelica.Units.SI.PressureDifference dpConChi_nominal( final min=0, displayUnit="Pa")=5E4 "Design condenser pressure drop (each unit)"; parameter Modelica.Units.SI.PressureDifference dpPumChiWat_nominal( final min=0, displayUnit="Pa")=1.1 * (dpChiWatSet_max + max( dpEvaChi_nominal + chi.valEva.dpValve_nominal, dpEvaChiHea_nominal + max(chiHea.valEva.dpValve_nominal) + sum(chiHea.valEvaSwi.dpValve_nominal))) "Design head of CHW pump(each unit)"; replaceable parameter Fluid.Chillers.Data.ElectricReformulatedEIR.Generic datChi constrainedby Buildings.Fluid.Chillers.Data.BaseClasses.Chiller "Chiller parameters (each unit)"; final parameter Modelica.Units.SI.Temperature TChiWatSup_nominal= max(chi.TChiWatSup_nominal, chiHea.TChiWatSup_nominal) "Design (minimum) CHW supply temperature"; final parameter Modelica.Units.SI.Temperature TChiWatRet_nominal= TChiWatSup_nominal - QChiWat_flow_nominal / mChiWat_flow_nominal / cp_default "Design (maximum) CHW return temperature"; // Plant capacity computed with HRCs in direct heat recovery mode, see // Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StagingPlant. final parameter Modelica.Units.SI.HeatFlowRate QChiWat_flow_nominal= chi.QChiWat_flow_nominal + chiHea.QChiWat_flow_nominal "Design plant cooling heat flow rate (all units)"; final parameter Modelica.Units.SI.MassFlowRate mChiWat_flow_nominal( final min=0)= nChi * mChiWatChi_flow_nominal + nChiHea * mChiWatChiHea_flow_nominal "Design CHW mass flow rate (all units)"; parameter Modelica.Units.SI.TemperatureDifference dTLifChi_min=10 "Minimum chiller lift at minimum load"; parameter Modelica.Units.SI.TemperatureDifference dTLifChi_nominal= TTanSet[1, 2] + 5 - TChiWatSup_nominal "Design chiller lift"; // HW loop and heat recovery chillers parameter Integer nChiHea(final min=1, start=1) "Number of units operating at design conditions"; parameter Integer nPumHeaWat(final min=1, start=1) = nChiHea "Number of HW pumps operating at design conditions"; final parameter Modelica.Units.SI.MassFlowRate mChiWatChiHea_flow_nominal= datChiHea.mEva_flow_nominal "Design HRC CHW mass flow rate (each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChiHea_flow_min( final min=0)=0.6 * mChiWatChiHea_flow_nominal "HRC CHW minimum mass flow rate (each unit)"; parameter Modelica.Units.SI.MassFlowRate mHeaWatChiHea_flow_min( final min=0)=0.6 * mConWatChiHea_flow_nominal "HRC HW minimum mass flow rate (each unit)"; final parameter Modelica.Units.SI.MassFlowRate mConWatChiHea_flow_nominal= datChiHea.mCon_flow_nominal "Design HRC CW mass flow rate (each unit)"; parameter Modelica.Units.SI.PressureDifference dpHeaWatSet_max( final min=0, displayUnit="Pa") "Design (maximum) HW differential pressure setpoint"; parameter Modelica.Units.SI.PressureDifference dpEvaChiHea_nominal( final min=0, displayUnit="Pa")=5E4 "Design evaporator pressure drop (each unit)"; parameter Modelica.Units.SI.PressureDifference dpConChiHea_nominal( final min=0, displayUnit="Pa")=5E4 "Design condenser pressure drop (each unit)"; parameter Modelica.Units.SI.PressureDifference dpPumHeaWat_nominal( final min=0, displayUnit="Pa")=1.1 * (dpHeaWatSet_max + dpConChiHea_nominal + max(chiHea.valCon.dpValve_nominal) + sum(chiHea.valConSwi.dpValve_nominal)) "Design head of HW pump(each unit)"; replaceable parameter Fluid.Chillers.Data.ElectricReformulatedEIR.Generic datChiHea constrainedby Buildings.Fluid.Chillers.Data.BaseClasses.Chiller "HRC parameters (each unit)"; final parameter Modelica.Units.SI.Temperature THeaWatSup_nominal= chiHea.THeaWatSup_nominal "Design (maximum) HW supply temperature"; final parameter Modelica.Units.SI.Temperature THeaWatRet_nominal= THeaWatSup_nominal - QHeaWat_flow_nominal / mHeaWat_flow_nominal / cp_default "Design (minimum) HW return temperature"; // TCasHeaEnt_nominal computed in second cycle of TES tank. final parameter Modelica.Units.SI.Temperature TCasHeaEnt_nominal= TTanSet[2, 2] "Design evaporator entering temperature in cascading heating mode"; // TCasCooEnt_nominal computed in Heat Rejection mode. final parameter Modelica.Units.SI.Temperature TCasCooEnt_nominal= TConWatCooSup_nominal + dTHexCoo_nominal "Design condenser entering temperature in cascading cooling mode"; final parameter Modelica.Units.SI.HeatFlowRate QHeaWat_flow_nominal= chiHea.QHeaWat_flow_nominal "Design heating heat flow rate (all units)"; final parameter Modelica.Units.SI.MassFlowRate mHeaWat_flow_nominal= chiHea.mConWat_flow_nominal "Design HW mass flow rate (all units)"; // CW loop, TES tank and heat pumps parameter Integer nHeaPum(final min=1, start=1) "Number of heat pumps operating at design conditions"; parameter Integer nPumConWatCon(final min=1, start=1)=max(nChi, nChiHea) "Number of CW pumps serving condenser barrels at design conditions"; parameter Integer nPumConWatEva(final min=1, start=1)=nChiHea "Number of CW pumps serving evaporator barrels at design conditions"; parameter Modelica.Units.SI.PressureDifference dpConWatConSet_max( final min=0, displayUnit="Pa")=max( dpConChi_nominal + chi.valCon.dpValve_nominal, dpConChiHea_nominal + max(chiHea.valCon.dpValve_nominal) + sum(chiHea.valConSwi.dpValve_nominal)) "Design (maximum) CW condenser loop differential pressure setpoint"; parameter Modelica.Units.SI.PressureDifference dpConWatEvaSet_max( final min=0, displayUnit="Pa")= dpEvaChiHea_nominal + max(chiHea.valEva.dpValve_nominal) + sum(chiHea.valEvaSwi.dpValve_nominal) "Design (maximum) CW evaporator loop differential pressure setpoint"; parameter Modelica.Units.SI.PressureDifference dpPumConWatCon_nominal( final min=0, displayUnit="Pa")=1.1 * (dpConWatConSet_max + max(dpHexCoo_nominal, dpTan_nominal)) "Design head of CW pump serving condenser barrels (each unit)"; parameter Modelica.Units.SI.PressureDifference dpPumConWatEva_nominal( final min=0, displayUnit="Pa")=1.1 * (dpConWatEvaSet_max + dpTan_nominal) "Design head of CW pump serving evaporator barrels (each unit)"; final parameter Modelica.Units.SI.MassFlowRate mConWatCon_flow_nominal( final min=0)=chi.mConWat_flow_nominal + chiHea.mConWat_flow_nominal "Design total CW mass flow rate through condenser barrels (all units)"; final parameter Modelica.Units.SI.MassFlowRate mConWatEva_flow_nominal( final min=0)=chiHea.mChiWat_flow_nominal "Design total CW mass flow rate through evaporator barrels (all units)"; parameter Modelica.Units.SI.Volume VTan= -chiHea.QEvaCasHea_flow_nominal * 3 * 3600 / (max(TTanSet) - min(TTanSet)) / cp_default / rho_default "Tank volume"; parameter Modelica.Units.SI.Length hTan = (16 * VTan / Modelica.Constants.pi)^(1/3) "Height of tank (without insulation)"; // Default considering 1 m high thermmocline and 1 m high section below and above diffusers. // Thermocline only useless during last tank cycle, hence the scale factor. parameter Real fraUslTan(final unit="1", final min=0, final max=1, start=0.1) = ((max(TTanSet[2]) - min(TTanSet)) / (max(TTanSet) - min(TTanSet)) * 1 + 1) / hTan "Useless fraction of TES"; parameter Modelica.Units.SI.Length dInsTan "Thickness of insulation"; parameter Modelica.Units.SI.ThermalConductivity kInsTan=0.04 "Specific heat conductivity of insulation"; parameter Integer nSegTan(min=2) = 10 "Number of volume segments"; parameter Modelica.Units.SI.Temperature TTanSet[2, 2] = { {15 + 273.15, 25 + 273.15}, {TChiWatSup_nominal, 15 + 273.15}} "Tank temperature setpoints: 2 cycles with 2 setpoints"; // Default TES tank pressure drop without PSV, otherwise ~ 20E3 parameter Modelica.Units.SI.PressureDifference dpTan_nominal=1E3 "Design pressure drop through TES tank"; replaceable parameter Fluid.HeatPumps.Data.EquationFitReversible.Generic datHeaPum "Heat pump parameters (each unit)"; // Cooling tower loop parameter Integer nCoo(final min=1, start=1) "Number of cooling tower cells operating at design conditions"; parameter Modelica.Units.SI.MassFlowRate mConWatCoo_flow_nominal( final min=0)=mConWatCon_flow_nominal "Design CT CW mass flow rate (all units)"; parameter Modelica.Units.SI.PressureDifference dpConWatCooFri_nominal( displayUnit="Pa", start=1E4, final min=0) "Design CW flow-friction losses through tower and piping only (without elevation head or valve)"; parameter Modelica.Units.SI.MassFlowRate mAirCooUni_flow_nominal( final min=0, start=mConWatCoo_flow_nominal / nCoo / 1.45) "Design CT air mass flow rate (each unit)"; parameter Modelica.Units.SI.Temperature TWetBulCooEnt_nominal( final min=273.15) "Design CT entering air wetbulb temperature"; parameter Modelica.Units.SI.Temperature TConWatCooRet_nominal( final min=273.15)=TConWatCooSup_nominal + abs(QHexCoo_flow_nominal) / mConWatCoo_flow_nominal / cpConWatCoo_default "Design CT CW return temperature (tower entering)"; parameter Modelica.Units.SI.Temperature TConWatCooSup_nominal( final min=273.15)=TWetBulCooEnt_nominal + 3 "Design CT CW supply temperature (tower leaving)"; parameter Modelica.Units.SI.Power PFanCoo_nominal( final min=0, start=340 * mConWatCoo_flow_nominal / nCoo) "CT fan power (each unit)"; parameter Integer nPumConWatCoo(final min=1, start=1)=nCoo "Number of CW pumps serving cooling towers at design conditions"; parameter Modelica.Units.SI.PressureDifference dpPumConWatCoo_nominal= 1.1 * (dpHexCoo_nominal + dpConWatCooFri_nominal) "Design head of CW pump serving cooling towers (each unit)"; parameter Modelica.Units.SI.TemperatureDifference dTHexCoo_nominal=2 "Design heat exchanger approach"; parameter Modelica.Units.SI.PressureDifference dpHexCoo_nominal=3E4 "Design pressure drop through heat exchanger (same on both sides)"; // HX sized with all HRCs in cascading cooling mode. parameter Modelica.Units.SI.HeatFlowRate QHexCoo_flow_nominal= -(chi.QConWat_flow_nominal + chiHea.QConCasCoo_flow_nominal) "Design cooling heat flow rate of heat exchanger (<0)"; // Assumptions parameter Modelica.Fluid.Types.Dynamics energyDynamics= Modelica.Fluid.Types.Dynamics.DynamicFreeInitial "Type of energy balance: dynamic (3 initialization options) or steady state"; parameter Boolean use_inputFilter=energyDynamics<>Modelica.Fluid.Types.Dynamics.SteadyState "= true, if control signal is filtered with a 2nd order CriticalDamping filter"; // Outside connectors Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Coo "Cooling enable signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Hea "Heating enable signal"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TChiWatSupSet( final unit="K", displayUnit="degC") "CHW supply temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpChiWatSet( final unit="Pa", final min=0) "CHW differential pressure setpoint (for local dp sensor)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput THeaWatSupSet( final unit="K", displayUnit="degC") "HW supply temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpHeaWatSet( final unit="Pa", final min=0) "HW differential pressure setpoint (for local dp sensor)"; // Components - CHW loop and cooling-only chillers Subsystems.ChillerGroup chi( redeclare final package Medium1=Medium, redeclare final package Medium2=Medium, final dat=datChi, final nUni=nChi, final dpEva_nominal=dpEvaChi_nominal, final dpCon_nominal=dpConChi_nominal, final energyDynamics=energyDynamics, final use_inputFilter=use_inputFilter, final allowFlowReversal1=allowFlowReversal, final allowFlowReversal2=allowFlowReversal) "Cooling-only chillers"; Subsystems.MultiplePumpsSpeed pumChiWat( redeclare final package Medium=Medium, final nPum=nPumChiWat, final have_var=true, final have_valve=true, final mPum_flow_nominal=mChiWat_flow_nominal / nPumChiWat, final dpPum_nominal=dpPumChiWat_nominal, final energyDynamics=energyDynamics, final use_inputFilter=use_inputFilter, final allowFlowReversal=allowFlowReversal) "Primary CHW pumps"; Fluid.FixedResistances.Junction junChiWatSup( redeclare final package Medium = Medium, final m_flow_nominal=mChiWat_flow_nominal * {1, -1, -1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Fluid.FixedResistances.Junction junChiWatRet( redeclare final package Medium = Medium, final m_flow_nominal=mChiWat_flow_nominal * {1, -1, 1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Fluid.FixedResistances.Junction junChiWatChiHeaRet( redeclare final package Medium = Medium, final m_flow_nominal=mChiWat_flow_nominal * {1,-1,-1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Fluid.FixedResistances.Junction junChiWatChiHeaSup( redeclare final package Medium = Medium, final m_flow_nominal=mChiWat_flow_nominal*{1,-1,1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; // PICV model sized at design flow (instead of minimum flow) for convenience. Fluid.Actuators.Valves.TwoWayLinear valChiWatMinByp( redeclare final package Medium=Medium, final m_flow_nominal=max(mChiWatChi_flow_min, mChiWatChiHea_flow_min), from_dp=true, linearized=true, dpValve_nominal=1E3, final use_inputFilter=use_inputFilter, final allowFlowReversal=allowFlowReversal) "CHW minimum flow bypass valve"; Fluid.Sensors.RelativePressure dpChiWat( redeclare final package Medium=Medium) "CHW differential pressure (local sensor hardwired to plant controller)"; Fluid.Sensors.TemperatureTwoPort TChiWatPriRet( redeclare final package Medium=Medium, final m_flow_nominal=mChiWat_flow_nominal, final allowFlowReversal=allowFlowReversal) "Primary CHW return temperature"; Fluid.Sensors.MassFlowRate mChiWatPri_flow( redeclare final package Medium =Medium, final allowFlowReversal=allowFlowReversal) "Primary CHW mass flow rate"; Fluid.Sensors.TemperatureTwoPort TChiWatSup( redeclare final package Medium = Medium, final m_flow_nominal=mChiWat_flow_nominal, final allowFlowReversal=allowFlowReversal) "CHW supply temperature"; // Components - HW loop and heat recovery chillers Subsystems.ChillerHeatRecoveryGroup chiHea( redeclare final package Medium = Medium, final dat=datChiHea, final nUni=nChiHea, final TCasCooEnt_nominal=TCasCooEnt_nominal, final TCasHeaEnt_nominal=TCasHeaEnt_nominal, final dpEva_nominal=dpEvaChiHea_nominal, final dpCon_nominal=dpConChiHea_nominal, final allowFlowReversal=allowFlowReversal, final use_inputFilter=use_inputFilter, final energyDynamics=energyDynamics) "Heat recovery chillers"; Subsystems.MultiplePumpsSpeed pumHeaWat( redeclare final package Medium=Medium, final nPum=nPumHeaWat, final have_var=true, final have_valve=true, final mPum_flow_nominal=mHeaWat_flow_nominal/nPumHeaWat, final dpPum_nominal=dpPumHeaWat_nominal, final energyDynamics=energyDynamics, final use_inputFilter=use_inputFilter, final allowFlowReversal=allowFlowReversal) "Primary HW pumps"; Fluid.FixedResistances.Junction junHeaWatSup( redeclare final package Medium = Medium, final m_flow_nominal=mHeaWat_flow_nominal * {1,-1,-1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Fluid.FixedResistances.Junction junHeaWatRet( redeclare final package Medium = Medium, final m_flow_nominal=mHeaWat_flow_nominal * {1,-1,1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; // PICV model sized at design flow (instead of minimum flow) for convenience. Fluid.Actuators.Valves.TwoWayLinear valHeaWatMinByp( redeclare final package Medium = Medium, final m_flow_nominal=mHeaWatChiHea_flow_min, from_dp=true, linearized=true, dpValve_nominal=1E3, final use_inputFilter=use_inputFilter, final allowFlowReversal=allowFlowReversal) "HW minimum flow bypass valve"; Fluid.Sensors.RelativePressure dpHeaWat( redeclare final package Medium =Medium) "HW differential pressure (local sensor hardwired to plant controller)"; Fluid.Sensors.TemperatureTwoPort THeaWatPriRet( redeclare final package Medium = Medium, final m_flow_nominal=mHeaWat_flow_nominal, final allowFlowReversal=allowFlowReversal) "Primary HW return temperature"; Fluid.Sensors.TemperatureTwoPort THeaWatSup( redeclare final package Medium = Medium, final m_flow_nominal=mHeaWat_flow_nominal, final allowFlowReversal=allowFlowReversal) "HW supply temperature"; Fluid.Sensors.MassFlowRate mHeaWatPri_flow( redeclare final package Medium =Medium, final allowFlowReversal=allowFlowReversal) "Primary HW mass flow rate"; // Components - CW loop and heat pumps Subsystems.MultiplePumpsSpeed pumConWatCon( redeclare final package Medium = Medium, final nPum=nPumConWatCon, final have_var=true, final have_valve=true, final mPum_flow_nominal=mConWatCon_flow_nominal / nPumConWatCon, final dpPum_nominal=dpPumConWatCon_nominal, final energyDynamics=energyDynamics, final use_inputFilter=use_inputFilter, final allowFlowReversal=allowFlowReversal) "CW pumps serving condenser barrels"; Subsystems.MultiplePumpsSpeed pumConWatEva( redeclare final package Medium = Medium, final nPum=nPumConWatEva, final have_var=true, final have_valve=true, final mPum_flow_nominal=mConWatEva_flow_nominal / nPumConWatEva, final dpPum_nominal=dpPumConWatEva_nominal, final energyDynamics=energyDynamics, final use_inputFilter=use_inputFilter, final allowFlowReversal=allowFlowReversal) "CW pumps serving evaporator barrels"; Fluid.FixedResistances.Junction junConWatEnt( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal*{1,-1,-1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Fluid.Storage.Stratified tan( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, final VTan=VTan, final hTan=hTan, final dIns=dInsTan, final kIns=kInsTan, final nSeg=nSegTan) "TES tank"; Fluid.Sources.Boundary_pT bouConWat( redeclare final package Medium = Medium, final p=hTan * rho_default * Modelica.Constants.g_n, final nPorts=1) "CW pressure boundary condition prescribed by tank operating level"; Fluid.FixedResistances.Junction junConWatTanEnt( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal*{1,-1,-1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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=Modelica.Fluid.Types.PortFlowDirection.Bidirectional) "Fluid junction"; Fluid.FixedResistances.Junction junConWatLvg( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal*{1,-1,1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Modelica.Thermal.HeatTransfer.Sensors.TemperatureSensor TTan[nSegTan]( T(each displayUnit="degC")) "TES tank temperature sensor gateway"; HeatTransfer.Sources.PrescribedTemperature out "Outdoor temperature"; Fluid.FixedResistances.Junction junConWatHeaPumEnt( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal*{1,-1,-1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Fluid.FixedResistances.Junction junConWatHeaPumLvg( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal*{1,-1,1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Subsystems.HeatPumpGroup heaPum( redeclare final package Medium = Medium, redeclare final package MediumAir = MediumAir, final nUni=nHeaPum, final dat=datHeaPum, final energyDynamics=energyDynamics, final use_inputFilter=use_inputFilter, final allowFlowReversal=allowFlowReversal) "Heat pumps"; Fluid.FixedResistances.Junction junConWatTanLvg( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal*{1,-1,1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Fluid.HeatExchangers.PlateHeatExchangerEffectivenessNTU hexCoo( redeclare final package Medium1=MediumConWatCoo, redeclare final package Medium2=Medium, final m1_flow_nominal=mConWatCoo_flow_nominal, final m2_flow_nominal=mConWatCon_flow_nominal, final dp1_nominal=0, final dp2_nominal=0, final Q_flow_nominal=QHexCoo_flow_nominal, final T_a1_nominal=TConWatCooSup_nominal, final T_a2_nominal=TConWatCooRet_nominal + dTHexCoo_nominal, final allowFlowReversal1=allowFlowReversal, final allowFlowReversal2=allowFlowReversal, final configuration=Buildings.Fluid.Types.HeatExchangerConfiguration.CounterFlow) "Heat exchanger with cooling tower circuit"; Subsystems.CoolingTowerGroup coo( redeclare final package Medium=Medium, final nUni=nCoo, final mConWatUni_flow_nominal=mConWatCoo_flow_nominal / nCoo, final dpConWatFriUni_nominal=dpConWatCooFri_nominal + dpHexCoo_nominal, final mAirUni_flow_nominal=mAirCooUni_flow_nominal, final TWetBulEnt_nominal=TWetBulCooEnt_nominal, final TConWatRet_nominal=TConWatCooRet_nominal, final TConWatSup_nominal=TConWatCooSup_nominal, final PFanUni_nominal=PFanCoo_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal) "Cooling towers"; Fluid.Actuators.Valves.ThreeWayLinear valBypTan( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, final energyDynamics=energyDynamics, dpValve_nominal=1E3, dpFixed_nominal={dpTan_nominal,dpHexCoo_nominal}) "TES tank bypass valve"; Fluid.Sources.Boundary_pT bouConWatCoo( redeclare final package Medium = Medium, final p=130000, nPorts=1) "CW pressure boundary condition prescribed by CT elevation head"; Subsystems.MultiplePumpsSpeed pumConWatCoo( redeclare final package Medium = Medium, final nPum=nPumConWatCoo, final have_var=true, have_valve=false, final mPum_flow_nominal=mConWatCoo_flow_nominal / nPumConWatCoo, final dpPum_nominal=dpPumConWatCoo_nominal, final energyDynamics=energyDynamics, final allowFlowReversal=allowFlowReversal) "Cooling tower pumps"; Fluid.Sensors.TemperatureTwoPort TConWatEvaEnt( redeclare final package Medium = Medium, final m_flow_nominal=mConWatEva_flow_nominal, final allowFlowReversal=allowFlowReversal) "HRC evaporator entering CW temperature"; // Controls Buildings.Experimental.DHC.Plants.Combined.Controls.Controller ctl( final nChi=nChi, final nPumChiWat=nPumChiWat, final QHeaPum_flow_nominal=datHeaPum.hea.Q_flow*nHeaPum, final dTLifChi_min=dTLifChi_min, final dTLifChi_nominal=dTLifChi_nominal, final nChiHea=nChiHea, final nPumHeaWat=nPumHeaWat, final nHeaPum=nHeaPum, final nPumConWatCon=nPumConWatCon, final nPumConWatEva=nPumConWatEva, final TTanSet=TTanSet, final nCoo=nCoo, final nPumConWatCoo=nPumConWatCoo, final THeaWatSup_nominal=THeaWatSup_nominal, final TChiWatSup_nominal=TChiWatSup_nominal, final mChiWat_flow_nominal=mChiWat_flow_nominal, final mHeaWat_flow_nominal=mHeaWat_flow_nominal, final mConWatCon_flow_nominal=mConWatCon_flow_nominal, final mConWatEva_flow_nominal=mConWatEva_flow_nominal, final mChiWatChi_flow_nominal=mChiWatChi_flow_nominal, final mChiWatChi_flow_min=mChiWatChi_flow_min, final mConWatChi_flow_nominal=mConWatChi_flow_nominal, final mChiWatChiHea_flow_nominal=mChiWatChiHea_flow_nominal, final mChiWatChiHea_flow_min=mChiWatChiHea_flow_min, final mConWatChiHea_flow_nominal=mConWatChiHea_flow_nominal, final mHeaWatChiHea_flow_min=mHeaWatChiHea_flow_min, final dpChiWatSet_max=dpChiWatSet_max, final dpHeaWatSet_max=dpHeaWatSet_max, final dpConWatConSet_max=dpConWatConSet_max, final dpConWatEvaSet_max=dpConWatEvaSet_max, final dpEvaChi_nominal=dpEvaChi_nominal, final dpValEvaChi_nominal=chi.valEva.dpValve_nominal, final dpEvaChiHea_nominal=dpEvaChiHea_nominal, final dpValEvaChiHea_nominal=max(chiHea.valEva.dpValve_nominal), final QChiWatChi_flow_nominal=chi.QChiWat_flow_nominal, final QChiWatCasCoo_flow_nominal=chiHea.QChiWatCasCoo_flow_nominal, final QChiWatCasCoo_flow_nominal_approx=chiHea.QChiWat_flow_nominal, final QHeaWat_flow_nominal=QHeaWat_flow_nominal, final cp_default=cp_default, final fraUslTan=fraUslTan, final dTHexCoo_nominal=dTHexCoo_nominal, final nTTan=nSegTan) "Controller"; // Miscellaneous Modelica.Blocks.Sources.RealExpression sumPHea( final y=heaPum.P + sum({ if ctl.y1CooChiHea[i] or ctl.y1HeaCooChiHea[i] then 0 else chiHea.chi[i].P for i in 1:nChiHea})) "Sum up power drawn from all subsystems"; Modelica.Blocks.Sources.RealExpression sumPCoo( final y=chi.P + sum({ if ctl.y1CooChiHea[i] or ctl.y1HeaCooChiHea[i] then chiHea.chi[i].P else 0 for i in 1:nChiHea})) "Sum up power drawn from all subsystems"; Modelica.Blocks.Sources.RealExpression sumPFan(y=coo.P) "Sum up power drawn from all subsystems"; Modelica.Blocks.Sources.RealExpression sumPPum( final y=pumChiWat.P + pumHeaWat.P + pumConWatCon.P + pumConWatEva.P + pumConWatCoo.P + heaPum.PPum) "Sum up power drawn from all subsystems"; Fluid.Sensors.RelativePressure dpConWatEva(redeclare final package Medium = Medium) "CW evaporator loop differential pressure "; Fluid.Sensors.RelativePressure dpConWatCon(redeclare final package Medium = Medium) "CW condenser loop differential pressure "; Fluid.Sensors.MassFlowRate mConWatEva_flow(redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal) "CW evaporator loop mass flow rate"; Fluid.Sensors.MassFlowRate mConWatCon_flow(redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal) "CW condenser loop mass flow rate"; Fluid.Sensors.MassFlowRate mConWatOutTan_flow(redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal) "Mass flow rate out of lower port of TES tank (>0 when charging)"; Fluid.Sensors.TemperatureTwoPort TConWatConChiLvg( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, final allowFlowReversal=allowFlowReversal) "Chiller and HRC leaving CW temperature"; Fluid.Sensors.TemperatureTwoPort TConWatConChiEnt( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, final allowFlowReversal=allowFlowReversal) "Chiller and HRC entering CW temperature"; Fluid.Sensors.TemperatureTwoPort TConWatCooSup( redeclare final package Medium = MediumConWatCoo, final m_flow_nominal=mConWatCoo_flow_nominal, final allowFlowReversal=allowFlowReversal) "Cooling tower loop CW supply temperature"; Fluid.Sensors.TemperatureTwoPort TConWatCooRet( redeclare final package Medium = MediumConWatCoo, final m_flow_nominal=mConWatCoo_flow_nominal, final allowFlowReversal=allowFlowReversal) "Cooling tower loop CW return temperature"; Fluid.Sensors.TemperatureTwoPort TConWatHexCooEnt( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, final allowFlowReversal=allowFlowReversal) "HX entering CW temperature"; Fluid.Sensors.TemperatureTwoPort TConWatHexCooLvg( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, final allowFlowReversal=allowFlowReversal) "HX leaving CW temperature"; Fluid.Actuators.Valves.ThreeWayLinear valConWatEvaMix( redeclare final package Medium = Medium, final m_flow_nominal=mConWatEva_flow_nominal, final energyDynamics=energyDynamics, dpValve_nominal=1E3, final dpFixed_nominal=fill(0, 2)) "HRC evaporator CW mixing valve"; Fluid.FixedResistances.Junction junConWatEvaLvg( redeclare final package Medium = Medium, final m_flow_nominal=mConWatEva_flow_nominal*{1,-1,-1}, final dp_nominal=fill(0, 3), final energyDynamics=energyDynamics, 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) "Fluid junction"; Fluid.Sensors.TemperatureTwoPort TConWatConRet( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, final allowFlowReversal=allowFlowReversal) "Condenser loop CW return temperature"; Fluid.Sensors.TemperatureTwoPort TConWatHeaPumEnt( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, final allowFlowReversal=allowFlowReversal) "HP entering CW temperature"; Fluid.Sensors.TemperatureTwoPort TConWatHeaPumLvg( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, final allowFlowReversal=allowFlowReversal) "HP leaving CW temperature"; protected final parameter Medium.ThermodynamicState sta_default=Medium.setState_pTX( T=Medium.T_default, p=Medium.p_default, X=Medium.X_default) "Medium state at default properties"; final parameter Modelica.Units.SI.SpecificHeatCapacity cp_default= Medium.specificHeatCapacityCp(sta_default) "Specific heat capacity of the fluid"; final parameter Modelica.Units.SI.Density rho_default= Medium.density(sta_default) "Density of the fluid"; final parameter MediumConWatCoo.ThermodynamicState staConWatCoo_default= MediumConWatCoo.setState_pTX( T=MediumConWatCoo.T_default, p=MediumConWatCoo.p_default, X=MediumConWatCoo.X_default) "Medium state at default properties"; final parameter Modelica.Units.SI.SpecificHeatCapacity cpConWatCoo_default= MediumConWatCoo.specificHeatCapacityCp(staConWatCoo_default) "Specific heat capacity of the fluid"; public Fluid.Sensors.MassFlowRate mConWatHexCoo_flow(redeclare final package Medium = Medium, final allowFlowReversal=allowFlowReversal) "CW mass flow rate through secondary (plant) side of HX"; Fluid.Actuators.Valves.TwoWayLinear valConWatByp( redeclare final package Medium = Medium, final m_flow_nominal=mConWatCon_flow_nominal, from_dp=true, linearized=true, dpValve_nominal=1E3, final use_inputFilter=use_inputFilter, final allowFlowReversal=allowFlowReversal) "CW chiller bypass valve"; equation connect(junChiWatSup.port_2, port_bSerCoo); connect(junChiWatSup.port_3, valChiWatMinByp.port_a); connect(valChiWatMinByp.port_b, junChiWatRet.port_3); connect(junChiWatSup.port_2, dpChiWat.port_a); connect(TChiWatPriRet.port_a, junChiWatRet.port_2); connect(port_aSerCoo, junChiWatRet.port_1); connect(dpChiWat.port_b, junChiWatRet.port_1); connect(junHeaWatSup.port_3, valHeaWatMinByp.port_a); connect(valHeaWatMinByp.port_b, junHeaWatRet.port_3); connect(THeaWatPriRet.port_a, junHeaWatRet.port_2); connect(dpHeaWat.port_b, junHeaWatRet.port_1); connect(junHeaWatSup.port_2, port_bSerHea); connect(ctl.y1Chi, chi.y1); connect(ctl.yValConChi, chi.yValCon); connect(TChiWatSupSet, chi.TSet); connect(ctl.y1PumChiWat, pumChiWat.y1); connect(ctl.y1PumHeaWat, pumHeaWat.y1); connect(ctl.yValChiWatMinByp, valChiWatMinByp.y); connect(ctl.yValHeaWatMinByp, valHeaWatMinByp.y); connect(THeaWatPriRet.port_b, mHeaWatPri_flow.port_a); connect(TChiWatPriRet.port_b, mChiWatPri_flow.port_a); connect(ctl.y1PumConWatEva, pumConWatEva.y1); connect(ctl.yPumConWatEva, pumConWatEva.y); connect(sumPHea.y, PHea); connect(sumPCoo.y, PCoo); connect(sumPFan.y, PFan); connect(sumPPum.y, PPum); connect(junHeaWatSup.port_2, dpHeaWat.port_a); connect(pumChiWat.port_b, TChiWatSup.port_a); connect(TChiWatSup.port_b, junChiWatSup.port_1); connect(tan.heaPorVol, TTan.port); connect(out.port, tan.heaPorTop); connect(out.port, tan.heaPorSid); connect(out.port, tan.heaPorBot); connect(pumHeaWat.port_b, THeaWatSup.port_a); connect(THeaWatSup.port_b, junHeaWatSup.port_1); connect(junConWatHeaPumEnt.port_2, junConWatHeaPumLvg.port_1); connect(weaBus.TDryBul, out.T); connect(weaBus, heaPum.weaBus); connect(ctl.y1HeaPum, heaPum.y1); connect(ctl.THeaPumSet, heaPum.TSet); connect(bouConWat.ports[1], tan.port_b); connect(ctl.yPumChiWat, pumChiWat.y); connect(ctl.yPumHeaWat, pumHeaWat.y); connect(mChiWatPri_flow.port_b,junChiWatChiHeaRet. port_1); connect(junChiWatChiHeaRet.port_2, chi.port_a2); connect(port_aSerHea, junHeaWatRet.port_1); connect(junConWatTanEnt.port_2, valBypTan.port_2); connect(valBypTan.port_1, tan.port_a); connect(ctl.yValBypTan, valBypTan.y); connect(bouConWatCoo.ports[1], pumConWatCoo.port_a); connect(coo.port_b, pumConWatCoo.port_a); connect(weaBus, coo.weaBus); connect(ctl.yCoo, coo.y); connect(ctl.y1PumConWatCoo, pumConWatCoo.y1); connect(chi.port_b1, junConWatLvg.port_3); connect(chiHea.port_b1, pumHeaWat.port_a); connect(mHeaWatPri_flow.port_b, chiHea.port_a1); connect(junChiWatChiHeaRet.port_3, chiHea.port_a4); connect(junConWatEnt.port_2, chiHea.port_a3); connect(chiHea.port_b3, junConWatLvg.port_1); connect(ctl.yValEvaChiHea, chiHea.yValEva); connect(ctl.y1CooChiHea, chiHea.y1Coo); connect(ctl.y1ChiHea, chiHea.y1); connect(ctl.yValConChiHea, chiHea.yValCon); connect(ctl.TChiHeaSet, chiHea.TSet); connect(ctl.yValEvaChi, chi.yValEva); connect(junChiWatChiHeaSup.port_2, pumChiWat.port_a); connect(chi.port_b2, junChiWatChiHeaSup.port_1); connect(chiHea.port_b4, junChiWatChiHeaSup.port_3); connect(TConWatEvaEnt.port_b, chiHea.port_a2); connect(TChiWatSupSet, ctl.TChiWatSupSet); connect(dpChiWatSet, ctl.dpChiWatSet); connect(THeaWatSupSet, ctl.THeaWatSupSet); connect(dpHeaWatSet, ctl.dpHeaWatSet); connect(u1Coo, ctl.u1Coo); connect(u1Hea, ctl.u1Hea); connect(mChiWatPri_flow.m_flow, ctl.mChiWatPri_flow); connect(dpChiWat.p_rel, ctl.dpChiWat); connect(mHeaWatPri_flow.m_flow, ctl.mHeaWatPri_flow); connect(dpHeaWat.p_rel, ctl.dpHeaWat); connect(pumConWatEva.port_b, dpConWatEva.port_a); connect(pumConWatEva.port_b, mConWatEva_flow.port_a); connect(mConWatEva_flow.port_b, TConWatEvaEnt.port_a); connect(junConWatTanLvg.port_2, mConWatCon_flow.port_a); connect(mConWatCon_flow.port_b, pumConWatCon.port_a); connect(mConWatCon_flow.m_flow, ctl.mConWatCon_flow); connect(mConWatEva_flow.m_flow, ctl.mConWatEva_flow); connect(dpConWatEva.p_rel, ctl.dpConWatEva); connect(dpConWatCon.p_rel, ctl.dpConWatCon); connect(TChiWatPriRet.T, ctl.TChiWatPriRet); connect(THeaWatPriRet.T, ctl.THeaWatPriRet); connect(TTan.T, ctl.TTan); connect(tan.port_b, mConWatOutTan_flow.port_a); connect(mConWatHexCoo_flow.m_flow, ctl.mConWatHexCoo_flow); connect(mConWatOutTan_flow.m_flow, ctl.mConWatOutTan_flow); connect(junConWatEnt.port_3, chi.port_a1); connect(chi.mCon_flow, ctl.mConChi_flow); connect(chi.mEva_flow, ctl.mEvaChi_flow); connect(chiHea.mCon_flow, ctl.mConChiHea_flow); connect(chiHea.mEva_flow, ctl.mEvaChiHea_flow); connect(ctl.yValConSwiChiHea, chiHea.yValConSwi); connect(ctl.yValEvaSwiHea, chiHea.yValEvaSwi); connect(TChiWatSup.T, ctl.TChiWatSup); connect(chiHea.TEvaLvg, ctl.TEvaLvgChiHea); connect(junConWatLvg.port_2, TConWatConChiLvg.port_a); connect(TConWatConChiLvg.port_b, junConWatHeaPumEnt.port_1); connect(THeaWatSup.T, ctl.THeaWatSup); connect(TConWatConChiEnt.port_b, junConWatEnt.port_1); connect(pumConWatCoo.port_b, TConWatCooSup.port_a); connect(TConWatCooSup.port_b, hexCoo.port_a1); connect(hexCoo.port_b1, TConWatCooRet.port_a); connect(TConWatCooRet.port_b, coo.port_a); connect(valBypTan.port_3, TConWatHexCooEnt.port_a); connect(TConWatHexCooEnt.port_b, hexCoo.port_a2); connect(hexCoo.port_b2, TConWatHexCooLvg.port_a); connect(TConWatHexCooLvg.port_b, mConWatHexCoo_flow.port_a); connect(TConWatConChiLvg.T, ctl.TConWatConChiLvg); connect(TConWatConChiEnt.T, ctl.TConWatConChiEnt); connect(TConWatCooSup.T, ctl.TConWatCooSup); connect(TConWatCooRet.T, ctl.TConWatCooRet); connect(TConWatHexCooEnt.T, ctl.TConWatHexCooEnt); connect(TConWatHexCooLvg.T, ctl.TConWatHexCooLvg); connect(ctl.yPumConWatCoo, pumConWatCoo.y); connect(chiHea.TConLvg, ctl.TConLvgChiHea); connect(chiHea.TConEnt, ctl.TConEntChiHea); connect(junConWatTanEnt.port_3, valConWatEvaMix.port_1); connect(valConWatEvaMix.port_2, pumConWatEva.port_a); connect(junConWatEvaLvg.port_3, valConWatEvaMix.port_3); connect(junConWatEvaLvg.port_3, dpConWatEva.port_b); connect(chiHea.port_b2, junConWatEvaLvg.port_1); connect(junConWatEvaLvg.port_2, junConWatTanLvg.port_3); connect(TConWatEvaEnt.T, ctl.TConWatEvaEnt); connect(ctl.yValConWatEvaMix, valConWatEvaMix.y); connect(junConWatHeaPumLvg.port_2, TConWatConRet.port_a); connect(TConWatConRet.port_b, junConWatTanEnt.port_1); connect(TConWatConRet.T, ctl.TConWatConRet); connect(chi.TConLvg, ctl.TConLvgChi); connect(junConWatHeaPumEnt.port_3, TConWatHeaPumEnt.port_a); connect(TConWatHeaPumEnt.port_b, heaPum.port_a); connect(heaPum.port_b, TConWatHeaPumLvg.port_a); connect(TConWatHeaPumLvg.port_b, junConWatHeaPumLvg.port_3); connect(ctl.y1Coo, coo.y1); connect(mConWatHexCoo_flow.port_b, junConWatTanLvg.port_1); connect(mConWatOutTan_flow.port_b, junConWatTanLvg.port_1); connect(ctl.yPumConWatCon, pumConWatCon.y); connect(ctl.y1PumConWatCon, pumConWatCon.y1); connect(pumConWatCon.port_b, valConWatByp.port_b); connect(ctl.yValConWatByp, valConWatByp.y); connect(pumConWatCon.port_b, TConWatConChiEnt.port_a); connect(pumConWatCon.port_b, dpConWatCon.port_a); connect(valConWatByp.port_a, TConWatConChiLvg.port_a); connect(dpConWatCon.port_b, TConWatConChiLvg.port_a); end AllElectricCWStorage;