Robotron Datenbank-Software GmbH Firmenlogo
MIT DATEN MEHR BEWEGEN.
🇩🇪 🇬🇧

Aggregator

Function Description and Application

The Aggregator block collects incoming messages. The fields contained in messages can be handled in various ways according to the configuration. The messages are grouped and processed in optionally overlapping groups (windows) based on time or count.

agg schematic
Figure 1. Schematic representation of the Aggregator block functionality

An example use case is a minimum/maximum aggregation to reduce the incoming data volume. For example, temperature data for the outside temperature arrives every second, but instead of transmitting 60 instantaneous values, only the minimum and maximum value can be transmitted for each minute.

The parameters explained in the following table are required for configuration.

Table 1. Configuration parameters of the Aggregator block
ParameterDescription

Name

Name of the block instance.

Into

Name of the block instance of the subsequent block to which output messages should be forwarded.

Window - Based On

Selection of the window type

  • Sample-based window: uses the sample count in the buffer, independent of time. When the window buffer is (fully) filled, one old entry is deleted each time a new message arrives. A filled window therefore always provides the same number of samples for subsequent calculations. Triggering occurs exclusively based on incoming messages.

  • TimeMs-based window: uses the time in milliseconds (timestamp) as the basis for discarding old samples from the buffer. It is possible that varying numbers of samples are available for a calculation. The window and aggregate formation are triggered by the system time and are independent of incoming messages. The timestamp property is mandatory for the TimeMs window type!

Window – Size

The window size determines the available buffer depending on the window type — sample-based (value as count) or time-based (value in milliseconds).

Window - HoppingEach

Frequency of a calculation and output depending on the window type — sample-based (value as count) or time-based (value in milliseconds). A higher value results in less frequent execution and output than a smaller one.

Behaviour

The processing function can be specified for each field of the incoming message. If an outgoing message does not have a timestamp (key timestamp), one will be generated using the current time.

Default

Default value that applies to all fields that are not explicitly specified.

Name

Field name (variable name) in the JSON of the incoming message

Value

Function selection for the respective field. The following value types are available:

  • ignore: Data is discarded and not considered in the output

  • collect: Collects the values of incoming messages for the evaluated "time period" in an array

  • min: minimum data value (requires numeric values)

  • max: maximum data value (requires numeric values)

  • first: first received data value

  • last: last received data value

  • sum: sum of the received data values (requires numeric values)

  • avg: arithmetic mean (requires numeric values)

  • median: median (requires numeric values)

  • stddev: standard deviation (requires numeric values)

  • default: defines the default function for all fields not explicitly specified

When the Aggregator block is used, certain properties such as "timestamp" should not be used indiscriminately with functions like "Average", as this will cause an error. A better solution is to explicitly add "timestamp" to Ignore, Last, Collect, Max, or Min. The functions Average, Stddev, Sum, and Median require that the value can be converted to a double value.

Example Configuration

The following example configuration is shown in Figure 2:

  • "a" is explicitly configured and collected in an array (Value: "Collect") and output.

  • "b" is explicitly ignored (Value: "Ignore") and omitted from the output message.

  • Since the timestamp is not configured, the default function is set to first.

agg
Figure 2. Configuration of the Aggregator block