Sampling Modes
Sampling modes are used to specify how the data will be retrieved from Historian. Several modes are available, such as CurrentValue, Interpolated, Calculated and RawByTime. Sampling modes are specified in the client you use to retrieve data from Historian.
For more information, refer to the Advanced Topics section in the online help.
Sampling Mode | Results |
---|---|
CurrentValue | Retrieves the most recent data sample value received by the archiver, of any data quality. This does not necessarily produce the most recent raw data sample, as archive compression may not have stored the most recent raw sample. The sample has a time stamp, a value, and a quality. The time stamp returned is not typically the current time; it is the time stamp as sent by the collector. If you have a slow poll rate or if collector compression is enabled, the time stamp may be much earlier than the current time. |
RawByTime | Returns all raw samples of all qualities with a time stamp greater than a specified start time, and less than or equal to a specified end time. The RawByTime sampling mode will not return a sample equal to the start time. |
RawByNumber | Returns a specified number of samples of all qualities with a time stamp greater than or equal to the start time. The RawByNumber sampling mode will return a sample with a time stamp equal to the start time if one exists You must also specify a direction and number of samples when using this sampling mode. |
Interpolated | When archive or collector compression is used, a minimal number of actual data samples are stored in the archive. When this data is retrieved, interpolation can be performed to create an evenly spaced list of most likely real-world values (since the actual values have been removed from the archive through the compression algorithm). The Interpolated sampling mode is also useful for data samples that haven't undergone archive compression. For example, you may want to plot data along an interval that doesn't match the collected raw samples. Using the Interpolated sampling mode would give you the most likely real-world values for the specified period. Typically, you use the interpolated sampling mode when data is not collected on a set time schedule, or if you want to see the results returned in an interval that is slower than the collection rate. For example, these instances show when you can use interpolated mode to make evenly spaced values:
|
InterpolatedtoRaw | When you request interpolated data, you specify an interval or number of samples. If the actual stored number of raw samples is greater than required, you will get interpolated data as described above. If the actual number of stored samples are less than the required, then you will get the raw samples. In this way, the needs of trending detail and application load are balanced. This mode is best used when querying compressed data because the Data Archiver can switch to the more efficient raw data query. |
Lab | The Lab sampling mode only returns the collected values, without any interpolation of the value. The collected value is repeated for each interval until there is a change in the raw data sample's value. Lab sampling is most often used to create a step chart rather than a smooth curve. Use Lab sampling instead of interpolated if you only want true collected values returned. The Lab sampling mode is generally not useful on highly compressed data. Use interpolated sampling instead. |
LabtoRaw | LabtoRaw is an extension to Lab mode of sampling and similar to InterpolatedtoRaw mode where you will be switched to raw data or lab when the actual data samples are fewer than the requested samples. |
Trend | The Trend sampling mode was designed to produce maximum performance when retrieving data for plotting, particularly over long time periods. The trend sampling mode returns the maximum and minimum value collected during each interval. When plotted, this makes it possible to display an accurate representation of the data that won’t miss any extrema, by only retrieving a minimum of points. For example, a trend of one year of data with a one-day interval will return 730 values consisting of the 365 minimums and 365 maximums for each day of the year. |
TrendtoRaw | The TrendtoRaw sampling mode almost always produces the same results as the Trend sampling mode. The exception is that, when more samples are requested than there are raw data points, the TrendtoRaw sampling mode returns all of the available raw data points with no further processing. TrendtoRaw is used when the number of actual data samples are fewer than the requested number of samples. In that case, TrendtoRaw retrieves raw data in a given interval (between a selected raw minimum and raw maximum). |
Trend2 | The Trend2 sampling mode is a modified version of the Trend sampling mode. Trend2 sampling splits up a given time period into a number of intervals (using either a specified number of samples or specified interval length), and returns the minimum and maximum data values that occur within the range of each interval, together with the timestamps of the raw values. The key differences between Trend and Trend2 sampling modes are in:
Trend sampling mode is more suitable for plotting applications that prefer evenly-spaced data. Trend2 sampling mode is more suitable for analysis of mins and maxes and for plotting programs that can handle unevenly spaced data. |
TrendtoRaw2 | The TrendtoRaw2 sampling mode is a modified version of the TrendtoRaw sampling mode. The TrendtoRaw2 sampling mode almost always produces the same results as the Trend2 sampling mode. The exception is that, when more samples are requested than there are raw data points, the TrendtoRaw2 sampling mode returns all of the available raw data points with no further processing. |
Calculated | Returns samples based on a selected Calculation mode. |
RawByFilterToggle | RawByFilterToggle returns filtered time ranges. The values returned are 0 and 1. If the value is 1, then the condition is true and 0 means false. This sampling mode is used with the time range and filter tag conditions. The result starts with a starting time stamp and ends with an ending timestamp |