Description of aggregation functions
Description
The following aggregation options are available.
Aggregation types
-
Single value aggregations
A variable is aggregated by specifying the aggregation method and the calculation period. The result is a value that represents the values of the period for the respective aggregation.
Calculation period: from[to], from exclusive, to inclusive
Example: "I want the 'sum' of 'Variable X' from '2022 to 2023' to be calculated." => 1 value is returned that represents the summed values of the year.
-
Aggregation of multiple values
A single-value aggregation can be calculated multiple times for a specific period. The aggregation of multiple values is defined by the period and the aggregations of the individual values (consisting of calculation period and aggregation method). The result is multiple values where each value represents the values in this calculation period for the respective aggregation.
Example: "I want the 'sum' of 'Variable X' to be calculated every day 'from 2022 to 2023'." => 365 values are returned, where each value represents the summed values of one day.
-
Precalculated aggregations
Aggregations can be scheduled to run continuously in the background. The other two aggregation types are calculated on request. This aggregation type enables calculation of aggregations on 'new-value-written'. That reduces the return time of the request and distributes the resource usage according to the written rate values, which prevents the peaks that occur with the other two aggregation types.
A precalculated aggregation is defined using an aggregation and a desired execution cycle. The result is an additional sub-variable that stores the aggregation of each cycle.
Example: "I want the 'sum' of 'Variable X' to be calculated 'every day'." => A new sub-variable is created in which a new value is stored every day that represents the summed values of the day.
Aggregation methods
Boolean values are interpreted in calculations as numeric values 0 and 1.
-
Sum
Returns the sum of the numeric values for the calculation period.
-
Count
Returns the number of values within the calculation period.
-
Average
Returns the arithmetic average of numeric values for the calculation period.
All values are weighted the same. The result can be a floating-point number.
-
Min
Returns the lowest numeric value within the calculation period.
-
Max
Returns the highest numeric value within the calculation period.
-
First
Returns the first value within the calculation period.
-
Last
Returns the last value within the calculation period.
-
Counter
Returns the summed value changes of numeric values within the calculation period.
With an up counter, only positive value changes are summed. Negative value changes are interpreted as a counter reset.
In the case of a down counter, positive and negative value changes are summed.
More precise settings can be made at the variable via the counter settings.
-
Step duration
Indicates how long the variable has a value and is thus not equal to 0 (NULL).
Time that the variable actively supplies values.
-
Timer
Returns the time during which a value was not "false" (FALSE, NULL or empty string).
-
Time weighted average
Returns the time-weighted average of numeric values for the calculation period.
The values are weighted differently, depending on how long they have been present. The longer a value was present, the more it is weighted.
-
Standard deviation
Returns the standard deviation of numeric values within the calculation period.
-
Variance
Returns the variance of numeric values within the calculation period.
-
ValueChanges
Indicates the updated value, if it has changed
-
Gantt
Indicates how long a value was valid, for example, how long a machine was in a certain state.
-
EnergyToPower
A consumption value is converted to power.
This aggregation function can only be selected in combination with the acquisition category consumption value (Energy) and Counter.
-
PowerToEnergy
Power is converted to a consumption value.
This aggregation function can only be selected in combination with the acquisition category power value (Power).
-
AmountToFlow
An amount value (per hour) is directly converted to a flow value.
This aggregation function can only be selected in combination with the acquisition category amount value (Amount) and Counter.
-
FlowToAmount
A flow value (amount/h) is converted to a quantity value.
The function calculates an estimated value for the upcoming period based on the current flow value.
This aggregation function can only be selected in combination with the acquisition category flow value (Flow).