5.4.2 Common characteristics

5.4.2.1 Description

Subclause 5.4.2 deals with Aggregate characteristics and behaviour that are common to all Aggregates.

5.4.2.2 Generating intervals

To read Historical Aggregates, OPC clients shall specify three time parameters:

startTime (Start)

endTime (End)

ProcessingInterval (Int)

The OPC Server shall use these three parameters to generate a sequence of time intervals and then calculate an Aggregate for each interval. Subclause 5.4.2.2 specifies, given the three parameters, which time intervals are generated. Table 49 provides information on the intervals for each Start and End time combination. The range is defined to be |End - Start|.

All Aggregates return a timestamp of the start of the interval unless otherwise noted for the particular Aggregate.

Table 49 – History Aggregate interval information
Start/End TimeIntervalResulting intervals
Start = End Int = AnythingNo intervals. Returns a Bad_InvalidArgument StatusCode, regardless of whether there is data at the specified time or not.
Start < End Int = 0 or IntRangeOne interval, starting at Start and ending at End. Includes Start, excludes End, i.e., [Start, End).
Start < End Int ≠ 0, Int < Range, Int divides Range evenly. Range/Int intervals. Intervals are [Start, Start + Int), [Start + Int, Start + 2 x Int),..., [End - Int, End).
Start < End Int ≠ 0, Int < Range, Int does not divide Range evenly.

Range/Int intervals. Intervals are [Start, Start + Int), [Start + Int, Start + 2 x Int),..., [Start + ( Range/Int - 1) x Int, Start + Range/Int x Int), [Start + Range/Int x Int, End).

In other words, the last interval contains the “rest” that remains in the range after taking away Range/Int intervals of size Int.

Start > End Int = 0 or IntRangeOne interval, starting at Start and ending at End. Includes Start, excludes End, i.e.,[Start, End). a
Start > End Int ≠ 0, Int < Range, Int divides Range evenly. Range/Int intervals. Intervals are [Start, Start- Int), [Start– Int, Start – 2 x Int),..., [End + Int, End). a
Start > End Int ≠ 0, Int < Range, Int does not divide Range evenly.

Range/Int intervals. Intervals are [Start, Start - Int), [Start –Int,Start - 2 x Int),..., [Start – ( Range/Int - 1) x Int , Start - Range/Int x Int), [Start - Range/Int x Int , End).

In other words, the last interval contains the “rest” that remains in the range after taking away Range/Int intervals of size Int starting at Start. a

a In this case time is running backwards on the intervals.

The calculation of all Aggregates when time flows backwards is the same as when time flows forwards with the exception that the ‘early time’ is excluded from the interval and the ‘late time’ is included. In most cases this means the value will be the same except the timestamps are shifted by one ProcessingInterval. E.g. when time flows forward the value at T = n is the same as the value at T = n + 1 when time flows backward.

Note that when determining Aggregates with MonitoredItem, the interval is simply the ProcessingInterval parameter as defined in the AggregateFilter structure. See OPC 10000-4 for more details.

5.4.2.3 Data types

Table 50 outlines the valid DataType for each Aggregate. Some Aggregates are intended for numeric data types – i.e. integers or real/floating point numbers. Dates, strings, arrays, etc. are not supported. Other Aggregates are intended for digital data types – i.e. Boolean or enumerations. In addition some Aggregates may return results with a different DataType than those used to calculate the Aggregate. Table 50 also outlines the data type returned for each Aggregate.

Table 50 – Standard History Aggregate Data Type information
BrowseNameValid Data TypeResult Data Type
Interpolation Aggregate
InterpolativeNumericRaw Data Type
Data Averaging Aggregates
AverageNumericDouble
TimeAverageNumericDouble
TimeAverage2NumericDouble
TotalNumericDouble
Total2NumericDouble
Data Variation Aggregates
MinimumNumericRaw data type
MaximumNumericRaw data type
MinimumActualTimeNumericRaw data type
MaximumActualTimeNumericRaw data type
RangeNumericRaw data type
Minimum2NumericRaw data type
Maximum2NumericRaw data type
MinimumActualTime2NumericRaw data type
MaximumActualTime2NumericRaw data type
Range2NumericRaw data type
Counting Aggregates
AnnotationCountAllInteger
CountAllInteger
DurationInStateZeroNumeric or BooleanDuration
DurationInStateNonZeroNumeric or BooleanDuration
NumberOfTransitionsNumeric or BooleanInteger
Time Aggregates
StartAllRaw data type
EndAllRaw data type
DeltaNumericRaw data type
StartBoundAllRaw data type
EndBoundAllRaw data type
DeltaBoundsNumericRaw data type
Data Quality Aggregates
DurationGoodAllDuration
DurationBadAllDuration
PercentGoodAllDouble
PercentBadAllDouble
WorstQualityAll StatusCode
WorstQuality2All StatusCode
Statistical Aggregates
StandardDeviationSampleNumericDouble
VarianceSampleNumericDouble
StandardDeviationPopulationNumericDouble
VariancePopulationNumericDouble
5.4.2.4 Time calculation issues

The following issues may come up when calculating Aggregates that include time as part of the calculation.