RawAverage Mode
The arithmetic average (mean) of all good quality raw samples in the interval.
- Value
-
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 the RawTotal divided by Count.
- Quality
- If there are no raw samples in the interval or they all have bad quality, then the percent good is 0. Otherwise, percent good is always 100, even if the interval contains bad quality samples.
select timestamp, value, quality from ihrawdata where samplingmode=calculated and calculationmode=rawaverage and timestamp >= '29-Mar-2002 13:30' and timestamp <= '29-Mar-2002 14:30' and tagname = counttag and intervalmilliseconds = 10M
Example: Calculating RawAverage:
The following example demonstrates that only good quality samples are included in RawAverage. Perform the following query on the same data set as that in the Count example above. This query retrieves data using RawAverage, with a start time of 13:30 and an end time of 14:30 at 10-minute intervals.select timestamp, value, quality from ihrawdata where samplingmode=calculated and calculationmode=rawaverage and timestamp >= '29-Mar-2002 13:30' and timestamp <= '29-Mar-2002 14:30' and tagname = counttag and intervalmilliseconds = 10M
Time Stamp Value Quality 29-Mar-200213:40:00.000 0.00 0.00 29-Mar-200213:50:00.000 0.00 0.00 29-Mar-200214:00:00.000 22.00 100.00 29-Mar-200214:10:00.000 0.00 0.00 29-Mar-200214:30:00.000 4.00 100.00 The interval from 14:11 to 14:20 has no raw samples. The percent good quality of 0.
The interval from 14:01 to 14:10 has 0 good and 1 bad samples. It also has a percent good quality of 0.
The interval from 14:21 to 14:30 has 1 good and 0 bad samples. It has a percent good quality of 100.
If the same start and end time are used, but the time span is treated as a single interval, then all values are averaged together:
select timestamp, value, quality from ihrawdata where samplingmode=calculated and calculationmode=rawaverage and timestamp >= '29-Mar-2002 13:30' and timestamp <= '29-Mar-2002 14:30' and tagname = counttag and numberofsamples=1
Time Stamp Value Quality 29-Mar-200214:30:00.000 13.00 100.00 Even though the time span covers all raw samples, but only the two good samples are used in the calculation: 13 = (22+4)/2 Since the interval includes at least one good quality sample, percent good for the interval is 100, even though 33% of the samples are of bad quality.
- Anticipated Usage
-
The RawAverage mode is useful for calculating an accurate average when a sufficient number of raw samples are collected.