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.
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.
The sorting logic is implemented using the following method.
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).