Calculation Modes

Calculation modes are used when the sampling mode is set to Calculated. The data type of all calculated values will be DoubleFloat except for MinimumTime, MaximumTime, FirstRawTime and LastRawTime which will be a Date. The datatype of the values of FirstRawValue and LastRawValue will be the same as that of the selected tag.

Calculation ModeResults
CountDisplays the number of raw samples in the specified interval. This only indicates the count and does not display the actual values or qualities of the samples.

The Count calculation mode is useful for analyzing the distribution of raw data samples. If you have a higher number of raw samples than expected, you may decide to implement collector or archive compression. If samples are missing, then you may want to slow your collection rates.

State Count Displays the number of times a tag has transitioned to another state from a previous state. A state transition is counted when the previous good sample is not equal to the state value and the next good sample is equal to state value.
State Time Displays the duration that a tag was in a given state within an interval.
MinimumDisplays the minimum value in a specified interval with good data quality. This value may be raw or interpolated.
Note: The Minimum and MinimumTime calculation retrieve two additional samples per interval; one is interpolated at the interval start time and the other is interpolated at the interval end time. These samples are used to determine the min or max just like any raw value.
MinimumTimeDisplays the time stamp of the minimum value in a specified interval.

See the note in Minimum for additional information.

MaximumDisplays the maximum value in a specified interval.
Note: The Maximum and MaximumTime calculation internally retrieve two additional samples per interval; one is interpolated at the interval start time and the other is interpolated at the interval end time. These samples are used in the min or max just like any raw or interpolated value.
MaximumTimeDisplays the time stamp of the maximum value in a specified interval.

See the note in Maximum for additional information.

RawAverageDisplays the arithmetic average of the raw values in a specified interval with good data quality. This is useful only when a sufficient number of raw data values are collected.
AverageSimilar to RawAverage, but performs a special logic for time weighting and for computing the value at the start of the interval. This is useful for computing an average on compressed data.
OPCQOr and OPCQAndThe OPCQOr is a bit wise OR operation of all the 16 bit OPC qualities of the raw samples stored in the specified interval.

The OPCQAnd is a bit wise AND operation of all the 16 bit OPC qualities of the raw samples stored in the specified interval.

TotalRetrieves the time-weighted total of raw and interpolated values for each calculation interval. The collected value must be a rate per 24 hours. This calculation mode determines a count from the collected rate.
RawTotalDisplays the arithmetic sum of raw values in a specified interval.
StandardDeviationDisplays the time-weighted standard deviation of raw values for a specified interval.
RawStandardDeviationDisplays the arithmetic standard deviation of raw values for a specified interval.
TimeGoodDisplays the amount of time (in milliseconds) during an interval when the data is of good quality and matches filter conditions if the filter tag is used.
FirstRawValueReturns the first good raw value for a specified time interval.
FirstRawTimeReturns the timestamp of the first good raw for a specified time interval.
LastRawValueReturns the last good raw value for a specified time interval.
LastRawTimeReturns the timestamp of the last good raw for a specified time interval.
TagStatsAllows you to return multiple calculation modes for a tag in a single query.
Note: You can also use INCLUDEBAD or FILTERINCLUDEBAD as query modifiers to include bad quality data. For more information, refer INLUDEBAD and FILTERINCLUDEBAD sections in Advanced Topics.