maxDuration function
Requirements.Internal.SlidingWindow.maxDuration
ยท source
Returns the maximum duration where buffer value is true in the sliding time window
Extends Modelica.Icons.Function
Returns the longest duration, within the sliding time window [t - T, t], of a phase 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 phases are evaluated from the newest to the oldest one: a running true phase (newest value true) counts
from its start to t; every closed true phase from its start to its end, clipped to the window; and
if the oldest value is false, the signal was true before it, from max(t0, t - T) on. An empty buffer
means that the signal has not changed in the window: then the duration is min(T, t - t0) if the
current value b is true, else 0. Phases are not merged, and every duration is at most T.
Used by ChecksInSlidingWindow.MinDuration, MaxDuration and BandDuration; tested by TestSlidingWindow.testMaxDuration. The sum of the durations instead of their maximum is accumulatedDuration.
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 | Maximum duration where buffer value is true in window |