Package of sequences for equipment staging and rotation
Information
This package contains equipment staging and rotation sequences.
Package Content
Name |
Description |
EquipmentAvailability
|
Equipment availability for heating and cooling applications |
EquipmentEnable
|
Return array of equipment to be enabled at given stage |
EventSequencing
|
Staging event sequencing |
SortRuntime
|
Sort equipment by increasing staging runtime |
StageAvailability
|
Compute stage availability |
StageChangeCommand
|
Generate stage change command |
StageCompletion
|
Checks successful completion of stage change |
Validation
|
Collection of validation models |
Equipment availability for heating and cooling applications
Information
If a 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
.
Parameters
Type | Name | Default | Description |
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
Modelica definition
block EquipmentAvailability
parameter Boolean have_heaWat
;
parameter Boolean have_chiWat
;
parameter Real dtOff(
final min=0,
final unit="s")=900
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Hea
if have_heaWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Hea
if have_heaWat
and have_chiWat
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Coo
if have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.And onAndHea
;
Buildings.Controls.OBC.CDL.Logical.And onAndCoo
;
Buildings.Controls.OBC.CDL.Logical.Not coo
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Ava
;
Utilities.PlaceholderLogical phHea(
final have_inp=have_heaWat
and have_chiWat,
final u_internal=have_heaWat
or not have_chiWat)
;
Buildings.Controls.OBC.CDL.Logical.Not off
;
inner Modelica.StateGraph.StateGraphRoot stateGraphRoot;
Modelica.StateGraph.StepWithSignal onHea(
nOut=2,
nIn=1);
Modelica.StateGraph.InitialStepWithSignal avaMod(
nOut=3,
nIn=2)
;
Modelica.StateGraph.TransitionWithSignal trnToOff
;
Modelica.StateGraph.StepWithSignal onCoo(
nOut=2,
nIn=1);
Modelica.StateGraph.TransitionWithSignal trnToCoo
;
Modelica.StateGraph.TransitionWithSignal trnToHea
;
Modelica.StateGraph.TransitionWithSignal trnToOff1
;
Buildings.Controls.OBC.CDL.Logical.Or avaAllHea
;
Buildings.Controls.OBC.CDL.Logical.Or avaAllCoo
;
Modelica.StateGraph.Step offSta(
nOut=1,
nIn=2)
;
Modelica.StateGraph.Transition trnToAvaTim(
enableTimer=true,
final waitTime=dtOff)
;
Modelica.StateGraph.Step unaSta(
nOut=1,
nIn=3)
;
Modelica.StateGraph.TransitionWithSignal trnToUna
;
Buildings.Controls.OBC.CDL.Logical.Not una
;
Modelica.StateGraph.TransitionWithSignal trnToAva
;
Modelica.StateGraph.TransitionWithSignal trnToUna2
;
Modelica.StateGraph.TransitionWithSignal trnToUna3
;
equation
connect(coo.y, onAndCoo.u2);
connect(u1, onAndHea.u1);
connect(u1, onAndCoo.u1);
connect(u1Hea, phHea.u);
connect(phHea.y, onAndHea.u2);
connect(phHea.y, coo.u);
connect(u1, off.u);
connect(avaMod.outPort[1], trnToCoo.inPort);
connect(onAndCoo.y, trnToCoo.condition);
connect(onHea.outPort[1], trnToOff.inPort);
connect(off.y, trnToOff.condition);
connect(onCoo.outPort[1], trnToOff1.inPort);
connect(trnToCoo.outPort, onCoo.inPort[1]);
connect(onAndHea.y, trnToHea.condition);
connect(avaMod.outPort[2], trnToHea.inPort);
connect(avaMod.active, avaAllHea.u1);
connect(onHea.active, avaAllHea.u2);
connect(avaAllHea.y, y1Hea);
connect(avaAllCoo.y, y1Coo);
connect(off.y, trnToOff1.condition);
connect(trnToHea.outPort, onHea.inPort[1]);
connect(offSta.outPort[1], trnToAvaTim.inPort);
connect(trnToOff.outPort, offSta.inPort[1]);
connect(trnToOff1.outPort, offSta.inPort[2]);
connect(trnToAvaTim.outPort, avaMod.inPort[1]);
connect(u1Ava, una.u);
connect(avaMod.outPort[3], trnToUna.inPort);
connect(una.y, trnToUna.condition);
connect(trnToUna.outPort, unaSta.inPort[1]);
connect(unaSta.outPort[1], trnToAva.inPort);
connect(u1Ava, trnToAva.condition);
connect(trnToAva.outPort, avaMod.inPort[2]);
connect(avaMod.active, avaAllCoo.u1);
connect(onCoo.active, avaAllCoo.u2);
connect(onHea.outPort[2], trnToUna2.inPort);
connect(trnToUna2.outPort, unaSta.inPort[2]);
connect(una.y, trnToUna2.condition);
connect(onCoo.outPort[2], trnToUna3.inPort);
connect(trnToUna3.outPort, unaSta.inPort[3]);
connect(una.y, trnToUna3.condition);
end EquipmentAvailability;
Return array of equipment to be enabled at given stage
Information
This block generates the equipment enable commands based on the
active stage index uSta
, the equipment available
signal u1Ava
and the indices of lead/lag alternate
equipment, sorted by increasing staging runtime.
A staging matrix staEqu
is required as a parameter.
- Each row of this matrix corresponds to a given stage.
- Each column of this matrix corresponds to a given equipment.
- A coefficient
staEqu[i, j]
equal to 0
means that equipment j
shall not be enabled at
stage i
.
- A coefficient
staEqu[i, j]
equal to 1
means that equipment j
is required at stage i
.
If equipment j
is unavailable, stage i
is
deemed unavailable.
- A coefficient
staEqu[i, j]
strictly lower than 1
and strictly greater than 0 means that equipment j
may be enabled at stage i
as a lead/lag alternate equipment.
If equipment j
is unavailable but another lead/lag alternate
equipment is available, then the latter equipment is enabled.
Stage i
is only deemed unavailable if all
lead/lag alternate equipment specified for stage i
are unavailable.
-
The sum of the coefficients in a given row
∑_j staEqu[i, j]
gives the number of equipment required at stage i
.
If this number cannot be achieved with the available equipment,
stage i
is deemed unavailable.
-
The condition
∑_j staEqu[i+1, j] ≥ ∑_j staEqu[i, j]
is required for all i < size(staEqu, 1)
.
The state of the enable signals is only updated at stage change, or
if the number of previously enabled equipment that is available is
strictly less than the number of equipment required to run.
This avoids hot swapping equipment, e.g., an equipment would not be started
and another stopped during operation just to fulfill the priority order.
However, when a lead/lag alternate equipment becomes unavailable and another
lead/lag alternate equipment can be enabled to meet the number of required
equipment, then the state of the enable signals is updated.
Parameters
Type | Name | Default | Description |
Real | staEqu[:, :] | | Staging matrix – Equipment required for each stage [1] |
Connectors
Type | Name | Description |
input IntegerInput | uIdxAltSor[nEquAlt] | Indices of lead/lag alternate equipment sorted by increasing runtime |
input IntegerInput | uSta | Stage index |
input BooleanInput | u1Ava[nEqu] | Equipment available signal |
output BooleanOutput | y1[nEqu] | Equipment enable command |
Modelica definition
block EquipmentEnable
parameter Real staEqu[:,:](
each unit="1",
each min=0,
each max=1)
;
final parameter Integer nEquAlt=
max({
sum({(
if staEqu[i, j] > 0
and staEqu[i, j] < 1
then 1
else 0)
for j
in 1:nEqu})
for i
in 1:nSta})
;
final parameter Integer nSta=
size(staEqu, 1)
;
final parameter Integer nEqu=
size(staEqu, 2)
;
final parameter Real traStaEqu[nEqu, nSta]={{staEqu[i, j]
for i
in 1:nSta}
for j
in 1:nEqu}
;
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uIdxAltSor[nEquAlt]
;
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uSta
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Ava[nEqu]
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant traMatStaEqu[nEqu, nSta](
final k=traStaEqu)
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1[nEqu]
;
Buildings.Controls.OBC.CDL.Routing.RealExtractor reqEquSta[nEqu](
each final nin=nSta)
;
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator intScaRep(
final nout=nEqu)
;
Buildings.Controls.OBC.CDL.Reals.MultiSum nEquStaRea(
nin=nEqu)
;
Buildings.Controls.OBC.CDL.Reals.GreaterThreshold isReq[nEqu](
each final t=0.99)
;
Buildings.Controls.OBC.CDL.Logical.And isReqAva[nEqu]
;
Buildings.Controls.OBC.CDL.Reals.GreaterThreshold isReqPosAlt[nEqu](
each final t=1E-4)
;
Buildings.Controls.OBC.CDL.Reals.LessThreshold isNotReqNoAlt[nEqu](
each final t=0.9999)
;
Buildings.Controls.OBC.CDL.Logical.MultiAnd isReqAltAva[nEqu](
each final nin=3)
;
Buildings.Controls.OBC.CDL.Logical.Or ena[nEqu]
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger nEquSta
;
Buildings.Controls.OBC.CDL.Integers.Subtract nAltReq
;
Buildings.Controls.OBC.CDL.Logical.And isReqAltAvaNee[nEqu]
;
Buildings.Controls.OBC.CDL.Integers.Change cha
;
Buildings.Controls.OBC.CDL.Logical.Pre y1Pre[nEqu]
;
Buildings.Controls.OBC.CDL.Logical.Switch logSwi[nEqu]
;
Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator booScaRep(
final nout=nEqu)
;
Utilities.CountTrue nReq(
nin=nEqu)
;
Utilities.CountTrue nEnaAvaPre(
nin=nEqu)
;
Buildings.Controls.OBC.CDL.Integers.Less intLes
;
Buildings.Controls.OBC.CDL.Logical.Or swiEna
;
Buildings.Controls.OBC.CDL.Logical.And isEnaPreAva[nEqu]
;
Utilities.TrueArrayConditional truArrCon(
final nout=nEqu,
final nin=nEquAlt)
;
Buildings.Controls.OBC.CDL.Integers.Sources.Constant one(
final k=1)
;
Buildings.Controls.OBC.CDL.Integers.Max maxInt
;
Buildings.Controls.OBC.CDL.Integers.GreaterThreshold greZer(
final t=0)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal booToRea(
final realTrue=1,
final realFalse=0)
;
Buildings.Controls.OBC.CDL.Routing.RealScalarReplicator reaScaRep(
final nout=nEqu)
;
Buildings.Controls.OBC.CDL.Reals.Multiply voiStaZer[nEqu]
;
equation
connect(intScaRep.y, reqEquSta.index);
connect(traMatStaEqu.y, reqEquSta.u);
connect(isReq.y, isReqAva.u1);
connect(u1Ava, isReqAva.u2);
connect(isReqPosAlt.y, isReqAltAva.u[1]);
connect(isNotReqNoAlt.y, isReqAltAva.u[2]);
connect(u1Ava, isReqAltAva.u[3]);
connect(isReqAva.y, ena.u2);
connect(nEquStaRea.y, nEquSta.u);
connect(nEquSta.y, nAltReq.u1);
connect(isReqAltAva.y, isReqAltAvaNee.u2);
connect(isReqAltAvaNee.y, ena.u1);
connect(uSta, cha.u);
connect(logSwi.y, y1);
connect(y1, y1Pre.u);
connect(y1Pre.y, logSwi.u3);
connect(ena.y, logSwi.u1);
connect(booScaRep.y, logSwi.u2);
connect(nReq.y, nAltReq.u2);
connect(isReq.y, nReq.u1);
connect(nEnaAvaPre.y, intLes.u1);
connect(nEquSta.y, intLes.u2);
connect(swiEna.y, booScaRep.u);
connect(cha.y, swiEna.u1);
connect(intLes.y, swiEna.u2);
connect(isEnaPreAva.y, nEnaAvaPre.u1);
connect(y1Pre.y, isEnaPreAva.u2);
connect(u1Ava, isEnaPreAva.u1);
connect(nAltReq.y, truArrCon.u);
connect(uIdxAltSor, truArrCon.uIdx);
connect(truArrCon.y1, isReqAltAvaNee.u1);
connect(one.y, maxInt.u1);
connect(uSta, maxInt.u2);
connect(maxInt.y, intScaRep.u);
connect(uSta, greZer.u);
connect(greZer.y, booToRea.u);
connect(booToRea.y, reaScaRep.u);
connect(reqEquSta.y, voiStaZer.u1);
connect(reaScaRep.y, voiStaZer.u2);
connect(voiStaZer.y, nEquStaRea.u);
connect(voiStaZer.y, isReqPosAlt.u);
connect(voiStaZer.y, isNotReqNoAlt.u);
connect(voiStaZer.y, isReq.u);
end EquipmentEnable;
Staging event sequencing
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.
Parameters
Type | Name | Default | Description |
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 as inlet isolation valves |
Boolean | have_valOutIso | | Set to true if the system as 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 |
Boolean | have_pumHeaWatSec | | Set to true for plants with secondary HW pumps |
Boolean | have_pumChiWatSec | | Set to true for plants with secondary 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 | u1Hea | Enable command from heating mode sequence |
input BooleanInput | u1PumHeaWatPri_actual | Primary HW pump status (dedicated or lead headered pump) |
input BooleanInput | u1PumChiWatPri_actual | Primary CHW pump status – Dedicated or lead headered pump |
input BooleanInput | u1PumHeaWatSec_actual | Lead headered secondary HW pump status |
input BooleanInput | u1PumChiWatSec_actual | Lead headered secondary CHW pump status |
output BooleanOutput | y1ValHeaWatInlIso | Inlet HW inlet 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 start command – Dedicated or lead headered pump |
output BooleanOutput | y1PumChiWatPri | Primary CHW pump start command – Dedicated or lead headered pump |
output BooleanOutput | y1 | Equipment enable command |
output BooleanOutput | y1Hea | Heating/cooling mode command: true=heating, false=cooling |
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 EventSequencing
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 Boolean have_pumHeaWatSec(start=false)
;
parameter Boolean have_pumChiWatSec(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 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.BooleanInput u1PumHeaWatSec_actual
if have_heaWat
and have_pumHeaWatSec
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1PumChiWatSec_actual
if have_chiWat
and have_pumChiWatSec
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValHeaWatInlIso
if have_heaWat
and have_valInlIso
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValHeaWatOutIso
if have_heaWat
and have_valOutIso
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValChiWatInlIso
if have_chiWat
and have_valInlIso
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1ValChiWatOutIso
if have_chiWat
and have_valOutIso
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumHeaWatPri
if have_heaWat
and have_pumHeaWatPri
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1PumChiWatPri
if have_chiWat
and have_pumChiWatPri
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Hea
if have_heaWat
and have_chiWat
;
Buildings.Controls.OBC.CDL.Logical.Timer timVal(
final t=dtVal)
;
Buildings.Controls.OBC.CDL.Logical.MultiAnd heaValPum(
nin=3)
;
Buildings.Controls.OBC.CDL.Logical.Or ena
;
Buildings.Controls.OBC.CDL.Logical.MultiAnd cooValPum(
nin=4)
;
Utilities.PlaceholderLogical u1PumChiWatSec_internal(
final have_inp=have_chiWat
and have_pumChiWatSec,
final have_inpPh=false,
final u_internal=true)
;
Utilities.PlaceholderLogical timVal_internal(
final have_inp=have_valInlIso
or have_valOutIso,
final have_inpPh=true,
final u_internal=true)
;
Utilities.PlaceholderLogical u1PumHeaWatSec_internal(
final have_inp=have_heaWat
and have_pumHeaWatSec,
final have_inpPh=false,
final u_internal=true)
;
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)
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Coo
if have_chiWat
;
Utilities.PlaceholderLogical u1Coo_internal(
final have_inp=have_chiWat,
final have_inpPh=false,
final u_internal=false)
;
Buildings.Controls.OBC.CDL.Logical.Or u1HeaOrCoo
;
Utilities.PlaceholderLogical u1Hea_internal(
final have_inp=have_heaWat,
final have_inpPh=false,
final u_internal=false)
;
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.And enaAndHea
;
Buildings.Controls.OBC.CDL.Logical.And enaAndCoo
;
Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rou(
final nout=1)
if have_pumChiWatPri
;
Buildings.Controls.OBC.CDL.Routing.BooleanScalarReplicator rou1(
final nout=1)
if 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
;
equation
connect(heaValPum.y, ena.u1);
connect(cooValPum.y, ena.u2);
connect(timVal.passed, timVal_internal.u);
connect(timVal_internal.y, heaValPum.u[1]);
connect(u1PumChiWatSec_actual, u1PumChiWatSec_internal.u);
connect(u1PumHeaWatPri_actual, u1PumHeaWatPri_internal.u);
connect(u1PumChiWatPri_actual, u1PumChiWatPri_internal.u);
connect(u1PumHeaWatSec_actual, u1PumHeaWatSec_internal.u);
connect(u1PumHeaWatPri_internal.y, heaValPum.u[2]);
connect(u1PumHeaWatSec_internal.y, heaValPum.u[3]);
connect(timVal_internal.y, cooValPum.u[1]);
connect(u1PumChiWatPri_internal.y, cooValPum.u[2]);
connect(u1PumChiWatSec_internal.y, cooValPum.u[3]);
connect(ena.y, y1);
connect(u1Hea, u1Hea_internal.u);
connect(u1Coo_internal.y, u1HeaOrCoo.u2);
connect(u1Hea_internal.y, u1HeaOrCoo.u1);
connect(u1HeaOrCoo.y, timVal.u);
connect(u1HeaOrCoo.y, timVal_internal.uPh);
connect(u1Coo, u1Coo_internal.u);
connect(u1Coo_internal.y, cooValPum.u[4]);
connect(u1Hea_internal.y, y1Hea);
connect(ena.y, enaAndHea.u1);
connect(u1Hea_internal.y, enaAndHea.u2);
connect(enaAndHea.y, y1AndHea);
connect(ena.y, enaAndCoo.u1);
connect(u1Coo_internal.y, enaAndCoo.u2);
connect(enaAndCoo.y, y1AndCoo);
connect(u1Hea_internal.y, rou.u);
connect(u1HeaOrCoo.y, rou1.u);
connect(u1Hea_internal.y, off.u1);
connect(u1Coo_internal.y, off.u2);
connect(off.y, timHp.u);
connect(timHp.passed, latValHeaWatIso.clr);
connect(latValHeaWatIso.y, y1ValHeaWatInlIso);
connect(u1Hea_internal.y, latValHeaWatIso.u);
connect(latValChiWatIso.y, y1ValChiWatInlIso);
connect(timHp.passed, latValChiWatIso.clr);
connect(latValHeaWatIso.y, y1ValHeaWatOutIso);
connect(latValChiWatIso.y, y1ValChiWatOutIso);
connect(rou1.y[1], latPumHeaWatPri.u);
connect(rou.y[1], latPumHeaWatPri.u);
connect(timHp.passed, latPumHeaWatPri.clr);
connect(latPumHeaWatPri.y, y1PumHeaWatPri);
connect(latPumChiWatPri.y, y1PumChiWatPri);
connect(timHp.passed, latPumChiWatPri.clr);
connect(u1Coo_internal.y, latPumChiWatPri.u);
connect(u1Coo_internal.y, latValChiWatIso.u);
end EventSequencing;
Sort equipment by increasing staging runtime
Information
This block implements the rotation logic for identical parallel
staged equipment that are lead/lag alternated.
Two runtime points are defined for each equipment.
The Lifetime Runtime is the cumulative runtime of the equipment
since equipment start-up. This point is not readily resettable by operators.
Lifetime Runtime should be stored to a software point on the control
system server so the recorded value is not lost due to controller reset,
loss of power, programming file update, etc.
The Staging Runtime is an operator resettable runtime point that stores
cumulative runtime since the last operator reset.
In the case of available equipment,
when more than one equipment is off or more than one is on,
the equipment with the most operating hours as determined by
Staging Runtime is made the last stage equipment and the one
with the least number of hours is made the lead stage equipment.
In the case of unavailable equipment,
the equipment that alarmed most recently is sent to the last position.
The equipment in alarm automatically moves up in the staging order
only if another equipment goes into alarm.
Staging runtime initialization
When the controller is initialized, the choice of the first equipment to run
is random since all runtimes are equal to zero.
So, before this first equipment reports status, all equipment will be
considered off and only this first equipment will increase runtime and be
queued in the staging order.
At next stage change, another equipment will then be staged on instead,
resulting in the first running equipment being "hot swapped".
To avoid this behavior, the vector parameter runTim_start
is used
to initialize the staging runtime, which will be fixed at this parameter
value until it becomes higher.
The parameter runTim_start
should be set to a vector of
strictly increasing values, where the minimum value is greater than
the time needed for the equipment to report status.
Details
The sorting logic is implemented using the following method.
-
If a unit is on and available, its staging runtime is used as is.
-
If a unit is off and available, its staging runtime is increased
by a constant of 1E10 s.
-
If a unit is unavailable, its staging runtime is replaced by
the time that has elapsed since the unit became unavailable.
This time is then increased by a constant of 1E20 s.
-
A unique instance of the sorting block is then used to order
the different units.
This is effectively the same as sorting the units within
the three following subsets: units that are on and available,
units that are off and available, units that are unavailable.
In particular, the order index of a given unit remains unchanged
if it is the only element of a given subset.
Note that the staging runtime and the time elapsed since an equipment became unavailable
are both computed from Boolean signals (u1Run
and u1Ava
).
These are discrete-time, piecewise constant variables,
which is why the caveat in the documentation of
Buildings.Templates.Plants.Controls.Utilities.SortWithIndices
for purely continuous time-varying variables does not apply here.
Therefore, no sampling is performed before sorting the equipment runtimes.
To facilitate integration into the plant controller, the input vectors
cover the full set of equipment, including equipment that may not be
lead/lag alternate.
The output vectors cover only the subset of lead/lag alternate equipment,
and the vector of sorted equipment provides indices with respect
to the input vectors (full set of equipment).
Parameters
Type | Name | Default | Description |
Integer | idxEquAlt[:] | {i for i in 1:nin} | Indices of lead/lag alternate equipment |
Real | runTim_start[nEquAlt] | {60 + i for i in 1:nEquAlt} | Staging runtime initial values |
Connectors
Type | Name | Description |
input BooleanInput | u1Run[nin] | Boolean signal used to assess equipment runtime |
input BooleanInput | u1Ava[nin] | Equipment available signal |
output RealOutput | yRunTimLif[nEquAlt] | Lifetime runtime |
output RealOutput | yRunTimSta[nEquAlt] | Staging runtime |
output IntegerOutput | yIdx[nEquAlt] | Indices of equipment sorted by increasing staging runtime |
Modelica definition
block SortRuntime
parameter Integer nin=0
;
parameter Integer idxEquAlt[:]={i
for i
in 1:nin}
;
final parameter Integer nEquAlt=
size(idxEquAlt, 1)
;
parameter Real runTim_start[nEquAlt]={60 + i
for i
in 1:nEquAlt}
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Run[nin]
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Ava[nin]
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput yRunTimLif[nEquAlt]
;
Buildings.Controls.OBC.CDL.Interfaces.RealOutput yRunTimSta[nEquAlt]
;
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutput yIdx[nEquAlt](
start={i
for i
in 1:nEquAlt})
;
Buildings.Controls.OBC.CDL.Logical.TimerAccumulating timRun[nEquAlt]
;
Buildings.Controls.OBC.CDL.Logical.Not off[nEquAlt]
;
Buildings.Controls.OBC.CDL.Logical.Sources.Constant u1Res[nEquAlt](
each k=false) ;
Utilities.SortWithIndices sor(
final ascending=true,
nin=nEquAlt)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal weiOffAva[nEquAlt](
each final realTrue=1E10,
each final realFalse=1)
;
Buildings.Controls.OBC.CDL.Reals.Multiply appWeiOffAva[nEquAlt]
;
Buildings.Controls.OBC.CDL.Reals.Multiply voiRunUna[nEquAlt]
;
Buildings.Controls.OBC.CDL.Logical.And offAva[nEquAlt]
;
Buildings.Controls.OBC.CDL.Logical.Not una[nEquAlt]
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal zerUna[nEquAlt](
each final realTrue=0,
each final realFalse=1)
;
Buildings.Controls.OBC.CDL.Logical.Timer timUna[nEquAlt]
;
Buildings.Controls.OBC.CDL.Reals.AddParameter addWei[nEquAlt](
each final p=1E20)
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter opp[nEquAlt](
each final k=- 1)
;
Buildings.Controls.OBC.CDL.Reals.Add addWeiUna[nEquAlt]
;
Buildings.Controls.OBC.CDL.Reals.Multiply voiWeiAva[nEquAlt]
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToReal zerAva[nEquAlt](
each final realTrue=0,
each final realFalse=1)
;
Buildings.Controls.OBC.CDL.Logical.TimerAccumulating timRunLif[nEquAlt]
;
Buildings.Controls.OBC.CDL.Logical.Sources.Constant fal[nEquAlt](
each final k=false)
;
Buildings.Controls.OBC.CDL.Routing.BooleanExtractSignal u1RunEquAlt(
final nin=nin,
final nout=nEquAlt,
final extract=idxEquAlt)
;
Buildings.Controls.OBC.CDL.Routing.BooleanExtractSignal u1AvaEquAlt(
final nin=nin,
final nout=nEquAlt,
final extract=idxEquAlt)
;
Buildings.Controls.OBC.CDL.Routing.IntegerExtractor resIdxInp[nEquAlt](
each final nin=nEquAlt)
;
Buildings.Controls.OBC.CDL.Integers.Sources.Constant idxEquAltMat[nEquAlt, nEquAlt](
final k={idxEquAlt
for i
in 1:nEquAlt})
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant runTimSta[nEquAlt](
final k=runTim_start)
;
Buildings.Controls.OBC.CDL.Reals.Max iniRunTim[nEquAlt]
;
equation
connect(u1Res.y, timRun.reset);
connect(weiOffAva.y, appWeiOffAva.u1);
connect(off.y, offAva.u1);
connect(offAva.y, weiOffAva.u);
connect(appWeiOffAva.y, voiRunUna.u1);
connect(zerUna.y, voiRunUna.u2);
connect(una.y, timUna.u);
connect(una.y, zerUna.u);
connect(timUna.y, opp.u);
connect(opp.y, addWei.u);
connect(addWeiUna.y, sor.u);
connect(voiRunUna.y, addWeiUna.u1);
connect(voiWeiAva.y, addWeiUna.u2);
connect(addWei.y, voiWeiAva.u1);
connect(zerAva.y, voiWeiAva.u2);
connect(timRunLif.y, yRunTimLif);
connect(fal.y, timRunLif.reset);
connect(u1Run, u1RunEquAlt.u);
connect(u1RunEquAlt.y, off.u);
connect(u1RunEquAlt.y, timRunLif.u);
connect(u1RunEquAlt.y, timRun.u);
connect(u1Ava, u1AvaEquAlt.u);
connect(u1AvaEquAlt.y, una.u);
connect(u1AvaEquAlt.y, zerAva.u);
connect(u1AvaEquAlt.y, offAva.u2);
connect(idxEquAltMat.y, resIdxInp.u);
connect(sor.yIdx, resIdxInp.index);
connect(resIdxInp.y, yIdx);
connect(runTimSta.y, iniRunTim.u1);
connect(timRun.y, iniRunTim.u2);
connect(iniRunTim.y, appWeiOffAva.u2);
connect(timRun.y, yRunTimSta);
end SortRuntime;
Compute stage availability
Information
A stage is deemed available if both the following are true:
-
Each equipment required to run at that stage without
lead/lag alternate is available.
-
The number of equipment required to run at that stage –
with or without lead/lag alternate – and available
is greater or equal to the number of equipment required to run
at that stage.
Otherwise, the stage is deemed unavailable.
Parameters
Type | Name | Default | Description |
Real | staEqu[:, :] | | Staging matrix – Equipment required for each stage [1] |
Connectors
Type | Name | Description |
input BooleanInput | u1Ava[nEqu] | Equipment available signal |
output BooleanOutput | y1[nSta] | Stage available signal |
Modelica definition
block StageAvailability
parameter Real staEqu[:,:](
each unit="1",
each min=0,
each max=1)
;
final parameter Integer nSta=
size(staEqu, 1)
;
final parameter Integer nEqu=
size(staEqu, 2)
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1Ava[nEqu]
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1[nSta]
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant matStaEqu[nSta, nEqu](
final k=staEqu)
;
Buildings.Controls.OBC.CDL.Reals.GreaterThreshold isReq[nSta, nEqu](
each final t=0.99)
;
Buildings.Controls.OBC.CDL.Reals.GreaterThreshold isReqPosAlt[nSta, nEqu](
each final t=0)
;
Buildings.Controls.OBC.CDL.Reals.LessThreshold isNotReqNoAlt[nSta, nEqu](
each final t=1)
;
Buildings.Controls.OBC.CDL.Routing.BooleanVectorReplicator booVecRep(
final nin=nEqu,
final nout=nSta)
;
Buildings.Controls.OBC.CDL.Logical.And isReqAva[nSta, nEqu]
;
Buildings.Controls.OBC.CDL.Logical.And isReqAltAva[nSta, nEqu]
;
Buildings.Controls.OBC.CDL.Logical.Or isReqAvaOrNotReq[nSta, nEqu]
;
Buildings.Controls.OBC.CDL.Logical.MultiAnd all[nSta](
each final nin=nEqu)
;
Buildings.Controls.OBC.CDL.Logical.And isAva[nSta]
;
Buildings.Controls.OBC.CDL.Reals.MultiSum nEquSta[nSta](
each final nin=nEqu)
;
Buildings.Controls.OBC.CDL.Conversions.BooleanToInteger booToInt[nSta, nEqu]
;
Buildings.Controls.OBC.CDL.Integers.GreaterEqual isReqAltAvaGreReq[nSta]
;
Buildings.Controls.OBC.CDL.Integers.MultiSum nReqAltAva[nSta](
each final nin=nEqu)
;
Buildings.Controls.OBC.CDL.Conversions.RealToInteger nEquStaInt[nSta]
;
equation
connect(matStaEqu.y, isReq.u);
connect(matStaEqu.y, isReqPosAlt.u);
connect(matStaEqu.y, isNotReqNoAlt.u);
connect(isReq.y, isReqAva.u1);
connect(booVecRep.y, isReqAva.u2);
connect(booVecRep.y, isReqAltAva.u2);
connect(isReqAva.y, isReqAvaOrNotReq.u2);
connect(isNotReqNoAlt.y, isReqAvaOrNotReq.u1);
connect(isAva.y, y1);
connect(isReqAvaOrNotReq.y, all.u);
connect(matStaEqu.y, nEquSta.u);
connect(nReqAltAva.y, isReqAltAvaGreReq.u1);
connect(nReqAltAva.u, booToInt.y);
connect(nEquSta.y, nEquStaInt.u);
connect(nEquStaInt.y, isReqAltAvaGreReq.u2);
connect(u1Ava, booVecRep.u);
connect(isReqPosAlt.y, isReqAltAva.u1);
connect(isReqAltAva.y, booToInt.u);
connect(isReqAltAvaGreReq.y, isAva.u1);
connect(all.y, isAva.u2);
end StageAvailability;
Generate stage change command
Information
The plant equipment is staged in part based on required capacity, Qrequired,
relative to nominal capacity of a given stage, Qstage.
This ratio is the operative part load ratio, OPLR.
OPLR = Qrequired / Qstage
If both primary and secondary hot water temperatures and flow rates are available,
the sensors in the primary loop are used for calculating Qrequired.
If a heat recovery chiller is piped into the secondary return, the sensors in the
primary loop are used.
(These conditions are implemented in
Buildings.Templates.Plants.Controls.HeatPumps.AirToWater.)
The required capacity is calculated based on return temperature,
active supply temperature setpoint and measured flow through the
associated circuit flow meter.
The required capacity used in logic is a rolling average over a period
of dtMea
of instantaneous values sampled at minimum once every 30 s.
When a stage up or stage down transition is initiated,
Qrequired is held fixed at its last value until the longer of
the successful completion of the stage change
and the duration dtRun
.
The nominal capacity of a given stage, Qstage, is calculated
as the sum of the design capacities of all units enabled in a given stage.
Staging is executed per the conditions below subject to the following requirements.
-
Each stage has a minimum runtime of
dtRun
.
(This condition is implemented in
Buildings.Templates.Plants.Controls.Utilities.StageIndex.)
-
Timers are reset to zero at the completion of every stage change.
-
Any unavailable stage is skipped during staging events,
but staging conditionals in the current stage are evaluated as per usual.
A stage up command is triggered if any of the following is true:
-
Availability Condition: The equipment necessary to operate the
current stage is unavailable.
The availability condition is not subject to the minimum stage runtime requirement.
(This condition is implemented in
Buildings.Templates.Plants.Controls.Utilities.StageIndex.)
-
Efficiency Condition: Current stage OPLR > plrSta for a duration of
dtRun
.
A stage down command is triggered if the following is true:
-
Next available lower stage OPLR < plrSta for a duration of
dtRun
.
Details
A staging matrix staEqu
is required as a parameter.
See the documentation of
Buildings.Templates.Plants.Controls.StagingRotation.EquipmentEnable
for the associated definition and requirements.
An "if" condition is used to generate the stage up and down command as opposed
to a "when" condition. This means that the command remains true as long as the
condition is verified. This is necessary, for example, if no higher stage is
available when a stage up command is triggered. Using a "when" condition –
which is only valid at the point in time at which the condition becomes true –
would prevent the plant from staging when a higher stage becomes available again.
To avoid multiple consecutive stage changes, the block that receives the stage up
and down command and computes the stage index must enforce a minimum stage runtime
of dtRun
.
Parameters
Type | Name | Default | Description |
Boolean | have_inpPlrSta | false | Set to true to use an input signal for SPLR, false to use a parameter |
Real | plrSta | 0.9 | Staging part load ratio [1] |
Real | staEqu[:, :] | | Staging matrix – Equipment required for each stage [1] |
Real | capEqu[nEqu] | | Design capacity of each equipment [W] |
Real | dtRun | 900 | Runtime with exceeded staging part load ratio before staging event is triggered [s] |
Real | dtMea | 300 | Duration used to compute the moving average of required capacity [s] |
Real | cp_default | | Default specific heat capacity used to compute required capacity [J/(kg.K)] |
Real | rho_default | | Default density used to compute required capacity [kg/m3] |
Connectors
Type | Name | Description |
input BooleanInput | u1AvaSta[nSta] | Stage available signal |
input BooleanInput | u1StaPro | Staging process in progress |
input RealInput | uPlrSta | Input signal for staging part load ratio [1] |
input IntegerInput | uSta | Stage index |
input RealInput | TRet | Return temperature used to compute required capacity [K] |
input RealInput | TSupSet | Active supply temperature setpoint used to compute required capacity [K] |
input RealInput | V_flow | Volume flow rate used to compute required capacity [m3/s] |
output BooleanOutput | y1Up | Stage up command |
output BooleanOutput | y1Dow | Stage down command |
Modelica definition
block StageChangeCommand
parameter Boolean have_inpPlrSta=false
;
parameter Real plrSta(
final max=1,
final min=0,
start=0.9,
final unit="1")=0.9
;
final parameter Real traStaEqu[nEqu, nSta]={{staEqu[i, j]
for i
in 1:nSta}
for j
in 1:nEqu}
;
parameter Real staEqu[:,:](
each final max=1,
each final min=0,
each final unit="1")
;
final parameter Integer nSta=
size(staEqu, 1)
;
final parameter Integer nEqu=
size(staEqu, 2)
;
parameter Real capEqu[nEqu](
each final min=0,
each final unit="W")
;
parameter Real dtRun(
final min=0,
final unit="s")=900
;
parameter Real dtMea(
final min=0,
final unit="s")=300
;
parameter Real cp_default(
final min=0,
final unit="J/(kg.K)")
;
parameter Real rho_default(
final min=0,
final unit="kg/m3")
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1AvaSta[nSta]
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1StaPro
;
Buildings.Controls.OBC.CDL.Interfaces.RealInput uPlrSta(
final unit="1",
final min=0,
final max=1)
if have_inpPlrSta
;
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uSta(
final min=0,
final max=nSta)
;
Buildings.Controls.OBC.CDL.Interfaces.RealInput TRet(
final unit="K",
displayUnit="degC")
;
Buildings.Controls.OBC.CDL.Interfaces.RealInput TSupSet(
final unit="K",
displayUnit="degC")
;
Buildings.Controls.OBC.CDL.Interfaces.RealInput V_flow(
final unit="m3/s")
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Up
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1Dow
;
Buildings.Controls.OBC.CDL.Reals.Subtract delT(
y(
final unit="K"))
;
Buildings.Controls.OBC.CDL.Reals.Abs absDelT(
y(
final unit="K"))
;
Buildings.Controls.OBC.CDL.Reals.MultiplyByParameter capFlo(
y(
final unit="W/K"),
final k=rho_default * cp_default)
;
Buildings.Controls.OBC.CDL.Reals.Multiply capReq
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant traMatStaEqu[nEqu, nSta](
final k=traStaEqu)
;
Buildings.Controls.OBC.CDL.Routing.RealExtractor reqEquSta[nEqu](
each final nin=nSta)
;
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator intScaRep(
final nout=nEqu)
;
Buildings.Controls.OBC.CDL.Reals.Multiply capEquSta[nEqu]
;
Buildings.Controls.OBC.CDL.Reals.Sources.Constant capEquPar[nEqu](
final k=capEqu)
;
Buildings.Controls.OBC.CDL.Reals.MultiSum capSta(
nin=nEqu)
;
Buildings.Controls.OBC.CDL.Reals.Greater gre(h=1E-4*
min(capEqu))
;
Buildings.Controls.OBC.CDL.Reals.MovingAverage movAve(
delta=dtMea)
;
Buildings.Templates.Plants.Controls.Utilities.TimerWithReset timUp(
final t=dtRun)
;
Buildings.Controls.OBC.CDL.Reals.Less les(h=1E-4*
min(capEqu))
;
Buildings.Templates.Plants.Controls.Utilities.TimerWithReset timDow(
final t=dtRun)
;
Utilities.HoldReal hol(
final dtHol=dtRun)
;
Buildings.Controls.OBC.CDL.Integers.Max maxInt
;
Buildings.Controls.OBC.CDL.Integers.Sources.Constant one(
final k=1)
;
Buildings.Controls.OBC.CDL.Integers.Sources.Constant idxSta[nSta](
final k={i
for i
in 1:nSta})
;
Buildings.Controls.OBC.CDL.Integers.Less idxStaLesAct[nSta]
;
Buildings.Controls.OBC.CDL.Logical.And idxStaLesActAva[nSta];
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator intScaRep1(
final nout=nSta)
;
Utilities.LastTrueIndex idxLasTru(
nin=nSta)
;
Buildings.Controls.OBC.CDL.Integers.Max maxInt1
;
Buildings.Controls.OBC.CDL.Routing.IntegerScalarReplicator intScaRep2(
final nout=nEqu)
;
Buildings.Controls.OBC.CDL.Routing.RealExtractor reqEquStaLow[nEqu](
each final nin=nSta)
;
Buildings.Controls.OBC.CDL.Reals.Multiply capEquStaLow[nEqu]
;
Buildings.Controls.OBC.CDL.Reals.MultiSum capStaLow(
nin=nEqu)
;
Buildings.Controls.OBC.CDL.Integers.Min minInt
;
Buildings.Controls.OBC.CDL.Conversions.IntegerToReal intToRea
;
Buildings.Controls.OBC.CDL.Reals.Multiply setZer
;
Buildings.Controls.OBC.CDL.Reals.Multiply splTimCapSta
;
Buildings.Controls.OBC.CDL.Reals.Multiply splTimCapStaLow
;
Utilities.PlaceholderReal parPlrSta(
final have_inp=have_inpPlrSta,
final have_inpPh=false,
final u_internal=plrSta) ;
Buildings.Controls.OBC.CDL.Logical.FallingEdge endStaPro
;
equation
connect(delT.y, absDelT.u);
connect(absDelT.y, capReq.u1);
connect(capFlo.y, capReq.u2);
connect(intScaRep.y, reqEquSta.index);
connect(traMatStaEqu.y, reqEquSta.u);
connect(reqEquSta.y, capEquSta.u1);
connect(capEquPar.y, capEquSta.u2);
connect(capEquSta.y, capSta.u);
connect(movAve.y, hol.u);
connect(intScaRep.u, maxInt.y);
connect(idxSta.y, idxStaLesAct.u1);
connect(uSta, intScaRep1.u);
connect(intScaRep1.y, idxStaLesAct.u2);
connect(idxStaLesAct.y, idxStaLesActAva.u1);
connect(u1AvaSta, idxStaLesActAva.u2);
connect(idxStaLesActAva.y, idxLasTru.u1);
connect(idxLasTru.y, maxInt1.u2);
connect(one.y, maxInt1.u1);
connect(maxInt1.y, intScaRep2.u);
connect(uSta, maxInt.u1);
connect(one.y, maxInt.u2);
connect(intScaRep2.y, reqEquStaLow.index);
connect(traMatStaEqu.y, reqEquStaLow.u);
connect(reqEquStaLow.y, capEquStaLow.u2);
connect(capEquPar.y, capEquStaLow.u1);
connect(capEquStaLow.y, capStaLow.u);
connect(idxLasTru.y, minInt.u2);
connect(one.y, minInt.u1);
connect(minInt.y, intToRea.u);
connect(capStaLow.y, setZer.u1);
connect(intToRea.y, setZer.u2);
connect(hol.y, gre.u1);
connect(splTimCapSta.y, gre.u2);
connect(capSta.y, splTimCapSta.u2);
connect(setZer.y, splTimCapStaLow.u2);
connect(splTimCapStaLow.y, les.u2);
connect(hol.y, les.u1);
connect(gre.y, timUp.u);
connect(les.y, timDow.u);
connect(uPlrSta, parPlrSta.u);
connect(parPlrSta.y, splTimCapSta.u1);
connect(parPlrSta.y, splTimCapStaLow.u1);
connect(u1StaPro, hol.u1);
connect(u1StaPro, endStaPro.u);
connect(endStaPro.y, timUp.reset);
connect(endStaPro.y, timDow.reset);
connect(timUp.passed, y1Up);
connect(timDow.passed, y1Dow);
connect(TSupSet, delT.u1);
connect(TRet, delT.u2);
connect(V_flow, capFlo.u);
connect(capReq.y, movAve.u);
end StageChangeCommand;
Checks successful completion of stage change
Information
Block that detects a stage change and evaluates whether the stage
transition is completed.
The completion of a stage change is considered successful when
both of the following conditions have been verified.
-
Following a stage transition event, or exactly at the same time,
there is a change in the enable command of at least one equipment.
-
The equipment status matches the enable command for all units,
after any change in the enable command has been detected.
The output signal y1End
is true exactly at the time when
the successful completion of the stage change is confirmed.
The output signal y1
is true during the entire time in which
the stage change is in progress.
Connectors
Modelica definition
block StageCompletion
parameter Integer nin=0
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1[nin]
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanInput u1_actual[nin]
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1End
;
Buildings.Controls.OBC.CDL.Interfaces.BooleanOutput y1
;
Buildings.Controls.OBC.CDL.Logical.And enaAndOn[nin]
;
Buildings.Controls.OBC.CDL.Logical.Nor disAndOff[nin]
;
Buildings.Controls.OBC.CDL.Logical.MultiAnd allTru(
nin=nin)
;
Buildings.Controls.OBC.CDL.Logical.Or onOrOff[nin]
;
Buildings.Controls.OBC.CDL.Logical.FallingEdge endStaPro
;
Buildings.Controls.OBC.CDL.Logical.Latch lckChaSta
;
Buildings.Controls.OBC.CDL.Logical.Change cha[nin]
;
Buildings.Controls.OBC.CDL.Logical.Latch lckAnyCha
;
Buildings.Controls.OBC.CDL.Logical.MultiOr anyCha(
nin=nin)
;
Buildings.Controls.OBC.CDL.Logical.And chaAndMat
;
Buildings.Controls.OBC.CDL.Logical.TrueFalseHold holAnyCha(
trueHoldDuration=1,
falseHoldDuration=0)
;
Buildings.Controls.OBC.CDL.Interfaces.IntegerInput uSta
;
Buildings.Controls.OBC.CDL.Integers.Change chaSta
;
equation
connect(u1_actual, disAndOff.u2);
connect(u1_actual, enaAndOn.u2);
connect(endStaPro.y, y1End);
connect(lckChaSta.y, y1);
connect(cha.y, anyCha.u);
connect(u1, cha.u);
connect(u1, enaAndOn.u1);
connect(lckAnyCha.y, chaAndMat.u1);
connect(chaAndMat.y, lckChaSta.clr);
connect(lckChaSta.y, endStaPro.u);
connect(u1, disAndOff.u1);
connect(enaAndOn.y, onOrOff.u1);
connect(disAndOff.y, onOrOff.u2);
connect(onOrOff.y, allTru.u);
connect(allTru.y, chaAndMat.u2);
connect(anyCha.y, holAnyCha.u);
connect(holAnyCha.y, lckAnyCha.u);
connect(chaSta.y, lckChaSta.u);
connect(chaSta.y, lckAnyCha.clr);
connect(uSta, chaSta.u);
end StageCompletion;