blockOnCounter

Increment the output if the input switches to true

Information

Block that outputs how often the trigger input changed to true since the last invocation of reset.

This block may be used as a counter. Its output y starts at the parameter value y_start. Whenever the input signal trigger changes to true, the output is incremented by 1. When the input reset changes to true, then the output is reset to y = y_start. If both inputs trigger and reset change simultaneously, then the ouput is y = y_start.

Parameters

TypeNameDefaultDescription
Integery_start0Initial and reset value of y if input reset switches to true

Connectors

TypeNameDefaultDescription
Buildings.Controls.OBC.CDL.Interfaces.BooleanInputtriggerTrigger, when set to true, the counter increases
Buildings.Controls.OBC.CDL.Interfaces.BooleanInputresetReset, when true, the counter is set to y_start
Buildings.Controls.OBC.CDL.Interfaces.IntegerOutputyCounter value

Revisions

  • October 21, 2021, by Michael Wetter:
    Removed errorneous visible attribute in icon.
  • January 3, 2017, by Michael Wetter:
    First implementation, based on the implementation of the Modelica Standard Library.