accumulatedDuration function

Requirements.Internal.SlidingWindow.accumulatedDuration  ยท source

Icon of accumulatedDuration

Returns the accumulated duration where buffer value is true in the sliding time window

Extends Modelica.Icons.Function

Returns the total duration, within the sliding time window [t - T, t], of all phases in which the Boolean signal stored in the buffer was true. The buffer must hold the instants at which the signal changed, with alternating values (as stored by the duration checks with push); this is asserted.

The algorithm is that of maxDuration, with the durations of the true phases added instead of their maximum taken: a running true phase counts from its start to t, every closed true phase clipped to the window, and, if the oldest value is false, the true phase before it from max(t0, t - T) on. For an empty buffer the result is min(T, t - t0) if the current value b is true, else 0.

Used by ChecksInSlidingWindow.MinAccumulatedDuration, MaxAccumulatedDuration and BandAccumulatedDuration; tested by TestSlidingWindow.testAccumulatedDuration.

Inputs

NameTypeDescription
buffer inputBufferMemory of sliding window
t inputSI.TimeActual time instant
b inputBooleanActual value at t (used if no element is in the buffer)

Outputs

NameTypeDescription
duration outputSI.TimeAccumulated duration where buffer value is true in window