SlidingWindow package

Requirements.Internal.SlidingWindow  ยท source

Icon of SlidingWindow

Ring buffer of the Boolean value changes in a sliding time window, and the functions operating on it (used by ChecksInSlidingWindow)

Extends Modelica.Icons.Package

Implementation of the sliding time windows of ChecksInSlidingWindow. A Boolean signal is represented by the instants at which it changed, stored in a ring buffer, the record Buffer, together with the window length T. The functions create the buffer (init), store a change (push), remove the elements that left the window (removeOldest, nextLeaving), read elements (firstValue, lastValue, indexValue, indexTime, numberOfValues) and evaluate the window (maxDuration, accumulatedDuration).

The size of the buffer is fixed by the constant nBuffer = 20: at most 20 changes (or rising edges) can be held in one window. If more occur, push prints a warning and the result of the check may not be correct (as stated in the documentation of the Requirements package). The functions are tested by TestSlidingWindow.

Contents

NameKindDescription
BufferrecordMemory of sliding window
initfunctionInitialize a sliding window buffer
pushimpure functionStore an element on the sliding window buffer and remove elements that are older as the window length
removeOldestfunctionRemove all elements from the buffer that are about to leave the sliding time window
nextLeavingfunctionReturn time instant when the oldest element is leaving the buffer
firstValuefunctionReturns the newest value
lastValuefunctionReturns the oldest value
indexValuefunctionReturns the value at buffer index
indexTimefunctionReturns the time value at buffer index
numberOfValuesfunctionReturns the number of values in the buffer
maxDurationfunctionReturns the maximum duration where buffer value is true in the sliding time window
accumulatedDurationfunctionReturns the accumulated duration where buffer value is true in the sliding time window

Parameters

NameTypeDescription
nBuffer constantIntegerLength of buffer