The rollupInterval
used can have a large impact on the resulting data of a calculation, particularly when using multiplication or division.
To demonstrate this, consider the following history grid with a rollupInterval
of 5 minutes. The first two value columns represent two inputs; the energy usage and the production volume of an arbitrary process. The last two columns represent two calculations; the quotient and product of the energy usage and production volume respectively.
ts | energy | prod | energy / prod | energy * prod |
00:00 | 9 | 6 | 1.50 | 54 |
00:05 | 6 | 1 | 6.00 | 6 |
00:10 | 7 | 3 | 2.33 | 21 |
00:15 | 2 | 1 | 2.00 | 2 |
|
|
| AVG = 2.96 SUM = 11.83 | AVG = 20.75 SUM = 83.00 |
If the same calculations were to be performed with a rollupInterval
of 10minutes, the following history grid would be produced:
ts | energy | prod | energy / prod | energy * prod |
00:00 | 15 | 7 | 2.14 | 105 |
00:10 | 9 | 4 | 2.25 | 36 |
|
|
| AVG = 2.20 SUM = 4.39 | AVG = 70.50 SUM = 141.00 |
In both cases, the exact same data is used and the same total time is considered (20minutes). However, the resulting average and sum of the quotient and product calculations differ greatly between the two grids. Both are correct for the given rollupIntervals
. So which rollupInterval
is correct for each use case must be considered carefully by the user.
The impact of using different rollupIntervals
may be counterintuitive for some. An easier way to consider it may be to consider the alignment of data. In the above example, it may be the case that there is a lag between the energy used to produce something and the actual production being recorded. In which case a much wider rollupInterval may make more sense.