testMaxDuration impure function
Requirements.Internal.TestSlidingWindow.testMaxDuration
ยท source
Test SlidingWindow.maxDuration on seven cases with known results
Extends Modelica.Icons.Function
Tests SlidingWindow.maxDuration,
the function the MinDuration check uses. Seven cases are built with
init,
push and
removeOldest, with window lengths of
4 s and 2 s: several true phases in the window, a running true phase, a window longer than every phase
(the result is clipped to T), a change at the current instant, and the oldest element leaving the
window. For each case the computed duration is printed with the expected value and asserted to be within
eps = 1e-10 of it; a failing case stops with the message "<case>: Wrong duration".
The function has no inputs or outputs; call it from the command line or a script of the tool, e.g.
Requirements.Internal.TestSlidingWindow.testMaxDuration(). The function is impure because
push and print are.
Revisions
2026-12-03, Model Based Innovation LLC: renamed from testMinDuration (it tests maxDuration) and declared impure.