Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses

Package with base classes

Information

This package contains base classes that are used to construct the main plant controller. Those include an interface class for the controller as well as blocks that implement the sequence of operation for each component of the plant.

Extends from Modelica.Icons.BasesPackage (Icon for packages containing base classes).

Package Content

Name Description
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.CoolingTowerLoop CoolingTowerLoop Cooling tower loop control
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.DirectHeatRecovery DirectHeatRecovery Block controlling HRC in direct heat recovery mode
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.IntegerArrayHold IntegerArrayHold Block that holds the value of an integer array for a given time
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ModeCondenserLoop ModeCondenserLoop Block that determines the condenser loop mode
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ModeHeatRecoveryChiller ModeHeatRecoveryChiller Block that computes the cascading cooling and direct HR switchover signals
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.PartialController PartialController Interface class for plant controller
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StageIndex StageIndex Block that computes the stage index out of staging signals
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StagingPlant StagingPlant Block that computes plant stage and command signals for chillers and HRC
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StagingPump StagingPump Pump staging
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.TankCycle TankCycle Block that determines the tank cycle flag
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ValveCondenserEvaporator ValveCondenserEvaporator Controller for chiller and HRC condenser and evaporator valves
Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.Validation Validation Package with validation models

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.CoolingTowerLoop Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.CoolingTowerLoop

Cooling tower loop control

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.CoolingTowerLoop

Information

This block implements the control logic for the CT pumps and CT fans.

CT supply temperature setpoint

When Heat Rejection mode is enabled, the setpoint is equal to min(25 °C, TChiWatSupSet + dTLif - dTConWat - dTHexCoo_nominal), where TChiWatSupSet is the CHW supply temperature setpoint, dTLif is the target chiller lift (see below), dTConWat is the chiller condenser Delta-T averaged over a 5-minute moving window, and dTHexCoo_nominal is the design heat exchanger approach. The target chiller lift is reset from the minimum chiller lift to the design chiller lift when the plant required cooling capacity varies from 10 % to 100 % of the design value.

In any other mode the setpoint is equal to the minimum setpoint value of the active tank cycle minus the design heat exchanger approach.

CT pumps

The lead pump is enabled whenever the TES tank bypass valve commanded position is lower than 1 for min and the CW mass flow rate through the secondary side of the cooling heat exchanger is higher than 2.5 % of design condition for min. The lead pump is disabled whenever the TES tank bypass valve commanded position is equal to 1 for min or the CW mass flow rate through the secondary side of the cooling heat exchanger is lower than 2.5 % of design condition for min.

The lag pump is enabled whenever the pump speed command (common to all pumps) is higher than 80 % for min. The lag pump is disabled whenever the pump speed command is lower than 80 % for min or the lead pump is disabled.

The pump speed command is the lower of that output by two loops, each loop being enabled whenever any pump is proven on. The first loop maintains the heat exchanger leaving CW temperature on plant side at setpoint. The setpoint is equal to the CT supply temperature setpoint plus the design HX approach. The second loop maintains the Delta-T across the primary side (CT loop) of the HX at a setpoint equal to the Delta-T across the secondary side (plant side) of the HX minus K. (This loop keeps the primary and secondary HX flow rates close to each other and prevents pump speed runaway when target CT supply temperature setpoint cannot be met.) The output of each loop is mapped to the minimum pump speed at 80 % to 100 % at 100 %. The minimum pump speed is provided as a parameter for each pump stage since different speeds are required for each stage to maintain minimum tower flow.

CT fans

When any of the CT pumps is commanded On, a control loop maintains the tower water supply temperature at setpoint by resetting the tower fan speed from 0 % to a maximum value varying between 70 % and 100 % when the plant required cooling capacity varies from 0 % to 50 % of the design value. Otherwise, the loop is disabled and its output set to 0 %.

Note that the fan cycling On and Off is implicitly modeled in the cooling tower component which uses a low limit of the control signal to switch to a free convection regime at zero fan power.

Parameters

