blockStage

Output total stages that should be enabled

Information

Block that outputs the total number of stages to be enabled.

The block compares the input u with the threshold of each stage. If the input is greater than a stage threshold, the output is set to that stage. The block outputs the total number of stages to be enabled.

The parameter n specifies the maximum number of stages. The stage thresholds are evenly distributed, i.e. the thresholds for stages [1, 2, 3, ... , n] are [0, 1/n, 2/n, ... , (n-1)/n], plus a hysteresis which is by default h=0.02/n. Once the output changes, it cannot change for at least holdDuration seconds.

Parameters

TypeNameDefaultDescription
IntegernNumber of stages that could be enabled
RealholdDurationMinimum time that the output needs to be held constant. Set to 0 to disable hold time
Realh0.02/nHysteresis for comparing input with threshold
Integerpre_y_start0Value of pre(y) at initial time

Connectors

TypeNameDefaultDescription
Buildings.Controls.OBC.CDL.Interfaces.RealInputuInput between 0 and 1 for specifying stages
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutputyTotal number of stages that should be enabled

Revisions

  • March 3, 2023, by Michael Wetter:
    Revised implementation.
  • September 8, 2022, by Jianjun Hu:
    First implementation.
    This is for Buildings, issue 3103.