Apama Analytics Builder 10.7.0 | Using Apama Analytics Builder for Cumulocity IoT | Block Reference | Aggregate | Average (Mean)
 
Average (Mean)
apama.analyticskit.blocks.core.Mean
Calculates the mean of the values over time.
Mean is defined as the sum of the input’s value multiplied by how long the input has stayed at that value, within an optional window, divided by the window duration or the time since the block was started or last reset, whichever is smallest.
The block can operate over a time-bounded window that is specified with the Window Duration parameter. If this parameter is not specified, it uses an unbounded window. The Reset input clears the window contents. Output is generated on any new input or, if the Output Threshold parameter is set, only when the output changes by more than the specified output threshold (which includes if no further input occurs, or the value only changes due to old entries expiring). The Sample input can be used to force re-evaluation and generate the latest value.
See also the "Value types" topic in the Apama Analytics Builder documentation for more details and an example of the frequency of output from this block and how values in windows behave.
If a window is configured, the block will use a set of 20 buckets, so the expired value is an approximation of the average value across a bucket.
Parameters
Name
Description
Type
Notes
Window Duration (secs)
If present, the amount of time (in seconds) for which values are to be kept in the window.
This must be a finite and positive number.
float
Optional
Output Threshold
If present, the output to be sent at the point when it changes by at least this value.
This must be a finite and positive number.
float
Optional
Input Port Details
Name
Description
Type
Value
Input for which the mean is to be calculated.
float
Reset
Clears the content of the window.
pulse
Sample
Forces re-evaluation of the current mean value and sends the output.
pulse
Output Port Details
Name
Description
Type
Average
The sum of the value multiplied by how long it stays at that value divided by the total time.
float