Analytics Builder 10.14.0 | Using Analytics Builder for Cumulocity IoT | Details of Values and Blocks | Window block output timings
 
Window block output timings
 
Windows and buckets
For aggregate blocks such as the Average (Mean) block, the effect of a change of input value means that, if regularly re-evaluated, the output of the block will change, approaching the new value. If there have been different input values received by the block in the past, then a re-evaluation of the block at any point in time is possible, and each may generate a different output.
With the previous example from On-change inputs and time windows, repeatedly re-evaluating an Average (Mean) block with a 10 second window will yield the following:
Time
Input value
Output of the Average (Mean) block
00:00
10
10
00:01
10
10
00:02
11
10
00:03
11
10.333
00:04
11
10.5
00:05
11
10.6
00:06
11
10.667
00:07
11
10.714
00:08
11
10.75
00:09
11
10.778
00:10
11
10.8
00.11
11
10.9
00:12
11
11
It would also be possible to re-evaluate the block every half a second, or any fraction of a second - to milliseconds or even smaller times between re-calculations. It is impractical to continuously re-evaluate the block (to re-calculate the average value at a given point in time and generate a new output). So when is an appropriate time for the block to evaluate and generate an output?
The Average (Mean) block (and others) provide an Output Threshold parameter. If this is set, then the block emulates a sensor which generates a new measurement reading if the output changes by the output threshold amount. Thus, if set at 0.1, we get several outputs between 00:02 and 00:03 (when the output is changing from 10 to 10.333), another output between 00:03 and 00:04 (when it reaches 10.4), outputs at 00:04 and 00:05 exactly, another between 00:06 and 00:07 (10.7), then at 00:10 and 00:11 and 00:12. The block calculates at what time the output would vary by more than the output threshold compared to the most recent output, and re-evaluates at that point in time. Thus, the output may occur quite irregularly in time, but output at times such that the values output always differs by an amount equal to the output threshold. The block also re-evaluates on any new inputs, even if there is not a different value to the last input.
As models may wish to perform a calculation with the output of the Average (Mean) block at any point in time (for example, to compare to another measurement), a Sample input port is also provided, to force a re-evaluation and generate an output value.