Raw Data Sampling Modes

To use raw data retrieval, you need only specify a start and end time, or a start time and number of samples. Any specified interval duration is ignored. Raw data may be retrieved using one of two methods:
  • RawByTime retrieval: Specify a start and end time for data retrieval. RawByTime returns all raw samples of all qualities with a time stamp greater than the start time and less than or equal to the end time. It will not return a raw sample with same time stamp as the start time. NumberOfSamples is ignored and all raw samples will be returned.
  • RawByNumber Retrieval: Specify a start time, a number of samples, and a direction (forward or backward). RawByNumber retrieval returns X raw samples of all qualities starting from a time stamp of the indicated start time, moving in the specified direction. It will return a raw sample with the same time stamp as the start time. If there is no sample at the specified start time, the retrieval count begins at the next sample.

Each sample has the following attributes:

  • Timestamp: The time stamp sent by the collector along with the raw sample.
  • Value: The value sent by the collector along with the raw sample.
  • Data Quality: The quality of data sent by the collector, as set by the collector.

Archive compression can reduce the number of raw samples stored in the archive. Archive compression may discard raw samples sent by the collector; these are not stored as raw samples and would not be returned by raw data retrieval.

If the current value has not been stored as a raw sample, will not be returned by a raw data retrieval.

If they exist within the requested time period, collected samples with a bad data quality and collector startup and shutdown markers will be returned in a raw data query.

Example: RawByTime retrieval of samples over a period of replaced data

  1. Import this data into the Historian.
    [Tags]
    Tagname,DataType,HiEngineeringUnits,LoEngineeringUnits 
    RAWTAG,SingleInteger,100,0
    [Data]
    Tagname,TimeStamp,Value,DataQuality 
    RAWTAG,29-Mar-2002 13:59:00.000,7,Good 
    RAWTAG,29-Mar-2002 14:08:00.000,8,Bad
  2. Import this data into the Historian so that there is replaced data:
    [Data] 
    Tagname,TimeStamp,Value,DataQuality 
    RAWTAG,29-Mar-2002 13:59:00.000,22,Good 
    RAWTAG,29-Mar-2002 14:08:00.000,12,Bad 
    RAWTAG,29-Mar-2002 14:22:00.000,4,Good
  3. Retrieve the data using this RawByTime query.
    select timestamp, value, quality from ihrawdata where samplingmode=rawbytime and timestamp>='29-Mar-2002 
    13:59' and timestamp<='29-Mar-2002 14:22' and tagname=rawtag

The following results are obtained:

TimestampValueQuality
29-Mar-200214:08:00.00012Bad NonSpecific
29-Mar-200214:22:00.0004 Good NonSpecific

Note that the raw sample exactly at the start time is not returned and that the replaced value of 8 at 14:08 is not returned. If the start time is changed to 13:58:59, then all the samples are returned:

select timestamp, value, quality from ihrawdata where samplingmode=rawbytime and timestamp>='29-Mar-2002 
13:58:59' and timestamp<='29-Mar-2002 14:22' and tagname=RAWTAG
TimestampValueQuality
29-Mar-200213:59:00.00022Good NonSpecific
29-Mar-200214:08:00.00012Bad NonSpecific
29-Mar-200214:22:00.0004Good NonSpecific

Example: RawByNumber retrieval over a period of replaced data

The RawByNumber sampling mode returns up to a specified number of raw samples beginning at the start time. The end time is ignored. Unlike the RawByTime, this can return a sample that has the same time stamp as the start time. You must specify a direction forward or backward from the start time to retrieve data.

  1. Using the data imported by the previous example, retrieve 10 samples going forward from 13:59:00.
    select timestamp, value, quality from ihrawdata where samplingmode=rawbynumber and timestamp>='29-Mar-2002 
    13:59' and numberofsamples=10 and direction=forward and tagname=RAWTAG

    The following results are obtained.

    TimestampValueQuality
    29-Mar-200213:59:00.00022Good NonSpecific
    29-Mar-200214:08:00.00012Bad NonSpecific
    29-Mar-200214:22:00.0004Good NonSpecific
  2. Using the data imported by the previous example, retrieve 10 samples going backward from 14:22:00.
    select timestamp, value, quality from ihrawdata where samplingmode=rawbynumber and timestamp<='29-Mar-2002 
    14:22' and numberofsamples=10 and direction=backward and tagname=RAWTAG

    The following results are obtained.

    TimestampValueQuality
    29-Mar-200214:22:00.0004Good NonSpecific
    29-Mar-200214:08:00.00012Bad NonSpecific
    29-Mar-200213:59:00.00022Good NonSpecific

Anticipated usage

You can use raw sampling to compute a raw minimum or raw maximum over a time period. Raw Average is already provided as a native calculation mode

You can also use raw sampling to analyze system efficiency. Count the number of raw samples per period of time, ignoring the values, then compare it to other periods of time.

If you have a high number of raw samples you may decide to implement collector or archive compression. If you have a different count of raw samples than another time period for the same point in your process, you should understand why the data is missing or why the extra data was logged.

You can use the ihCount calculation mode to easily count the number of raw samples between the start and end time.