Analytics Builder 10.13.0 | Using 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.
This block is suitable for continuous values, even if they are irregularly sampled. The time between inputs or samples is significant, while the number of samples is not. Use this block, for example, if the input is a physical property, such as temperature, that is sampled either regularly or irregularly (for example, only generating measurement values on a change in temperature). Use the Discrete Statistics block instead of the Average (Mean) block for independent measurements, such as ticket sales, where the number of measurements is significant, but the time between measurements is not.
The 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, the block uses an unbounded window. The Reset input port 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 port can be used to force re-evaluation and generate the latest value.
See also the "Value types" topic in the 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 uses a set of 20 buckets, so the expired value is an approximation of the average value across a bucket.
Note:The Average (Mean) block generates the mean for an individual device. If the input comes from a device group, the mean is generated separately for each device in that group. To calculate and generate aggregate values for the group as a whole (not for individual devices), use the Group Statistics block.
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