7 Calculations | 124
Arguments:
T result: the reduction function applied to the given range
T input: the signal to be reduced
double range: a sequence of ranges
Note: T can be any type supported by the given reduction function.
Accumulate_Rolling(input, windowStart)
The Accumulate_Rolling behavior applies the reduction function to a moving win-
dow. The windowStart signal specifies a window (see "Ranges" on the previous
page). For each range, the samples in that range from the input signal are
reduced according to the reduction function and produce an output sample
which has the same timestamp as the end of the range.
Examples:
Rolling average over the last 2 seconds:
Accumulate_Rolling_Average(input, Master()-2)
Rolling average over the last 10 samples:
Accumulate_Rolling_Average(input, State_Delay(Master(),
0, 10))
Notes:
The memory usage of accumulate rolling behavior grows with the number
of samples in the window. It is possible to use windowStart = 0, however
each new sample will increase the memory. Depending on the input signal,
this may lead to using significant amounts of memory.
For correct functionality, the start times of the ranges must be mono-
tonously increasing.
Window_Signal
Calculates a window with a given "size".
Syntax:
Window_Signal_<reduction function>(input, limit)
Arguments:
double result: ranges of input that have the given size of limit
T input: the input signal that is reduced to determine the size of a window
T limit: desired "size" of the calculated ranges
Note: T can be any type supported by the given reduction function.
Window_Signal(input, limit)
The Window_Signal behavior calculates for each input sample a range ending at
that sample. The size and thus the start of the range is chosen such that when
applying the reduction function to the values of the input in this range the reduc-
tion approximately equals the limit. More specific the smallest interval is chosen
where the reduction is greater or equal the limit.
MDA V8 | User Guide