TimeAverage
TimeAverage is the Part 13 aggregate that computes a time-weighted mean over each interval, weighting every raw value by how long it held rather than counting samples equally. Use it instead of Average for unevenly sampled process values: a deadbanded temperature averaged sample-wise produces a number that means nothing physically.
Time-weighted versus sample-weighted
Average sums the values in the interval and divides by their count. TimeAverage integrates the value over time and divides by the interval duration. For evenly sampled data the two agree. For anything stored on change, on deadband, or at a variable rate, they diverge sharply, and only the time-weighted number corresponds to the physical average an engineer means when they say average temperature over the shift.
Why OPC UA history is almost never evenly sampled
Servers store on change and on deadband precisely to keep history small. A steady value produces one stored point per hour; a swinging value produces hundreds per minute. Sample-weighted averaging then over-weights exactly the unstable periods, so the reported average is dragged toward whatever the process was doing while it was misbehaving. This is one of the most common silent errors in plant analytics.
Interpolation, bounding and stepped variables
Because the calculation needs a value at the start of each interval, TimeAverage depends on the bounding value before the interval and on the variable's interpolation behaviour. A variable whose Historizing configuration marks it as stepped holds its last value until the next point; a non-stepped variable is interpolated linearly between points. The same raw data therefore yields different time averages depending on that flag, so check it before comparing servers.
Reading the StatusCode
Each returned interval carries its own StatusCode with aggregate quality information. An interval built largely from Bad or missing data is reported as Uncertain rather than quietly averaged, and partial intervals are flagged. Discard or annotate Uncertain intervals in your reporting instead of averaging them into a shift figure, and pair TimeAverage with PercentGood over the same interval so you can see how much of the window was real data.
Example
Where Average and TimeAverage disagree - one 60 minute interval
Raw stored values (deadbanded, so storage is dense only while swinging):
00:00 20.0 C held 50 min
00:50 80.0 C held 2 min
00:52 81.0 C held 2 min
00:54 80.0 C held 2 min
00:56 79.0 C held 2 min
00:58 20.0 C held 2 min
Average (6 samples, sample-weighted) = 60.0 C <- physically meaningless
TimeAverage (stepped, time-weighted)
= (20*50 + 80*2 + 81*2 + 80*2 + 79*2 + 20*2) / 60
= (1000 + 160 + 162 + 160 + 158 + 40) / 60
= 1680 / 60
= 28.0 C <- what the process did
Defined in: Part 13 - Aggregate Functions. Worked examples ship as Schema/AggregateExamples.csv with the nodesets.
Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.