java.lang.Object
com.inductiveautomation.historian.gateway.query.aggregates.AbstractAggregationFunction
com.inductiveautomation.historian.gateway.query.aggregates.TimeCounterAggregate
All Implemented Interfaces:
AggregationFunction

public class TimeCounterAggregate extends AbstractAggregationFunction
This aggregate returns a Integer time for the number of seconds that a value has been On (or Off, depending on on the mode).
  • Constructor Details

    • TimeCounterAggregate

      public TimeCounterAggregate(boolean onValue)
  • Method Details

    • process

      public QualifiedValue[] process(@Nullable QualifiedValue value, boolean interpolatedValue, boolean blockFinished, BlockContext blockContext, QueryContext queryContext)
      Description copied from interface: AggregationFunction
      This function will be called for each value that should be processed, for the entire range of the query. It works in the following way:
      1. For each window, a new BlockContext is created. This object provides some information, but can also be used as a scratch pad for data in the aggregation window.
      2. The function will be called for each value that is actually read from the data source. In this case, interpolatedValue will be false
      3. The function will be called with values at the start of the window and at the end of the window. In these cases, the interpolatedValue boolean will be true (unless raw values just happen to correspond exactly).
      4. The BlockContext contains the previous raw and computed values prior to this block, which can be used for running sums, ongoing calculations, etc.
      5. The return value is only used when blockFinished is true. At the end of the window, the function will be called with an interpolated value for the end time, and blockFinished=true. The function should finalize calculations and return results. (* The function may reuse the return array, and mutate it after returning values)