2. Decimated samples

The Channel Access control-system support implements the generation of decimated samples in a way that should fit for most applications. This section explains how sample decimation is handled in different situations, in particular regarding the different possible types of raw samples.

For numeric, scalar samples, the Channel Access control-system support aggregates source samples in order to generate a decimated sample that represents the aggregated information of all its source samples. This process is described in Section 2.1, “Aggregation”. When the source samples cannot be reasonably aggregated (for example string samples or arrays), the Channel Access control-system support falls back to a simple decimation algorithm. This decimation algorithm is described in Section 2.2, “Decimation”.

2.1. Aggregation

Numeric, scalar source samples are aggregated when generating a decimated sample. Such source samples are of the types DBR_DOUBLE, DBR_FLOAT, DBR_INT, DBR_LONG, and DBR_SHORT and only have a single element. If the period that is covered by a decimated sample contains a sample of type DBR_ENUM or DBR_STRING or a sample that has more than one element, the algorithm falls back to using the simple decimation algorithm that is described in Section 2.2, “Decimation”.

When the source samples are of different types that are all aggregatable, (e.g. DBR_DOUBLE and DBR_SHORT), the samples of the type that covers the greatest fraction of the period is used. Samples of other types are not considered when building the aggregated sample. Source samples that indicate the channel being disabled or disconnected are not used when building the aggregated sample either.

The generated aggregated sample contains the following information:

  • mean of the source samples’ values
  • standard deviation of the source samples’ values
  • least source sample value (minimum)
  • greatest source sample value (maximum)
  • fraction of the total period that is covered by the source samples of that type

The mean and the standard deviation are calculated so that the validity period of each sample is used as its weight. For example, if the period for which a decimated sample is generated contains two samples and one of these two samples covers 90 percent of the period and the other one covers 10 percent of the period, the weight of the first sample is 0.9 and the weight of the second sample is 0.1. This way, the mean and the standard deviation give a more natural representation of the channel’s actual value during the whole period.

The fraction of the total period that is covered by the source samples of that type is kept for two reasons: First, it is needed when aggregating already aggregated samples further (for decimation levels with an even greater decimation period) in order to correctly calculate the weight of each sample. Second, it gives an idea of how much one can “trust” a sample. An aggregated sample that only covers a small fraction of the period is typically less reliable than an aggregated sample that covers a large fraction.

The meta-data of an aggregated sample (alarm limits, engineering units, etc.) is simply taken from the first source sample of the respective type. The alarm severity is taken from the source sample with the highest alarm severity. The alarm status is taken from that same sample. If there is more than one source sample with the highest alarm severity, the alarm status from the first of these samples is used.

2.2. Decimation

When source samples cannot reasonably be aggregated (because they are of a non-numeric type or have values with more than a single element), a very simple decimation strategy is chosen. This strategy simply uses the first source sample, replacing its time stamp with the time of the start of the interval for which the decimated sample is generated. Decimated samples that are generated in this way are decimated in the literal sense and simply represent snapshots of the channel at specific points in time.