Counters

Counter components output the amount of time for which a condition has been satisfied. The most common use of counter components is as a building block for timer components, but they have many other uses as well.

Frames True (Inclusive) and Frames True (Exclusive)

../_images/frames-true.png

These components output the number of frames for which the input value has continuously been True. The internal counter starts at zero at the beginning of simulation, and increases by one for every frame where the input is True. As soon as the input becomes False, the output resets to zero. The difference between the Inclusive and Exclusive variants is whether the current frame is included in or excluded from the count when the input is True on the current frame. The components use the Saturating Increment component internally so that, for integer output data types, the output stops incrementing at the data type maximum value instead of overflowing to the data type minimum value.

Frames Since True (Inclusive) and Frames Since True (Exclusive)

../_images/frames-since-true.png

These components are the reverse of the Frames True (Inclusive) and Frames True (Exclusive) components: they output the number of frames since the last time the input was True. The internal counter increases by one for every frame where the input is False. As soon as the input becomes True, the output resets to zero. At the beginning of simulation, the counter starts at the maximum value for the output data type, as if the input had been False for a very long time. (This is the distinction between a Frames Since True component and a “Frames False” component, i.e. a NOT Gate followed by a Frames True component.) The difference between the Inclusive and Exclusive variants is whether the current frame is included in or excluded from the count when the input is False on the current frame.