Subsequences for heat pump staging controls
Information
This package contains subsequences that are specific to heat pump controls.
Package Content
| Name |
Description |
AssertMinimumRuntime
|
Assert that heat pumps are not short cycling |
EquipmentAvailability
|
Equipment availability for heating and cooling applications |
EventSequencingMultiple
|
Staging event sequencing for multiple heat pumps |
EventSequencingSingle
|
Staging event sequencing for a single heat pump |
RoutingPrimaryPumpStatus
|
Primary pump status signal routing |
SelectModeState
|
Equipment state and mode selection at a given stage |
Validation
|
Collection of validation models |
Assert that heat pumps are not short cycling
Information
This block asserts that each heat pump does not short cycle, based on its
enable and heating/cooling mode commands.
If use_runTim=true (default), it asserts that the heat pump has
been enabled in the same mode for at least dt_min before its
enable command turns false or its mode command changes.
If use_runTim=false, it asserts that the heat pump has been
commanded off and its mode command hasn't changed for at least
dt_min before its enable command turns true again
or its mode command changes.
Parameters
| Type | Name | Default | Description |
| Boolean | have_chiWat | | Set to true for reversible HP, false for heating-only HP |
| Boolean | use_runTim | true | Set to true to assert minimum runtime, false for minimum off time |
| Integer | nUni | | Number of units |
| Real | dt_min | 10*60 | Minimum runtime or off-time [s] |
| String | message | if use_runTim then "HP minim... | Warning message |
Connectors
| Type | Name | Description |
| input BooleanInput | u1[nUni] | HP on/off command |
| input BooleanInput | u1Hea[nUni] | HP heating/cooling mode command: true=heating, false=cooling |
Modelica definition
block AssertMinimumRuntime
parameter Boolean have_chiWat
;
parameter Boolean use_runTim = true
;
parameter Integer nUni(
final min=1) ;
parameter Real dt_min(
final min=0,
final unit="s") = 10 * 60
;
parameter String message =
if use_runTim
then "HP minimum runtime is not met."
else "HP minimum off-time is not met."
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1[nUni]
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Hea[nUni]
if have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.TrueFalseHold holOn[nUni](
each final trueHoldDuration=
if use_runTim
then dt_min
else 0,
each final falseHoldDuration=
if use_runTim
then 0
else dt_min)
;
Buildings.Controls.OBC.CDL.Logical.Xor xorOn[nUni]
;
Utilities.PlaceholderLogical phHea[nUni](
each final have_inp=have_chiWat,
each final u_internal=true)
;
Buildings.Controls.OBC.CDL.Logical.TrueFalseHold holHea[nUni](
each final trueHoldDuration=dt_min,
each final falseHoldDuration=dt_min)
;
Buildings.Controls.OBC.CDL.Logical.Xor xorHea[nUni]
;
Buildings.Controls.OBC.CDL.Logical.Nor nor[nUni]
;
Buildings.Controls.OBC.CDL.Utilities.Assert assRunTim[nUni](
each message=message)
;
equation
connect(u1, holOn.u);
connect(u1, xorOn.u1);
connect(holOn.y, xorOn.u2);
connect(u1Hea, phHea.u);
connect(phHea.y, holHea.u);
connect(phHea.y, xorHea.u1);
connect(holHea.y, xorHea.u2);
connect(xorOn.y, nor.u1);
connect(xorHea.y, nor.u2);
connect(nor.y, assRunTim.u);
end AssertMinimumRuntime;
Equipment availability for heating and cooling applications
Information
If a reversible heat pump is commanded enabled in either heating or cooling
mode, it is removed from the staging order of the opposite mode until it has
been off for dtOff.
If a polyvalent heat pump is commanded enabled in single mode, it is removed
from the staging order of the opposite single mode until it has been off or
operating in simultaneous heating and cooling mode for dtOff.
Implementation details
To avoid concurrent stage transitions between heating and cooling modes,
"commanded enabled in a given mode" should be interpreted as "required to
run in a given mode", and evaluated before the heat pump is actually
enabled. Event sequencing during stage transitions introduces a delay
between these two events. During this delay, the heat pump should not be
considered available for the opposite mode.
Since the enable commands are computed from the availability signals within
the plant controller, the block is structured to avoid creating an algebraic
loop at simulation time and at initialization: the heating availability has
no direct dependency on any enable command, and the cooling availability
directly depends on the heating enable command only. If both single mode
commands are received at the same time event, the heating command prevails
and the equipment is reported unavailable for cooling.
A mode command is only accepted – and the equipment considered as
operating in that mode – if it is received while the equipment is
available or already operating in that mode. Commands received before the
off time has elapsed are disregarded, so the availability outputs remain
false even if an enable command is issued.
At initial time the equipment is available for all modes.
Parameters
| Type | Name | Default | Description |
| Boolean | is_php | false | Set to true for polyvalent heat pumps |
| Boolean | have_heaWat | | Set to true for plants that provide HW |
| Boolean | have_chiWat | | Set to true for plants that provide CHW |
| Real | dtOff | 900 | Off time required before equipment is deemed available again [s] |
Connectors
| Type | Name | Description |
| input BooleanInput | u1EnaHea | Heating enable command |
| output BooleanOutput | y1Hea | Equipment available for heating |
| input BooleanInput | u1EnaCoo | Cooling enable command |
| output BooleanOutput | y1Coo | Equipment available for cooling |
| input BooleanInput | u1Ava | Equipment available signal |
| input BooleanInput | u1EnaShc | Simultaneous heating and cooling enable command |
| output BooleanOutput | y1Shc | Equipment available for simultaneous heating and cooling |
Modelica definition
block EquipmentAvailability
parameter Boolean is_php = false
;
parameter Boolean have_heaWat
;
parameter Boolean have_chiWat
;
parameter Real dtOff(min=0, unit="s") = 900
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1EnaHea
if have_heaWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Hea
if have_heaWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1EnaCoo
if have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Coo
if have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Ava
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1EnaShc
if is_php
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Shc
if is_php
;
Utilities.PlaceholderLogical phHea(
final have_inp=have_heaWat,
final u_internal=false)
;
Utilities.PlaceholderLogical phCoo(
final have_inp=have_chiWat,
final u_internal=false)
;
Utilities.PlaceholderLogical phShc(
final have_inp=is_php,
final u_internal=false)
;
Buildings.Controls.OBC.CDL.Logical.Not notShc
;
Buildings.Controls.OBC.CDL.Logical.And reqHea
;
Buildings.Controls.OBC.CDL.Logical.And reqCoo
;
Buildings.Controls.OBC.CDL.Logical.Pre preLatHea
;
Buildings.Controls.OBC.CDL.Logical.Pre preLatCoo
;
Buildings.Controls.OBC.CDL.Logical.Or latAll
;
Buildings.Controls.OBC.CDL.Logical.Not entHea
;
Buildings.Controls.OBC.CDL.Logical.Nor entCoo
;
Buildings.Controls.OBC.CDL.Logical.Pre preRunHea
;
Buildings.Controls.OBC.CDL.Logical.Or avaHea
;
Buildings.Controls.OBC.CDL.Logical.And runHea
;
Buildings.Controls.OBC.CDL.Logical.Pre preRunCoo
;
Buildings.Controls.OBC.CDL.Logical.Or avaCoo
;
Buildings.Controls.OBC.CDL.Logical.And runCoo
;
Buildings.Controls.OBC.CDL.Logical.Nor off
;
Buildings.Controls.OBC.CDL.Logical.Timer tim(
final t=dtOff)
;
Buildings.Controls.OBC.CDL.Logical.Latch latHea
;
Buildings.Controls.OBC.CDL.Logical.Latch latCoo
;
Buildings.Controls.OBC.CDL.Logical.And avaAllHea
;
Buildings.Controls.OBC.CDL.Logical.And avaAllCoo
;
equation
connect(phHea.u, u1EnaHea);
connect(u1EnaCoo, phCoo.u);
connect(u1EnaShc, phShc.u);
connect(phShc.y, notShc.u);
connect(phHea.y, reqHea.u1);
connect(notShc.y, reqHea.u2);
connect(phCoo.y, reqCoo.u1);
connect(notShc.y, reqCoo.u2);
connect(preLatHea.y, latAll.u1);
connect(preLatCoo.y, latAll.u2);
connect(latAll.y, entHea.u);
connect(phHea.y, entCoo.u1);
connect(latAll.y, entCoo.u2);
connect(runHea.y, preRunHea.u);
connect(runCoo.y, preRunCoo.u);
connect(runHea.y, off.u1);
connect(runCoo.y, off.u2);
connect(off.y, tim.u);
connect(runHea.y, latHea.u);
connect(tim.passed, latHea.clr);
connect(runCoo.y, latCoo.u);
connect(tim.passed, latCoo.clr);
connect(latHea.y, preLatHea.u);
connect(latCoo.y, preLatCoo.u);
connect(avaHea.y, avaAllHea.u1);
connect(u1Ava, avaAllHea.u2);
connect(u1Ava, avaAllCoo.u2);
connect(avaAllHea.y, y1Hea);
connect(avaAllCoo.y, y1Coo);
connect(u1Ava, y1Shc);
connect(avaHea.y, runHea.u1);
connect(reqHea.y, runHea.u2);
connect(entHea.y, avaHea.u1);
connect(preRunHea.y, avaHea.u2);
connect(avaCoo.y, runCoo.u1);
connect(avaCoo.y, avaAllCoo.u1);
connect(reqCoo.y, runCoo.u2);
connect(preRunCoo.y, avaCoo.u2);
connect(entCoo.y, avaCoo.u1);
end EquipmentAvailability;
Staging event sequencing for multiple heat pumps
Information
This block applies the staging event sequencing logic of
Buildings.Templates.Plants.Controls.HeatPumps.Subsequences.EventSequencingSingle
to a group of nHp reversible heat pumps and nPhp
polyvalent heat pumps.
To facilitate integration into plant controllers serving both reversible and
polyvalent heat pumps, the output connectors for the isolation valve
commands and the primary pump enable commands have always the same dimension
nHp + nPhp. When a piece of equipment is not present for a
given unit, the corresponding array element is set to false.
Parameters
| Type | Name | Default | Description |
| Integer | nHp | | Number of heat pumps |
| Integer | nPhp | | Number of polyvalent eat pumps |
| Boolean | have_heaWat | | Set to true for plants that provide HW |
| Boolean | have_chiWat | | Set to true for plants that provide CHW |
| Boolean | have_valHpInlIso | | Set to true for plants with isolation valves at heat pump inlet |
| Boolean | have_valHpOutIso | | Set to true for plants with isolation valves at heat pump outlet |
| Boolean | have_valPhpInlIso | | Set to true for isolation valves at polyvalent HP inlet |
| Boolean | have_valPhpOutIso | | Set to true for isolation valves at polyvalent HP outlet |
| Boolean | have_pumPriHdr | | Set to true for plants with headered primary pumps |
| Boolean | have_pumChiWatPriDedHp | | Set to true for HP with separate dedicated primary pumps for CHW and HW circuits |
| Integer | nPumHeaWatPri | | Number of primary HW pumps |
| Integer | nPumChiWatPri | | Number of primary CHW pumps |
| Real | dtVal | 90 | Nominal valve timing [s] |
| Real | dtOff | 180 | Heat pump internal shutdown cycle timing [s] |
Connectors
| Type | Name | Description |
| input BooleanInput | u1ShcPhp[nPhp] | SHC enable command – Polyvalent HP |
| input BooleanInput | u1HeaHpPhp[nHp + nPhp] | Heating enable command – HP or polyvalent HP (single mode) |
| input BooleanInput | u1PumHeaWatPriDed_actual[nPumHeaWatPri] | Dedicated primary HW pump status |
| input BooleanInput | u1PumChiWatPriDed_actual[nPumChiWatPri] | Dedicated primary CHW pump status |
| output BooleanOutput | y1ValHeaWatInlIso[nHp + nPhp] | Inlet HW isolation valve command |
| output BooleanOutput | y1ValHeaWatOutIso[nHp + nPhp] | Outlet HW isolation valve command |
| output BooleanOutput | y1ValChiWatInlIso[nHp + nPhp] | Inlet CHW isolation valve command |
| output BooleanOutput | y1ValChiWatOutIso[nHp + nPhp] | Outlet CHW isolation valve command |
| output BooleanOutput | y1PumHeaWatPri[nHp + nPhp] | Primary HW pump request to pump staging logic |
| output BooleanOutput | y1PumChiWatPri[nHp + nPhp] | Primary CHW pump request to pump staging logic |
| output BooleanOutput | y1Hp[nHp] | Heat pump enable command |
| output BooleanOutput | y1HeaHp[nHp] | Heat pump heating mode command |
| input BooleanInput | u1CooHpPhp[nHp + nPhp] | Cooling enable command – HP or polyvalent HP (single mode) |
| output BooleanOutput | y1HeaPhp[nPhp] | Polyvalent HP heating on/off command |
| output BooleanOutput | y1CooPhp[nPhp] | Polyvalent HP cooling on/off command |
| input BooleanInput | u1PumHeaWatPriHdr_actual | Lead headered primary HW pump status |
| input BooleanInput | u1PumChiWatPriHdr_actual | Lead headered primary CHW pump status |
Modelica definition
block EventSequencingMultiple
parameter Integer nHp
;
parameter Integer nPhp
;
parameter Boolean have_heaWat
;
parameter Boolean have_chiWat
;
parameter Boolean have_valHpInlIso(start=false)
;
parameter Boolean have_valHpOutIso(start=false)
;
parameter Boolean have_valPhpInlIso(start=false)
;
parameter Boolean have_valPhpOutIso(start=false)
;
parameter Boolean have_pumPriHdr
;
parameter Boolean have_pumChiWatPriDedHp(start=false)
;
parameter Integer nPumHeaWatPri
;
parameter Integer nPumChiWatPri
;
parameter Real dtVal(min=0, start=90, unit="s") = 90
;
parameter Real dtOff(min=0, unit="s") = 180
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1ShcPhp[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1HeaHpPhp[nHp + nPhp]
if have_heaWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumHeaWatPriDed_actual[nPumHeaWatPri]
if have_heaWat
and not have_pumPriHdr
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumChiWatPriDed_actual[nPumChiWatPri]
if have_chiWat
and not have_pumPriHdr
or have_pumChiWatPriDedHp
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValHeaWatInlIso[nHp +
nPhp]
if have_heaWat
and (have_valHpInlIso
or have_valPhpInlIso)
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValHeaWatOutIso[nHp +
nPhp]
if have_heaWat
and (have_valHpOutIso
or have_valPhpOutIso)
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValChiWatInlIso[nHp +
nPhp]
if have_chiWat
and (have_valHpInlIso
or have_valPhpInlIso)
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValChiWatOutIso[nHp +
nPhp]
if have_chiWat
and (have_valHpOutIso
or have_valPhpOutIso)
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumHeaWatPri[nHp + nPhp]
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumChiWatPri[nHp + nPhp]
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Hp[nHp]
if nHp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaHp[nHp]
if have_heaWat
and have_chiWat
and nHp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1CooHpPhp[nHp + nPhp]
if have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaPhp[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1CooPhp[nPhp]
if nPhp > 0
;
EventSequencingSingle seqEveHp[nHp](
each final is_php=false,
each final have_heaWat=have_heaWat,
each final have_chiWat=have_chiWat,
each final have_valInlIso=have_valHpInlIso,
each final have_valOutIso=have_valHpOutIso,
each final have_pumHeaWatPri=have_heaWat,
each final have_pumChiWatPri=have_chiWat
and have_pumPriHdr
or have_pumChiWatPriDedHp,
each final dtVal=dtVal,
each final dtOff=dtOff)
if nHp > 0
;
EventSequencingSingle seqEvePhp[nPhp](
each final is_php=true,
each final have_heaWat=have_heaWat,
each final have_chiWat=have_chiWat,
each final have_valInlIso=have_valPhpInlIso,
each final have_valOutIso=have_valPhpOutIso,
each final have_pumHeaWatPri=have_heaWat,
each final have_pumChiWatPri=have_chiWat,
each final dtVal=dtVal,
each final dtOff=dtOff)
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumHeaWatPriHdr_actual
if have_heaWat
and have_pumPriHdr
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumChiWatPriHdr_actual
if have_chiWat
and have_pumPriHdr
;
Utilities.ConcatenateParameterLogical u1PumHeaWatPriDed_internal(
final nin1=nPumHeaWatPri,
final is_app=false,
final new=
fill(false,
max(0, nHp + nPhp - nPumHeaWatPri)))
if have_heaWat
and not have_pumPriHdr
;
Utilities.ConcatenateParameterLogical u1PumChiWatPriDed_internal(
final nin1=nPumChiWatPri,
final is_app=false,
final new=
fill(false,
max(0, nHp + nPhp - nPumChiWatPri)))
if have_chiWat
and (
not have_pumPriHdr
and nPhp > 0
or have_pumChiWatPriDedHp)
;
Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator u1PumHeaWatPriHdr_internal(
final nout=nHp + nPhp)
if have_heaWat
and have_pumPriHdr
;
Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator u1PumChiWatPriHdr_internal(
final nout=nHp + nPhp)
if have_chiWat
and have_pumPriHdr
;
equation
connect(u1HeaHpPhp[1:nHp], seqEveHp.u1Hea);
connect(u1CooHpPhp[1:nHp], seqEveHp.u1Coo);
connect(seqEveHp.y1, y1Hp);
connect(seqEveHp.y1Hea, y1HeaHp);
connect(u1HeaHpPhp[nHp + 1:nHp + nPhp], seqEvePhp.u1Hea);
connect(u1CooHpPhp[nHp + 1:nHp + nPhp], seqEvePhp.u1Coo);
connect(u1ShcPhp, seqEvePhp.u1Shc);
connect(u1PumHeaWatPriDed_actual, u1PumHeaWatPriDed_internal.u1);
connect(u1PumHeaWatPriDed_internal.y[1:nHp], seqEveHp.u1PumHeaWatPri_actual);
connect(u1PumChiWatPriDed_actual, u1PumChiWatPriDed_internal.u1);
connect(u1PumChiWatPriDed_internal.y[nHp + 1:nHp +
nPhp], seqEvePhp.u1PumChiWatPri_actual);
connect(u1PumHeaWatPriDed_internal.y[nHp + 1:nHp +
nPhp], seqEvePhp.u1PumHeaWatPri_actual);
connect(u1PumChiWatPriDed_internal.y[1:nHp], seqEveHp.u1PumChiWatPri_actual);
connect(u1PumHeaWatPriHdr_actual, u1PumHeaWatPriHdr_internal.u);
connect(u1PumChiWatPriHdr_actual, u1PumChiWatPriHdr_internal.u);
connect(u1PumHeaWatPriHdr_internal.y[1:nHp], seqEveHp.u1PumHeaWatPri_actual);
connect(u1PumChiWatPriHdr_internal.y[1:nHp], seqEveHp.u1PumChiWatPri_actual);
connect(u1PumHeaWatPriHdr_internal.y[nHp + 1:nHp +
nPhp], seqEvePhp.u1PumHeaWatPri_actual);
connect(u1PumChiWatPriHdr_internal.y[nHp + 1:nHp +
nPhp], seqEvePhp.u1PumChiWatPri_actual);
connect(seqEvePhp.y1PumChiWatPri, y1PumChiWatPri[nHp + 1:nHp + nPhp]);
connect(seqEvePhp.y1PumHeaWatPri, y1PumHeaWatPri[nHp + 1:nHp + nPhp]);
connect(seqEvePhp.y1AndHea, y1HeaPhp);
connect(seqEvePhp.y1AndCoo, y1CooPhp);
connect(seqEveHp.y1ValHeaWatInlIso, y1ValHeaWatInlIso[1:nHp]);
connect(seqEveHp.y1ValHeaWatOutIso, y1ValHeaWatOutIso[1:nHp]);
connect(seqEveHp.y1ValChiWatInlIso, y1ValChiWatInlIso[1:nHp]);
connect(seqEveHp.y1ValChiWatOutIso, y1ValChiWatOutIso[1:nHp]);
connect(seqEvePhp.y1ValHeaWatInlIso, y1ValHeaWatInlIso[nHp + 1:nHp + nPhp]);
connect(seqEvePhp.y1ValHeaWatOutIso, y1ValHeaWatOutIso[nHp + 1:nHp + nPhp]);
connect(seqEvePhp.y1ValChiWatInlIso, y1ValChiWatInlIso[nHp + 1:nHp + nPhp]);
connect(seqEvePhp.y1ValChiWatOutIso, y1ValChiWatOutIso[nHp + 1:nHp + nPhp]);
connect(seqEveHp.y1PumChiWatPri, y1PumChiWatPri[1:nHp]);
connect(seqEveHp.y1PumHeaWatPri, y1PumHeaWatPri[1:nHp]);
end EventSequencingMultiple;
Staging event sequencing for a single heat pump
Information
If a heat pump is commanded on in a desired heating or cooling mode:
-
The isolation valves for desired heating or cooling mode are commanded
open.
-
Plants with dedicated primary pumps: The dedicated primary pumps
are commanded on when the associated isolation valves are commanded open.
-
Plants with headered primary pumps: The headered primary pumps are
commanded on as described in
Buildings.Templates.Plants.Controls.Pumps.Generic.StagingHeadered.
-
Once the isolation valves are fully open (based on nominal valve timing
dtVal) and the lead pumps are proven on, the heat pump is
enabled in heating or cooling mode.
If a heat pump is commanded off:
- The heat pump is disabled.
-
After the time required for the internal shutdown cycle to time out
(
dtOff to be determined empirically, defaulting to
3 min), all isolation valves are commanded closed.
-
Plants with dedicated primary pumps: The dedicated primary pumps
are commanded off when the associated isolation valves are commanded
closed.
-
Plants with headered primary pumps: The headered primary pumps are
commanded off as described in
Buildings.Templates.Plants.Controls.Pumps.Generic.StagingHeadered.
Polyvalent heat pumps
Note: For polyvalent heat pumps with dedicated primary pumps, no isolation
valves are required. This is in contrast with two-pipe reversible heat
pumps, which require changeover valves regardless of the primary pump
arrangement.
If a polyvalent heat pump is commanded on in either heating-only or
cooling-only mode:
-
Plants with dedicated primary pumps: The associated primary pumps
are commanded on. Once the associated primary pumps are proven on, the
polyvalent heat pump command for the desired mode is switched on.
-
Plants with headered primary pumps: The isolation valves for the
desired mode are commanded open. The headered primary pumps are commanded
on as described in
Buildings.Templates.Plants.Controls.Pumps.Generic.StagingHeadered.
Once the isolation valves are fully open (based on nominal valve timing
dtVal) and the lead pumps are proven on, the polyvalent heat
pump command for the desired mode is switched on.
If a polyvalent heat pump is commanded on in simultaneous heating and
cooling mode, the enable interlocking logic described above applies to both
the CHW and HW sides. Once both the CHW and HW isolation valves, if any, are
fully open (based on nominal valve timing dtVal) and the
associated CHW and HW primary pumps are proven on, the polyvalent heat pump
commands for both modes are switched on.
If a polyvalent heat pump switches from heating-only or cooling-only mode to
simultaneous heating and cooling mode, the enable interlocking logic
described above applies to the side being enabled: the polyvalent heat pump
command for the newly enabled mode is switched on once the isolation valves
of that side, if any, are fully open (based on nominal valve timing
dtVal) and the associated primary pumps are proven on.
If a polyvalent heat pump switches from simultaneous heating and cooling
mode to heating-only or cooling-only mode:
-
The polyvalent heat pump command for the disabled mode is switched off.
-
Plants with dedicated primary pumps: The associated primary pumps
of the disabled side are commanded off without delay.
-
Plants with headered primary pumps: The isolation valves of the
disabled side are commanded closed without delay. The headered primary
pumps of the disabled side are commanded off as described in
Buildings.Templates.Plants.Controls.Pumps.Generic.StagingHeadered.
If a polyvalent heat pump is commanded off:
- The polyvalent heat pump commands for both modes are switched off.
-
Plants with dedicated primary pumps: After the time required for
the internal shutdown cycle to time out (
dtOff to be
determined empirically, defaulting to 3 min), the dedicated
primary pumps are commanded off.
-
Plants with headered primary pumps: After the time required for the
internal shutdown cycle to time out (
dtOff to be determined
empirically, defaulting to 3 min), all isolation valves are
commanded closed. The headered primary pumps are commanded off as
described in
Buildings.Templates.Plants.Controls.Pumps.Generic.StagingHeadered.
Implementation details
The timer tracking the heat pump shutdown cycle is reset if the heat pump is
enabled in any mode. This implies that the isolation valves remain open
unless the heat pump stays disabled for at least dtOff. The
heat pump enable sequence must therefore guarantee that the heat pump
remains off for at least dtOff before being enabled in the
opposite mode. For polyvalent heat pumps, this requirement is not needed for
valve and pump control: when one mode is disabled while the other remains
enabled, the isolation valves and pumps of the disabled side are commanded
off without delay. However, any minimum off time required by the heat pump
between opposite operating modes must still be enforced by the enable
sequence.
To facilitate integration into plant controllers serving both reversible and
polyvalent heat pumps, the output connectors for the isolation valve
commands and the primary pump enable commands are always instantiated, and
set to false when the corresponding equipment is not present.
Parameters
| Type | Name | Default | Description |
| Boolean | is_php | false | Set to true for polyvalent heat pumps |
| Boolean | have_heaWat | | Set to true for plants that provide HW |
| Boolean | have_chiWat | | Set to true for plants that provide CHW |
| Boolean | have_valInlIso | | Set to true if the system has inlet isolation valves |
| Boolean | have_valOutIso | | Set to true if the system has outlet isolation valves |
| Boolean | have_pumHeaWatPri | | Set to true for plants with primary HW pumps |
| Boolean | have_pumChiWatPri | | Set to true for plants with separate primary CHW pumps |
| Real | dtVal | 90 | Nominal valve timing [s] |
| Real | dtOff | 180 | Heat pump internal shutdown cycle timing [s] |
Connectors
| Type | Name | Description |
| input BooleanInput | u1Shc | Enable command in SHC mode |
| input BooleanInput | u1Hea | Enable command from heating mode sequence |
| input BooleanInput | u1PumHeaWatPri_actual | Primary HW pump status – Lead headered or dedicated pump |
| input BooleanInput | u1PumChiWatPri_actual | Primary CHW pump status – Lead headered or dedicated pump |
| output BooleanOutput | y1ValHeaWatInlIso | Inlet HW isolation valve command |
| output BooleanOutput | y1ValHeaWatOutIso | Outlet HW isolation valve command |
| output BooleanOutput | y1ValChiWatInlIso | Inlet CHW isolation valve command |
| output BooleanOutput | y1ValChiWatOutIso | Outlet CHW isolation valve command |
| output BooleanOutput | y1PumHeaWatPri | Primary HW pump request to pump staging logic |
| output BooleanOutput | y1PumChiWatPri | Primary CHW pump request to pump staging logic |
| output BooleanOutput | y1 | Enable command |
| output BooleanOutput | y1Hea | Heating mode command |
| input BooleanInput | u1Coo | Enable command from cooling mode sequence |
| output BooleanOutput | y1AndHea | Equipment commanded on in heating mode |
| output BooleanOutput | y1AndCoo | Equipment commanded on in cooling mode |
Modelica definition
block EventSequencingSingle
parameter Boolean is_php = false
;
parameter Boolean have_heaWat
;
parameter Boolean have_chiWat
;
parameter Boolean have_valInlIso
;
parameter Boolean have_valOutIso
;
parameter Boolean have_pumHeaWatPri(start=false)
;
parameter Boolean have_pumChiWatPri(start=false)
;
parameter Real dtVal(min=0, start=90, unit="s") = 90
;
parameter Real dtOff(min=0, unit="s") = 180
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Shc
if is_php
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Hea
if have_heaWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumHeaWatPri_actual
if have_heaWat
and have_pumHeaWatPri
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumChiWatPri_actual
if have_chiWat
and have_pumChiWatPri
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValHeaWatInlIso
if have_heaWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValHeaWatOutIso
if have_heaWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValChiWatInlIso
if have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValChiWatOutIso
if have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumHeaWatPri
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumChiWatPri
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Hea
if have_heaWat
and have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Coo
if have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1AndHea
if have_heaWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1AndCoo
if have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.Timer timValHea(
final t=dtVal)
if have_heaWat
and (have_valInlIso
or have_valOutIso)
;
Buildings.Controls.OBC.CDL.Logical.MultiAnd heaValPum(nin=3)
;
Buildings.Controls.OBC.CDL.Logical.Or heaOrCooMet
;
Buildings.Controls.OBC.CDL.Logical.MultiAnd cooValPum(nin=3)
;
Utilities.PlaceholderLogical timValHea_internal(
final have_inp=have_heaWat
and (have_valInlIso
or have_valOutIso),
final have_inpPh=true,
final u_internal=true)
;
Utilities.PlaceholderLogical u1Coo_internal(
final have_inp=have_chiWat,
final have_inpPh=false,
final u_internal=false)
;
Buildings.Controls.OBC.CDL.Logical.Or u1HeaOrCoo
if have_heaWat
and have_chiWat
and not have_pumChiWatPri
;
Utilities.PlaceholderLogical u1Hea_internal(
final have_inp=have_heaWat,
final have_inpPh=false,
final u_internal=false)
;
Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rou(
final nout=1)
if have_heaWat
and (have_chiWat
and have_pumChiWatPri
or not have_chiWat)
;
Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rou1(
final nout=1)
if have_heaWat
and have_chiWat
and not have_pumChiWatPri
;
Buildings.Controls.OBC.CDL.Logical.Nor off
;
Buildings.Controls.OBC.CDL.Logical.Timer timHp(
final t=dtOff)
;
Buildings.Controls.OBC.CDL.Logical.Latch latValHeaWatIso
if have_heaWat
;
Buildings.Controls.OBC.CDL.Logical.Latch latValChiWatIso
if have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.Latch latPumHeaWatPri
if have_heaWat
;
Buildings.Controls.OBC.CDL.Logical.Latch latPumChiWatPri
if have_chiWat
and have_pumChiWatPri
;
Buildings.Controls.OBC.CDL.Logical.Timer timValCoo(
final t=dtVal)
if have_chiWat
and (have_valInlIso
or have_valOutIso)
;
Utilities.PlaceholderLogical timValCoo_internal(
final have_inp=have_chiWat
and (have_valInlIso
or have_valOutIso),
final have_inpPh=true,
final u_internal=true)
;
Buildings.Controls.OBC.CDL.Logical.Not notHea
;
Buildings.Controls.OBC.CDL.Logical.Not notCoo
;
Buildings.Controls.OBC.CDL.Logical.MultiAnd isPhpAndNotCooAndHea(nin=3)
;
Buildings.Controls.OBC.CDL.Logical.Or timHpOrPhpNotCooAndHea
;
Buildings.Controls.OBC.CDL.Logical.MultiAnd isPhpAndNotHeaAndCoo(nin=3)
;
Buildings.Controls.OBC.CDL.Logical.Or timHpOrPhpNotHeaAndCoo
;
Utilities.PlaceholderLogical u1ShcHea_internal(
final have_inp=is_php,
final have_inpPh=false,
final u_internal=false)
;
Buildings.Controls.OBC.CDL.Logical.Or u1HeaOrShcHea
;
Buildings.Controls.OBC.CDL.Logical.Or u1CooOrShcCoo
;
Buildings.Controls.OBC.CDL.Logical.And heaAndCooMet
;
Buildings.Controls.OBC.CDL.Logical.Pre y1AndHeaPre
if have_heaWat
and have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.Pre y1AndCooPre
if have_heaWat
and have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.Switch swiShcHea
;
Buildings.Controls.OBC.CDL.Logical.Nor offPre
if have_heaWat
and have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.And u1ShcAndOffPre
;
Buildings.Controls.OBC.CDL.Logical.Switch swiShcCoo
;
Utilities.PlaceholderLogical offPre_internal(
final have_inp=have_heaWat
and have_chiWat,
final have_inpPh=false,
final u_internal=false)
;
Buildings.Controls.OBC.CDL.Logical.Sources.Constant isPhp(
final k=is_php)
;
Utilities.PlaceholderLogical y1ValHeaWatInlIso_internal(
final have_inp=have_heaWat
and have_valInlIso,
final have_inpPh=false,
final u_internal=false)
;
Utilities.PlaceholderLogical y1ValHeaWatOutIso_internal(
final have_inp=have_heaWat
and have_valOutIso,
final have_inpPh=false,
final u_internal=false)
;
Utilities.PlaceholderLogical y1ValChiWatInlIso_internal(
final have_inp=have_chiWat
and have_valInlIso,
final have_inpPh=false,
final u_internal=false)
;
Utilities.PlaceholderLogical y1ValChiWatOutIso_internal(
final have_inp=have_chiWat
and have_valOutIso,
final have_inpPh=false,
final u_internal=false)
;
Utilities.PlaceholderLogical y1PumHeaWatPri_internal(
final have_inp=have_heaWat
and have_pumHeaWatPri,
final have_inpPh=false,
final u_internal=false)
;
Utilities.PlaceholderLogical y1PumChiWatPri_internal(
final have_inp=have_chiWat
and have_pumChiWatPri,
final have_inpPh=false,
final u_internal=false)
;
Utilities.PlaceholderLogical u1PumChiWatPri_internal(
final have_inp=have_chiWat
and have_pumChiWatPri,
final have_inpPh=false,
final u_internal=true)
;
Utilities.PlaceholderLogical u1PumHeaWatPri_internal(
final have_inp=have_heaWat
and have_pumHeaWatPri,
final have_inpPh=false,
final u_internal=true)
;
equation
connect(timValHea.passed, timValHea_internal.u);
connect(u1PumHeaWatPri_internal.y, heaValPum.u[1]);
connect(u1PumChiWatPri_internal.y, cooValPum.u[1]);
connect(heaOrCooMet.y, y1);
connect(u1Hea, u1Hea_internal.u);
connect(u1Coo, u1Coo_internal.u);
connect(u1HeaOrCoo.y, rou1.u);
connect(off.y, timHp.u);
connect(rou1.y[1], latPumHeaWatPri.u);
connect(rou.y[1], latPumHeaWatPri.u);
connect(timValHea_internal.y, heaValPum.u[2]);
connect(timValCoo_internal.y, cooValPum.u[2]);
connect(timHp.passed, timHpOrPhpNotCooAndHea.u2);
connect(timHpOrPhpNotCooAndHea.y, latValChiWatIso.clr);
connect(timHpOrPhpNotCooAndHea.y, latPumChiWatPri.clr);
connect(isPhpAndNotCooAndHea.y, timHpOrPhpNotCooAndHea.u1);
connect(timHp.passed, timHpOrPhpNotHeaAndCoo.u2);
connect(isPhpAndNotHeaAndCoo.y, timHpOrPhpNotHeaAndCoo.u1);
connect(timHpOrPhpNotHeaAndCoo.y, latValHeaWatIso.clr);
connect(timHpOrPhpNotHeaAndCoo.y, latPumHeaWatPri.clr);
connect(u1Shc, u1ShcHea_internal.u);
connect(u1HeaOrShcHea.y, timValHea.u);
connect(u1HeaOrShcHea.y, y1Hea);
connect(u1HeaOrShcHea.y, timValHea_internal.uPh);
connect(u1HeaOrShcHea.y, notHea.u);
connect(u1HeaOrShcHea.y, off.u1);
connect(u1HeaOrShcHea.y, rou.u);
connect(u1HeaOrShcHea.y, heaValPum.u[3]);
connect(u1HeaOrShcHea.y, u1HeaOrCoo.u1);
connect(u1CooOrShcCoo.y, timValCoo.u);
connect(u1CooOrShcCoo.y, timValCoo_internal.uPh);
connect(u1CooOrShcCoo.y, cooValPum.u[3]);
connect(u1CooOrShcCoo.y, notCoo.u);
connect(u1CooOrShcCoo.y, off.u2);
connect(u1CooOrShcCoo.y, u1HeaOrCoo.u2);
connect(u1CooOrShcCoo.y, latValChiWatIso.u);
connect(u1HeaOrShcHea.y, latValHeaWatIso.u);
connect(u1CooOrShcCoo.y, latPumChiWatPri.u);
connect(heaValPum.y, heaAndCooMet.u1);
connect(cooValPum.y, heaAndCooMet.u2);
connect(y1AndHea, y1AndHeaPre.u);
connect(y1AndCoo, y1AndCooPre.u);
connect(y1AndCooPre.y, offPre.u2);
connect(y1AndHeaPre.y, offPre.u1);
connect(heaAndCooMet.y, swiShcHea.u1);
connect(heaValPum.y, swiShcHea.u3);
connect(swiShcHea.y, y1AndHea);
connect(cooValPum.y, swiShcCoo.u3);
connect(swiShcCoo.y, y1AndCoo);
connect(heaAndCooMet.y, swiShcCoo.u1);
connect(timValCoo.passed, timValCoo_internal.u);
connect(offPre.y, offPre_internal.u);
connect(offPre_internal.y, u1ShcAndOffPre.u2);
connect(u1ShcAndOffPre.y, swiShcCoo.u2);
connect(u1ShcAndOffPre.y, swiShcHea.u2);
connect(notCoo.y, isPhpAndNotCooAndHea.u[1]);
connect(notHea.y, isPhpAndNotHeaAndCoo.u[1]);
connect(isPhp.y, isPhpAndNotHeaAndCoo.u[2]);
connect(u1CooOrShcCoo.y, isPhpAndNotHeaAndCoo.u[3]);
connect(isPhp.y, isPhpAndNotCooAndHea.u[2]);
connect(u1HeaOrShcHea.y, isPhpAndNotCooAndHea.u[3]);
connect(latValHeaWatIso.y, y1ValHeaWatInlIso_internal.u);
connect(y1ValHeaWatInlIso_internal.y, y1ValHeaWatInlIso);
connect(latValHeaWatIso.y, y1ValHeaWatOutIso_internal.u);
connect(y1ValHeaWatOutIso_internal.y, y1ValHeaWatOutIso);
connect(latValChiWatIso.y, y1ValChiWatInlIso_internal.u);
connect(y1ValChiWatInlIso_internal.y, y1ValChiWatInlIso);
connect(latValChiWatIso.y, y1ValChiWatOutIso_internal.u);
connect(y1ValChiWatOutIso_internal.y, y1ValChiWatOutIso);
connect(swiShcHea.y, heaOrCooMet.u1);
connect(swiShcCoo.y, heaOrCooMet.u2);
connect(u1ShcHea_internal.y, u1ShcAndOffPre.u1);
connect(u1Hea_internal.y, u1HeaOrShcHea.u1);
connect(u1Coo_internal.y, u1CooOrShcCoo.u1);
connect(u1ShcHea_internal.y, u1CooOrShcCoo.u2);
connect(u1ShcHea_internal.y, u1HeaOrShcHea.u2);
connect(latPumHeaWatPri.y, y1PumHeaWatPri_internal.u);
connect(y1PumHeaWatPri_internal.y, y1PumHeaWatPri);
connect(latPumChiWatPri.y, y1PumChiWatPri_internal.u);
connect(y1PumChiWatPri_internal.y, y1PumChiWatPri);
connect(u1PumHeaWatPri_actual, u1PumHeaWatPri_internal.u);
connect(u1PumChiWatPri_actual, u1PumChiWatPri_internal.u);
end EventSequencingSingle;
Primary pump status signal routing
Information
This block consolidates primary pump status signals into a single output
array. Based on the specified pumping configuration, exactly one of the
following paths is instantiated:
-
Headered primary pumps: the headered pump status signals are passed
through directly.
-
Dedicated pumps — reversible HP only: the HP dedicated pump status
signals are passed through directly.
-
Dedicated pumps — polyvalent HP only: the polyvalent HP dedicated
pump status signals are passed through directly.
-
Dedicated pumps — reversible HP and polyvalent HP: the HP and
polyvalent HP dedicated pump status signals are concatenated.
Parameters
| Type | Name | Default | Description |
| Boolean | have_pumPriHdr | | Set to true for headered primary pumps, false for dedicated pumps |
| Integer | nPumPriDedHp | | Number of dedicated primary pumps serving HP |
| Integer | nPumPriDedPhp | | Number of dedicated primary pumps serving polyvalent HP |
| Integer | nPumPri | | Number of primary pumps |
Connectors
| Type | Name | Description |
| input BooleanInput | u1PumPriDedPhp_actual[nPumPriDedPhp] | Primary pump status – Polyvalent HP dedicated pumps |
| input BooleanInput | u1PumPriDedHp_actual[nPumPriDedHp] | Primary pump status – HP dedicated pumps |
| input BooleanInput | u1PumPriHdr_actual[nPumPri] | Primary pump status – Headered pumps |
| output BooleanOutput | y1[nPumPri] | Primary CHW pump status |
Modelica definition
block RoutingPrimaryPumpStatus
parameter Boolean have_pumPriHdr
;
parameter Integer nPumPriDedHp
;
parameter Integer nPumPriDedPhp
;
parameter Integer nPumPri
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumPriDedPhp_actual[nPumPriDedPhp]
if nPumPriDedPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumPriDedHp_actual[nPumPriDedHp]
if nPumPriDedHp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumPriHdr_actual[nPumPri]
if have_pumPriHdr
;
Utilities.ConcatenateLogical pumPriDedHpPhp(
nin1=nPumPriDedHp,
nin2=nPumPriDedPhp)
if nPumPriDedHp > 0
and nPumPriDedPhp > 0
;
Buildings.Controls.OBC.CDL.Routing.BooleanExtractSignal pumPriDedHp(
final nin=nPumPriDedHp,
final nout=nPumPriDedHp)
if nPumPriDedHp > 0
and nPumPriDedPhp == 0
;
Buildings.Controls.OBC.CDL.Routing.BooleanExtractSignal pumPriDedPhp(
final nin=nPumPriDedPhp,
final nout=nPumPriDedPhp)
if nPumPriDedHp == 0
and nPumPriDedPhp > 0
;
Buildings.Controls.OBC.CDL.Routing.BooleanExtractSignal pumPriHdr(
final nin=nPumPri,
final nout=nPumPri)
if have_pumPriHdr
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1[nPumPri]
;
equation
connect(u1PumPriDedHp_actual, pumPriDedHpPhp.u1);
connect(u1PumPriDedPhp_actual, pumPriDedHpPhp.u2);
connect(u1PumPriDedHp_actual, pumPriDedHp.u);
connect(u1PumPriDedPhp_actual, pumPriDedPhp.u);
connect(u1PumPriHdr_actual, pumPriHdr.u);
connect(pumPriHdr.y, y1);
connect(pumPriDedHp.y, y1);
connect(pumPriDedHpPhp.y, y1);
connect(pumPriDedPhp.y, y1);
end RoutingPrimaryPumpStatus;
Equipment state and mode selection at a given stage
Information
State alternation
Heat pumps are lead/lag controlled as specified in
Buildings.Templates.Plants.Controls.StagingRotation.SortRuntime, in
all operating modes.
A single runtime point accumulates per heat pump inclusive of all operating
mode runtimes.
Mode alternation
Plants with reversible heat pumps
Alternation between heating and cooling mode is subject to the requirements
specified in
Buildings.Templates.Plants.Controls.HeatPumps.Subsequences.EquipmentAvailability.
Plants with polyvalents heat pumps
Alternation between heating-only and cooling-only mode is subject to the
requirements specified in
Buildings.Templates.Plants.Controls.HeatPumps.Subsequences.EquipmentAvailability.
Alternation between heating-only or cooling-only mode and SHC mode is
subject to the requirements specified in
Buildings.Templates.Plants.Controls.PolyvalentHeatPumps.ModeAlternation.
Parameters
| Type | Name | Default | Description |
| Boolean | have_chiWat | | Set to true for plants that provide CHW |
| Integer | nStaHp | | Number of stages in HP staging matrix |
| Real | staHp[:, :] | {min(iSta, nHp)/nHp for _ in... | HP staging matrix – Equipment required for each stage [1] |
| Integer | nHp | | Number of reversible heat pumps |
| Integer | nAltHp_select | nHp | Number of reversible heat pumps subject to lead/lag alternation |
| Integer | nPhp | | Number of polyvalent units |
Connectors
| Type | Name | Description |
| input IntegerInput | uIdxSorHp[nAltHp] | Indices of heat pumps sorted by increasing runtime |
| input IntegerInput | uStaHea | Heating stage index |
| input BooleanInput | u1AvaHeaHp[nHp] | HP heating mode available signal |
| input RealInput | staTraHea[nCol, nSta] | Transpose of heating staging matrix at current cooling stage |
| output BooleanOutput | y1HeaHp[nHp] | HP heating mode command |
| input IntegerInput | uIdxSorPhp[nPhp] | Indices of polyvalent units sorted by increasing runtime |
| input BooleanInput | u1AvaHeaPhp[nPhp] | Polyvalent HP heating-only mode available signal |
| input BooleanInput | u1AvaShcPhp[nPhp] | Polyvalent HP SHC mode available signal |
| output BooleanOutput | y1HeaPhp[nPhp] | Polyvalent HP heating-only mode command |
| output BooleanOutput | y1ShcPhp[nPhp] | Polyvalent HP SHC mode command |
| output BooleanOutput | y1HeaOrShcPhp[nPhp] | True if polyvalent HP commanded on in heating-only or SHC mode |
| output BooleanOutput | y1HeaHpPhp[nHp + nPhp] | Heating mode command – HP (up to nHp) and polyvalent HP (from nHp+1) |
| input IntegerInput | uStaCoo | Cooling stage index |
| input RealInput | staTraCoo[nCol, nSta] | Transpose of cooling staging matrix at current heating stage |
| input BooleanInput | u1AvaCooPhp[nPhp] | Polyvalent HP cooling-only mode available signal |
| output BooleanOutput | y1CooPhp[nPhp] | Polyvalent HP cooling-only mode command |
| output BooleanOutput | y1CooHp[nHp] | HP cooling mode command |
| output BooleanOutput | y1CooHpPhp[nHp + nPhp] | Cooling mode command – HP (up to nHp) and polyvalent HP (from nHp+1) |
| input BooleanInput | u1AvaCooHp[nHp] | HP cooling mode available signal |
Modelica definition
block SelectModeState
parameter Boolean have_chiWat
;
parameter Integer nStaHp(start=nHp)
;
parameter Real staHp[:, :](
each final unit="1",
each final min=0,
each final max=1) = {
min(iSta, nHp) / nHp
for _
in 1:nHp, iSta
in 1:nStaHp}
;
final parameter Real traStaHp[:, :] =
{staHp[i, j]
for i
in 1:nStaHp, j
in 1:nHp}
;
parameter Integer nHp
;
parameter Integer nAltHp_select(start=nHp) = nHp
;
final parameter Integer nAltHp =
if nPhp > 0
then nHp
else nAltHp_select
;
parameter Integer nPhp
;
final parameter Integer nSta =
if nPhp > 0
then nHp + nPhp
else size(staHp, 1)
;
final parameter Integer nCol =
if nPhp > 0
then nHp + 2 * nPhp
else size(staHp, 2)
;
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uIdxSorHp[nAltHp]
if nHp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uStaHea
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1AvaHeaHp[nHp]
if nHp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.RealInput staTraHea[nCol, nSta]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaHp[nHp]
if nHp > 0
;
Buildings.Controls.OBC.CDL.Routing.RealExtractor reqEquStaHea[nCol](
each final nin=nSta)
;
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator intScaRepHea(
final nout=nCol)
;
Buildings.Controls.OBC.CDL.Integers.Sources.Constant one(
final k=1)
;
Buildings.Controls.OBC.CDL.Integers.Max maxIntHea
;
Buildings.Controls.OBC.CDL.Integers.GreaterThreshold greZerHea(
final t=0)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToReaHea(
final realTrue=1,
final realFalse=0)
;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaScaRepHea(
final nout=nCol)
;
Buildings.Controls.OBC.CDL.Reals.Multiply voiStaZerHea[nCol]
;
Buildings.Controls.OBC.CDL.Routing.RealExtractSignal reqHpStaHea(
nin=nCol,
nout=nHp,
extract={i
for i
in 1:nHp})
if nHp > 0
;
Buildings.Controls.OBC.CDL.Routing.RealExtractSignal reqPhpHeaSta(
nin=nCol,
nout=nPhp,
extract={nHp + i
for i
in 1:nPhp})
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Routing.RealExtractSignal reqPhpShcSta(
nin=nCol,
nout=nPhp,
extract={nHp + nPhp + i
for i
in 1:nPhp})
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uIdxSorPhp[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1AvaHeaPhp[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1AvaShcPhp[nPhp]
if nPhp > 0
;
StagingRotation.BaseClasses.SelectSortedAvailable selSorAvaHeaHp(
final nEqu=nHp,
final nEquAlt=nAltHp)
if nHp > 0
;
StagingRotation.BaseClasses.SelectSortedAvailable selSorAvaPhpHea(
final nEqu=nPhp,
final nEquAlt=nPhp)
if nPhp > 0
;
StagingRotation.BaseClasses.SelectSortedAvailable selSorAvaPhpShc(
final nEqu=nPhp,
final nEquAlt=nPhp)
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Logical.And isHpAvaAltNeeHea[nHp]
if nHp > 0
;
Buildings.Controls.OBC.CDL.Logical.And isPhpAvaReqOrAltNeeHea[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Logical.And isPhpAvaReqOrAltNeeShc[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaPhp[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ShcPhp[nPhp]
if nPhp > 0
;
StagingRotation.BaseClasses.SelectEquipmentAtStage selEquStaHpHea(
final nEqu=nHp)
if nHp > 0
;
StagingRotation.BaseClasses.SelectEquipmentAtStage selEquStaPhpHea(
final nEqu=nPhp)
if nPhp > 0
;
StagingRotation.BaseClasses.SelectEquipmentAtStage selEquStaPhpShc(
final nEqu=nPhp)
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaOrShcPhp[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Logical.Or onHeaOrShc[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1HeaHpPhp[nHp + nPhp]
;
Buildings.Controls.OBC.CDL.Logical.Or enaHeaHp[nHp]
if nHp > 0
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant traMatStaHp[nCol, nSta](
final k=traStaHp)
if nPhp == 0
;
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uStaCoo
if have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.RealInput staTraCoo[nCol, nSta]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Routing.RealExtractor reqEquStaCoo[nCol](
each final nin=nSta)
if have_chiWat
;
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator intScaRepCoo(
final nout=nCol)
if have_chiWat
;
Buildings.Controls.OBC.CDL.Integers.Max maxIntCoo
if have_chiWat
;
Buildings.Controls.OBC.CDL.Integers.GreaterThreshold greZerCoo(
final t=0)
if have_chiWat
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToReaCoo(
final realTrue=1,
final realFalse=0)
if have_chiWat
;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaScaRepCoo(
final nout=nCol)
if have_chiWat
;
Buildings.Controls.OBC.CDL.Reals.Multiply voiStaZerCoo[nCol]
if have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1AvaCooPhp[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Routing.RealExtractSignal reqPhpCooSta(
nin=nCol,
nout=nPhp,
extract={nHp + i
for i
in 1:nPhp})
if nPhp > 0
;
StagingRotation.BaseClasses.SelectEquipmentAtStage selEquStaPhpCoo(
final nEqu=nPhp)
if nPhp > 0
;
StagingRotation.BaseClasses.SelectSortedAvailable selSorAvaPhpCoo(
final nEqu=nPhp,
final nEquAlt=nPhp)
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Logical.And isPhpAvaReqOrAltNeeCoo[nPhp]
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1CooPhp[nPhp]
if nPhp > 0
;
PolyvalentHeatPumps.ModeAlternation selModPhp(
final nPhp=nPhp)
if nPhp > 0
;
Buildings.Controls.OBC.CDL.Routing.RealExtractSignal reqHpStaCoo(
nin=nCol,
nout=nHp,
extract={i
for i
in 1:nHp})
if nHp > 0
and have_chiWat
;
StagingRotation.BaseClasses.SelectSortedAvailable selSorAvaCooHp(
final nEqu=nHp,
final nEquAlt=nAltHp)
if nHp > 0
and have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.And isHpAvaAltNeeCoo[nHp]
if nHp > 0
and have_chiWat
;
StagingRotation.BaseClasses.SelectEquipmentAtStage selEquStaHpCoo(
final nEqu=nHp)
if nHp > 0
and have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.Or enaCooHp[nHp]
if nHp > 0
and have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1CooHp[nHp]
if nHp > 0
and have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1CooHpPhp[nHp + nPhp]
if have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1AvaCooHp[nHp]
if nHp > 0
and have_chiWat
;
equation
connect(intScaRepHea.y, reqEquStaHea.index);
connect(one.y, maxIntHea.u1);
connect(uStaHea, maxIntHea.u2);
connect(maxIntHea.y, intScaRepHea.u);
connect(uStaHea, greZerHea.u);
connect(greZerHea.y, booToReaHea.u);
connect(booToReaHea.y, reaScaRepHea.u);
connect(reqEquStaHea.y, voiStaZerHea.u1);
connect(reaScaRepHea.y, voiStaZerHea.u2);
connect(staTraHea, reqEquStaHea.u);
connect(voiStaZerHea.y, reqHpStaHea.u);
connect(voiStaZerHea.y, reqPhpHeaSta.u);
connect(voiStaZerHea.y, reqPhpShcSta.u);
connect(uIdxSorHp, selSorAvaHeaHp.uIdxSor);
connect(u1AvaHeaHp, selSorAvaHeaHp.u1Ava);
connect(u1AvaHeaPhp, selSorAvaPhpHea.u1Ava);
connect(selSorAvaHeaHp.y1, isHpAvaAltNeeHea.u1);
connect(selSorAvaPhpHea.y1, isPhpAvaReqOrAltNeeHea.u1);
connect(selSorAvaPhpShc.y1, isPhpAvaReqOrAltNeeShc.u1);
connect(reqHpStaHea.y, selEquStaHpHea.uEquSta);
connect(reqPhpHeaSta.y, selEquStaPhpHea.uEquSta);
connect(reqPhpShcSta.y, selEquStaPhpShc.uEquSta);
connect(u1AvaHeaHp, selEquStaHpHea.u1Ava);
connect(u1AvaHeaPhp, selEquStaPhpHea.u1Ava);
connect(selEquStaPhpHea.nTot, selSorAvaPhpHea.n);
connect(selEquStaPhpShc.nTot, selSorAvaPhpShc.n);
connect(selEquStaPhpShc.y1ReqOrAltAndAva, isPhpAvaReqOrAltNeeShc.u2);
connect(selEquStaPhpHea.y1ReqOrAltAndAva, isPhpAvaReqOrAltNeeHea.u2);
connect(onHeaOrShc.y, y1HeaOrShcPhp);
connect(isPhpAvaReqOrAltNeeHea.y, onHeaOrShc.u1);
connect(isPhpAvaReqOrAltNeeShc.y, onHeaOrShc.u2);
connect(isPhpAvaReqOrAltNeeHea.y, y1HeaHpPhp[nHp + 1:nHp + nPhp]);
connect(isHpAvaAltNeeHea.y, enaHeaHp.u1);
connect(traMatStaHp.y, reqEquStaHea.u);
connect(enaHeaHp.y, y1HeaHp);
connect(selEquStaHpHea.nAlt, selSorAvaHeaHp.n);
connect(selEquStaHpHea.y1AltAndAva, isHpAvaAltNeeHea.u2);
connect(selEquStaHpHea.y1ReqAndAva, enaHeaHp.u2);
connect(enaHeaHp.y, y1HeaHpPhp[1:nHp]);
connect(isPhpAvaReqOrAltNeeHea.y, y1HeaPhp);
connect(isPhpAvaReqOrAltNeeShc.y, y1ShcPhp);
connect(u1AvaShcPhp, selEquStaPhpShc.u1Ava);
connect(u1AvaShcPhp, selSorAvaPhpShc.u1Ava);
connect(staTraCoo, reqEquStaCoo.u);
connect(uStaCoo, maxIntCoo.u2);
connect(maxIntCoo.y, intScaRepCoo.u);
connect(intScaRepCoo.y, reqEquStaCoo.index);
connect(greZerCoo.y, booToReaCoo.u);
connect(booToReaCoo.y, reaScaRepCoo.u);
connect(uStaCoo, greZerCoo.u);
connect(reqEquStaCoo.y, voiStaZerCoo.u1);
connect(reaScaRepCoo.y, voiStaZerCoo.u2);
connect(voiStaZerCoo.y, reqPhpCooSta.u);
connect(reqPhpCooSta.y, selEquStaPhpCoo.uEquSta);
connect(u1AvaCooPhp, selEquStaPhpCoo.u1Ava);
connect(isPhpAvaReqOrAltNeeCoo.y, y1CooPhp);
connect(selEquStaPhpCoo.nTot, selSorAvaPhpCoo.n);
connect(u1AvaCooPhp, selSorAvaPhpCoo.u1Ava);
connect(selSorAvaPhpCoo.y1, isPhpAvaReqOrAltNeeCoo.u1);
connect(uIdxSorPhp, selModPhp.uIdxSor);
connect(selModPhp.yIdxSorHea, selSorAvaPhpHea.uIdxSor);
connect(selEquStaPhpCoo.nTot, selModPhp.nCoo);
connect(y1HeaPhp, selModPhp.u1Hea);
connect(y1ShcPhp, selModPhp.u1Shc);
connect(y1CooPhp, selModPhp.u1Coo);
connect(selModPhp.yIdxSorShc, selSorAvaPhpShc.uIdxSor);
connect(selModPhp.yIdxSorCoo, selSorAvaPhpCoo.uIdxSor);
connect(uIdxSorHp, selSorAvaCooHp.uIdxSor);
connect(selSorAvaCooHp.y1, isHpAvaAltNeeCoo.u1);
connect(reqHpStaCoo.y, selEquStaHpCoo.uEquSta);
connect(isHpAvaAltNeeCoo.y, enaCooHp.u1);
connect(selEquStaHpCoo.nAlt, selSorAvaCooHp.n);
connect(selEquStaHpCoo.y1AltAndAva, isHpAvaAltNeeCoo.u2);
connect(selEquStaHpCoo.y1ReqAndAva, enaCooHp.u2);
connect(selEquStaPhpHea.nTot, selModPhp.nHea);
connect(selEquStaPhpShc.nTot, selModPhp.nShc);
connect(enaCooHp.y, y1CooHp);
connect(u1AvaCooHp, selSorAvaCooHp.u1Ava);
connect(traMatStaHp.y, reqEquStaCoo.u);
connect(one.y, maxIntCoo.u1);
connect(voiStaZerCoo.y, reqHpStaCoo.u);
connect(selEquStaPhpCoo.y1ReqOrAltAndAva, isPhpAvaReqOrAltNeeCoo.u2);
connect(enaCooHp.y, y1CooHpPhp[1:nHp]);
connect(isPhpAvaReqOrAltNeeCoo.y, y1CooHpPhp[nHp + 1:nHp + nPhp]);
connect(u1AvaCooHp, selEquStaHpCoo.u1Ava);
end SelectModeState;