Buildings.Templates.Plants.Controls.Utilities
Package with utility blocks
Information
This package contains utility blocks that are used to implement the control sequences within Buildings.Templates.Plants.Controls.
Package Content
Name | Description |
---|---|
CountTrue | Output the number of true elements in a Boolean array |
FirstTrueIndex | |
HoldReal | Hold value of real signal based on timer and Boolean signal |
LastTrueIndex | |
MultiMaxInteger | Output the maximum element of the input vector |
MultiMinInteger | Output the minimum element of the input vector |
PIDWithEnable | PID controller with enable signal |
PlaceholderInteger | Output a placeholder signal |
PlaceholderLogical | Output a placeholder signal |
PlaceholderReal | Output a placeholder signal |
SortWithIndices | Sort elements of input vector in ascending or descending order |
StageIndex | Evaluation of stage index from staging signals |
TimerWithReset | Timer measuring the time from the time instant where the Boolean input became true |
TrueArrayConditional | Output a Boolean array with a given number of true elements and a priority order |
Validation | Collection of validation models |
Buildings.Templates.Plants.Controls.Utilities.CountTrue
Output the number of true elements in a Boolean array
Information
Counts the number of true
elements in the Boolean
input vector.
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u1[nin] | Array of Boolean signals |
output IntegerOutput | y | Index of first element being true |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.FirstTrueIndex
Information
Returns the index of the first true
element of the Boolean
input vector.
If no element is true
, the block returns 0.
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u1[nin] | Array of Boolean signals |
output IntegerOutput | y | Index of first element being true |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.HoldReal
Hold value of real signal based on timer and Boolean signal
Information
Holds input value fixed at its last value while the Boolean signal
u1
is true, and for at least the hold time dtHol
.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Real | dtHol | 0 | Hold time [s] |
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u1 | Boolean signal that triggers fixed output value |
input RealInput | u | Input signal |
output RealOutput | y | Output signal |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.LastTrueIndex
Information
Returns the index of the last true
element of the Boolean
input vector.
If no element is true
, the block returns 0.
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u1[nin] | Array of Boolean signals |
output IntegerOutput | y | Index of first element being true |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.MultiMaxInteger
Output the maximum element of the input vector
Information
Outputs the maximum element of the input vector.
Connectors
Type | Name | Description |
---|---|---|
input IntegerInput | u[nin] | Integer input signal |
output IntegerOutput | y | Integer output signal |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.MultiMinInteger
Output the minimum element of the input vector
Information
Outputs the minimum element of the input vector.
Connectors
Type | Name | Description |
---|---|---|
input IntegerInput | u[nin] | Integer input signal |
output IntegerOutput | y | Integer output signal |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.PIDWithEnable
PID controller with enable signal
Information
This is an update of Buildings.Controls.OBC.CDL.Reals.PIDWithReset with an additional enable signal provided as a Boolean input.
-
When enabled, the output of the controller is identical to
Buildings.Controls.OBC.CDL.Reals.PIDWithReset,
and the integral term is reset to
y_reset
at enable time. -
When disabled, the output of the controller is set to
y_neutral
and the setpoint is overridden by the measurement signal in order to avoid time integration of the control error.
Extends from Modelica.Blocks.Icons.Block (Basic graphical layout of input/output block).
Parameters
Type | Name | Default | Description |
---|---|---|---|
SimpleController | controllerType | Buildings.Controls.OBC.CDL.T... | Type of controller |
Real | k | 1 | Gain of controller |
Time | Ti | 0.5 | Time constant of integrator block [s] |
Time | Td | 0.1 | Time constant of derivative block [s] |
Real | r | 1 | Typical range of control error, used for scaling the control error |
Real | yMin | 0 | Lower limit of output |
Real | yMax | 1 | Upper limit of output |
Boolean | reverseActing | true | Set to true for reverse acting, or false for direct acting control action |
Real | y_reset | yMin | Value to which the controller output is reset if the boolean trigger has a rising edge |
Real | y_neutral | y_reset | Value to which the controller output is reset when the controller is disabled |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | u_s | Connector of setpoint input signal |
input RealInput | u_m | Connector of measurement input signal |
output RealOutput | y | Connector of actuator output signal |
input BooleanInput | uEna | Enable signal |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.PlaceholderInteger
Output a placeholder signal
Information
This block enables replacing a variable that is conditionally removed with either a parameter or another input variable.
-
If the parameter
have_inp
is true, the output variabley
is equal to the input variableu
. -
If the parameter
have_inp
is false and the parameterhave_inpPh
is true, the output variabley
is equal to the input variableuPh
. -
If the parameter
have_inp
is false and the parameterhave_inpPh
is false, the output variabley
is equal to the parameteru_internal
.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Boolean | have_inp | true | Set to true if input signal is available |
Boolean | have_inpPh | false | Set to true if placeholder value is provided with input signal |
Integer | u_internal | Placeholder value if input signal is not available |
Connectors
Type | Name | Description |
---|---|---|
input IntegerInput | u | Input |
input IntegerInput | uPh | Input |
output IntegerOutput | y | Output |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.PlaceholderLogical
Output a placeholder signal
Information
This block enables replacing a variable that is conditionally removed with either a parameter or another input variable.
-
If the parameter
have_inp
is true, the output variabley
is equal to the input variableu
. -
If the parameter
have_inp
is false and the parameterhave_inpPh
is true, the output variabley
is equal to the input variableuPh
. -
If the parameter
have_inp
is false and the parameterhave_inpPh
is false, the output variabley
is equal to the parameteru_internal
.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Boolean | have_inp | true | Set to true if input signal is available |
Boolean | have_inpPh | false | Set to true if placeholder value is provided with input signal |
Boolean | u_internal | Placeholder value if input signal is not available |
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u | Input |
input BooleanInput | uPh | Input |
output BooleanOutput | y | Output |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.PlaceholderReal
Output a placeholder signal
Information
This block enables replacing a variable that is conditionally removed with either a parameter or another input variable.
-
If the parameter
have_inp
is true, the output variabley
is equal to the input variableu
. -
If the parameter
have_inp
is false and the parameterhave_inpPh
is true, the output variabley
is equal to the input variableuPh
. -
If the parameter
have_inp
is false and the parameterhave_inpPh
is false, the output variabley
is equal to the parameteru_internal
.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Boolean | have_inp | true | Set to true if input signal is available |
Boolean | have_inpPh | false | Set to true if placeholder value is provided with input signal |
Real | u_internal | Placeholder value if input signal is not available |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | u | Input |
input RealInput | uPh | Input |
output RealOutput | y | Output |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.SortWithIndices
Sort elements of input vector in ascending or descending order
Information
Block that sorts the elements of the input signal u.
If the parameter ascending = true
, then the output signal y satisfies
yi <= yi+1 for all i ∈ {1, ..., n-1}.
Otherwise, it satisfies
yi >= yi+1 for all i ∈ {1, ..., n-1}.
The output signal yIdx contains the indices of the sorted elements,
with respect to the input vector u.
Usage
Note that this block shall only be used for input signals u
that are
time sampled.
Otherwise, in simulation, numerical noise from a nonlinear solver or from an
implicit time integration algorithm may cause the simulation to stall.
Numerical noise can be present if an input depends
on a state variable or a quantity that requires an iterative solution,
such as a temperature or a mass flow rate of an HVAC system.
In real controllers, measurement noise may cause the output to change frequently.
This block may for example be used in a variable air volume flow controller to access the position of the dampers that are most open.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Boolean | ascending | true | Set to true if ascending order, otherwise order is descending |
Connectors
Type | Name | Description |
---|---|---|
input RealInput | u[nin] | Connector of Real input signals |
output RealOutput | y[nin] | Sorted vector |
output IntegerOutput | yIdx[nin] | Indices of the sorted vector with respect to the original vector |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.StageIndex
Evaluation of stage index from staging signals
Information
This block is used to compute the stage index for a group of multiple equipment such as CHW pumps or chillers.
-
At initial time, stage
0
is active – all units are disabled. -
From stage
0
, the transition to the next higher available stage is triggered when the lead unit is enabled (u1Lea = true
) and if at least one stage is available. -
From any stage
i
(1 ≤ i ≤ nSta
), the transition to the next higher or lower available stagej
(1 ≤ j ≤ nSta
,j ≠ i
) is triggered when stagei
has been active for the minimum runtime and there is a stage up commandu1Up
or stage down commandu1Dow
, respectively. -
From any stage
i
(1 ≤ i ≤ nSta
), the transition to stage0
is triggered when stagei
has been active for the minimum runtime and the lead unit is disabled (u1Lea = false
).
Unavailable stages are handled by the following requirements.
-
Any unavailable stage (
u1Ava[i] = false
) is skipped during staging events. - If all higher (resp. lower) stages are unavailable, then the transition to a higher (resp. lower) stage is blocked.
- If the current stage is unavailable, the transition to the next higher available stage is triggered.
- Stage transitions due to availability conditions are not subject to the minimum stage runtime requirement.
Caveats
The only way to transition to stage 0
is by disabling the lead unit
(u1Lea = false
).
The stage down command u1Dow
cannot be used to transition
below stage 1
.
When the current stage becomes unavailable, the transition to the next higher available stage is triggered. However, it can happen that equipment that is enabled at the current stage is no longer available while the current stage is not deemed unavailable – for example if a lead/lag alternate equipment remains available. In this case, the equipment rotation logic must stage on the lead/lag alternate equipment to replace the faulty equipment.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Boolean | have_inpAva | true | Set to true if stage availability is provided with input signal, false for stages always available |
Integer | nSta | Number of stages | |
Real | dtRun | 0 | Minimum runtime of each stage [s] |
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u1Lea | Lead unit enable signal |
input BooleanInput | u1Up | Stage up command |
input BooleanInput | u1Dow | Stage down command |
input BooleanInput | u1AvaSta[nSta] | Stage available signal |
output IntegerOutput | y | Stage index |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.TimerWithReset
Timer measuring the time from the time instant where the Boolean input became true
Information
This block is similar to
Buildings.Controls.OBC.CDL.Logical.Timer,
but introduces an additional Boolean input signal reset
,
which resets the timer.
When reset
becomes true:
y=0
and passed=false
.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Real | t | 0 | Threshold time for comparison [s] |
Connectors
Type | Name | Description |
---|---|---|
input BooleanInput | u | Input that switches timer on if true, and off if false |
input BooleanInput | reset | Reset signal |
output RealOutput | y | Elapsed time [s] |
output BooleanOutput | passed | True if the elapsed time is greater than threshold |
Modelica definition
Buildings.Templates.Plants.Controls.Utilities.TrueArrayConditional
Output a Boolean array with a given number of true elements and a priority order
Information
Accepts indices of true elements that may not be within the range of indices of the output vector. In this, the number of true elements will not be met.
Parameters
Type | Name | Default | Description |
---|---|---|---|
Integer | nout | nin | Size of output array |
Connectors
Type | Name | Description |
---|---|---|
input IntegerInput | u | Number of true elements |
input IntegerInput | uIdx[nin] | Array of indices by order of priority to be true |
output BooleanOutput | y1[nout] | Output |