Calculation Modes

This information is intended to supplement the information in the Historian electronic books and the SDK Help File.

Sampling and calculation modes are used on retrieval of data that has already been collected to the archive. Calculation modes are used when the sampling mode is set to "Calculated". It is helpful to separate the many modes into 3 main categories from simplest to most complex. A detailed explanation of the calculation modes with examples are discussed in following topics:

Raw Calculation Modes: Easiest to understand. Only raw points are used to determine calculated value.
  • Count
  • RawTotal
  • RawAverage
  • RawStandardDeviation
  • FirstRawValue
  • FirstRawTime
  • LastRawValue
  • LastRawTime
Interpolated Calculation Modes – both raw and interpolated points are used to determine a value.
  • Minimum
  • MinimumTime
  • Maximum
  • MaximumTime
  • TimeGood
Time Weighted Calculation Modes – Most complicated. Time weighting on raw and interpolated points is used to determine a value.
  • Average
  • Total
  • StandardDeviation

Other Calculation Modes

  • STATECOUNT
  • STATETIME
  • OPCQOR and OPCQAND
  • TagStats

Each sample retrieved from Historian has a timestamp, value, and quality.

  • Timestamp - the same logic as for interpolated values. It is covered in detail in the Understanding Sampling Modes document and not covered at all in this document.
  • Value – depends entirely on the calculation mode being used
  • Quality - Depending on the calculation mode, this either means:
    • The percent of raw samples vs. total raw samples in the interval that were of good data quality.
    • The percent of time in the interval that the data was of good data quality

Filtered data queries are described in the Filtered data Queries section.

Note: This document intentionally contains all necessary data for executing the examples and reproducing the results. The tags and data are in the form of a CSV to be imported with the Historian File collector. You will not be able to import the data unless you adjust the active hours setting and possibly the Create Offline Archives setting of the archiver. This is true any time you are importing old data with the File collector.