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 12 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 12 – History Aggregate interval information
Start/End Time |
Interval |
Resulting intervals |
Int = Anything |
No intervals. Returns a Bad_InvalidArgument StatusCode, regardless of whether there is data at the specified time or not. |
|
One interval, starting at Start and ending at End. Includes Start, excludes End, i.e., [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). |
|
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. |
|
One interval, starting at Start and ending at End. Includes Start, excludes End, i.e.,[Start, End). a |
||
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 |
|
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.