Aggregation functions
The following aggregation options are available in IIH Essentials.
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 time period for the respective aggregation.
Calculation period: from[to], from exclusive, to inclusive
Example: "I want the sum 'sum' of 'Variable X' from '2022 to 2023' to be calculated." => one value is returned that represents the summed values of the year.
Use the API "DataService/Calculate" to calculate single value aggregations.
Series value aggregation
A single-value aggregation can be calculated multiple times for a specific time period. The series-value aggregation is defined by the time period and the aggregations of the individual values (consisting of calculation period and aggregation method). The result is a series of 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.
Use the API "DataService/CalculateTrend" to calculate aggregations of a series of multiple values.
Precalculated aggregations
Aggregations can be planned in such a way that they are performed 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.
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.
EnergyToPower
A consumption value is converted to power. This aggregation function can only be selected in combination with the Consumption Value (Energy) and Counter acquisition categories.
PowerToEnergy
Power is converted to a consumption value. This aggregation function can only be selected in combination with the Power acquisition category.
AmountToFlow
An amount value (per hour) is directly converted to a flow value. This aggregation function can only be selected in combination with the Amount and Counter acquisition categories.
FlowToAmount
A flow value (amount/h) is converted to am amount 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 Flow acquisition category.
Except where otherwise noted, content on this site is licensed under the Siemens Inner Source License .