Rolling Aggregate Logic Block
Description
The Rolling Block is a special type of Aggregate Block that calculates using a moving window of data. There is an output value for each input data point, based on a number of previous samples or based on time. This is different than the aggregate block which uses fixed non-overlapping windows for its calculations and transforms many input values into one output.
The block provides a method to analyze data points by creating a series of different subsets of the full data set. A moving average is commonly used with time-series data to smooth out short-term fluctuations and highlight longer-term trends or cycles.
Functionality
Input: The Rolling Aggregate Logic Block accepts input from one logic block. This can be any block that has an output.
Output: The output of the Rolling Aggregate Logic Block is a summary of the input data with a time-stamp that aligns with the most recent sample of the specified input data window.
Available summary functions:
- Minimum – minimum of all input data over aggregation period
- Maximum – maximum of all input data over aggregation period
- Average – an average of all input data over aggregation period
- Sum – the sum of all incoming data over the aggregation period
Output value time stamps:
- Output time-stamps will be aligned with the most recent sample of the specified input data window
Block Configuration
Name: The ‘Name’ field is for the user to set a title/description for the Logic Block.
Aggregation Method: The ‘Aggregation Method’ is the mathematical operation to perform on the samples. Options are:
- Min
- Max
- Average
- Sum
Type: ‘Type’ defines whether to use a fixed number of samples or a fixed amount of time to define your data window.
Number of Samples: This field only appears when the ‘Type’ is ‘Samples’. This defines the number of samples to use for the calculation. It includes the current sample. This is not a time interval. Output is only generated when there are enough previous samples. The number is truncated to an integer. Values of 0 and less will cause the working rule to generate an error.
Aggregation Interval & Time Interval: These fields only appear when the ‘Type’ is ‘Time’. These define the window of time to use for the calculation. The ‘Aggregation Interval’ is the unit of time (Minutes, Hours, Days), and the ‘Time Interval’ is the quantity of those units. i.e. to use a 4-hour window of data:
- Aggregation Interval = hours
- Hours Interval = 4
Minimum Number of Samples: The ‘Minimum Number of Samples’ defines the number of samples that must be present in a data window for the Rolling Block to generate an output. If there are less than this number of samples, the block will output nothing. Normally these “no-data occurrences” will be seen at the beginning of the Rolling Block’s output since the Block may need to “wait” for more samples. They can also appear later if there are data gaps or a Filter Block has removed some samples.
Examples
Maximum Value Within the Last Hour:
- Method = max
- Type = time
- Aggregation Interval = hours
- Hours Interval = 1
- Minimum Number of Samples = 4
Timestamps | Input | Output |
---|---|---|
09:00 | 1 | |
09:15 | 1 | |
09:30 | 2 | |
09:45 | 3 | 3 |
10:00 | 1 | 3 |
10:15 | 4 | 4 |
10:30 | 2 | 4 |
10:45 | 1 | 4 |
Sum of Values From the Last 4 Samples:
- Method = Sum
- Type = Samples
- Number of Samples = 4
- Minimum Number of Samples = 4
Timestamps | Input | Output |
---|---|---|
09:00 | 1 | |
09:15 | 1 | |
09:30 | 2 | |
09:45 | 3 | 7 |
10:00 | 1 | 7 |
10:15 | 4 | 10 |
10:30 | 2 | 10 |
10:45 | 2 | 9 |