Class RunningCounterApplication.AverageCalculator

java.lang.Object
org.scictrl.csshell.epics.server.application.RunningCounterApplication.AverageCalculator
Enclosing class:
RunningCounterApplication

public static class RunningCounterApplication.AverageCalculator extends Object
Calculates average and other statistics on predefine time window.
Author:
igor@scictrl.com
  • Field Details

    • data

      Collected data.
    • size

      public int size
      number of data points.
    • avg

      public double avg
      Calculated average.
    • rms

      public double rms
      Calculated RMS
    • std

      public double std
      Calculated STD
    • interval

      public long interval
      Averaging interval.
    • span

      public long span
      Time span of data.
    • last

      public long last
      Last data timestamp.
  • Constructor Details

    • AverageCalculator

      public AverageCalculator()
      Constructor.
  • Method Details

    • add

      public void add(ValueLinks.ValueHolder vh)
      Adds new value to the data pool.
      Parameters:
      vh - value to be added
    • add

      public void add(double value, long timestamp)
      Adds new value to the data pool.
      Parameters:
      value - value to be added
      timestamp - the timestamp of the value
    • addValid

      public boolean addValid(ValueLinks.ValueHolder vh, boolean strictAlarmFilter)
      Adds ValueHolder data to the data pool if meets criteria
      Parameters:
      vh - the ValueHolder for which data is added
      strictAlarmFilter - if true it will accept only data if there is NO_ALARM status. If false then data is added unless it is INVALID alarm. This is useful, because for MINOR or MAJOR alarms the data is still valid.
      Returns:
      true if data has been added, otherwise false
    • addValid

      public boolean addValid(Record r, boolean strictAlarmFilter)
      Adds record data to the data pool if meets criteria
      Parameters:
      r - the Record for which data is added
      strictAlarmFilter - if true it will accept only data if there is NO_ALARM status. If false then data is added unless it is INVALID alarm. This is useful, because for MINOR or MAJOR alarms the data is still valid.
      Returns:
      true if data has been added, otherwise false
    • trim

      public void trim()
      Trims data pool to the predefined time window.
    • update

      public void update()
      Updates the statistics from data pool.
    • clear

      public void clear()
      Clears the data pool.