Skip to main content
Version: 7.9

Sample Size and Aggregation Mode

In places where the Tag History system can be queried, a Sample Size and Aggregation mode can be selected that will determine how the results will be queried out and how the raw values will be aggregated.

Inductive University

Tag History Aggregates

Watch the video

Sample Size

The sample size determines how the query results will look.

  • Natural - A Natural query will look up the logging rate for the queried tags (when possible), and return results spaced apart at that rate. This means that the return size will vary with the date range.
  • On Change/Raw - An On Change query will return points as they were logged, and can be thought of as a "raw" query mode. This means that the results may not be evenly spaced. Also, it is important to note that every changed value will result in a row, and therefore if you are querying multiple tags and once, you may end up with more rows than you anticipated. For example, if tag A and tag B both change, you would end up with [[A0, B0],[A1, B0], [A1, B1]]. Note: If you want to essentially retrieve raw values, while coalescing them down into fewer rows, try using the Interval sample mode, with an interval set to your largest acceptable time between rows, and select "prevent interpolation" from the advanced settings.
  • Fixed - A Fixed query will return the given number of rows. Where data was sparse, interpolated values will be added. Where data is dense, the Aggregation Mode will come into play.
  • Interval - Similar to fixed, but with the spacing based on time, rather than the number of requested results.

Aggregation Mode

The aggregation mode dictates what happens when multiple raw values are encountered for a given sample window (the size of which is determined by the number of requested rows, or the interval size).

  • Time-weighted Average - The values are averaged together, weighted for the amount of time they cover in the interval.
  • Min/Max - The minimum and maximum values will be returned for the window. In other words, two rows will be returned. If only one value is seen in the interval, only one row will be returned.
  • Closest Value - The value closest to the ending time of the interval will be returned.
  • Basic Average - The values are summed together and divided by the number of values.
  • Sum - The values in the interval are summed together.
  • Maximum - The maximum value in the interval.
  • Minimum- The minimum value in the interval.
  • Duration On - Returns the number of seconds that the value was recorded as non-zero.
  • Duration Off - Returns the number of seconds that the value recorded as zero.
  • Count On - Returns the number of times the tag's value went from a zero value to non-zero.
  • Count Off - Returns the number of times the tag's value changed from a non-zero value to zero.
  • Count - Returns the number of times a value was recorded
  • Percent Good - Time-weighted percentage of good values over the date range.
  • Percent Bad - Time-weighted percentage of bad values over the date range.
  • Range - Returns the range between the highest and lowest value for the period.
  • Standard Deviation - Returns the standard deviation of values, or how much spread is present in the data; low standard deviation shows the values are close to the mean, and high standard deviation shows that the data points are spread out over a large range of values. Only good quality values are used when calculating.
  • Variance - Returns the variance of values. Similar in concept Standard Deviation. Only good quality values are used when calculating.