Buffer record

Requirements.Internal.SlidingWindow.Buffer  · source

Icon of Buffer

Memory of sliding window

Extends Modelica.Icons.Record

The memory of a sliding time window of length T: a ring buffer of at most nBuffer pairs (t[i], b[i]), each the instant at which a Boolean signal changed and its value from then on. first is the index of the newest element, last the index of the oldest one, nElem the number of elements (first = last = 0 when the buffer is empty); the indices wrap around from nBuffer to 1. t0 is the instant at which the window started (the start of the simulation), so that the time before it is not counted. The record is created with init, updated with push and removeOldest, and read with the other functions of SlidingWindow; its fields should not be written directly.

Components and variables

NameTypeDescription
TSI.TimeLength of sliding window
t0SI.TimeTime instant where sliding time window starts
t[…]SI.TimeTime instants
b[…]BooleanValues at corresponding time instants
firstIntegerIndex of first element in buffer
lastIntegerIndex of last element in buffer
nElemIntegerNumber of elements in the buffer