TypeNameDefaultDescription
MassFlowRatemConWatHexCoo_flow_nominal Design total CW mass flow rate through condenser barrels (all units) [kg/s]
IntegernCoo Number of cooling tower cells operating at design conditions
IntegernPumConWatCoo Number of CW pumps serving cooling towers at design conditions
HeatFlowRateQChiWat_flow_nominal Design plant cooling heat flow rate (all units) [W]
TemperatureDifferencedTLifChi_min Minimum chiller lift at minimum load [K]
TemperatureDifferencedTLifChi_nominal Design chiller lift [K]
TemperatureTTanSet[2, 2] Tank temperature setpoints: 2 cycles with 2 setpoints [K]
TemperatureDifferencedTHexCoo_nominal Design heat exchanger approach [K]
RealyPumConWatCoo_min[nPumConWatCoo]{0.2/i for i in 1:nPumConWat...Tower pump speed needed to maintain minimum tower flow (each pump stage) [1]

Connectors

TypeNameDescription
input IntegerInputmodeCondenser loop operating mode
input IntegerInputidxCycTanIndex of active tank cycle
input RealInputTConWatCooSupCooling tower loop CW supply temperature [K]
input RealInputmConWatHexCoo_flowCW mass flow rate through secondary side of HX [kg/s]
input RealInputQCooReq_flowPlant required cooling capacity (>0) [W]
input RealInputTConWatConChiEntChiller and HRC entering CW temperature [K]
input RealInputTConWatConChiLvgChiller and HRC leaving CW temperature [K]
input RealInputTChiWatSupSetCHW supply temperature setpoint [K]
input RealInputTConWatCooRetCooling tower loop CW return temperature [K]
input RealInputyValBypTanTES tank bypass valve commanded position [1]
input RealInputTConWatHexCooEntHX entering CW temperature [K]
input RealInputTConWatHexCooLvgHX leaving CW temperature [K]
output BooleanOutputy1PumConWatCoo[nPumConWatCoo]Cooling tower pump Start command
output RealOutputyCooCooling tower fan speed command
output RealOutputyPumConWatCooCooling tower pump speed command
output BooleanOutputy1Coo[nCoo]Cooling tower Start command

Modelica definition

block CoolingTowerLoop "Cooling tower loop control" parameter Modelica.Units.SI.MassFlowRate mConWatHexCoo_flow_nominal "Design total CW mass flow rate through condenser barrels (all units)"; parameter Integer nCoo(final min=1, start=1) "Number of cooling tower cells operating at design conditions"; parameter Integer nPumConWatCoo(final min=1, start=1) "Number of CW pumps serving cooling towers at design conditions"; parameter Modelica.Units.SI.HeatFlowRate QChiWat_flow_nominal "Design plant cooling heat flow rate (all units)"; parameter Modelica.Units.SI.TemperatureDifference dTLifChi_min "Minimum chiller lift at minimum load"; parameter Modelica.Units.SI.TemperatureDifference dTLifChi_nominal "Design chiller lift"; parameter Modelica.Units.SI.Temperature TTanSet[2, 2] "Tank temperature setpoints: 2 cycles with 2 setpoints"; parameter Modelica.Units.SI.TemperatureDifference dTHexCoo_nominal "Design heat exchanger approach"; parameter Real yPumConWatCoo_min[nPumConWatCoo](each final unit="1")= {0.2/i for i in 1:nPumConWatCoo} "Tower pump speed needed to maintain minimum tower flow (each pump stage)"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput mode( final min=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.tankCharge, final max=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.heatRejection) "Condenser loop operating mode"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput idxCycTan( final min=1, final max=2) "Index of active tank cycle"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatCooSup(final unit="K", displayUnit="degC") "Cooling tower loop CW supply temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConWatHexCoo_flow( final unit="kg/s") "CW mass flow rate through secondary side of HX"; Buildings.Controls.OBC.CDL.Interfaces.RealInput QCooReq_flow( final unit="W") "Plant required cooling capacity (>0)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatConChiEnt(final unit= "K", displayUnit="degC") "Chiller and HRC entering CW temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatConChiLvg(final unit= "K", displayUnit="degC") "Chiller and HRC leaving CW temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TChiWatSupSet(final unit="K", displayUnit="degC") "CHW supply temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatCooRet(final unit="K", displayUnit="degC") "Cooling tower loop CW return temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput yValBypTan(final unit="1") "TES tank bypass valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatHexCooEnt(final unit= "K", displayUnit="degC") "HX entering CW temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatHexCooLvg(final unit= "K", displayUnit="degC") "HX leaving CW temperature"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumConWatCoo[ nPumConWatCoo] "Cooling tower pump Start command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yCoo "Cooling tower fan speed command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yPumConWatCoo "Cooling tower pump speed command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Coo[nCoo] "Cooling tower Start command"; Buildings.Controls.OBC.CDL.Reals.Subtract delTemCon "Compute CW deltaT"; Buildings.Controls.OBC.CDL.Reals.MovingAverage mea(delta=5*60) "Moving mean"; Buildings.Controls.OBC.CDL.Reals.Subtract delTem1 "Compute deltaT"; Buildings.Controls.OBC.CDL.Reals.Add lifPlu "Add target lift"; Buildings.Controls.OBC.CDL.Reals.AddParameter subApp(final p=- dTHexCoo_nominal) "Substract HX approach"; Buildings.Controls.OBC.CDL.Reals.Switch TSupSetUnb(y(unit="K", displayUnit="degC")) "Compute tower supply temperature setpoint, unbounded"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant modRej( final k=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.heatRejection) "Heat rejection mode index"; Buildings.Controls.OBC.CDL.Integers.Equal isModRej "Heat rejection mode"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant setOth[2](final k= TTanSet[:, 1] .- dTHexCoo_nominal) "Target setpoint in any mode other than heat rejection"; Buildings.Controls.OBC.CDL.Routing.RealExtractor extSet(final nin=2) "Extract setpoint value based on current mode"; Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter ratDes(final k=abs(1 /QChiWat_flow_nominal)) "Ratio to design capacity"; Buildings.Controls.OBC.CDL.Reals.Line lif "Compute target chiller lift"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xLif[2](k={0.1,1}) "x-value for lift reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yLif[2](final k={ dTLifChi_min,dTLifChi_nominal}) "y-value for lift reset"; StagingPump staPum( nPum=nPumConWatCoo, have_flowCriterion=false, yDow=0.4, yUp=0.8) "Stage pumps"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold cmpFlo(t=0.025* mConWatHexCoo_flow_nominal, h=0.025*mConWatHexCoo_flow_nominal/2) "Flow criterion to enable lead pump"; Buildings.Controls.OBC.CDL.Logical.Timer timFlo(t=60) "Timer for flow exceeding triggering limit"; Buildings.Controls.OBC.CDL.Logical.Timer timFlo1(t=5*60) "Timer for flow exceeding triggering limit"; Buildings.Controls.OBC.CDL.Reals.LessThreshold cmpOpe(t=0.99, h=0.005) "Valve opening criterion to enable lead pump"; Buildings.Controls.OBC.CDL.Logical.Timer timOpe(t=60) "Timer for valve opening exceeding triggering limit"; Buildings.Controls.OBC.CDL.Logical.Timer timOpe1(t=60) "Timer for valve opening exceeding triggering limit"; Buildings.Controls.OBC.CDL.Logical.Not not1 "Valve opening criterion to disable lead pump"; Buildings.Controls.OBC.CDL.Logical.Or dis "Disable condition"; Buildings.Controls.OBC.CDL.Logical.And ena "Enable condition"; Buildings.Controls.OBC.CDL.Logical.Latch enaLea "Enable lead pump"; Buildings.Controls.OBC.CDL.Reals.Subtract delTem2 "Compute deltaT"; Buildings.Controls.OBC.CDL.Reals.Subtract delTem3 "Compute deltaT"; Buildings.Controls.OBC.CDL.Reals.AddParameter addOff(final p=-1) "Add offset"; Buildings.Controls.OBC.CDL.Reals.AddParameter addApp(final p= dTHexCoo_nominal) "Add HX approach"; EnergyTransferStations.Combined.Controls.PIDWithEnable ctlPum1( k=0.01, Ti=60, final reverseActing=false) "Pump control loop #1"; EnergyTransferStations.Combined.Controls.PIDWithEnable ctlPum2( k=0.01, Ti=60, final reverseActing=false) "Pump control loop #1"; Buildings.Controls.OBC.CDL.Reals.Min minCtlPum "Minimum loop output"; Buildings.Controls.OBC.CDL.Reals.Line pum "Pump speed command"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xPum[2](k={0,1}) "x-value for pump speed reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant one(final k=1) "Constant"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yPumMin[nPumConWatCoo]( final k=yPumConWatCoo_min) "Minimum pump speed"; Buildings.Controls.OBC.CDL.Routing.RealExtractor extYPumMin(final nin= nPumConWatCoo) "Extract minimum pump speed value based on current pump stage"; Modelica.Blocks.Sources.IntegerExpression nPumBou(y=max(1, staPum.nPumEna)) "Number of pumps commanded on, bounded by 1"; Buildings.Controls.OBC.CDL.Reals.Line fanMax "Compute maximum fan speed"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xFan[2](k={0,0.5}) "x-value for maximum fan speed reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yFan[2](final k={0.7,1.0}) "y-value for maximum fan speed reset"; EnergyTransferStations.Combined.Controls.PIDWithEnable ctlFan( k=0.05, Ti=60, final reverseActing=false) "Fan control loop"; Buildings.Controls.OBC.CDL.Logical.Pre pre1 "Left limit of signal to avoid direct feedback"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant setMax(k=25 + 273.15) "Maximum setpoint"; Buildings.Controls.OBC.CDL.Reals.Min TSupSet( y(unit="K", displayUnit="degC")) "Compute tower supply temperature setpoint"; Buildings.Controls.OBC.CDL.Reals.Line fan "Compute fan speed"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xFan1 [2](k={0,1}) "x-value for fan speed reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yFan1(final k=0) "y-value for fan speed reset"; Buildings.Controls.OBC.CDL.Logical.Not not2 "Flow criterion to disable lead pump"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rep(final nout= nCoo) "Replicate"; Buildings.Controls.OBC.CDL.Logical.Not notDis "Not disabled"; Buildings.Controls.OBC.CDL.Logical.And enaAndNotDis "Reset enable condition when disable is true to trigger latch block when (enable, disable) becomes (true, false) again"; equation connect(QCooReq_flow, ratDes.u); connect(ratDes.y, lif.u); connect(xLif[1].y, lif.x1); connect(xLif[2].y, lif.x2); connect(yLif[1].y, lif.f1); connect(yLif[2].y, lif.f2); connect(TConWatConChiLvg, delTemCon.u1); connect(TConWatConChiEnt, delTemCon.u2); connect(delTemCon.y, mea.u); connect(lif.y, lifPlu.u1); connect(TChiWatSupSet, lifPlu.u2); connect(lifPlu.y, delTem1.u1); connect(mea.y, delTem1.u2); connect(delTem1.y,subApp. u); connect(mode, isModRej.u1); connect(modRej.y, isModRej.u2); connect(isModRej.y, TSupSetUnb.u2); connect(subApp.y, TSupSetUnb.u1); connect(setOth.y,extSet. u); connect(extSet.y, TSupSetUnb.u3); connect(mConWatHexCoo_flow, cmpFlo.u); connect(cmpFlo.y, timFlo.u); connect(yValBypTan, cmpOpe.u); connect(not1.y, timOpe1.u); connect(cmpOpe.y, timOpe.u); connect(cmpOpe.y, not1.u); connect(timFlo.passed, ena.u1); connect(timOpe.passed, ena.u2); connect(timFlo1.passed, dis.u1); connect(timOpe1.passed, dis.u2); connect(dis.y,enaLea. clr); connect(enaLea.y, staPum.y1Ena); connect(TConWatCooRet, delTem3.u1); connect(TConWatCooSup, delTem3.u2); connect(TConWatHexCooEnt, delTem2.u1); connect(delTem2.y, addOff.u); connect(addApp.y, ctlPum1.u_s); connect(delTem3.y, ctlPum2.u_m); connect(addOff.y, ctlPum2.u_s); connect(ctlPum1.y, minCtlPum.u1); connect(ctlPum2.y, minCtlPum.u2); connect(xPum[1].y, pum.x1); connect(xPum[2].y, pum.x2); connect(pum.y, yPumConWatCoo); connect(one.y, pum.f2); connect(minCtlPum.y, pum.u); connect(idxCycTan,extSet. index); connect(yPumMin.y, extYPumMin.u); connect(nPumBou.y, extYPumMin.index); connect(extYPumMin.y, pum.f1); connect(xFan[1].y, fanMax.x1); connect(xFan[2].y, fanMax.x2); connect(yFan[1].y, fanMax.f1); connect(yFan[2].y, fanMax.f2); connect(ratDes.y, fanMax.u); connect(enaLea.y, pre1.u); connect(TConWatCooSup, ctlFan.u_m); connect(pum.y, staPum.y); connect(pre1.y, ctlPum1.uEna); connect(pre1.y, ctlPum2.uEna); connect(staPum.y1, y1PumConWatCoo); connect(setMax.y, TSupSet.u2); connect(TSupSetUnb.y, TSupSet.u1); connect(TSupSet.y, ctlFan.u_s); connect(TSupSet.y, addApp.u); connect(TConWatHexCooLvg, delTem2.u2); connect(TConWatHexCooLvg, ctlPum1.u_m); connect(xFan1[1].y, fan.x1); connect(xFan1[2].y, fan.x2); connect(yFan1.y, fan.f1); connect(ctlFan.y, fan.u); connect(fan.y, yCoo); connect(fanMax.y, fan.f2); connect(enaLea.y, ctlFan.uEna); connect(cmpFlo.y, not2.u); connect(not2.y, timFlo1.u); connect(rep.y, y1Coo); connect(enaLea.y, rep.u); connect(ena.y, enaAndNotDis.u1); connect(notDis.y, enaAndNotDis.u2); connect(enaAndNotDis.y, enaLea.u); connect(dis.y, notDis.u); end CoolingTowerLoop;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.DirectHeatRecovery Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.DirectHeatRecovery

Block controlling HRC in direct heat recovery mode

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.DirectHeatRecovery

Information

In direct heat recovery mode, the HRC is internally controlled in heating mode and tracks a HW supply temperature setpoint. The CHW supply temperature setpoint is maintained by means of supervisory controls that act on the evaporator flow rate and condenser entering water temperature as described below.

A direct acting control loop runs for each HRC operating in direct heat recovery mode. Each loop is enabled with a bias of 50 % whenever the HRC is commanded On and in direct heat recovery mode. The loop is disabled with output set to 50 % otherwise. The loop output is mapped as follows. From 0 % to 33 % the evaporator flow setpoint of cooling-only chillers is reset from 1.2 times its minimum value to 1.2 times its design value. From 33 % to 67 % the evaporator flow setpoint of the HRC is reset from 1.2 times its minimum value to 1.2 times its design value. From 67 % to 100 % the HRC condenser entering temperature setpoint is reset from THeaWatRet + 0.5 °C to THeaWatRet - 15 °C.

Parameters

TypeNameDefaultDescription
CHW loop and cooling-only chillers
IntegernChi Number of units operating at design conditions
MassFlowRatemChiWatChi_flow_nominal Chiller CHW design mass flow rate (value will be used for each unit) [kg/s]
MassFlowRatemChiWatChi_flow_min Chiller CHW minimum mass flow rate (value will be used for each unit) [kg/s]
HW loop and heat recovery chillers
IntegernChiHea Number of units operating at design conditions
MassFlowRatemChiWatChiHea_flow_nominal HRC CHW design mass flow rate (value will be used for each unit) [kg/s]
MassFlowRatemChiWatChiHea_flow_min HRC CHW minimum mass flow rate (value will be used for each unit) [kg/s]
Control parameters
Realk0.01Gain of controller
TimeTi60Time constant of integrator block [s]
Realy_reset0.5Value to which the controller output is reset if the boolean trigger has a rising edge
Realy_neutral0.5Value to which the controller output is reset when the controller is disabled

Connectors

TypeNameDescription
input RealInputTChiWatSupSetCHW supply temperature setpoint [K]
input RealInputTEvaLvg[nChiHea]Evaporator barrel leaving temperature (each HRC) [K]
input BooleanInputy1HeaCoo[nChiHea]Direct HR command
input BooleanInputy1[nChiHea]On/Off command
output RealOutputmEvaChiSet_flowChiller evaporator flow setpoint [kg/s]
output RealOutputTConEntChiHeaSetHRC condenser entering temperature setpoint [K]
input RealInputTHeaWatPriRetPrimary HW return temperature [K]
output RealOutputmEvaChiHeaSet_flowHRC evaporator flow setpoint [kg/s]

Modelica definition

block DirectHeatRecovery "Block controlling HRC in direct heat recovery mode" parameter Integer nChi(final min=1, start=1) "Number of units operating at design conditions"; parameter Integer nChiHea(final min=1, start=1) "Number of units operating at design conditions"; parameter Modelica.Units.SI.MassFlowRate mChiWatChi_flow_nominal "Chiller CHW design mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChi_flow_min "Chiller CHW minimum mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChiHea_flow_nominal "HRC CHW design mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChiHea_flow_min "HRC CHW minimum mass flow rate (value will be used for each unit)"; parameter Real k(min=0)=0.01 "Gain of controller"; parameter Modelica.Units.SI.Time Ti=60 "Time constant of integrator block"; parameter Real y_reset=0.5 "Value to which the controller output is reset if the boolean trigger has a rising edge"; parameter Real y_neutral=0.5 "Value to which the controller output is reset when the controller is disabled"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TChiWatSupSet(final unit="K", displayUnit="degC") "CHW supply temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TEvaLvg[nChiHea](each final unit="K", each displayUnit="degC") "Evaporator barrel leaving temperature (each HRC)"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput y1HeaCoo[nChiHea] "Direct HR command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput y1[nChiHea] "On/Off command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput mEvaChiSet_flow( final unit="kg/s") "Chiller evaporator flow setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput TConEntChiHeaSet( final unit="K", displayUnit="degC") "HRC condenser entering temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput THeaWatPriRet(final unit="K", displayUnit="degC") "Primary HW return temperature"; Buildings.Controls.OBC.CDL.Logical.And heaCooAndOn[nChiHea] "Return true if direct HR AND On"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator rep( final nout=nChiHea) "Replicate"; EnergyTransferStations.Combined.Controls.PIDWithEnable ctl[nChiHea]( each final k=k, each final Ti=Ti, each final reverseActing=false, each final y_reset=y_reset, each final y_neutral=y_neutral) "CHW supply temperature control"; Buildings.Controls.OBC.CDL.Reals.Line chiFloRes[nChiHea] "Chiller evaporator flow reset"; Buildings.Controls.OBC.CDL.Reals.MultiMin min(nin=nChiHea) "Minimum evaporator flow setpoint"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xFlo[nChiHea,2]( final k=fill({0,0.33}, nChiHea)) "x-value for flow reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yFlo[nChiHea,2]( final k=fill(1.2 .* {mChiWatChi_flow_min,mChiWatChi_flow_nominal}, nChiHea)) "y-value for flow reset"; Buildings.Controls.OBC.CDL.Reals.Line chiHeaFloRes[nChiHea] "HRC evaporator flow reset"; Buildings.Controls.OBC.CDL.Reals.MultiMin min1(nin=nChiHea) "Minimum evaporator flow setpoint"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xFlo1 [nChiHea, 2](final k= fill({0.33,0.67}, nChiHea)) "x-value for flow reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yFlo1 [nChiHea, 2](final k= fill(1.2 .* {mChiWatChiHea_flow_nominal,mChiWatChiHea_flow_min}, nChiHea)) "y-value for flow reset"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput mEvaChiHeaSet_flow(final unit="kg/s") "HRC evaporator flow setpoint"; Buildings.Controls.OBC.CDL.Reals.Line chiHeaConTemRes[nChiHea] "HRC condenser entering temperature reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xFlo2 [nChiHea, 2](final k= fill({0.67,1.0}, nChiHea)) "x-value for flow reset"; Buildings.Controls.OBC.CDL.Reals.AddParameter addOff(final p=0.5) "Add offset"; Buildings.Controls.OBC.CDL.Reals.AddParameter addOff1(final p=-15) "Add offset"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator rep1(final nout= nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator rep2(final nout= nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Routing.RealExtractor extIndRea(final nin=nChiHea) "Keep reset value from HRC in direct HR with higher index"; Modelica.Blocks.Sources.IntegerExpression idxHig(final y=max({if heaCooAndOn[ i].y then i else 1 for i in 1:nChiHea})) "Highest index of HRC in direct HR (defaulted to 1 if all false)"; Buildings.Controls.OBC.CDL.Reals.MovingAverage mea(delta=5*60) "Moving average"; equation connect(TChiWatSupSet, rep.u); connect(y1, heaCooAndOn.u1); connect(y1HeaCoo, heaCooAndOn.u2); connect(rep.y, ctl.u_s); connect(TEvaLvg, ctl.u_m); connect(heaCooAndOn.y, ctl.uEna); connect(chiFloRes.y, min.u); connect(yFlo[:, 2].y, chiFloRes.f2); connect(yFlo[:, 1].y, chiFloRes.f1); connect(ctl.y, chiFloRes.u); connect(xFlo[:, 1].y, chiFloRes.x1); connect(xFlo[:, 2].y, chiFloRes.x2); connect(min.y, mEvaChiSet_flow); connect(chiHeaFloRes.y, min1.u); connect(yFlo1[:, 2].y, chiHeaFloRes.f2); connect(yFlo1[:, 1].y, chiHeaFloRes.f1); connect(ctl.y, chiHeaFloRes.u); connect(xFlo1[:, 1].y, chiHeaFloRes.x1); connect(xFlo1[:, 2].y, chiHeaFloRes.x2); connect(min1.y, mEvaChiHeaSet_flow); connect(ctl.y, chiHeaConTemRes.u); connect(xFlo2[:, 1].y, chiHeaConTemRes.x1); connect(xFlo2[:, 2].y, chiHeaConTemRes.x2); connect(addOff.y, rep1.u); connect(addOff1.y, rep2.u); connect(rep2.y, chiHeaConTemRes.f2); connect(rep1.y, chiHeaConTemRes.f1); connect(extIndRea.y, TConEntChiHeaSet); connect(chiHeaConTemRes.y, extIndRea.u); connect(idxHig.y, extIndRea.index); connect(addOff.u, mea.y); connect(THeaWatPriRet, mea.u); connect(mea.y, addOff1.u); end DirectHeatRecovery;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.IntegerArrayHold Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.IntegerArrayHold

Block that holds the value of an integer array for a given time

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.IntegerArrayHold

Information

This blocks updates the value of the output array to match the value of the input array only if the time since the last update exceeds holdDuration. Otherwise, the value of the output array is kept equal to its value at the time of the last update. At initial time, the value of the output array is set to the value of the input array, and this is considered as the first update time.

Parameters

TypeNameDefaultDescription
RealholdDuration1Hold duration [s]

Connectors

TypeNameDescription
input IntegerInputu[nin]Connector of Real input signal
output IntegerOutputy[nout]Connector of Integer output signal

Modelica definition

block IntegerArrayHold "Block that holds the value of an integer array for a given time" parameter Integer nin=0 "Array dimension"; final parameter Integer nout=nin "Output array dimension"; parameter Real holdDuration( final quantity="Time", final unit="s")=1 "Hold duration"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput u[nin] "Connector of Real input signal"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput y[nout] "Connector of Integer output signal"; protected Real time_change; initial algorithm y := u; time_change := time; algorithm when Modelica.Math.BooleanVectors.anyTrue({ u[i] <> pre(y[i]) for i in 1:nin}) and time - time_change > holdDuration then y := u; time_change := time; end when; end IntegerArrayHold;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ModeCondenserLoop Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ModeCondenserLoop

Block that determines the condenser loop mode

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ModeCondenserLoop

Information

Tank charge fraction and rate of change

The tank charge fraction fraChaTan (-) is computed as the 5-minute moving average of the following expression: (∑i (TTani - min(TTanSet)) / (max(TTanSet) - min(TTanSet)) / nTTan - fraUslTan) / (1 - fraUslTan), where TTani is the measurement from the i-th temperature sensor along the vertical axis of the tank, TTanSet are the tank temperature setpoints (two values for each tank cycle), nTTan is the number of temperature sensors along the vertical axis of the tank, fraUslTan is the useless fraction of the tank which is computed as follows: fraUslTan = ((max(TTanSet[2]) - min(TTanSet)) / (max(TTanSet) - min(TTanSet)) * hThe + hHee) / hTan, where hThe is the height of the thermocline (m by default) which is considered useless only during the second tank cycle, hHee is the upper and lower heel heights above and below the diffusers (m by default), hTan is the tank height (used as an approximation for the normal operating level of the tank at minimum temperature).

The rate of change of the tank charge fraction ratFraChaTan (h-1) is computed over several time periods (10, 30, 120, 240 and 360 min) as: ratFraChaTan(Δt) = (fraChaTan(t) - fraChaTan(t - Δt)) / Δt * 3600, where Δt is the time period in seconds.

Operating modes

Three operating modes are defined within Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.

Charge Assist

The mode is enabled whenever any of the following conditions is true for min. Any of the rates of change exceeds the values specified with the parameter ratFraChaTanLim. The tank charge fraction is lower than 97 % and 1 - fraChaTan > 0.08 * abs(nHouToWarUp - 2), where fraChaTan is the tank charge fraction and nHouToWarUp is the number of hours between the present time and the start time of morning warmup (4 AM by default). The 2-hour offset forces Charge Assist mode two hours before morning warmup if the tank is not fully charged.

The mode is disabled whenever none of the Enable conditions is true for 15 min, or the flow rate out of the lower port of the tank is positive for min and the temperature at the bottom of the tank is higher than the maximum tank temperature setpoint minus K for min.

Heat Rejection

The mode is enabled whenever all of the following conditions are true. The Charge Assist mode is disabled for min. The flow rate out of the lower port of the tank is positive for min. The tank charge fraction is higher than 97 % for min or the temperature at the bottom of the tank is higher than the maximum tank temperature setpoint minus K for min.

The mode is disabled whenever there is reverse flow through the cooling heat exchanger for min.

Tank Charge/Discharge

The mode is enabled whenever neither Charge Assist nor Heat Rejection mode is enabled.

Parameters

TypeNameDefaultDescription
MassFlowRatemConWatHexCoo_flow_nominal Design total CW mass flow rate through condenser barrels (all units) [kg/s]
HeatFlowRateQHeaPum_flow_nominal Design heat flow from heat pumps (all units) [W]
RealratFraChaTanLim[5]{-0.3,-0.2,-0.15,-0.10,-0.08}Rate of change of tank charge fraction (over 10, 30, 120, 240, and 360') that triggers Charge Assist (<0) [1/h]
SpecificHeatCapacitycp_defaultBuildings.Utilities.Psychrom...Specific heat capacity of the fluid [J/(kg.K)]
CW loop, TES tank and heat pumps
TemperatureTTanSet[2, 2] Tank temperature setpoints: 2 cycles with 2 setpoints [K]
RealfraUslTan Useless fraction of TES [1]

Connectors

TypeNameDescription
input RealInputmConWatOutTan_flowMass flow rate out of lower port of TES tank (>0 when charging) [kg/s]
input RealInputTTan[nTTan]TES tank temperature [K]
output IntegerOutputmodeCondenser loop operating mode
input RealInputmConWatHexCoo_flowCW mass flow rate through secondary (plant) side of HX [kg/s]
input RealInputmConWatCon_flowCW condenser loop mass flow rate [kg/s]
input RealInputTConWatConChiLvgChiller and HRC leaving CW temperature [K]
input RealInputTConWatConRetCWC return temperature [K]

Modelica definition

block ModeCondenserLoop "Block that determines the condenser loop mode" parameter Modelica.Units.SI.MassFlowRate mConWatHexCoo_flow_nominal "Design total CW mass flow rate through condenser barrels (all units)"; parameter Modelica.Units.SI.HeatFlowRate QHeaPum_flow_nominal "Design heat flow from heat pumps (all units)"; parameter Modelica.Units.SI.Temperature TTanSet[2, 2] "Tank temperature setpoints: 2 cycles with 2 setpoints"; parameter Real fraUslTan(unit="1") "Useless fraction of TES"; parameter Integer nTTan=2 "Number of tank temperature points"; parameter Real ratFraChaTanLim[5](each final unit="1/h")= {-0.3, -0.2, -0.15, -0.10, -0.08} "Rate of change of tank charge fraction (over 10, 30, 120, 240, and 360') that triggers Charge Assist (<0)"; parameter Modelica.Units.SI.SpecificHeatCapacity cp_default= Buildings.Utilities.Psychrometrics.Constants.cpWatLiq "Specific heat capacity of the fluid"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConWatOutTan_flow( final unit="kg/s") "Mass flow rate out of lower port of TES tank (>0 when charging)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TTan[nTTan]( each final unit="K", each displayUnit="degC") "TES tank temperature"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput mode( final min=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.tankCharge, final max=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.heatRejection) "Condenser loop operating mode"; Real fraChaTanIns(final unit="1")= (sum(TTan .- min(TTanSet)) / (max(TTanSet) - min(TTanSet)) / nTTan - fraUslTan) / (1 - fraUslTan) "Tank charge fraction (instantaneous value)"; Real ratFraChaTan[5](each final unit="1/h")= {(fraChaTan.y - delay(fraChaTan.y, x)) / x * 3600 for x in {10, 30, 120, 240, 360} .* 60} "Rate of change of tank charge fraction (over 10, 30, 120, 240, and 360')"; Real nHouToWarUp(final unit="h") = noEvent( if mod(time, 24 * 3600) > 4 * 3600 then 4 + 24 - mod(time, 24 * 3600) / 3600 else 4 - mod(time, 24 * 3600) / 3600) "Number of hours between next warmup period (set at 4 AM by default)"; Modelica.Blocks.Sources.RealExpression ratFraChaTanVal[5](final y=ratFraChaTan) "Rate of change of tank charge fraction"; Buildings.Controls.OBC.CDL.Reals.LessThreshold lesThr[5]( final t=ratFraChaTanLim, each h=1E-4) "Compare rate of change to threshold"; Buildings.Controls.OBC.CDL.Logical.Timer tim[5](each t=5*60) "Condition is true for given time"; Buildings.Controls.OBC.CDL.Logical.MultiOr anyEnaTru(nin=6) "Any of the enable conditions is true"; Modelica.Blocks.Sources.RealExpression varCriWarUp(y=1 - fraChaTan.y) "Compute variable used to evaluate warmup criterion"; Buildings.Controls.OBC.CDL.Reals.Greater criWarUp(h=1e-3) "Enable criterion based on time to warmup"; Buildings.Controls.OBC.CDL.Logical.And criWarUpAndChaLow "Both enable criteria met"; Buildings.Controls.OBC.CDL.Reals.LessThreshold criChaLow(t=0.97, h=1e-3) "Low charge fraction criterion"; Buildings.Controls.OBC.CDL.Logical.Not enaFal[6] "True if enabling condition is false"; Buildings.Controls.OBC.CDL.Logical.MultiAnd noEnaTruAndRatCon(nin=7) "None of the enable conditions is true AND HR rate condition true"; Buildings.Controls.OBC.CDL.Logical.Timer tim2(t=15*60) "None of the enabling conditions is true for given time"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold criFlo(t=1E-3* mConWatHexCoo_flow_nominal, h=1E-3*mConWatHexCoo_flow_nominal/2) "Disable criterion based on flow rate"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold criTem(t=max(TTanSet) - 2, h=1e-3) "Disable criterion based on temperature"; Buildings.Controls.OBC.CDL.Logical.And criFloAndTem "Flow criterion and temperature criterion both true"; Buildings.Controls.OBC.CDL.Logical.Timer timCriFlo(t=5*60) "Criterion true for given time"; Buildings.Controls.OBC.CDL.Logical.Or disCha "Any of the disabling conditions is true"; Buildings.Controls.OBC.CDL.Logical.Latch enaCha "Enable charge assist mode"; Buildings.Controls.OBC.CDL.Logical.Timer timNotCha(t=5*60); Buildings.Controls.OBC.CDL.Logical.Timer timCriTem(t=5*60) "Criterion true for given time"; Buildings.Controls.OBC.CDL.Logical.Not criFraChaHig "High charge fraction criterion"; Buildings.Controls.OBC.CDL.Logical.And allEnaTru "All enable criteria true"; Buildings.Controls.OBC.CDL.Logical.And criTemOrCriChaHigAndTimCriFlo "Temperature or high charge fraction criterion true and given time criterion true"; Buildings.Controls.OBC.CDL.Logical.Timer timCriFraChaHig(t=5*60); Buildings.Controls.OBC.CDL.Logical.Or criTemOrCriChaHig "Temperature criterion or high charge fraction criterion true"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConWatHexCoo_flow(final unit="kg/s") "CW mass flow rate through secondary (plant) side of HX"; Buildings.Controls.OBC.CDL.Reals.LessThreshold criFlo1(t=-1E-3* mConWatHexCoo_flow_nominal, h=1E-3*mConWatHexCoo_flow_nominal/2); Buildings.Controls.OBC.CDL.Logical.Timer timCriFlo1(t=60) "Criterion true for given time"; Buildings.Controls.OBC.CDL.Logical.Latch enaRej "Enable heat rejection mode"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant modTan( final k=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.tankCharge) "Tank Charge/Discharge mode"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant modRej( final k=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.heatRejection) "Heat rejection mode"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant modCha( final k=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.chargeAssist) "Charge assist mode"; Buildings.Controls.OBC.CDL.Integers.Switch intSwi; Buildings.Controls.OBC.CDL.Integers.Switch intSwi1; Modelica.Blocks.Sources.RealExpression varCriWarUp1( final y=0.08*abs(nHouToWarUp - 2)) "Compute variable used to evaluate warmup criterion"; Buildings.Controls.OBC.CDL.Logical.Not isChaDis "Charge assist mode disabled"; Buildings.Controls.OBC.CDL.Logical.And enaAndNotDis "Reset enable condition when disable is true to trigger latch block when (enable, disable) becomes (true, false) again"; Buildings.Controls.OBC.CDL.Logical.Not notDis "Not disabled"; Buildings.Controls.OBC.CDL.Logical.And enaAndNotDis1 "Reset enable condition when disable is true to trigger latch block when (enable, disable) becomes (true, false) again"; Buildings.Controls.OBC.CDL.Logical.Not notDis1 "Not disabled"; Buildings.Controls.OBC.CDL.Reals.MovingAverage fraChaTan(delta=5*60) "Moving mean of tank charge fraction used for control logic"; Modelica.Blocks.Sources.RealExpression fraChaTanVal(y=fraChaTanIns) "Instantaneous tank charge fraction"; Buildings.Controls.OBC.CDL.Logical.Timer tim1(t=5*60) "Condition is true for given time"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConWatCon_flow(final unit="kg/s") "CW condenser loop mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatConChiLvg(final unit="K", displayUnit="degC") "Chiller and HRC leaving CW temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatConRet(final unit="K", displayUnit="degC") "CWC return temperature"; Buildings.Controls.OBC.CDL.Reals.Subtract delTem "Compute Delta-T"; Buildings.Controls.OBC.CDL.Reals.Multiply floOutHeaPum "Compute HP heat flow rate output "; Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter floCap(final k= cp_default) "Compute capacity flow rate"; Buildings.Controls.OBC.CDL.Reals.Subtract delTem1 "Compute Delta-T"; Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter floCap1(final k= cp_default) "Compute capacity flow rate"; Buildings.Controls.OBC.CDL.Reals.Multiply floChaTan "Compute tank charge rate"; Buildings.Controls.OBC.CDL.Reals.Subtract ratHeaRec "Compute heat recovery rate"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold criRatHeaRec(final t= 1E-4*(mConWatHexCoo_flow_nominal*(TTanSet[1, 2] - TTanSet[1, 1])*4184 - QHeaPum_flow_nominal), final h=1E-4*(mConWatHexCoo_flow_nominal*( TTanSet[1, 2] - TTanSet[1, 1])*4184 - QHeaPum_flow_nominal)/2) "Disable criterion based on heat recovery rate"; equation connect(ratFraChaTanVal.y, lesThr.u); connect(criWarUp.y, criWarUpAndChaLow.u1); connect(criChaLow.y, criWarUpAndChaLow.u2); connect(noEnaTruAndRatCon.y, tim2.u); connect(disCha.y, enaCha.clr); connect(criTem.y, timCriTem.u); connect(criFlo.y, timCriFlo.u); connect(timCriFlo.passed, criFloAndTem.u1); connect(timCriTem.passed, criFloAndTem.u2); connect(criChaLow.y, criFraChaHig.u); connect(criFloAndTem.y, disCha.u1); connect(timNotCha.passed, allEnaTru.u1); connect(criFraChaHig.y, timCriFraChaHig.u); connect(timCriTem.passed, criTemOrCriChaHig.u1); connect(timCriFraChaHig.passed, criTemOrCriChaHig.u2); connect(criFlo1.y, timCriFlo1.u); connect(timCriFlo1.passed,enaRej. clr); connect(enaRej.y, intSwi1.u2); connect(modRej.y, intSwi1.u1); connect(modTan.y, intSwi1.u3); connect(intSwi.y, mode); connect(enaCha.y, intSwi.u2); connect(modCha.y, intSwi.u1); connect(intSwi1.y, intSwi.u3); connect(varCriWarUp1.y, criWarUp.u2); connect(varCriWarUp.y, criWarUp.u1); connect(TTan[nTTan], criTem.u); connect(isChaDis.y, timNotCha.u); connect(enaCha.y, isChaDis.u); connect(mConWatHexCoo_flow, criFlo1.u); connect(mConWatOutTan_flow, criFlo.u); connect(disCha.y, notDis.u); connect(notDis.y, enaAndNotDis.u1); connect(enaAndNotDis.y, enaCha.u); connect(enaAndNotDis1.y, enaRej.u); connect(allEnaTru.y, enaAndNotDis1.u1); connect(notDis1.y, enaAndNotDis1.u2); connect(timCriFlo1.passed, notDis1.u); connect(fraChaTanVal.y, fraChaTan.u); connect(fraChaTan.y, criChaLow.u); connect(lesThr.y, tim.u); connect(criWarUpAndChaLow.y, tim1.u); connect(enaAndNotDis.u2, anyEnaTru.y); connect(tim.passed, anyEnaTru.u[1:5]); connect(tim1.passed, anyEnaTru.u[6]); connect(lesThr.y, enaFal[1:5].u); connect(criWarUpAndChaLow.y, enaFal[6].u); connect(enaFal.y, noEnaTruAndRatCon.u[1:6]); connect(TConWatConRet, delTem.u1); connect(TConWatConChiLvg, delTem.u2); connect(mConWatCon_flow, floCap.u); connect(floCap.y, floOutHeaPum.u1); connect(delTem.y, floOutHeaPum.u2); connect(mConWatOutTan_flow, floCap1.u); connect(floCap1.y,floChaTan. u1); connect(delTem1.y,floChaTan. u2); connect(TTan[1], delTem1.u1); connect(TTan[nTTan], delTem1.u2); connect(floOutHeaPum.y, ratHeaRec.u2); connect(floChaTan.y, ratHeaRec.u1); connect(criRatHeaRec.y, noEnaTruAndRatCon.u[7]); connect(tim2.passed, disCha.u2); connect(ratHeaRec.y, criRatHeaRec.u); connect(criTemOrCriChaHig.y, criTemOrCriChaHigAndTimCriFlo.u2); connect(timCriFlo.passed, criTemOrCriChaHigAndTimCriFlo.u1); connect(criTemOrCriChaHigAndTimCriFlo.y, allEnaTru.u2); end ModeCondenserLoop;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ModeHeatRecoveryChiller Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ModeHeatRecoveryChiller

Block that computes the cascading cooling and direct HR switchover signals

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ModeHeatRecoveryChiller

Information

This block computes the command signals to the HRCs to initiate the switchover into either cascading cooling mode (with the evaporator indexed to the CHW loop and the condenser indexed to the CW loop) or direct heat recovery mode (with the evaporator indexed to the CHW loop and the condenser indexed to the HW loop). Switching a HRC to cascading cooling mode is done starting from the unit nearest to the CW interconnection, that is the unit with the highest index. Switching a HRC to direct heat recovery mode is done starting from the unit nearest to the CW interconnection and that is not operating in cascading cooling, that is the unit with the highest index below the lowest index of HRCs operating in cascading cooling mode.

Parameters

TypeNameDefaultDescription
IntegernChiHea Number of HRC

Connectors

TypeNameDescription
input IntegerInputnCasCooNumber of units required to be operating in cascading cooling mode
input IntegerInputnHeaCooNumber of HRC required to be operating in direct HR mode
output BooleanOutputy1Coo[nChiHea]Command signal for cascading cooling mode
output BooleanOutputy1HeaCoo[nChiHea]Command signal for direct HR mode

Modelica definition

block ModeHeatRecoveryChiller "Block that computes the cascading cooling and direct HR switchover signals" parameter Integer nChiHea "Number of HRC"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput nCasCoo "Number of units required to be operating in cascading cooling mode"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput nHeaCoo "Number of HRC required to be operating in direct HR mode"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Coo[nChiHea] "Command signal for cascading cooling mode"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaCoo[nChiHea] "Command signal for direct HR mode"; protected Integer lasTruIdx; Integer counter; algorithm y1Coo := fill(false, nChiHea); y1HeaCoo := fill(false, nChiHea); lasTruIdx := 0; counter := 1; for i in 1:nChiHea loop if counter > nHeaCoo then break; end if; if i > nCasCoo then y1HeaCoo[nChiHea - i + 1] := true; counter := counter + 1; end if; end for; for i in 1:nChiHea loop if y1HeaCoo[i] then lasTruIdx := i; end if; end for; counter := 1; for i in 1:nChiHea loop if counter > nCasCoo then break; end if; y1Coo[nChiHea - i + 1] := true; counter := counter + 1; end for; end ModeHeatRecoveryChiller;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.PartialController Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.PartialController

Interface class for plant controller

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.PartialController

Information

This block serves as an interface class for the plant controller.

Parameters

TypeNameDefaultDescription
RealPLRStaTra0.85Part load ratio triggering stage transition [1]
SpecificHeatCapacitycp_defaultBuildings.Utilities.Psychrom...Specific heat capacity of the fluid [J/(kg.K)]
CHW loop and cooling-only chillers
IntegernChi Number of units operating at design conditions
IntegernPumChiWat Number of CHW pumps operating at design conditions
TemperatureTChiWatSup_nominal Design (minimum) CHW supply temperature [K]
HeatFlowRateQChiWatChi_flow_nominal Cooling design heat flow rate of cooling-only chillers (all units) [W]
MassFlowRatemChiWat_flow_nominal CHW design mass flow rate (all units) [kg/s]
PressureDifferencedpChiWatSet_max Design (maximum) CHW differential pressure setpoint [Pa]
MassFlowRatemChiWatChi_flow_nominal Chiller CHW design mass flow rate (each unit) [kg/s]
MassFlowRatemChiWatChi_flow_min Chiller CHW minimum mass flow rate (each unit) [kg/s]
MassFlowRatemConWatChi_flow_nominal Chiller CW design mass flow rate (each unit) [kg/s]
PressureDifferencedpEvaChi_nominal Chiller evaporator design pressure drop (each unit) [Pa]
PressureDifferencedpValEvaChi_nominal Chiller evaporator isolation valve design pressure drop (each unit) [Pa]
TemperatureDifferencedTLifChi_min Minimum chiller lift at minimum load [K]
TemperatureDifferencedTLifChi_nominal Design chiller lift [K]
HW loop and heat recovery chillers
IntegernChiHea Number of units operating at design conditions
IntegernPumHeaWat Number of HW pumps operating at design conditions
TemperatureTHeaWatSup_nominal Design (maximum) HW supply temperature [K]
HeatFlowRateQChiWatCasCoo_flow_nominal Cooling design heat flow rate of HRC in cascading cooling mode (all units) [W]
HeatFlowRateQChiWatCasCoo_flow_nominal_approx Cooling design heat flow rate of HRC in cascading cooling mode (all units), approximate for scaling [W]
HeatFlowRateQHeaWat_flow_nominal Heating design heat flow rate (all units) [W]
MassFlowRatemHeaWat_flow_nominal HW design mass flow rate (all units) [kg/s]
PressureDifferencedpHeaWatSet_max Design (maximum) HW differential pressure setpoint [Pa]
MassFlowRatemChiWatChiHea_flow_nominal HRC CHW design mass flow rate (each unit) [kg/s]
MassFlowRatemChiWatChiHea_flow_min HRC CHW minimum mass flow rate (each unit) [kg/s]
MassFlowRatemConWatChiHea_flow_nominal HRC CW design mass flow rate (each unit) [kg/s]
MassFlowRatemHeaWatChiHea_flow_min Chiller HW minimum mass flow rate (each unit) [kg/s]
PressureDifferencedpEvaChiHea_nominal Design chiller evaporator pressure drop (each unit) [Pa]
PressureDifferencedpValEvaChiHea_nominal HRC evaporator isolation valve design pressure drop (each unit) [Pa]
CW loop, TES tank and heat pumps
IntegernHeaPum Number of heat pumps operating at design conditions
IntegernPumConWatCon Number of CW pumps serving condenser barrels at design conditions
IntegernPumConWatEva Number of CW pumps serving evaporator barrels at design conditions
HeatFlowRateQHeaPum_flow_nominal Heating design heat flow rate of heat pumps (all units) [W]
MassFlowRatemConWatCon_flow_nominal Design total CW mass flow rate through condenser barrels (all units) [kg/s]
MassFlowRatemConWatEva_flow_nominal Design total CW mass flow rate through evaporator barrels (all units) [kg/s]
PressureDifferencedpConWatConSet_max Design (maximum) CW condenser loop differential pressure setpoint [Pa]
PressureDifferencedpConWatEvaSet_max Design (maximum) CW evaporator loop differential pressure setpoint [Pa]
TemperatureTTanSet[2, 2] Tank temperature setpoints: 2 cycles with 2 setpoints [K]
RealfraUslTan Useless fraction of TES [1]
RealratFraChaTanLim[5]{-0.3,-0.2,-0.15,-0.10,-0.08}Rate of change of tank charge fraction (over 10, 30, 120, 240, and 360') that triggers Charge Assist (<0) [1/h]
Cooling tower loop
IntegernCoo Number of cooling tower cells operating at design conditions
IntegernPumConWatCoo Number of CW pumps serving cooling towers at design conditions
TemperatureDifferencedTHexCoo_nominal Design heat exchanger approach [K]
Dynamics
Filtered speed
TimeriseTimePum30Pump rise time of the filter (time to reach 99.6 % of the speed) [s]
Filtered opening
TimeriseTimeVal120Pump rise time of the filter (time to reach 99.6 % of the opening) [s]

Connectors

TypeNameDescription
input BooleanInputu1CooCooling enable signal
input BooleanInputu1HeaHeating enable signal
input RealInputTChiWatSupSetCHW supply temperature setpoint [K]
input RealInputTHeaWatSupSetHW supply temperature setpoint [K]
output RealOutputyValEvaChi[nChi]Cooling-only chiller evaporator isolation valve commanded position
output RealOutputyValConChi[nChi]Cooling-only chiller condenser isolation valve commanded position [1]
output BooleanOutputy1Chi[nChi]Cooling-only chiller On/Off command
output BooleanOutputy1PumChiWat[nPumChiWat]CHW pump Start command
output RealOutputyPumChiWatCHW pump speed signal [1]
output RealOutputyValEvaChiHea[nChiHea]HRC evaporator isolation valve commanded position [1]
output BooleanOutputy1ChiHea[nChiHea]HRC On/Off command
output BooleanOutputy1CooChiHea[nChiHea]HRC cooling mode switchover command: true for cooling, false for heating
output RealOutputyValConChiHea[nChiHea]HRC condenser isolation valve commanded position [1]
output BooleanOutputy1PumHeaWat[nPumHeaWat]HW pump Start command
output RealOutputyPumHeaWatHW pump speed signal [1]
output RealOutputyValChiWatMinBypCHW minimum flow bypass valve control signal [1]
output RealOutputyValHeaWatMinBypHW minimum flow bypass valve control signal [1]
output BooleanOutputy1PumConWatCon[nPumConWatCon]CW pump serving condenser barrels Start command
output RealOutputyPumConWatConCW pump serving condenser barrels Speed command [1]
output BooleanOutputy1PumConWatEva[nPumConWatEva]CW pump serving evaporator barrels Start command
output RealOutputyPumConWatEvaCW pump serving evaporator barrels Speed command [1]
output BooleanOutputy1HeaPum[nHeaPum]Heat pump On/Off command
output RealOutputTHeaPumSetHeat pump supply temperature setpoint [K]
output RealOutputyValBypTanTES tank bypass valve commanded position [1]
output BooleanOutputy1Coo[nCoo]Cooling tower Start command
output RealOutputyCooCooling tower fan speed command [1]
output BooleanOutputy1PumConWatCoo[nPumConWatCoo]Cooling tower pump Start command
output RealOutputTChiHeaSet[nChiHea]HRC supply temperature setpoint [K]
output BooleanOutputy1HeaCooChiHea[nChiHea]HRC direct heat recovery switchover command: true for direct HR, false for cascading
input RealInputdpChiWatSetCHW differential pressure setpoint (for local dp sensor) [Pa]
input RealInputdpHeaWatSetHW differential pressure setpoint (for local dp sensor) [Pa]
input RealInputdpChiWatCHW differential pressure (from local dp sensor) [Pa]
input RealInputdpHeaWatHW differential pressure (from local dp sensor) [Pa]
input RealInputmChiWatPri_flowPrimary CHW mass flow rate [kg/s]
input RealInputmHeaWatPri_flowPrimary HW mass flow rate [kg/s]
input RealInputdpConWatConCW condenser loop differential pressure [Pa]
input RealInputdpConWatEvaCW evaporator loop differential pressure [Pa]
input RealInputmConWatCon_flowCW condenser loop mass flow rate [kg/s]
input RealInputmConWatEva_flowCW evaporator loop mass flow rate [kg/s]
input RealInputTChiWatSupCHW supply temperature [K]
input RealInputTChiWatPriRetPrimary CHW return temperature [K]
input RealInputTHeaWatPriRetPrimary HW return temperature [K]
input RealInputTTan[nTTan]TES tank temperature [K]
input RealInputmConWatHexCoo_flowCW mass flow rate through secondary (plant) side of HX [kg/s]
input RealInputmConWatOutTan_flowMass flow rate out of lower port of TES tank (>0 when charging) [kg/s]
input RealInputmEvaChi_flow[nChi]Chiller evaporator barrel mass flow rate [kg/s]
input RealInputmConChi_flow[nChi]Chiller condenser barrel mass flow rate [kg/s]
input RealInputmEvaChiHea_flow[nChiHea]HRC evaporator barrel mass flow rate [kg/s]
input RealInputmConChiHea_flow[nChiHea]HRC condenser barrel mass flow rate [kg/s]
output RealOutputyValEvaSwiHea[nChiHea]HRC evaporator switchover valve commanded position [1]
output RealOutputyValConSwiChiHea[nChiHea]HRC condenser switchover valve commanded position [1]
input RealInputTEvaLvgChiHea[nChiHea]HRC evaporator barrel leaving temperature [K]
input RealInputTHeaWatSupHW supply temperature [K]
output RealOutputyPumConWatCooCooling tower pump speed command
input RealInputTConWatConChiEntChiller and HRC entering CW temperature [K]
input RealInputTConWatConChiLvgChiller and HRC leaving CW temperature [K]
input RealInputTConWatCooSupCooling tower loop CW supply temperature [K]
input RealInputTConWatCooRetCooling tower loop CW return temperature [K]
input RealInputTConWatHexCooEntHX entering CW temperature [K]
input RealInputTConWatHexCooLvgHX leaving CW temperature [K]
input RealInputTConEntChiHea[nChiHea]HRC condenser barrel entering temperature [K]
input RealInputTConLvgChiHea[nChiHea]HRC condenser barrel leaving temperature [K]
input RealInputTConWatEvaEntHRC evaporator entering CW temperature [K]
output RealOutputyValConWatEvaMixHRC evaporator CW mixing valve commanded position
input RealInputTConWatConRetCondenser loop CW return temperature [K]
input RealInputTConLvgChi[nChi]Chiller condenser barrel leaving temperature [K]
output RealOutputyValConWatBypCW chiller bypass valve control signal [1]

Modelica definition

block PartialController "Interface class for plant controller" parameter Integer nChi(final min=1, start=1) "Number of units operating at design conditions"; parameter Integer nPumChiWat(final min=1, start=1) "Number of CHW pumps operating at design conditions"; parameter Modelica.Units.SI.Temperature TChiWatSup_nominal "Design (minimum) CHW supply temperature"; parameter Integer nChiHea(final min=1, start=1) "Number of units operating at design conditions"; parameter Integer nPumHeaWat(final min=1, start=1) "Number of HW pumps operating at design conditions"; parameter Modelica.Units.SI.Temperature THeaWatSup_nominal "Design (maximum) HW supply temperature"; parameter Integer nHeaPum(final min=1, start=1) "Number of heat pumps operating at design conditions"; parameter Integer nPumConWatCon(final min=1, start=1) "Number of CW pumps serving condenser barrels at design conditions"; parameter Integer nPumConWatEva(final min=1, start=1) "Number of CW pumps serving evaporator barrels at design conditions"; parameter Integer nCoo(final min=1, start=1) "Number of cooling tower cells operating at design conditions"; parameter Integer nPumConWatCoo(final min=1, start=1) "Number of CW pumps serving cooling towers at design conditions"; parameter Modelica.Units.SI.HeatFlowRate QChiWatChi_flow_nominal "Cooling design heat flow rate of cooling-only chillers (all units)"; parameter Modelica.Units.SI.HeatFlowRate QHeaPum_flow_nominal "Heating design heat flow rate of heat pumps (all units)"; parameter Real PLRStaTra(final unit="1", final min=0, final max=1) = 0.85 "Part load ratio triggering stage transition"; parameter Modelica.Units.SI.HeatFlowRate QChiWatCasCoo_flow_nominal "Cooling design heat flow rate of HRC in cascading cooling mode (all units)"; parameter Modelica.Units.SI.HeatFlowRate QChiWatCasCoo_flow_nominal_approx "Cooling design heat flow rate of HRC in cascading cooling mode (all units), approximate for scaling"; final parameter Modelica.Units.SI.HeatFlowRate QChiWat_flow_nominal= QChiWatChi_flow_nominal+QChiWatCasCoo_flow_nominal "Plant cooling design heat flow rate (all units)"; parameter Modelica.Units.SI.HeatFlowRate QHeaWat_flow_nominal "Heating design heat flow rate (all units)"; parameter Modelica.Units.SI.SpecificHeatCapacity cp_default= Buildings.Utilities.Psychrometrics.Constants.cpWatLiq "Specific heat capacity of the fluid"; parameter Modelica.Units.SI.MassFlowRate mChiWat_flow_nominal( final min=0) "CHW design mass flow rate (all units)"; parameter Modelica.Units.SI.PressureDifference dpChiWatSet_max( final min=0, displayUnit="Pa") "Design (maximum) CHW differential pressure setpoint"; parameter Modelica.Units.SI.MassFlowRate mHeaWat_flow_nominal "HW design mass flow rate (all units)"; parameter Modelica.Units.SI.PressureDifference dpHeaWatSet_max( final min=0, displayUnit="Pa") "Design (maximum) HW differential pressure setpoint"; parameter Modelica.Units.SI.MassFlowRate mConWatCon_flow_nominal( final min=0) "Design total CW mass flow rate through condenser barrels (all units)"; parameter Modelica.Units.SI.MassFlowRate mConWatEva_flow_nominal( final min=0) "Design total CW mass flow rate through evaporator barrels (all units)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChi_flow_nominal "Chiller CHW design mass flow rate (each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChi_flow_min "Chiller CHW minimum mass flow rate (each unit)"; parameter Modelica.Units.SI.MassFlowRate mConWatChi_flow_nominal "Chiller CW design mass flow rate (each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChiHea_flow_nominal "HRC CHW design mass flow rate (each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChiHea_flow_min "HRC CHW minimum mass flow rate (each unit)"; parameter Modelica.Units.SI.MassFlowRate mConWatChiHea_flow_nominal "HRC CW design mass flow rate (each unit)"; parameter Modelica.Units.SI.MassFlowRate mHeaWatChiHea_flow_min "Chiller HW minimum mass flow rate (each unit)"; parameter Modelica.Units.SI.PressureDifference dpEvaChi_nominal( final min=0, displayUnit="Pa") "Chiller evaporator design pressure drop (each unit)"; parameter Modelica.Units.SI.PressureDifference dpValEvaChi_nominal( final min=0, displayUnit="Pa") "Chiller evaporator isolation valve design pressure drop (each unit)"; parameter Modelica.Units.SI.PressureDifference dpEvaChiHea_nominal( final min=0, displayUnit="Pa") "Design chiller evaporator pressure drop (each unit)"; parameter Modelica.Units.SI.PressureDifference dpValEvaChiHea_nominal( final min=0, displayUnit="Pa") "HRC evaporator isolation valve design pressure drop (each unit)"; parameter Modelica.Units.SI.PressureDifference dpConWatConSet_max( final min=0, displayUnit="Pa") "Design (maximum) CW condenser loop differential pressure setpoint"; parameter Modelica.Units.SI.PressureDifference dpConWatEvaSet_max( final min=0, displayUnit="Pa") "Design (maximum) CW evaporator loop differential pressure setpoint"; parameter Modelica.Units.SI.Temperature TTanSet[2, 2] "Tank temperature setpoints: 2 cycles with 2 setpoints"; parameter Real fraUslTan(final unit="1", final min=0, final max=1) "Useless fraction of TES"; parameter Integer nTTan(final min=0)=0 "Number of tank temperature points"; parameter Real ratFraChaTanLim[5](each final unit="1/h")= {-0.3, -0.2, -0.15, -0.10, -0.08} "Rate of change of tank charge fraction (over 10, 30, 120, 240, and 360') that triggers Charge Assist (<0)"; parameter Modelica.Units.SI.TemperatureDifference dTLifChi_min "Minimum chiller lift at minimum load"; parameter Modelica.Units.SI.TemperatureDifference dTLifChi_nominal "Design chiller lift"; parameter Modelica.Units.SI.TemperatureDifference dTHexCoo_nominal "Design heat exchanger approach"; parameter Modelica.Units.SI.Time riseTimePum=30 "Pump rise time of the filter (time to reach 99.6 % of the speed)"; parameter Modelica.Units.SI.Time riseTimeVal=120 "Pump rise time of the filter (time to reach 99.6 % of the opening)"; 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 THeaWatSupSet(final unit="K", displayUnit="degC") "HW supply temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValEvaChi[nChi] "Cooling-only chiller evaporator isolation valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConChi[nChi]( each final unit="1") "Cooling-only chiller condenser isolation valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Chi[nChi] "Cooling-only chiller On/Off command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumChiWat[nPumChiWat] "CHW pump Start command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yPumChiWat( final unit="1") "CHW pump speed signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValEvaChiHea[nChiHea]( each final unit="1") "HRC evaporator isolation valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ChiHea[nChiHea] "HRC On/Off command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1CooChiHea[nChiHea] "HRC cooling mode switchover command: true for cooling, false for heating"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConChiHea[nChiHea]( each final unit="1") "HRC condenser isolation valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumHeaWat[nPumHeaWat] "HW pump Start command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yPumHeaWat( final unit="1") "HW pump speed signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValChiWatMinByp( final unit="1") "CHW minimum flow bypass valve control signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValHeaWatMinByp( final unit="1") "HW minimum flow bypass valve control signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumConWatCon[nPumConWatCon] "CW pump serving condenser barrels Start command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yPumConWatCon( final unit="1") "CW pump serving condenser barrels Speed command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumConWatEva[nPumConWatEva] "CW pump serving evaporator barrels Start command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yPumConWatEva( final unit="1") "CW pump serving evaporator barrels Speed command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaPum[nHeaPum] "Heat pump On/Off command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput THeaPumSet( final unit="K", displayUnit="degC") "Heat pump supply temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValBypTan( final unit="1") "TES tank bypass valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Coo[nCoo] "Cooling tower Start command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yCoo( final unit="1") "Cooling tower fan speed command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumConWatCoo[ nPumConWatCoo] "Cooling tower pump Start command"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput TChiHeaSet[nChiHea]( each final unit="K", each displayUnit="degC") "HRC supply temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaCooChiHea[nChiHea] "HRC direct heat recovery switchover command: true for direct HR, false for cascading"; 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 dpHeaWatSet(final unit="Pa", final min=0) "HW differential pressure setpoint (for local dp sensor)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpChiWat(final unit="Pa") "CHW differential pressure (from local dp sensor)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpHeaWat(final unit="Pa") "HW differential pressure (from local dp sensor)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mChiWatPri_flow(final unit= "kg/s") "Primary CHW mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mHeaWatPri_flow(final unit= "kg/s") "Primary HW mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpConWatCon(final unit="Pa") "CW condenser loop differential pressure"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpConWatEva(final unit="Pa") "CW evaporator loop differential pressure"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConWatCon_flow(final unit= "kg/s") "CW condenser loop mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConWatEva_flow(final unit= "kg/s") "CW evaporator loop mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TChiWatSup(final unit="K", displayUnit="degC") "CHW supply temperature "; Buildings.Controls.OBC.CDL.Interfaces.RealInput TChiWatPriRet(final unit="K", displayUnit="degC") "Primary CHW return temperature "; Buildings.Controls.OBC.CDL.Interfaces.RealInput THeaWatPriRet(final unit="K", displayUnit="degC") "Primary HW return temperature "; Buildings.Controls.OBC.CDL.Interfaces.RealInput TTan[nTTan]( each final unit="K", each displayUnit="degC") "TES tank temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConWatHexCoo_flow(final unit ="kg/s") "CW mass flow rate through secondary (plant) side of HX"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConWatOutTan_flow(final unit ="kg/s") "Mass flow rate out of lower port of TES tank (>0 when charging)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mEvaChi_flow[nChi]( each final unit="kg/s") "Chiller evaporator barrel mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConChi_flow[nChi]( each final unit="kg/s") "Chiller condenser barrel mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mEvaChiHea_flow[nChiHea]( each final unit="kg/s") "HRC evaporator barrel mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConChiHea_flow[nChiHea]( each final unit="kg/s") "HRC condenser barrel mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValEvaSwiHea[nChiHea]( each final unit="1") "HRC evaporator switchover valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConSwiChiHea[nChiHea]( each final unit="1") "HRC condenser switchover valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TEvaLvgChiHea[nChiHea]( each final unit="K", each displayUnit="degC") "HRC evaporator barrel leaving temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput THeaWatSup( final unit="K", displayUnit="degC") "HW supply temperature "; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yPumConWatCoo "Cooling tower pump speed command"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatConChiEnt(final unit= "K", displayUnit="degC") "Chiller and HRC entering CW temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatConChiLvg(final unit= "K", displayUnit="degC") "Chiller and HRC leaving CW temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatCooSup(final unit="K", displayUnit="degC") "Cooling tower loop CW supply temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatCooRet(final unit="K", displayUnit="degC") "Cooling tower loop CW return temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatHexCooEnt(final unit="K", displayUnit="degC") "HX entering CW temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatHexCooLvg(final unit="K", displayUnit="degC") "HX leaving CW temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConEntChiHea[nChiHea](each final unit="K", each displayUnit="degC") "HRC condenser barrel entering temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConLvgChiHea[nChiHea](each final unit="K", each displayUnit="degC") "HRC condenser barrel leaving temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatEvaEnt(final unit="K", displayUnit="degC") "HRC evaporator entering CW temperature "; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConWatEvaMix "HRC evaporator CW mixing valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatConRet(final unit ="K", displayUnit="degC") "Condenser loop CW return temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConLvgChi[nChi](each final unit="K", each displayUnit="degC") "Chiller condenser barrel leaving temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConWatByp(final unit="1") "CW chiller bypass valve control signal"; end PartialController;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StageIndex Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StageIndex

Block that computes the stage index out of staging signals

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StageIndex

Information

This block is used to compute the stage index of the plant or of multiple lead/lag units such as pump groups.

At initial time, stage #0 is active. The transition to stage #1 is triggered when stage #0 has been active for the minimum runtime and when either the Enable signal u1 has a rising edge or when the stage up signal u1Up is true.

From stage #i, the transition to stage #i+1 (resp. i-1) is triggered when stage #i has been active for the minimum runtime and when the stage up signal u1Up (resp. stage down signal u1Dow) is true. From stage #i, the transition to stage #0 is triggered when stage #i has been active for the minimum runtime and the Enable signal u1 is false.

Parameters

TypeNameDefaultDescription
IntegernSta Number of stages
TimetSta0Minimum runtime of each stage [s]

Connectors

TypeNameDescription
input BooleanInputu1Enable signal
input BooleanInputu1UpStaging up signal
input BooleanInputu1DowStaging down signal
output IntegerOutputidxStaStage index
output IntegerOutputpreIdxStaLeft limit (in discrete-time) of stage index

Modelica definition

block StageIndex "Block that computes the stage index out of staging signals" parameter Integer nSta(start=1) "Number of stages"; parameter Modelica.Units.SI.Time tSta=0 "Minimum runtime of each stage"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1 "Enable signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Up "Staging up signal"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Dow "Staging down signal"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput idxSta "Stage index"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput preIdxSta "Left limit (in discrete-time) of stage index"; Modelica.StateGraph.InitialStepWithSignal sta0( final nOut=1, final nIn=nSta+1) "Stage 0: no unit"; Modelica.StateGraph.StepWithSignal sta[nSta]( each final nIn=2, each final nOut=3) "Stage i"; Modelica.StateGraph.TransitionWithSignal enaLea( final enableTimer=false) "Transition enabling lead unit"; inner Modelica.StateGraph.StateGraphRoot stateGraphRoot "State graph root"; Modelica.StateGraph.TransitionWithSignal enaLag[nSta]( each final enableTimer=false) "Transition enabling lag unit"; Buildings.Controls.OBC.CDL.Logical.Timer tim[nSta](each final t=tSta) "Timer for minimum runtime"; Buildings.Controls.OBC.CDL.Logical.Timer tim0(final t=tSta) "Timer for minimum runtime"; Buildings.Controls.OBC.CDL.Logical.And and2 "Timer for minimum runtime"; Buildings.Controls.OBC.CDL.Logical.And andUp[nSta] "Runtime criterion met AND staging up order"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rep( final nout=nSta) "Replicate"; Buildings.Controls.OBC.CDL.Logical.And andDow[nSta] "Runtime criterion met AND staging down order"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rep1( final nout=nSta) "Replicate"; Modelica.StateGraph.TransitionWithSignal disLag[nSta]( each final enableTimer=false) "Transition disabling lag unit"; Modelica.StateGraph.TransitionWithSignal disAll[nSta]( each final enableTimer=false) "Transition disabling all units"; Buildings.Controls.OBC.CDL.Logical.And andNotEna[nSta] "Runtime criterion met AND enable signal false"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rep2( final nout=nSta) "Replicate"; Buildings.Controls.OBC.CDL.Logical.Not not1 "True if enable signal false"; Modelica.Blocks.Sources.IntegerExpression calIdxSta(final y= Modelica.Math.BooleanVectors.firstTrueIndex(sta.active)) "Compute stage index"; Buildings.Controls.OBC.CDL.Logical.Edge edg "Transition to stage 1 at enable time"; Buildings.Controls.OBC.CDL.Logical.Or or2 "Transition to stage 1 at enable time or staging up order"; Modelica.Blocks.Sources.IntegerExpression calPre(final y=pre(idxSta)) "Compute left limit of stage index"; Buildings.Controls.OBC.CDL.Logical.And upAndEna "Stage up only if enabled"; Buildings.Controls.OBC.CDL.Logical.And dowOrDis "Stage down if disabled"; initial equation preIdxSta=0; equation for i in 1:(nSta - 1) loop connect(enaLag[i].outPort, sta[i+1].inPort[1]); connect(disLag[i+1].outPort, sta[i].inPort[2]); end for; connect(enaLag[nSta].outPort, sta[nSta].inPort[2]); connect(disAll.outPort, sta0.inPort[1:nSta]); connect(sta0.outPort[1], enaLea.inPort); connect(enaLea.outPort, sta[1].inPort[1]); connect(disLag[1].outPort, sta0.inPort[nSta+1]); connect(sta.outPort[1], disAll.inPort); connect(sta.outPort[2], enaLag.inPort); connect(sta.outPort[3], disLag.inPort); connect(sta.active, tim.u); connect(sta0.active, tim0.u); connect(tim0.passed, and2.u2); connect(and2.y, enaLea.condition); connect(rep.y, andUp.u2); connect(andUp.y, enaLag.condition); connect(tim.passed, andDow.u1); connect(rep1.y, andDow.u2); connect(tim.passed, andUp.u1); connect(andDow.y, disLag.condition); connect(u1, not1.u); connect(not1.y, rep2.u); connect(rep2.y, andNotEna.u1); connect(tim.passed, andNotEna.u2); connect(andNotEna.y, disAll.condition); connect(calIdxSta.y, idxSta); connect(u1, edg.u); connect(edg.y, or2.u1); connect(or2.y, and2.u1); connect(calPre.y, preIdxSta); connect(u1, upAndEna.u2); connect(u1Up, upAndEna.u1); connect(upAndEna.y, rep.u); connect(dowOrDis.y, rep1.u); connect(u1Dow, dowOrDis.u1); connect(u1, dowOrDis.u2); connect(upAndEna.y, or2.u2); end StageIndex;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StagingPlant Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StagingPlant

Block that computes plant stage and command signals for chillers and HRC

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StagingPlant

Information

This block implements the staging logic for the chillers and HRCs. The units are staged in part based on an efficiency condition using the operative part load ratio. The units are also staged based on failsafe conditions using the CHW and HW supply temperature and differential pressure.

For the sake of simplicity, equipment rotation (i.e. the possibility at a given stage that either one unit or another unit can be operating) is not taken into account.

Plant stages

At cooling (resp. heating) stage #i, a number i of units are operating in cooling (resp. heating) mode. The cooling (resp. heating) stage #0 (no unit operating in that given mode) is active whenever the plant is disabled based on the cooling and heating Enable condition (see below) or when the plant is enabled and has been staged down due to the efficiency or failsafe conditions. The plant stage is given by the couple (cooling stage, heating stage). The minimum runtime of each plant stage is set to 15 min.

Direct heat recovery mode

All HRCs are allowed to operate in direct heat recovery mode, that is when their condenser is indexed to the HW loop and their evaporator is indexed to the CHW loop. Switching a HRC to operate in direct heat recovery mode is done on a load requirement basis. This means that HRCs are first switched over to cascading heating or cascading cooling mode. Only when all HRCs are operating and when a new stage up event is initiated, an additional HRC is then switched to operate in direct heat recovery mode. As described in Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ModeHeatRecoveryChiller the HRC with the highest index that is not operating operating in cascading cooling mode is the next to be switched into direct heat recovery mode.

For example, considering a plant with two chillers and three HRCs, the table below shows the plant stages derived from this logic. In this table, the chiller with index #i is denoted CHI#i, the HRC with index #i is denoted HRC#i, the units enumerated before (resp. after) the semicolon sign (:) operate in cooling (resp. heating) mode, the units marked with a star (*) operate in direct heat recovery mode.

Heating stage ↓ Cooling stage → 0 1 2 3 4 5
0 N/A:
N/A
CHI1:
N/A
CHI1 & CHI2:
N/A
CHI1 & CHI2 & HRC3:
N/A
CHI1 & CHI2 & HRC3 & HRC2:
N/A
CHI1 & CHI2 & HRC3 & HRC2 & HRC1:
N/A
1 N/A:
HRC1
CHI1:
HRC1
CHI1 & CHI2:
HRC1
CHI1 & CHI2 & HRC3:
HRC1
CHI1 & CHI2 & HRC3 & HRC2:
HRC1
CHI1 & CHI2 & HRC3 & HRC2:
HRC1*
2 N/A:
HRC1 & HRC2
CHI1:
HRC1 & HRC2
CHI1 & CHI2:
HRC1 & HRC2
CHI1 & CHI2 & HRC3:
HRC1 & HRC2
CHI1 & CHI2 & HRC3:
HRC1 & HRC2*
CHI1 & CHI2 & HRC3:
HRC1* & HRC2*
3 N/A:
HRC1 & HRC2 & HRC3
CHI1:
HRC1 & HRC2 & HRC3
CHI1 & CHI2:
HRC1 & HRC2 & HRC3
CHI1 & CHI2:
HRC1 & HRC2 & HRC3*
CHI1 & CHI2:
HRC1 & HRC2* & HRC3*
CHI1 & CHI2:
HRC1* & HRC2* & HRC3*

Cooling and heating Enable condition

The cooling and heating Enable signals u1Coo and u1Hea shall be computed outside of the plant model, at least based on a time schedule and ideally in conjunction with a signal representative of the demand such as the requests yielded by the consumer control valves. Based on those signals, the cooling (resp. heating) stage #1 is activated whenever the cooling (resp. heating) Enable signal switches to true and when cooling (resp. heating) has been disabled for at least 15 min.

Operative part load ratio

The efficiency condition is based on the operative part load ratio which is computed as the ratio of the required capacity relative to design capacity of a given stage, which is the sum of the design capacity of each unit active in a given stage. The required capacity is calculated based on the primary mass flow rate and the temperature difference between supply and primary return, and averaged over a 5-minute moving window.

Cooling and heating staging

A stage up event is initiated if any of the following conditions is true.

A stage down event is initiated if both of the following conditions are true.

Parameters

TypeNameDefaultDescription
RealPLRStaTra0.85Part load ratio triggering stage transition [1]
SpecificHeatCapacitycp_defaultBuildings.Utilities.Psychrom...Specific heat capacity of the fluid [J/(kg.K)]
CHW loop and cooling-only chillers
IntegernChi Number of units operating at design conditions
HeatFlowRateQChiWatChi_flow_nominal Cooling design heat flow rate of cooling-only chillers (all units) [W]
HW loop and heat recovery chillers
IntegernChiHea Number of units operating at design conditions
HeatFlowRateQChiWatCasCoo_flow_nominal Cooling design heat flow rate of HRC in cascading cooling mode (all units) [W]
HeatFlowRateQChiWatCasCoo_flow_nominal_approx Cooling design heat flow rate of HRC in cascading cooling mode (all units), approximate for scaling [W]
HeatFlowRateQHeaWat_flow_nominal Heating design heat flow rate (all units) [W]

Connectors

TypeNameDescription
input RealInputmChiWatPri_flowPrimary CHW mass flow rate [kg/s]
input RealInputTChiWatSupSetCHW supply temperature setpoint [K]
input RealInputTChiWatPriRetPrimary CHW return temperature [K]
input RealInputmHeaWatPri_flowPrimary HW mass flow rate [kg/s]
input RealInputTHeaWatSupSetHW supply temperature setpoint [K]
input RealInputTHeaWatPriRetPrimary HW return temperature [K]
input RealInputTChiWatSupCHW supply temperature [K]
input RealInputdpChiWatCHW loop differential pressure [Pa]
input RealInputdpChiWatSetCHW loop differential pressure setpoint [Pa]
input RealInputTHeaWatSupHW supply temperature [K]
input RealInputdpHeaWatHW loop differential pressure [Pa]
input RealInputdpHeaWatSetHW loop differential pressure setpoint [Pa]
output RealOutputQCooReq_flowPlant required cooling capacity (>0) [W]
input BooleanInputu1CooCooling enable signal
input BooleanInputu1HeaHeating enable signal
output BooleanOutputy1Chi[nChi]Chiller On/Off command
output BooleanOutputy1CooChiHea[nChiHea]HRC cooling mode switchover command: true for cooling, false for heating
output BooleanOutputy1ChiHea[nChiHea]HRC On/Off command
output BooleanOutputy1HeaCooChiHea[nChiHea]HRC cooling mode switchover command: true for cooling, false for heating

Modelica definition

block StagingPlant "Block that computes plant stage and command signals for chillers and HRC" parameter Integer nChi(final min=1, start=1) "Number of units operating at design conditions"; parameter Modelica.Units.SI.HeatFlowRate QChiWatChi_flow_nominal "Cooling design heat flow rate of cooling-only chillers (all units)"; parameter Integer nChiHea(final min=1, start=1) "Number of units operating at design conditions"; parameter Real PLRStaTra(unit="1")=0.85 "Part load ratio triggering stage transition"; parameter Modelica.Units.SI.HeatFlowRate QChiWatCasCoo_flow_nominal "Cooling design heat flow rate of HRC in cascading cooling mode (all units)"; parameter Modelica.Units.SI.HeatFlowRate QChiWatCasCoo_flow_nominal_approx "Cooling design heat flow rate of HRC in cascading cooling mode (all units), approximate for scaling"; parameter Modelica.Units.SI.HeatFlowRate QHeaWat_flow_nominal "Heating design heat flow rate (all units)"; parameter Modelica.Units.SI.SpecificHeatCapacity cp_default= Buildings.Utilities.Psychrometrics.Constants.cpWatLiq "Specific heat capacity of the fluid"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mChiWatPri_flow( final unit="kg/s") "Primary CHW mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TChiWatSupSet( final unit="K", displayUnit="degC") "CHW supply temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TChiWatPriRet(final unit="K", displayUnit="degC") "Primary CHW return temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mHeaWatPri_flow(final unit="kg/s") "Primary HW mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput THeaWatSupSet( final unit="K", displayUnit="degC") "HW supply temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput THeaWatPriRet(final unit="K", displayUnit="degC") "Primary HW return temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TChiWatSup(final unit="K", displayUnit="degC") "CHW supply temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpChiWat(final unit="Pa") "CHW loop differential pressure"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpChiWatSet(final unit="Pa") "CHW loop differential pressure setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput THeaWatSup(final unit="K", displayUnit="degC") "HW supply temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpHeaWat(final unit="Pa") "HW loop differential pressure"; Buildings.Controls.OBC.CDL.Interfaces.RealInput dpHeaWatSet(final unit="Pa") "HW loop differential pressure setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput QCooReq_flow(final unit="W") "Plant required cooling capacity (>0)"; 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.BooleanOutput y1Chi[nChi] "Chiller On/Off command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1CooChiHea[nChiHea] "HRC cooling mode switchover command: true for cooling, false for heating"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ChiHea[nChiHea] "HRC On/Off command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaCooChiHea[nChiHea] "HRC cooling mode switchover command: true for cooling, false for heating"; Buildings.Controls.OBC.CDL.Reals.MovingAverage movAve(delta=300) "Moving average"; Buildings.Controls.OBC.CDL.Reals.Multiply loaChiWat "Compute total chiller load (>0)"; Buildings.Controls.OBC.CDL.Reals.Subtract dTChiWatPos "Compute deltaT (>0)"; Buildings.Controls.OBC.CDL.Reals.Multiply loaHeaWat "Compute total chiller load"; Buildings.Controls.OBC.CDL.Reals.Subtract dTHeaWat "Compute deltaT"; Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator rep(final nout= nChi) "Replicate"; Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold cmdChi[nChi](final t={i for i in 1:nChi}) "Compute chiller On/Off command from number of units to be commanded On"; Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter timCp(final k= cp_default) "Scale"; Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter timCp1(final k= cp_default) "Scale"; Buildings.Controls.OBC.CDL.Reals.MovingAverage movAve1(delta=300) "Moving average"; Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator rep5(final nout= nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold cmdChiHea[nChiHea]( final t={i for i in 1:nChiHea}) "Compute chiller On/Off command from number of units to be commanded On"; Buildings.Controls.OBC.CDL.Integers.Subtract numChiHeaCoo "Number of HRC required in direct HR mode"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant numChiHea(final k= nChiHea) "Number of HRC"; Buildings.Controls.OBC.CDL.Integers.Add nChiHeaAndCooUnb "Number of HRC required to meet heating and cooling load - Unbounded"; Buildings.Controls.OBC.CDL.Integers.Subtract numChiCasCoo "Number of HRC required in cascading cooling"; ModeHeatRecoveryChiller modHeaCoo(final nChiHea=nChiHea) "Compute the cascading cooling and direct HR switchover signals"; Buildings.Controls.OBC.CDL.Integers.Min nChiHeaHeaAndCoo "Number of HRC required to meet heating and cooling load - Bounded by number of HRC"; Buildings.Controls.OBC.CDL.Reals.Subtract errTChiWatSup "Compute tracking error"; Buildings.Controls.OBC.CDL.Reals.Subtract errDpChiWat "Compute tracking error"; Buildings.Controls.OBC.CDL.Reals.LessThreshold cmpErrLim(t=-1, h=1E-4) "Check tracking error limit"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold cmpErrLim1(t=1.5E4, h=1E-1) "Check tracking error limit"; Buildings.Controls.OBC.CDL.Logical.Timer timErrExcLim(t=15*60) "Timer for error exceeding error limit"; Buildings.Controls.OBC.CDL.Logical.Timer timErrExcLim1(t=15*60) "Timer for error exceeding error limit"; Buildings.Controls.OBC.CDL.Logical.Or or2 "Failsafe condition to stage up"; Buildings.Controls.OBC.CDL.Logical.And and2 "Apply failsafe condition only in stage >= 1"; Buildings.Controls.OBC.CDL.Logical.And and3 "Apply failsafe condition only in stage >= 1"; StageIndex staCoo(final nSta=nChi + nChiHea, tSta=15*60) "Compute cooling stage"; Modelica.Blocks.Sources.RealExpression capCoo(final y=abs(PLRStaTra*(min(nChi, staCoo.preIdxSta)/nChi*QChiWatChi_flow_nominal + max(0, staCoo.preIdxSta - nChi)/nChiHea*QChiWatCasCoo_flow_nominal))) "Total capacity at current stage (>0) times stage-up PLR limit "; Buildings.Controls.OBC.CDL.Reals.Greater cmpOPLRLimUp(h=-1E-4*( QChiWatChi_flow_nominal + QChiWatCasCoo_flow_nominal_approx)/2) "Check OPLR limit"; Buildings.Controls.OBC.CDL.Logical.Timer timOPLRExcLim(t=15*60) "Timer for OPLR exceeding limit"; Buildings.Controls.OBC.CDL.Logical.Or or1 "Failsafe condition or efficiency condition to stage up"; Buildings.Controls.OBC.CDL.Integers.Min numOpeChi "Number of operating chillers"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant numChi(final k=nChi) "Number of chillers"; Buildings.Controls.OBC.CDL.Integers.Subtract numOpeCooChiHea "Number of HRC required for cooling"; Modelica.Blocks.Sources.RealExpression capHea(final y=PLRStaTra*staHea.preIdxSta /nChiHea*QHeaWat_flow_nominal) "Total capacity at current stage times stage-up PLR limit "; Buildings.Controls.OBC.CDL.Reals.Greater cmpOPLRLimUp1(h=1E-1) "Check OPLR limit"; Buildings.Controls.OBC.CDL.Logical.Timer timOPLRExcLim1(t=15*60) "Timer for OPLR exceeding limit"; StageIndex staHea(final nSta=nChiHea, tSta=15*60) "Compute heating stage"; Modelica.Blocks.Sources.RealExpression capHeaLow(final y=PLRStaTra*max(0, staHea.preIdxSta - 1)/nChiHea*QHeaWat_flow_nominal) "Total capacity at next lower stage times stage-down PLR limit "; Buildings.Controls.OBC.CDL.Reals.Less cmpOPLRLimDow(h=1E-1) "Check OPLR limit"; Buildings.Controls.OBC.CDL.Logical.Timer timOPLRExcLim2(t=15*60) "Timer for OPLR exceeding limit"; Modelica.Blocks.Sources.RealExpression capCooLow(final y=abs(PLRStaTra*(min( nChi, max(0, staCoo.preIdxSta - 1))/nChi*QChiWatChi_flow_nominal + max( 0, staCoo.preIdxSta - 1 - nChi)/nChiHea*QChiWatCasCoo_flow_nominal))) "Total capacity at next lower stage (>0) times stage-down PLR limit "; Buildings.Controls.OBC.CDL.Reals.Less cmpOPLRLimDow1(h=-1E-4*( QChiWatChi_flow_nominal + QChiWatCasCoo_flow_nominal_approx)/2) "Check OPLR limit"; Buildings.Controls.OBC.CDL.Logical.Timer timOPLRExcLim3(t=15*60) "Timer for OPLR exceeding limit"; Buildings.Controls.OBC.CDL.Logical.Not notFail "Failsafe conditions are not true"; Buildings.Controls.OBC.CDL.Logical.And dowAndNotFail "No stage up failsafe condition and efficiency condition to stage down"; Buildings.Controls.OBC.CDL.Reals.Subtract errTChiWatSup1 "Compute tracking error"; Buildings.Controls.OBC.CDL.Reals.Subtract errDpHeaWat "Compute tracking error"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold cmpErrLim2(t=+1, h=1E-4) "Check tracking error limit"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold cmpErrLim3(t=1.5E4, h=1E-1) "Check tracking error limit"; Buildings.Controls.OBC.CDL.Logical.Timer timErrExcLim2(t=15*60) "Timer for error exceeding error limit"; Buildings.Controls.OBC.CDL.Logical.Timer timErrExcLim3(t=15*60) "Timer for error exceeding error limit"; Buildings.Controls.OBC.CDL.Logical.Or or3 "Failsafe condition to stage up"; Buildings.Controls.OBC.CDL.Logical.And and1 "Apply failsafe condition only in stage >= 1"; Buildings.Controls.OBC.CDL.Logical.And and4 "Apply failsafe condition only in stage >= 1"; Buildings.Controls.OBC.CDL.Logical.Not notFail1 "Failsafe conditions are not true"; Buildings.Controls.OBC.CDL.Logical.Or or4 "Failsafe condition or efficiency condition to stage up"; Buildings.Controls.OBC.CDL.Logical.And dowAndNotFail1 "No stage up failsafe condition and efficiency condition to stage down"; IntegerArrayHold hol(holdDuration=15*60, nin=4) "Minimum plant stage runtime (needed because cooling and heating stage runtimes are handled separately)"; equation connect(dTChiWatPos.y, loaChiWat.u2); connect(dTHeaWat.y, loaHeaWat.u2); connect(THeaWatSupSet, dTHeaWat.u1); connect(THeaWatPriRet, dTHeaWat.u2); connect(rep.y, cmdChi.u); connect(mChiWatPri_flow, timCp.u); connect(timCp.y, loaChiWat.u1); connect(mHeaWatPri_flow, timCp1.u); connect(timCp1.y, loaHeaWat.u1); connect(loaChiWat.y, movAve.u); connect(loaHeaWat.y, movAve1.u); connect(rep5.y, cmdChiHea.u); connect(cmdChiHea.y, y1ChiHea); connect(modHeaCoo.y1HeaCoo, y1HeaCooChiHea); connect(numChiHea.y, nChiHeaHeaAndCoo.u2); connect(nChiHeaAndCooUnb.y, nChiHeaHeaAndCoo.u1); connect(nChiHeaAndCooUnb.y, numChiHeaCoo.u1); connect(nChiHeaHeaAndCoo.y, numChiHeaCoo.u2); connect(modHeaCoo.y1Coo, y1CooChiHea); connect(numChiHeaCoo.y, numChiCasCoo.u2); connect(TChiWatSupSet, errTChiWatSup.u1); connect(dpChiWatSet, errDpChiWat.u1); connect(errTChiWatSup.y, cmpErrLim.u); connect(errDpChiWat.y, cmpErrLim1.u); connect(timErrExcLim1.passed, or2.u1); connect(timErrExcLim.passed, or2.u2); connect(cmpErrLim1.y, and2.u1); connect(and2.y, timErrExcLim1.u); connect(cmpErrLim.y, and3.u1); connect(and3.y, timErrExcLim.u); connect(u1Coo, and3.u2); connect(u1Coo, and2.u2); connect(cmdChi.y, y1Chi); connect(u1Coo, staCoo.u1); connect(cmpOPLRLimUp.y, timOPLRExcLim.u); connect(or2.y, or1.u1); connect(or1.y, staCoo.u1Up); connect(timOPLRExcLim.passed, or1.u2); connect(numChi.y, numOpeChi.u2); connect(staCoo.idxSta, numOpeChi.u1); connect(staCoo.idxSta, numOpeCooChiHea.u1); connect(numOpeChi.y, numOpeCooChiHea.u2); connect(numOpeCooChiHea.y, nChiHeaAndCooUnb.u1); connect(cmpOPLRLimUp1.y, timOPLRExcLim1.u); connect(u1Hea, staHea.u1); connect(cmpOPLRLimDow.y, timOPLRExcLim2.u); connect(cmpOPLRLimDow1.y, timOPLRExcLim3.u); connect(or2.y, notFail.u); connect(dowAndNotFail.y, staCoo.u1Dow); connect(timOPLRExcLim3.passed, dowAndNotFail.u2); connect(notFail.y, dowAndNotFail.u1); connect(staHea.idxSta, nChiHeaAndCooUnb.u2); connect(numOpeCooChiHea.y, numChiCasCoo.u1); connect(movAve.y, cmpOPLRLimUp.u1); connect(capCoo.y, cmpOPLRLimUp.u2); connect(movAve.y, cmpOPLRLimDow1.u1); connect(capCooLow.y, cmpOPLRLimDow1.u2); connect(capHea.y, cmpOPLRLimUp1.u2); connect(movAve1.y, cmpOPLRLimUp1.u1); connect(capHeaLow.y, cmpOPLRLimDow.u2); connect(movAve1.y, cmpOPLRLimDow.u1); connect(TChiWatSupSet, dTChiWatPos.u2); connect(TChiWatPriRet, dTChiWatPos.u1); connect(dpHeaWatSet, errDpHeaWat.u1); connect(errTChiWatSup1.y, cmpErrLim2.u); connect(errDpHeaWat.y, cmpErrLim3.u); connect(cmpErrLim3.y,and1. u1); connect(and1.y,timErrExcLim3. u); connect(cmpErrLim2.y, and4.u1); connect(and4.y, timErrExcLim2.u); connect(or3.y, notFail1.u); connect(THeaWatSupSet, errTChiWatSup1.u1); connect(timErrExcLim2.passed, or3.u1); connect(timErrExcLim3.passed, or3.u2); connect(u1Hea, and4.u2); connect(u1Hea, and1.u2); connect(timOPLRExcLim1.passed, or4.u1); connect(or3.y, or4.u2); connect(timOPLRExcLim2.passed, dowAndNotFail1.u1); connect(notFail1.y, dowAndNotFail1.u2); connect(dowAndNotFail1.y, staHea.u1Dow); connect(or4.y, staHea.u1Up); connect(numOpeChi.y, hol.u[1]); connect(numChiCasCoo.y, hol.u[2]); connect(numChiHeaCoo.y, hol.u[3]); connect(nChiHeaHeaAndCoo.y, hol.u[4]); connect(hol.y[1], rep.u); connect(hol.y[2], modHeaCoo.nCasCoo); connect(hol.y[3], modHeaCoo.nHeaCoo); connect(hol.y[4], rep5.u); connect(movAve.y, QCooReq_flow); connect(dpChiWat, errDpChiWat.u2); connect(TChiWatSup, errTChiWatSup.u2); connect(THeaWatSup, errTChiWatSup1.u2); connect(dpHeaWat, errDpHeaWat.u2); end StagingPlant;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StagingPump Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StagingPump

Pump staging

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.StagingPump

Information

This block implements the logic for staging the lag pump of a multiple-pump group.

The first staging criterion is optional and is based on ratFlo, the ratio of current flow rate to design flow rate. The lag pump is enabled whenever any of the following is true.

The lag pump is disabled whenever any of the following is true.

Parameters

TypeNameDefaultDescription
Booleanhave_flowCriteriontrueSet to true for flow criterion in conjunction with speed criterion
IntegernPum Number of pumps
RealyDow0.30Low speed limit for staging down
RealyUp0.99High speed limit for staging up
Nominal condition
MassFlowRatem_flow_nominal1Loop design mass flow rate (all pumps) [kg/s]

Connectors

TypeNameDescription
input BooleanInputy1EnaLead pump Enable signal (e.g. based on isolation valve opening command)
input RealInputm_flowMass flow rate as measured by the loop flow meter [kg/s]
input RealInputyCommanded speed [1]
output BooleanOutputy1[nPum]Start signal (VFD Run or motor starter contact)
output IntegerOutputnPumEnaNumber of pumps that are enabled
output BooleanOutputy1AnyReturn true if any pump enabled (left limit to avoid direct feedback)

Modelica definition

block StagingPump "Pump staging" parameter Boolean have_flowCriterion=true "Set to true for flow criterion in conjunction with speed criterion"; parameter Integer nPum( final min=1, start=1) "Number of pumps"; parameter Modelica.Units.SI.MassFlowRate m_flow_nominal=1 "Loop design mass flow rate (all pumps)"; parameter Real yDow=0.30 "Low speed limit for staging down"; parameter Real yUp=0.99 "High speed limit for staging up"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput y1Ena "Lead pump Enable signal (e.g. based on isolation valve opening command)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput m_flow(final unit="kg/s") if have_flowCriterion "Mass flow rate as measured by the loop flow meter"; Buildings.Controls.OBC.CDL.Interfaces.RealInput y(final unit="1") "Commanded speed"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1[nPum] "Start signal (VFD Run or motor starter contact)"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold cmp(final t=yUp, h=1e-3) "Compare"; Buildings.Controls.OBC.CDL.Logical.Timer timSpe(t=5*60) "True delay"; Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter ratFlo( final k=1/m_flow_nominal) if have_flowCriterion "Ratio of current flow rate to design value"; Buildings.Controls.OBC.CDL.Reals.Greater cmp2(h=1e-3) if have_flowCriterion "Compare"; Buildings.Controls.OBC.CDL.Reals.AddParameter addOff(p=-0.03) if have_flowCriterion "Add offset"; Buildings.Controls.OBC.CDL.Logical.Timer timFlo(t=10*60) if have_flowCriterion "Check if true for a given time"; Buildings.Controls.OBC.CDL.Logical.Or up "Check if flow or speed criterion passed for staging up"; Buildings.Controls.OBC.CDL.Reals.Less cmp3(h=1e-3) if have_flowCriterion "Compare"; Buildings.Controls.OBC.CDL.Logical.Timer timFlo1(t=10*60) if have_flowCriterion "Check if true for a given time"; Buildings.Controls.OBC.CDL.Reals.LessThreshold cmp4(final t=yDow, h=1e-3) "Compare"; Buildings.Controls.OBC.CDL.Logical.Timer timSpe1(t=5*60) "True delay"; Buildings.Controls.OBC.CDL.Logical.Or dow "Check if flow or speed criterion passed for staging down"; Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter ratOpeDsg( final k=1/nPum) "Ratio of number of operating pumps to number of operating pumps at design conditions"; Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold cvtBoo[nPum]( final t={i for i in 1:nPum}) "Compute pump Start command from number of pumps to be commanded On"; Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator rep( final nout=nPum) "Replicate"; StageIndex staLag(final nSta=max(1, nPum - 1), tSta=30) if nPum>1 "Stage lag pumps (minimum runtime allowing for pump start time)"; Buildings.Controls.OBC.CDL.Conversions.IntegerToReal cvtInt "Convert"; Buildings.Controls.OBC.CDL.Reals.AddParameter addOffLowSta( final p=-1/nPum) if have_flowCriterion "Add offset for lower stage"; Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger leaEna "Return 1 if lead pump enabled"; Buildings.Controls.OBC.CDL.Integers.Add num "Number of pumps enabled"; Buildings.Controls.OBC.CDL.Integers.Add numPre "Number of pumps enabled"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant zer(final k=0) if nPum==1 "Constant"; Buildings.Controls.OBC.CDL.Logical.Sources.Constant fal(final k=false) if not have_flowCriterion "Constant"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput nPumEna "Number of pumps that are enabled"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Any "Return true if any pump enabled (left limit to avoid direct feedback)"; Buildings.Controls.OBC.CDL.Integers.GreaterEqualThreshold anyEna(final t=1) "Return true if any pump is enabled"; Buildings.Controls.OBC.CDL.Logical.Pre pre1 "Left limit of signal avoiding direct feedback"; equation connect(y, cmp.u); connect(cmp.y, timSpe.u); connect(ratFlo.y, cmp2.u1); connect(addOff.y, cmp2.u2); connect(timFlo.passed, up.u1); connect(ratFlo.y, cmp3.u1); connect(y, cmp4.u); connect(cmp4.y, timSpe1.u); connect(timFlo1.passed,dow. u1); connect(addOff.u, ratOpeDsg.y); connect(rep.y, cvtBoo.u); connect(cmp2.y, timFlo.u); connect(cmp3.y, timFlo1.u); connect(timSpe.passed, up.u2); connect(timSpe1.passed,dow. u2); connect(y1Ena, staLag.u1); connect(cvtInt.y, ratOpeDsg.u); connect(cvtBoo.y, y1); connect(addOff.y, addOffLowSta.u); connect(addOffLowSta.y, cmp3.u2); connect(y1Ena, leaEna.u); connect(dow.y, staLag.u1Dow); connect(num.y, rep.u); connect(staLag.idxSta, num.u2); connect(leaEna.y, num.u1); connect(numPre.y, cvtInt.u); connect(leaEna.y, numPre.u1); connect(staLag.preIdxSta, numPre.u2); connect(zer.y, num.u2); connect(zer.y, numPre.u2); connect(up.y, staLag.u1Up); connect(fal.y, dow.u1); connect(fal.y, up.u1); connect(num.y, nPumEna); connect(anyEna.y, pre1.u); connect(pre1.y, y1Any); connect(num.y, anyEna.u); connect(m_flow, ratFlo.u); end StagingPump;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.TankCycle Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.TankCycle

Block that determines the tank cycle flag

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.TankCycle

Information

The tank operating conditions should match the operating limits and selection conditions of the chillers and HRCs. The highest temperature (at the top of the tank) should be limited by the maximum evaporator entering temperature per manufacturer’s recommendations. The lowest temperature (at the bottom of the tank) should be limited by the design CHW supply temperature. This gives the tank maximum ΔT and the actual storage capacity. However, this value is likely above the maximum ΔT that chillers and HRCs can achieve across the condenser or evaporator barrel (typically 11 K). Therefore, in order to fully leverage the TES capacity, two temperature cycles are needed.

The first tank cycle (higher temperature setpoint) is activated whenever all of the following conditions are true.

The second tank cycle (lower temperature setpoint) is activated whenever both of the following conditions are true.

At initial time the tank cycle flag is set based on the tank temperature condition only from the above two clauses without a time delay. If neither condition is true, the tank cycle flag is set based on the flow condition only in the above two clauses without a time delay.

The minimum runtime of each tank cycle is fixed at 30 min.

Parameters

TypeNameDefaultDescription
MassFlowRatemConWatHexCoo_flow_nominal Design total CW mass flow rate through condenser barrels (all units) [kg/s]
CW loop, TES tank and heat pumps
TemperatureTTanSet[2, 2] Tank temperature setpoints: 2 cycles with 2 setpoints [K]

Connectors

TypeNameDescription
input RealInputmConWatOutTan_flowMass flow rate out of lower port of TES tank (>0 when charging) [kg/s]
input RealInputTTan[nTTan]TES tank temperature [K]
output IntegerOutputidxCycTanIndex of active tank cycle

Modelica definition

block TankCycle "Block that determines the tank cycle flag" parameter Modelica.Units.SI.MassFlowRate mConWatHexCoo_flow_nominal "Design total CW mass flow rate through condenser barrels (all units)"; parameter Modelica.Units.SI.Temperature TTanSet[2, 2] "Tank temperature setpoints: 2 cycles with 2 setpoints"; parameter Integer nTTan=0 "Number of tank temperature points"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConWatOutTan_flow( final unit="kg/s") "Mass flow rate out of lower port of TES tank (>0 when charging)"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TTan[nTTan]( each final unit="K", each displayUnit="degC") "TES tank temperature"; Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput idxCycTan( final min=1, final max=2) "Index of active tank cycle"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold criTem1[nTTan]( each t=sum(TTanSet[2])/2, each h=1E-4) "Temperature criterion for first tank cycle"; Buildings.Controls.OBC.CDL.Logical.MultiAnd allCriTem1(final nin=nTTan) "All temperature criteria met"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold criFlo1(final t=1E-3* mConWatHexCoo_flow_nominal, h=1E-3*mConWatHexCoo_flow_nominal/2) "Flow criterion for first tank cycle"; Buildings.Controls.OBC.CDL.Reals.LessThreshold criTem2[nTTan](each t=sum(TTanSet[1])/2, each h=1E-4) "Temperature criterion for first tank cycle"; Buildings.Controls.OBC.CDL.Logical.MultiAnd allCriTem2(final nin=nTTan) "All temperature criteria met"; Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt(final integerTrue=1, final integerFalse=2) "Convert"; Buildings.Controls.OBC.CDL.Logical.Or or2 "Neither of temperature criterion is true"; Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt3(final integerTrue=2, final integerFalse=0) "Convert"; Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt4(final integerTrue=1, final integerFalse=0) "Convert"; Buildings.Controls.OBC.CDL.Integers.Max maxInt1 "Set cycle index as maximum"; Buildings.Controls.OBC.CDL.Logical.And allCri2 "All criteria met"; Buildings.Controls.OBC.CDL.Logical.And allCri1 "All criteria met"; Buildings.Controls.OBC.CDL.Integers.Switch idxIni "Index at initial time"; Buildings.Controls.OBC.CDL.Logical.Timer timAllCri1(t=5*60) "All criteria met for given time"; Buildings.Controls.OBC.CDL.Logical.Timer timAllCri2(t=5*60) "All criteria met for given time"; Buildings.Controls.OBC.CDL.Integers.Switch intSwi "Switch index"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant idx1(final k=1) "Index"; Buildings.Controls.OBC.CDL.Integers.Switch intSwi1 "Switch index"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant idx2(final k=2) "Index"; Modelica.Blocks.Sources.IntegerExpression preIdxCycTan(y=pre(idxCycTan)) "Previous index value"; Buildings.Controls.OBC.CDL.Logical.Not criFlo2 "Flow criterion for second tank cycle"; IntegerArrayHold hol(holdDuration=30*60, nin=1) "Hold for minimum runtime"; initial equation pre(idxCycTan)=idxIni.y; equation connect(criTem1.y, allCriTem1.u); connect(TTan, criTem2.u); connect(TTan, criTem1.u); connect(criTem2.y, allCriTem2.u); connect(allCriTem2.y, booToInt3.u); connect(allCriTem1.y, booToInt4.u); connect(allCriTem1.y, allCri1.u1); connect(allCriTem2.y, allCri2.u1); connect(maxInt1.u2, booToInt3.y); connect(booToInt4.y, maxInt1.u1); connect(allCriTem1.y, or2.u1); connect(allCriTem2.y, or2.u2); connect(or2.y, idxIni.u2); connect(maxInt1.y, idxIni.u1); connect(criFlo1.y, booToInt.u); connect(booToInt.y, idxIni.u3); connect(mConWatOutTan_flow, criFlo1.u); connect(allCri1.y, timAllCri1.u); connect(allCri2.y, timAllCri2.u); connect(timAllCri1.passed, intSwi.u2); connect(idx1.y, intSwi.u1); connect(timAllCri2.passed, intSwi1.u2); connect(idx2.y, intSwi1.u1); connect(intSwi1.y, intSwi.u3); connect(preIdxCycTan.y, intSwi1.u3); connect(criFlo1.y, criFlo2.u); connect(hol.y[1], idxCycTan); connect(criFlo1.y, allCri1.u2); connect(criFlo2.y, allCri2.u2); connect(intSwi.y, hol.u[1]); end TankCycle;

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ValveCondenserEvaporator Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ValveCondenserEvaporator

Controller for chiller and HRC condenser and evaporator valves

Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.ValveCondenserEvaporator

Information

This block implements the control logic for the chiller isolation valves, the HRC isolation and switchover valves, the CHW and HW minimum flow bypass valves, the HRC evaporator CW mixing valve, and the CW chiller bypass valve. It also computes the lead pump Enable signal for the CHW, HW, CWC and CWE pump groups.

Chiller evaporator isolation valve

When a chiller is enabled, the valve position is controlled as follows.

Otherwise, the valve is commanded to a closed position.

Chiller evaporator flow setpoint

The setpoint is computed based on the logic implemented in Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.DirectHeatRecovery.

Chiller condenser isolation valve

When a chiller is enabled, the condenser isolation valve is modulated with a control loop tracking a condenser flow setpoint which is reset as described hereunder. The loop output is mapped to a valve position of 10 % (resp. 100 %) at 0 % (resp. 100 %) output signal. The loop is biased to launch from 100 %.

Otherwise, the valve is commanded to a closed position.

Chiller condenser flow setpoint

The condenser flow setpoint varies based on the condenser loop mode and on the tank cycle index.

HRC evaporator isolation valve

When a HRC is enabled, the valve position is controlled as follows.

Otherwise, the valve is commanded to a closed position.

HRC evaporator flow setpoint

In direct heat recovery mode, the setpoint is reset based on the logic implemented in Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.DirectHeatRecovery.

In cascading heating mode, the setpoint is reset with a control loop that maintains the evaporator leaving temperature at target setpoint equal to the lowest temperature setpoint of the active tank cycle. The loop output is mapped as follows. From 0 % to 50 %, the HRC evaporator CW mixing valve commanded position is reset from 0 % (full bypass flow) to 100 % (no bypass flow). From 50 % to 100 %, the evaporator flow setpoint is reset from minimum to design value. The loop is biased to launch from 75 %. When disabled, the loop output is set to 75 % to ensure that the HRC evaporator CW mixing valve is fully open (no bypass flow).

HRC condenser isolation valve

When a HRC is enabled, the valve position is controlled as follows.

Otherwise, the valve is commanded to a closed position.

HRC condenser and evaporator switchover valve

Each valve is commanded to a fully open or fully closed position depending on the valve index and the current operating mode of the HRC (cascading cooling, cascading heating or direct heat recovery). In addition, the condenser switchover valve indexed to the HRC which is nearest to the interconnection with the condenser loop (highest index) and which is operating in direct heat recovery mode is modulated with a control loop tracking the condenser entering temperature. The condenser entering temperature setpoint is reset based on the logic implemented in Buildings.Experimental.DHC.Plants.Combined.Controls.BaseClasses.DirectHeatRecovery. This allows false loading the HRC that is controlled to meet the HW supply temperature setpoint in direct heat recovery mode, and thus meeting the CHW supply temperature setpoint simultaneously.

HRC evaporator CW mixing valve

The valve is modulated based on two control loops: the HRC evaporator leaving temperature control loop (see the section HRC evaporator flow setpoint) and another control loop that maintains the HRC evaporator entering water temperature below the highest tank temperature setpoint. This latter control loop is enabled when any HRC is operating in cascading heating mode. When the loop is enabled, the loop output is mapped to a valve position of 100 % (resp. 0 %) at 0 % (resp. 100 %) output signal. When the loop is disabled, the loop output is set to 100 % (no bypass flow). The valve control signal is the minimum (maximum bypass flow) of the resulting signals of those two control loops.

CHW and HW minimum flow bypass valve

Each chiller and HRC has its own CHW (resp. HW) minimum flow control loop. The loop is enabled whenever the unit's evaporator (resp. condenser) is indexed to the CHW (resp. HW) loop and its evaporator (resp. condenser) isolation valve is commanded open (with a threshold of 10 %). When enabled, each loop tracks a flow setpoint equal to 1.1 times the minimum CHW (resp. HW) flow rate. When disabled, each loop output is set to 0 %. The valve control signal is the maximum (maximum bypass flow) of the resulting signals of all control loops.

CW chiller bypass valve

The valve control is enabled when the plant is enabled either in cooling or heating mode, the Charge Assist mode is active and all chiller condenser isolation valves are closed (based on their commanded position).

When the valve control is enabled the valve position is modulated by the same control loop used to maintain the condenser loop return temperature at a target setpoint equal to the highest temperature setpoint of the active tank cycle (see the section "Chiller condenser flow setpoint").

Otherwise, the valve is commanded to a closed position.

CHW, HW, CWC, CWE lead pump

The lead pump of each loop is enabled whenever any chiller or HRC is indexed to the loop and the corresponding evaporator or condenser isolation valve is commanded open (with a threshold of 10 %). In addition, the CWC lead pump may also be enabled if the CW chiller bypass valve is commanded open.

Parameters

TypeNameDefaultDescription
RealyBalEvaChiif dpEvaChiHea_nominal + dpV...Chiller evaporator isolation valve opening for flow balancing with HRC
RealyBalEvaChiHeaif dpEvaChi_nominal + dpValE...HRC evaporator isolation valve opening for flow balancing with chiller
CHW loop and cooling-only chillers
IntegernChi Number of units operating at design conditions
MassFlowRatemChiWatChi_flow_nominal Chiller CHW design mass flow rate (value will be used for each unit) [kg/s]
MassFlowRatemChiWatChi_flow_min Chiller CHW minimum mass flow rate (value will be used for each unit) [kg/s]
MassFlowRatemConWatChi_flow_nominal Chiller CW design mass flow rate (value will be used for each unit) [kg/s]
PressureDifferencedpEvaChi_nominal Chiller evaporator design pressure drop (value will be used for each unit) [Pa]
PressureDifferencedpValEvaChi_nominal Chiller evaporator isolation valve design pressure drop (value will be used for each unit) [Pa]
HW loop and heat recovery chillers
IntegernChiHea Number of units operating at design conditions
MassFlowRatemChiWatChiHea_flow_nominal HRC CHW design mass flow rate (value will be used for each unit) [kg/s]
MassFlowRatemChiWatChiHea_flow_min HRC CHW minimum mass flow rate (value will be used for each unit) [kg/s]
MassFlowRatemConWatChiHea_flow_nominal HRC CW design mass flow rate (value will be used for each unit) [kg/s]
MassFlowRatemHeaWatChiHea_flow_min Chiller HW minimum mass flow rate (value will be used for each unit) [kg/s]
PressureDifferencedpEvaChiHea_nominal Design chiller evaporator pressure drop (value will be used for each unit) [Pa]
PressureDifferencedpValEvaChiHea_nominal HRC evaporator isolation valve design pressure drop (value will be used for each unit) [Pa]
CW loop, TES tank and heat pumps
TemperatureTTanSet[2, 2] Tank temperature setpoints: 2 cycles with 2 setpoints [K]
Control parameters
Realk0.01Gain of controller
TimeTi60Time constant of integrator block [s]
RealyMin0.1Lower limit of valve opening when control loop enabled
Realy_reset1Value to which the controller output is reset if the boolean trigger has a rising edge
Realy_neutral0Value to which the controller output is reset when the controller is disabled

Connectors

TypeNameDescription
input IntegerInputidxCycTanIndex of active tank cycle
input IntegerInputmodeCondenser loop operating mode
input BooleanInputu1Chi[nChi]Cooling-only chiller On/Off command
input BooleanInputu1ChiHea[nChiHea]HRC On/Off command
input BooleanInputu1CooChiHea[nChiHea]HRC cooling mode switchover command: true for cooling, false for heating
input BooleanInputu1HeaCooChiHea[nChiHea]HRC direct heat recovery switchover command: true for direct HR, false for cascading
input RealInputTEvaLvgChiHea[nChiHea]HRC evaporator barrel leaving temperature [K]
input RealInputmEvaChiSet_flowChiller evaporator flow setpoint [kg/s]
input RealInputmEvaChiHeaSet_flowHRC evaporator flow setpoint [kg/s]
input RealInputmEvaChi_flow[nChi]Chiller evaporator mass flow rate [kg/s]
input RealInputmConChi_flow[nChi]Chiller condenser mass flow rate [kg/s]
input RealInputmEvaChiHea_flow[nChiHea]HRC evaporator mass flow rate [kg/s]
input RealInputTConWatEvaEntHRC evaporator entering CW temperature [K]
input RealInputmConChiHea_flow[nChiHea]HRC condenser mass flow rate [kg/s]
input RealInputTConEntChiHeaSetHRC condenser entering temperature setpoint [K]
input RealInputTConEntChiHea[nChiHea]HRC condenser entering temperature [K]
input RealInputTConLvgChiHea[nChiHea]HRC condenser barrel leaving temperature [K]
input RealInputTConLvgChi[nChi]Chiller condenser barrel leaving temperature [K]
input RealInputTConWatConRetCWC return temperature [K]
output BooleanOutputy1PumChiWatEnable signal for lead CHW pump
output BooleanOutputy1PumHeaWatEnable signal for lead HW pump
output BooleanOutputy1PumConWatConEnable signal for lead CW pump serving evaporator loop
output BooleanOutputy1PumConWatEvaEnable signal for lead CW pump serving evaporator loop
output RealOutputyValEvaChi[nChi]Cooling-only chiller evaporator isolation valve commanded position
output RealOutputyValConChi[nChi]Cooling-only chiller condenser isolation valve commanded position [1]
output RealOutputyValEvaChiHea[nChiHea]HRC evaporator isolation valve commanded position [1]
output RealOutputyValConChiHea[nChiHea]HRC condenser isolation valve commanded position [1]
output RealOutputyValEvaSwiChiHea[nChiHea]HRC evaporator switchover valve commanded position [1]
output RealOutputyValConSwiChiHea[nChiHea]HRC condenser switchover valve commanded position [1]
output RealOutputyValConWatEvaMixHRC evaporator CW mixing valve commanded position
output RealOutputyValChiWatMinBypCHW minimum flow bypass valve control signal [1]
output RealOutputyValHeaWatMinBypHW minimum flow bypass valve control signal [1]
output RealOutputyValConWatBypCW chiller bypass valve control signal [1]
input BooleanInputu1CooOrHeaPlant Enable signal: either cooling or heating is enabled

Modelica definition

block ValveCondenserEvaporator "Controller for chiller and HRC condenser and evaporator valves" parameter Integer nChi(final min=1, start=1) "Number of units operating at design conditions"; parameter Integer nChiHea(final min=1, start=1) "Number of units operating at design conditions"; parameter Modelica.Units.SI.MassFlowRate mChiWatChi_flow_nominal "Chiller CHW design mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChi_flow_min "Chiller CHW minimum mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.MassFlowRate mConWatChi_flow_nominal "Chiller CW design mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.PressureDifference dpEvaChi_nominal(displayUnit="Pa") "Chiller evaporator design pressure drop (value will be used for each unit)"; parameter Modelica.Units.SI.PressureDifference dpValEvaChi_nominal( displayUnit="Pa") "Chiller evaporator isolation valve design pressure drop (value will be used for each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChiHea_flow_nominal "HRC CHW design mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.MassFlowRate mChiWatChiHea_flow_min "HRC CHW minimum mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.MassFlowRate mConWatChiHea_flow_nominal "HRC CW design mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.MassFlowRate mHeaWatChiHea_flow_min "Chiller HW minimum mass flow rate (value will be used for each unit)"; parameter Modelica.Units.SI.PressureDifference dpEvaChiHea_nominal( displayUnit="Pa") "Design chiller evaporator pressure drop (value will be used for each unit)"; parameter Modelica.Units.SI.PressureDifference dpValEvaChiHea_nominal( displayUnit="Pa") "HRC evaporator isolation valve design pressure drop (value will be used for each unit)"; parameter Modelica.Units.SI.Temperature TTanSet[2, 2] "Tank temperature setpoints: 2 cycles with 2 setpoints"; parameter Real k(min=0)=0.01 "Gain of controller"; parameter Modelica.Units.SI.Time Ti=60 "Time constant of integrator block"; parameter Real yMin=0.1 "Lower limit of valve opening when control loop enabled"; parameter Real y_reset=1 "Value to which the controller output is reset if the boolean trigger has a rising edge"; parameter Real y_neutral=0 "Value to which the controller output is reset when the controller is disabled"; parameter Real yBalEvaChi = if dpEvaChiHea_nominal + dpValEvaChiHea_nominal - dpEvaChi_nominal <= 0 then 1 else (dpValEvaChi_nominal / (dpEvaChiHea_nominal + dpValEvaChiHea_nominal - dpEvaChi_nominal))^0.5 "Chiller evaporator isolation valve opening for flow balancing with HRC"; parameter Real yBalEvaChiHea = if dpEvaChi_nominal + dpValEvaChi_nominal - dpEvaChiHea_nominal <= 0 then 1 else (dpValEvaChiHea_nominal / (dpEvaChi_nominal + dpValEvaChi_nominal - dpEvaChiHea_nominal))^0.5 "HRC evaporator isolation valve opening for flow balancing with chiller"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput idxCycTan(final min=1, final max=2) "Index of active tank cycle"; Buildings.Controls.OBC.CDL.Interfaces.IntegerInput mode(final min=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.tankCharge, final max=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.heatRejection) "Condenser loop operating mode"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Chi[nChi] "Cooling-only chiller On/Off command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1ChiHea[nChiHea] "HRC On/Off command"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1CooChiHea[nChiHea] "HRC cooling mode switchover command: true for cooling, false for heating"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1HeaCooChiHea[nChiHea] "HRC direct heat recovery switchover command: true for direct HR, false for cascading"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TEvaLvgChiHea[nChiHea](each final unit="K", each displayUnit="degC") "HRC evaporator barrel leaving temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mEvaChiSet_flow(final unit="kg/s") "Chiller evaporator flow setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mEvaChiHeaSet_flow(final unit="kg/s") "HRC evaporator flow setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mEvaChi_flow[nChi]( each final unit="kg/s") "Chiller evaporator mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConChi_flow[nChi]( each final unit="kg/s") "Chiller condenser mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput mEvaChiHea_flow[nChiHea]( each final unit="kg/s") "HRC evaporator mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatEvaEnt(final unit="K", displayUnit="degC") "HRC evaporator entering CW temperature "; Buildings.Controls.OBC.CDL.Interfaces.RealInput mConChiHea_flow[nChiHea]( each final unit="kg/s") "HRC condenser mass flow rate"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConEntChiHeaSet(final unit="K", displayUnit="degC") "HRC condenser entering temperature setpoint"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConEntChiHea[nChiHea](each final unit="K", each displayUnit="degC") "HRC condenser entering temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConLvgChiHea[nChiHea](each final unit="K", each displayUnit="degC") "HRC condenser barrel leaving temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConLvgChi[nChi](each final unit="K", each displayUnit="degC") "Chiller condenser barrel leaving temperature"; Buildings.Controls.OBC.CDL.Interfaces.RealInput TConWatConRet(final unit= "K", displayUnit="degC") "CWC return temperature"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumChiWat "Enable signal for lead CHW pump"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumHeaWat "Enable signal for lead HW pump"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumConWatCon "Enable signal for lead CW pump serving evaporator loop"; Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumConWatEva "Enable signal for lead CW pump serving evaporator loop"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValEvaChi[nChi] "Cooling-only chiller evaporator isolation valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConChi[nChi](each final unit="1") "Cooling-only chiller condenser isolation valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValEvaChiHea[nChiHea](each final unit="1") "HRC evaporator isolation valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConChiHea[nChiHea](each final unit="1") "HRC condenser isolation valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValEvaSwiChiHea[nChiHea]( each final unit="1") "HRC evaporator switchover valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConSwiChiHea[nChiHea]( each final unit="1") "HRC condenser switchover valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConWatEvaMix "HRC evaporator CW mixing valve commanded position"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValChiWatMinByp(final unit= "1") "CHW minimum flow bypass valve control signal"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValHeaWatMinByp(final unit= "1") "HW minimum flow bypass valve control signal"; EnergyTransferStations.Combined.Controls.PIDWithEnable valEvaChi[nChi]( each k=k, each Ti=Ti, each final yMin=yMin, each final yMax=1, each final reverseActing=true, each final y_reset=y_reset, each final y_neutral=y_neutral) "Chiller evaporator isolation valve control when HRC in direct HR"; EnergyTransferStations.Combined.Controls.PIDWithEnable valConChi[nChi]( each k=k, each Ti=Ti, each final yMin=yMin, each final yMax=1, each final reverseActing=true, each final y_reset=y_reset, each final y_neutral=y_neutral) "Chiller condenser isolation valve control"; EnergyTransferStations.Combined.Controls.PIDWithEnable valEvaChiHea[nChiHea]( each k=4*k, each Ti=Ti/3, each final yMin=yMin, each final yMax=1, each final reverseActing=true, each final y_reset=y_reset, each final y_neutral=y_neutral) "HRC evaporator isolation valve control"; EnergyTransferStations.Combined.Controls.PIDWithEnable valConChiHea[nChiHea]( each k=k, each Ti=Ti, each final yMin=yMin, each final yMax=1, each final reverseActing=true, each final y_reset=y_reset, each final y_neutral=y_neutral) "HRC condenser isolation valve control"; Buildings.Controls.OBC.CDL.Conversions.BooleanToReal yValConSwi[nChiHea] "HRC condenser switchover valve commanded position"; Buildings.Controls.OBC.CDL.Logical.Not hea[nChiHea] "Return true if heating"; Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt[nChiHea]( each final integerTrue=1, each final integerFalse=0) "Convert"; Buildings.Controls.OBC.CDL.Integers.MultiSum numHeaAndOn(nin=nChiHea) "Number of HRC connected to HW loop and On"; Buildings.Controls.OBC.CDL.Integers.Less intLes[nChiHea] "Return true if switchover valve to be open for heating operation"; Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator rep( final nout=nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Logical.Or heaOrCooCon[nChiHea] "Return true if switchover valve to be open for heating or cooling operation"; Buildings.Controls.OBC.CDL.Logical.And heaAndOn[nChiHea] "Return true if heating AND On"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant idx[nChiHea](final k={i for i in 1:nChiHea}) "HRC index"; Buildings.Controls.OBC.CDL.Logical.Or cooOrDir[nChiHea] "Return true if cooling OR direct HR"; Buildings.Controls.OBC.CDL.Conversions.BooleanToReal yValEvaSwi[nChiHea] "HRC evaporator switchover valve commanded position"; Buildings.Controls.OBC.CDL.Logical.Not heaAndCas[nChiHea] "Return true if cascading heating"; Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt1[nChiHea] "Convert"; Buildings.Controls.OBC.CDL.Integers.MultiSum numHeaAndCasAndOn(nin=nChiHea) "Number of HRC in cascading heating AND On"; Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator rep1(final nout= nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Integers.Less intLes1[nChiHea] "Return true if switchover valve to be open for heating operation"; Buildings.Controls.OBC.CDL.Logical.Or heaOrCooEva[nChiHea] "Return true if switchover valve to be open for heating or cooling operation"; Buildings.Controls.OBC.CDL.Logical.And cooOrDirAndOn[nChiHea] "Return true if (cooling OR direct HR) AND On"; Buildings.Controls.OBC.CDL.Logical.And heaAndCasAndOn[nChiHea] "Return true if cascading heating AND On"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold isOpe[nChiHea](each t=0.1, each h=5E-2) "Check if valve open"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold isOpe1[nChiHea](each t= 0.1, each h=5E-2) "Check if valve open"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold isOpe2[nChi](each t=0.1, each h=5E-2) "Check if valve open"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold isOpe3[nChi](each t=0.1, each h=5E-2) "Check if valve open"; Buildings.Controls.OBC.CDL.Logical.And cooOrDirAndOnAndOpe[nChiHea] "Return true if HRC (cooling OR direct HR) AND On AND isolation valve open"; Buildings.Controls.OBC.CDL.Logical.And onAndOpe[nChi] "Return true if On AND isolation valve open"; Buildings.Controls.OBC.CDL.Logical.And onAndOpe1[nChi] "Return true if On AND isolation valve open"; Buildings.Controls.OBC.CDL.Logical.MultiOr enaPumChiWat(nin=nChi+nChiHea) "Enable signal for lead CHW pump"; Buildings.Controls.OBC.CDL.Logical.MultiOr enaPumConWatCon(nin=nChi+nChiHea+1) "Enable signal for lead CW pump serving condenser loop"; Buildings.Controls.OBC.CDL.Logical.And cooAndOpe[nChiHea] "Return true if cooling (necessarily cascading) AND isolation valve open"; Buildings.Controls.OBC.CDL.Logical.MultiOr enaPumHeaWat(nin=nChiHea) "Enable signal for lead HW pump"; Buildings.Controls.OBC.CDL.Logical.MultiOr enaPumConWatEva(nin=nChiHea) "Enable signal for lead CW pump serving evaporator loop"; Buildings.Controls.OBC.CDL.Logical.And heaAndOnAndOpe[nChiHea] "Return true if heating AND On AND isolation valve open"; Buildings.Controls.OBC.CDL.Logical.And heaAndCasAndOnAndOpe[nChiHea] "Return true if cascading heating AND On AND isolation valve open"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator rep2(final nout=nChi) "Replicate"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator rep3(final nout= nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Logical.And dirHeaCooAndOn[nChiHea] "Return true if direct HR AND On"; Buildings.Controls.OBC.CDL.Logical.MultiOr anyDirHeaCooAndOn(nin=nChiHea) "Return true if any HRC in direct HR AND On"; EnergyTransferStations.Combined.Controls.PIDWithEnable valConSwi( u_s(unit="K", displayUnit="degC"), u_m(unit="K", displayUnit="degC"), k=k, Ti=Ti, final yMin=0, final yMax=1, final reverseActing=false, final y_reset=0, final y_neutral=0) "Condenser switchover valve control"; Modelica.Blocks.Sources.IntegerExpression idxHig(final y=max({if dirHeaCooAndOn[i].y then i else 1 for i in 1:nChiHea})) "Highest index of HRC in direct HR (defaulted to 1 if all false)"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator rep4(final nout= nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Integers.Equal equIdx[nChiHea] "Return true if index equals highest index of HRC in direct HR"; Modelica.Blocks.Sources.IntegerExpression idxChiHea[nChiHea](final y={i for i in 1:nChiHea}) "HRC index"; Buildings.Controls.OBC.CDL.Reals.Switch selCtl[nChiHea] "Select control signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant zer[nChiHea](each final k=0) "Constant"; Buildings.Controls.OBC.CDL.Reals.Max max1[nChiHea] "Take into account entering CW temperature control in direct HR mode"; Buildings.Controls.OBC.CDL.Routing.RealExtractor extT(final nin=nChiHea) "Extract value at given index"; Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator rep5(final nout= nChiHea) "Replicate"; EnergyTransferStations.Combined.Controls.PIDWithEnable ctlTConWatEvaLvg[nChiHea]( u_s(each final unit="K", each displayUnit="degC"), u_m(each final unit="K", each displayUnit="degC"), each final k=k/2, each Ti=Ti, each final yMin=0, each final yMax=1, each final reverseActing=true, each final y_reset=0.75, each final y_neutral=0.75) "HRC evaporator leaving temperature control"; Buildings.Controls.OBC.CDL.Routing.RealExtractor TConWatEvaLvgSet(final nin=2) "Extract value at given index"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant TConWatEvaLvgSetCst[2]( final k=TTanSet[:, 1]) "HRC evaporator leaving CW temperature setpoint"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator rep6(final nout= nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Reals.Line valConWatEvaMix[nChiHea] "Mixing valve opening reset: 1 means no bypass flow"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xVal[nChiHea,2](final k=fill({0,0.5}, nChiHea)) "x-value for mixing valve opening reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yVal[nChiHea,2](final k= fill({0,1}, nChiHea)) "y-value for mixing valve opening reset: 1 means no bypass flow"; Buildings.Controls.OBC.CDL.Reals.Line floEva[nChiHea] "HRC evaporator flow reset when On AND cascading heating"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xFlo[nChiHea,2](final k=fill({0.5,1}, nChiHea)) "x-value for evaporator flow reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yFlo[nChiHea,2](final k=fill({mChiWatChiHea_flow_min,mChiWatChiHea_flow_nominal}, nChiHea)) "y-value for evaporator flow reset"; Buildings.Controls.OBC.CDL.Reals.Switch selFloSet[nChiHea] "Select HRC evaporator flow setpoint based on operating mode"; EnergyTransferStations.Combined.Controls.PIDWithEnable ctlTConWatEvaEnt( u_s(final unit="K", displayUnit="degC"), u_m(final unit="K", displayUnit="degC"), k=k, Ti=Ti, final yMin=0, final yMax=1, final reverseActing=true, final y_reset=1, final y_neutral=1) "HRC evaporator entering temperature control: 1 means no bypass flow"; Buildings.Controls.OBC.CDL.Logical.MultiOr anyHeaAndCasAndOn(nin=nChiHea) "Return true if ANY HRC cascading heating AND On"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant TConWatEvaEntSet(final k= max(TTanSet)) "HRC evaporator entering CW temperature setpoint"; Buildings.Controls.OBC.CDL.Reals.MultiMin mulMin(nin=nChiHea+1) "Combine outputs from evaporator entering and leaving temperature control"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant TConWatConRetSetCst[2](final k=TTanSet[:, 2]) "CW condenser loop return temperature setpoint"; Buildings.Controls.OBC.CDL.Routing.RealExtractor TConWatConRetSet(final nin=2) "Extract value at given index"; EnergyTransferStations.Combined.Controls.PIDWithEnable ctlTConWatConRet( u_s(final unit="K", displayUnit="degC"), u_m(final unit="K", displayUnit="degC"), k=k, Ti=Ti, final yMin=0, final yMax=1, final reverseActing=false, final y_reset=0.2, final y_neutral=0.0) "Condenser loop CW return temperature control"; Buildings.Controls.OBC.CDL.Integers.Equal isChaAss "Check if charge assist mode is active"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant chaAss(final k=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.chargeAssist) "Charge assist mode index"; Buildings.Controls.OBC.CDL.Reals.Line floCon[nChi + nChiHea] "Condenser flow reset (normalized output)"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant xFloCon[nChi + nChiHea, 2](final k=fill({0,1}, nChi + nChiHea)) "x-value for flow reset"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yFloCon[nChi + nChiHea, 2](final k=fill({0.1,1}, nChi + nChiHea)) "y-value for condenser flow reset"; Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter scaFloConChi[nChi]( each final k=mConWatChi_flow_nominal) "Scale flow reset signal"; Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter scaFloConChiHea[nChiHea]( each final k=mConWatChiHea_flow_nominal) "Scale flow reset signal"; EnergyTransferStations.Combined.Controls.PIDWithEnable ctlTConLvgChi[nChi + nChiHea]( u_s(each final unit="K", each displayUnit="degC"), u_m(each final unit="K", each displayUnit="degC"), each k=k, each Ti=Ti, each final yMin=0, each final yMax=1, each final reverseActing=false, each final y_reset=0.5, each final y_neutral=0) "Condenser leaving temperature control"; Buildings.Controls.OBC.CDL.Integers.Sources.Constant tanCha(final k=Buildings.Experimental.DHC.Plants.Combined.Controls.ModeCondenserLoop.tankCharge) "Tank charge/discharge mode index"; Buildings.Controls.OBC.CDL.Integers.Equal isTanCha "Check if tank charge/discharge mode is active"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rep9(final nout=nChi + nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator rep10(final nout=nChi + nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator rep11(final nout=nChi + nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant one[nChi + nChiHea]( each final k=1) "Constant"; Buildings.Controls.OBC.CDL.Reals.Switch swiFloSet[nChi + nChiHea] "Switch condenser flow setpoint based on condenser loop operating mode"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rep12(final nout=nChi + nChiHea) "Replicate"; Buildings.Controls.OBC.CDL.Reals.Switch swiFloSet1[nChi + nChiHea] "Switch condenser flow setpoint based on condenser loop operating mode"; EnergyTransferStations.Combined.Controls.PIDWithEnable valChiWatMinByp[nChi + nChiHea]( each k=0.01, each Ti=Ti, each final yMin=0, each final yMax=1, each final reverseActing=true, each final y_reset=0, each final y_neutral=0) "CHW minimum flow bypass valve control"; EnergyTransferStations.Combined.Controls.PIDWithEnable valHeaWatMinByp[nChiHea]( each k=0.01, each Ti=Ti, each final yMin=0, each final yMax=1, each final reverseActing=true, each final y_reset=0, each final y_neutral=0) "HW minimum flow bypass valve control"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant floChiWatMin[nChi + nChiHea](final k=1.1*cat( 1, fill(mChiWatChi_flow_min, nChi), fill(mChiWatChiHea_flow_min, nChiHea))) "Minimum flow setpoint"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant floHeaWatMin[nChiHea](final k= 1.1*fill(mHeaWatChiHea_flow_min, nChiHea)) "Minimum flow setpoint"; Buildings.Controls.OBC.CDL.Reals.MultiMax max2(nin=nChi + nChiHea) "Maximum control signal"; Buildings.Controls.OBC.CDL.Reals.MultiMax max3(nin=nChiHea) "Maximum control signal"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rep7(final nout=nChi) "Replicate"; Buildings.Controls.OBC.CDL.Reals.Switch swi[nChi] "Condition to enable evaporator flow control loop"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant zer1[nChi](final k= fill(0, nChi)) "Constant"; Buildings.Controls.OBC.CDL.Logical.Not noHeaAndCooAndOn "Return true if NO HRC in direct HR AND On"; Buildings.Controls.OBC.CDL.Logical.MultiOr anyCooAndOn(nin=nChiHea) "Return true if ANY HRC in cascading cooling AND On"; Buildings.Controls.OBC.CDL.Logical.And and2 "Condition to switch to fixed valve opening (balancing)"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rep8(final nout=nChi) "Replicate"; Buildings.Controls.OBC.CDL.Reals.Switch swi1[nChi] "Condition to enable evaporator flow control loop"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yBalChi[nChi](final k= fill(yBalEvaChi, nChi)) "Constant"; Buildings.Controls.OBC.CDL.Logical.Not fulOpe[nChi] "Condition to switch to fixed full opening"; Buildings.Controls.OBC.CDL.Reals.Switch swi2[nChi] "Condition to enable evaporator flow control loop"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant one1[nChi](final k= fill(1, nChi)) "Constant"; Buildings.Controls.OBC.CDL.Logical.And cooAndOn[nChiHea] "Return true if HRC in cascading cooling AND On"; Buildings.Controls.OBC.CDL.Reals.Switch selValPos[nChiHea] "Select HRC evaporator isolation valve command signal"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant yBalChiHea[nChiHea]( final k=fill(yBalEvaChiHea, nChiHea)) "Constant"; Buildings.Controls.OBC.CDL.Logical.MultiOr anyCooOrDirAndOn(nin=nChiHea) "Return true if any HRC in (cooling OR direct HR) AND On"; Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rep13(final nout=nChi) "Replicate"; Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea[nChiHea] "Convert"; Buildings.Controls.OBC.CDL.Reals.Max max4[nChiHea] "Convert"; Buildings.Controls.OBC.CDL.Interfaces.RealOutput yValConWatByp(final unit="1") "CW chiller bypass valve control signal"; Buildings.Controls.OBC.CDL.Logical.Not isCloConChi[nChi] "Check if valve closed"; Buildings.Controls.OBC.CDL.Logical.MultiAnd allCloAndChaAndEna(nin=nChi+2) "Check if all valves closed AND Charge Assist mode is active"; Buildings.Controls.OBC.CDL.Reals.Switch enaCtlValConWatByp "Enable CW bypass valve control"; Buildings.Controls.OBC.CDL.Reals.Sources.Constant zer2(final k=0) "Constant"; Buildings.Controls.OBC.CDL.Reals.GreaterThreshold isOpe4(t=0.1, h=5E-2) "Check if valve open"; Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1CooOrHea "Plant Enable signal: either cooling or heating is enabled"; equation connect(u1Chi, valConChi.uEna); connect(valConChi.y, yValConChi); connect(rep.y,intLes. u2); connect(intLes.y, heaOrCooCon.u2); connect(heaOrCooCon.y, yValConSwi.u); connect(numHeaAndOn.y, rep.u); connect(u1CooChiHea, hea.u); connect(u1ChiHea, heaAndOn.u1); connect(hea.y, heaAndOn.u2); connect(heaAndOn.y, booToInt.u); connect(idx.y, intLes.u1); connect(cooOrDir.y,heaAndCas. u); connect(booToInt1.y, numHeaAndCasAndOn.u); connect(numHeaAndCasAndOn.y, rep1.u); connect(rep1.y,intLes1. u2); connect(intLes1.y, heaOrCooEva.u2); connect(heaOrCooEva.y, yValEvaSwi.u); connect(u1CooChiHea, cooOrDir.u1); connect(u1HeaCooChiHea, cooOrDir.u2); connect(cooOrDir.y, cooOrDirAndOn.u2); connect(u1ChiHea, cooOrDirAndOn.u1); connect(heaAndCas.y, heaAndCasAndOn.u2); connect(u1ChiHea, heaAndCasAndOn.u1); connect(heaAndCasAndOn.y, booToInt1.u); connect(booToInt.y, numHeaAndOn.u); connect(idx.y, intLes1.u1); connect(cooOrDirAndOn.y, heaOrCooEva.u1); connect(yValEvaChi, isOpe2.u); connect(yValConChi, isOpe3.u); connect(yValEvaChiHea, isOpe.u); connect(yValConChiHea, isOpe1.u); connect(isOpe.y, cooOrDirAndOnAndOpe.u1); connect(cooOrDirAndOn.y, cooOrDirAndOnAndOpe.u2); connect(isOpe2.y, onAndOpe.u2); connect(u1Chi, onAndOpe.u1); connect(isOpe3.y, onAndOpe1.u2); connect(u1Chi, onAndOpe1.u1); connect(onAndOpe[1:nChi].y, enaPumChiWat.u[1:nChi]); connect(cooOrDirAndOnAndOpe[1:nChiHea].y, enaPumChiWat.u[nChi+1:nChi+nChiHea]); connect(onAndOpe1[1:nChi].y, enaPumConWatCon.u[1:nChi]); connect(u1CooChiHea, cooAndOpe.u1); connect(isOpe1.y, cooAndOpe.u2); connect(cooAndOpe[1:nChiHea].y, enaPumConWatCon.u[nChi+1:nChi+nChiHea]); connect(heaAndOn.y, heaAndOnAndOpe.u1); connect(isOpe1.y, heaAndOnAndOpe.u2); connect(heaAndOnAndOpe.y, enaPumHeaWat.u); connect(heaAndCasAndOn.y, heaAndCasAndOnAndOpe.u1); connect(isOpe.y, heaAndCasAndOnAndOpe.u2); connect(heaAndCasAndOnAndOpe.y, enaPumConWatEva.u); connect(enaPumChiWat.y, y1PumChiWat); connect(enaPumConWatCon.y, y1PumConWatCon); connect(enaPumHeaWat.y, y1PumHeaWat); connect(rep3.u, mEvaChiHeaSet_flow); connect(yValEvaSwi.y, yValEvaSwiChiHea); connect(enaPumConWatEva.y, y1PumConWatEva); connect(u1ChiHea, dirHeaCooAndOn.u1); connect(u1HeaCooChiHea, dirHeaCooAndOn.u2); connect(dirHeaCooAndOn.y, anyDirHeaCooAndOn.u); connect(TConEntChiHeaSet, valConSwi.u_s); connect(anyDirHeaCooAndOn.y, valConSwi.uEna); connect(valConSwi.y, rep4.u); connect(equIdx.y, selCtl.u2); connect(rep4.y, selCtl.u1); connect(zer.y, selCtl.u3); connect(yValConSwi.y, max1.u1); connect(max1.y, yValConSwiChiHea); connect(selCtl.y, max1.u2); connect(TConEntChiHea, extT.u); connect(idxHig.y, extT.index); connect(extT.y, valConSwi.u_m); connect(idxHig.y, rep5.u); connect(idxChiHea.y, equIdx.u2); connect(rep5.y, equIdx.u1); connect(heaAndCasAndOn.y, ctlTConWatEvaLvg.uEna); connect(TEvaLvgChiHea, ctlTConWatEvaLvg.u_m); connect(TConWatEvaLvgSetCst.y, TConWatEvaLvgSet.u); connect(idxCycTan, TConWatEvaLvgSet.index); connect(rep6.y, ctlTConWatEvaLvg.u_s); connect(TConWatEvaLvgSet.y, rep6.u); connect(yVal[:, 2].y, valConWatEvaMix.f2); connect(yVal[:, 1].y, valConWatEvaMix.f1); connect(xVal[:, 1].y, valConWatEvaMix.x1); connect(xVal[:, 2].y, valConWatEvaMix.x2); connect(yFlo[:, 2].y, floEva.f2); connect(yFlo[:, 1].y, floEva.f1); connect(xFlo[:, 1].y, floEva.x1); connect(xFlo[:, 2].y, floEva.x2); connect(heaAndCasAndOn.y, selFloSet.u2); connect(rep3.y, selFloSet.u3); connect(ctlTConWatEvaLvg.y, valConWatEvaMix.u); connect(ctlTConWatEvaLvg.y, floEva.u); connect(selFloSet.y, valEvaChiHea.u_s); connect(floEva.y, selFloSet.u1); connect(TConWatEvaEnt, ctlTConWatEvaEnt.u_m); connect(anyHeaAndCasAndOn.y, ctlTConWatEvaEnt.uEna); connect(heaAndCasAndOn.y, anyHeaAndCasAndOn.u); connect(TConWatEvaEntSet.y, ctlTConWatEvaEnt.u_s); connect(ctlTConWatEvaEnt.y, mulMin.u[nChiHea+1]); connect(valConWatEvaMix.y, mulMin.u[1:nChiHea]); connect(mulMin.y, yValConWatEvaMix); connect(TConWatConRetSetCst.y, TConWatConRetSet.u); connect(idxCycTan, TConWatConRetSet.index); connect(mode, isChaAss.u1); connect(chaAss.y, isChaAss.u2); connect(isChaAss.y, ctlTConWatConRet.uEna); connect(TConWatConRetSet.y, ctlTConWatConRet.u_s); connect(TConWatConRet, ctlTConWatConRet.u_m); connect(xFloCon[:, 1].y, floCon.x1); connect(xFloCon[:, 2].y, floCon.x2); connect(mode, isTanCha.u2); connect(tanCha.y, isTanCha.u1); connect(TConLvgChi, ctlTConLvgChi[1:nChi].u_m); connect(TConLvgChiHea, ctlTConLvgChi[nChi + 1:nChi + nChiHea].u_m); connect(isTanCha.y, rep9.u); connect(rep9.y, ctlTConLvgChi.uEna); connect(rep10.y, ctlTConLvgChi.u_s); connect(ctlTConWatConRet.y, rep11.u); connect(TConWatConRetSet.y, rep10.u); connect(rep12.y, swiFloSet.u2); connect(isChaAss.y, rep12.u); connect(rep11.y, swiFloSet.u1); connect(rep9.y, swiFloSet1.u2); connect(ctlTConLvgChi.y, swiFloSet1.u1); connect(one.y, swiFloSet1.u3); connect(swiFloSet1.y, swiFloSet.u3); connect(swiFloSet.y, floCon.u); connect(yFloCon[:, 1].y, floCon.f1); connect(yFloCon[:, 2].y, floCon.f2); connect(scaFloConChi.y, valConChi.u_s); connect(scaFloConChiHea.y, valConChiHea.u_s); connect(floCon[nChi + 1:nChi + nChiHea].y, scaFloConChiHea.u); connect(floCon[1:nChi].y, scaFloConChi.u); connect(onAndOpe.y, valChiWatMinByp[1:nChi].uEna); connect(cooOrDirAndOnAndOpe.y, valChiWatMinByp[nChi + 1:nChi + nChiHea].uEna); connect(heaAndOnAndOpe.y, valHeaWatMinByp.uEna); connect(floChiWatMin.y, valChiWatMinByp.u_s); connect(floHeaWatMin.y, valHeaWatMinByp.u_s); connect(max2.y, yValChiWatMinByp); connect(valChiWatMinByp.y, max2.u); connect(max3.y, yValHeaWatMinByp); connect(valHeaWatMinByp.y, max3.u); connect(mEvaChiHea_flow, valEvaChiHea.u_m); connect(mEvaChiHea_flow, valChiWatMinByp[nChi + 1:nChi + nChiHea].u_m); connect(mConChi_flow, valConChi.u_m); connect(mEvaChi_flow, valEvaChi.u_m); connect(mEvaChi_flow, valChiWatMinByp[1:nChi].u_m); connect(mConChiHea_flow, valConChiHea.u_m); connect(mConChiHea_flow, valHeaWatMinByp.u_m); connect(mEvaChiSet_flow, rep2.u); connect(rep2.y, valEvaChi.u_s); connect(anyDirHeaCooAndOn.y, rep7.u); connect(zer1.y, swi.u3); connect(u1Chi, swi.u2); connect(anyDirHeaCooAndOn.y, noHeaAndCooAndOn.u); connect(anyCooAndOn.y, and2.u1); connect(noHeaAndCooAndOn.y, and2.u2); connect(and2.y, rep8.u); connect(yBalChi.y, swi1.u1); connect(rep8.y, swi1.u2); connect(fulOpe.y, swi2.u2); connect(valEvaChi.y, swi2.u3); connect(rep7.y, valEvaChi.uEna); connect(one1.y, swi2.u1); connect(swi2.y, swi1.u3); connect(swi1.y, swi.u1); connect(swi.y, yValEvaChi); connect(heaAndOn.y, valEvaChiHea.uEna); connect(u1ChiHea, cooAndOn.u1); connect(u1CooChiHea, cooAndOn.u2); connect(cooAndOn.y, selValPos.u2); connect(yBalChiHea.y, selValPos.u1); connect(valEvaChiHea.y, selValPos.u3); connect(selValPos.y, yValEvaChiHea); connect(anyCooOrDirAndOn.y, rep13.u); connect(rep13.y, fulOpe.u); connect(cooOrDirAndOn.y, anyCooOrDirAndOn.u); connect(cooAndOn.y, anyCooAndOn.u); connect(cooAndOn.y, heaOrCooCon.u1); connect(cooAndOn.y, valConChiHea.uEna); connect(heaAndOn.y, booToRea.u); connect(max4.y, yValConChiHea); connect(booToRea.y, max4.u2); connect(valConChiHea.y, max4.u1); connect(isOpe3.y, isCloConChi.u); connect(isCloConChi.y, allCloAndChaAndEna.u[1:nChi]); connect(enaCtlValConWatByp.y, yValConWatByp); connect(allCloAndChaAndEna.y, enaCtlValConWatByp.u2); connect(ctlTConWatConRet.y, enaCtlValConWatByp.u1); connect(isChaAss.y, allCloAndChaAndEna.u[nChi + 1]); connect(zer2.y, enaCtlValConWatByp.u3); connect(yValConWatByp, isOpe4.u); connect(isOpe4.y, enaPumConWatCon.u[nChi+nChiHea+1]); connect(u1CooOrHea, allCloAndChaAndEna.u[nChi+2]); end ValveCondenserEvaporator;