CalculationModeType Parameter

The CalculationModeType parameter is only applied if the Sampling Mode is set to Calculated. It represents the type of calculation to use on the archive data. The default Calculation Mode, if none is specified, is Average.
Calculation Mode TypeDescriptionValue
UndefinedCalculation mode is not defined.0
AverageRetrieves the time-weighted average for each calculation interval.1
StandardDeviationRetrieves the time-weighted standard deviation for each calculation interval.2
TotalRetrieves the time-weighted rate total for each calculation interval.

Use rate totals when working with a continuous measurement. Time weighting takes into account that compressed data is not evenly spaced in time. A factor must be applied to the total value to convert into appropriate engineering units. As a rate total, the default is Units/Day. If the actual units of the continuous measurement are Units/Minute, you would multiply the results by 1440 (minutes per day) to convert the total into appropriate engineering units.

3
MinimumRetrieves the minimum value for each calculation interval.4
MaximumRetrieves the maximum value for each calculation interval.5
CountCounts the number of raw samples found with good quality in the interval.

Value is the count of raw samples with good quality in the interval. The values of each sample are ignored. The Count does not include any samples of bad quality, including the start and end of collection markers.

For Quality, the percentage of good samples is always 100, even if the interval does not contain any raw samples, or contains only bad quality samples.

Count is useful for analyzing the distribution of the raw data samples to determine the effect of compression deadbands. It is also useful to determine which tags are consuming the most archive space.

6
RawAverageRetrieves the arithmetic average of all good quality raw samples for each calculation interval.

Value is the sum of all good quality samples in the interval, divided by the number of good quality samples in the interval. All bad quality samples are ignored. That is RawAverage is equivalent to RawTotal divided by the Count.

For Quality, if there are no raw samples in the interval or if they all are bad quality, then the percentage of good is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad quality samples.

RawAverage is useful for calculating an accurate average when a sufficient number of raw samples are collected.

7
RawStandardDeviationRetrieves the arithmetic standard deviation of raw values for each calculation interval.

For Value, any raw point of bad data quality is ignored.

For Quality, if there are no raw samples in the interval or they all have bad quality, then the percentage of good is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad quality samples.

RawStandardDeviation is useful for calculating an accurate standard deviation when a sufficient number of raw samples are collected.

8
RawTotalRetrieves the arithmetic total (sum) of sampled values for each interval.

Value is the sum of the good quality values of all raw samples in the interval. All bad quality samples are ignored.

For Quality, the percentage of good samples is always 100, even if the interval does not contain any raw samples or it contains only bad quality samples.

If the same start and end times are used, and the time span is treated as a single interval, then all values are added together.

RawTotal is useful for calculating an accurate total when a sufficient number of raw samples are collected. Note that unlike ihTotal, this is a simple sum with no assumption that the values are rate values.

9
MinimumTimeRetrieves the timestamp of the minimum value found within each calculation interval. It can be a raw or an interpolated value. The minimum must be a good data quality sample.10
MaximumTimeRetrieves the timestamp of the maximum value found within each calculation interval. It can be a raw or an interpolated value. The maximum must be a good data quality sample.11
TimeGoodRetrieves the amount of time (milliseconds) during the interval when the data is of good quality and the filter condition is met.12
StateCountRetrieves the amount of time a tag uses to transition to another state from a previous state during a time interval.13
StateTimeRetrieves the duration that a tag stayed in a given state within an interval.14
OPCQAndRetrieves the OPCQAND, bit-wise AND operation of all the 16-bit OPC qualities of the raw samples stored in the specified interval.

Note that OPC Quality is a subfield for Quality-Value-Timestamp (QVT), so when this calculation mode is used, OPC Quality is considered for calculation.

15
OPCQOrRetrieves the OPCQOR, bit-wise OR operation of all the 16-bit OPC qualities of the raw samples stored in the specified interval.

Note that OPC Quality is a subfield for Quality-Value-Timestamp (QVT), so when this calculation mode is used, OPC Quality is considered for calculation.

16
FirstRawValueRetrieves the first good raw sample value for a given interval.

Value is the value of the raw sample, or zero if there are no good raw samples in the interval.

For Quality, if there are not good raw samples in the interval, then the percentage of good is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad quality samples. Note that Quality is the same for FirstRawValue and FirstRawTime.

The Raw sample has a quality of Good, Bad, or Uncertain, and that is converted to a 0 or 100 percent.

17
FirstRawTimeRetrieves the first good raw timestamp for a given interval.

Value is the timestamp of the sample or the year 1969 if there are no good raw samples in the interval.

For Quality, if there are not good raw samples in the interval, then the percentage of good is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad quality samples. Note that Quality is the same for FirstRawValue and FirstRawTime.

The Raw sample has a quality of Good, Bad, or Uncertain, and that is converted to a 0 or 100 percent.

18
LastRawValueRetrieves the last good raw sample value for a given time interval.

Value is the value of the raw sample or zero if there are no good raw samples in the interval.

For Quality, if there are no good raw samples in the interval, the the percentage of good samples is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad samples. Note that Quality is the same for LastRawValue and LastRawTime.

The Raw sample has a quality of Good, Bad, or Uncertain, and that is converted to a 0 or 100 percent.

19
LastRawTimeRetrieves the last good timestamp of the last value for a given time interval.

Value is the timestamp of the sample or the year 1969 if there are no good raw samples in the interval.

For Quality, if there are no good raw samples in the interval, the percentage of good samples is 0. Otherwise, the percentage of good is always 100, even if the interval contains bad samples. Note that Quality is the same for LastRawValue and LastRawTime.

The Raw sample has a quality of Good, Bad, or Uncertain, and that is converted to a 0 or 100 percent.

20
TagStatsRetrieves the statistics for a tag from the archive stored in the specified interval.21