accumulatedDuration function
Requirements.Internal.SlidingWindow.accumulatedDuration
ยท source
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
| Name | Type | Description |
|---|---|---|
buffer input | Buffer | Memory of sliding window |
t input | SI.Time | Actual time instant |
b input | Boolean | Actual value at t (used if no element is in the buffer) |
Outputs
| Name | Type | Description |
|---|---|---|
duration output | SI.Time | Accumulated duration where buffer value is true in window |