Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Historian

Average retrieval - how it works

  • Last UpdatedFeb 28, 2025
  • 3 minute read

The following illustration shows how the time-weighted average is calculated for an analog tag that uses linear interpolation.

Graph showing value over time average.

Data is retrieved in average mode with a start time of TC0 and an end time of TC2. The resolution has been set in such a way that the historian returns data for two complete cycles starting at TC0 and TC1 and an incomplete cycle starting at TC2. P1 to P9 represent actual data points stored on the historian. Of these points, eight represent normal analog values, and one, P5, represents a NULL due to an I/O Server disconnect, which causes a gap in the data between P5 and P6. Assume that the query calls for timestamping at the end of the cycle.

Results are calculated as follows:

  • The "initial value" returned at the query start time (TC0) is the time-weighted average of the points in the last cycle preceding TC0.

  • The value returned at TC1 is the time-weighted average of the points in the cycle starting at TC0.

  • The value returned at the query end time (TC2) is the time-weighted average of the points in the cycle starting at TC1.

To understand how the time-weighted average is calculated, observe the last cycle as an example. First, the area under the curve must be calculated. This curve is indicated by the red line through P6, P7, P8 and PC2, where PC2 represents the interpolated value at time TC2 using points P8 and P9. The data gap caused by the I/O Server disconnect does not contribute anything to this area. If a quality rule of "good" has been specified, then points with doubtful quality will not contribute anything to the area, either.

To understand how the area is calculated, consider points P6 and P7. The area contribution between these two points is calculated by multiplying the arithmetic average of value P6 and value P7 by the time difference between the two points. The formula is:

((P6 + P7) / 2) x (T7 - T6)

When the area for the whole cycle has been calculated, the time-weighted average is calculated by dividing that area by the cycle time, less any periods within the cycle that did not contribute anything to the area calculation. The result is returned at the cycle end time.

If you take a closer look at points P4 and P5 in the example, you can see that the red line through point P4 is parallel to the x-axis. This is because P5 represents a NULL, which cannot be used to calculate an arithmetic average. Instead, the value P4 is used for the whole time period between points P4 and P5.

The area calculation is signed. If the arithmetic average between two points is negative, then the contribution to the area is negative.

Related Links
TitleResults for “How to create a CRG?”Also Available in