testAccumulatedDuration impure function

Requirements.Internal.TestSlidingWindow.testAccumulatedDuration  ยท source

Icon of testAccumulatedDuration

Test SlidingWindow.accumulatedDuration on seven cases with known results

Extends Modelica.Icons.Function

Tests SlidingWindow.accumulatedDuration on the same seven buffers as testMaxDuration, built with init, push and removeOldest; the expected values are the sums of the true phases in the window (e.g. 6.4 - 5.3 + 4.5 - 3.2 = 2.4 s in the first case). 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.testAccumulatedDuration(). The function is impure because push and print are.

Revisions

2026-12-03, Model Based Innovation LLC: declared impure.