Computing an Average Without A Raw Sample At Start Time

There is rarely a raw sample available at the interval start time. However, the archiver needs to know the value at the start of an interval before it can perform time-weighted calculations. The archiver uses interpolation to get values it needs for which no raw samples are available.

For example, if we set the start time for the query to 14:05, then the archiver will interpolate a value at the timestamp of 14:05.

The RawAverage would then be calculated as follows:

select timestamp, value, quality from ihrawdata where samplingmode=calculated and calculationmode=RawAverage and timestamp 
>= '29-Mar-2002 14:00:05' and timestamp <= '29-Mar-2002 14:02' and tagname = tag2 and numberofsamples = 1
Time StampValueQuality
29-Mar-200214:02:00.00038.33100.00

Similarly, the time-weighted average would be calculated as follows:

select timestamp, value, quality from ihrawdata where samplingmode=calculated and calculationmode=Average and timestamp >= 
'29-Mar-2002 14:00:05' and timestamp <= '29-Mar-2002 14:02' and tagname  = tag2 and numberofsamples = 1
Time StampValueQuality
29-Mar-2002 14:02:00.000 32.0173.91