Class MonitoredValue

java.lang.Object
org.eso.ias.plugin.MonitoredValue
All Implemented Interfaces:
Runnable

public class MonitoredValue extends Object implements Runnable
A MonitoredValue is a monitor point value or alarm read from the controlled system.

The history of samples needed to apply the filter is part of the filter itself because its management depends on the filter.
For example a filter that returns only the last received value needs to save a history with only that sample, but a filter that averages the values acquired in the last minute needs a longer history even if its refresh rate is much shorter then the averaging period.

The MonitoredValue main tasks are:

  • receive the values (samples, in ((submitSample(Sample))) of the monitor point generated by the monitored control system and apply the filter to generate the value, a ValueToSend, to send to the IAS
  • if the value has not been sent to the IAS when the refresh time interval elapses, send the value again to the core

The MonitoredValue sends the value to the listener, that will send it to the core of the IAS:

  • immediately if the generated value changed
  • periodically by a timer task.
A timer task implemented by the run() resend to the core the last value sent.
Note that he periodic sending time interval is a global parameter of the plugin (of the IAS, actually) and must not be confused with the refreshRate of the monitor point that is the time interval that the monitor point is refreshed by the device. The validity depends on the time when the value has been produced by the remote system against the refresh rate and the actual time: the IAS periodic sending of the value does not play a role in the assessment of the validity.
Author:
acaproni
  • Field Details

    • id

      public final String id
      The ID of the monitored value
    • minAllowedSendRate

      public static final long minAllowedSendRate
      The refreshRate of the monitored can be dynamically changed but can never be less than the allowed minimum.
      See Also:
    • validityDeltaPropName

      public static final String validityDeltaPropName
      The name of the property to set the delta time error
      See Also:
    • validityDelta

      public static final long validityDelta
      The delta time error in msec, to take into account chacking if a value is valid.
    • refreshRate

      public long refreshRate
      The actual refresh rate (msec) of this monitored value: the value depends on the time when the device provides a new value and it is used to evaluate the validity
    • iasPeriodicSendingTime

      public final int iasPeriodicSendingTime
      The periodic time interval to automatically send the last computed value to the BSDB
  • Constructor Details

    • MonitoredValue

      public MonitoredValue(String id, long refreshRate, Filter filter, ScheduledExecutorService executorSvc, ChangeValueListener listener, int iasPeriodicSendingTime)
      Build a MonitoredValue with the passed filter
      Parameters:
      id - The identifier of the value
      refreshRate - The refresh time interval of the device (in msec)
      filter - The filter to apply to the samples
      executorSvc - The executor to schedule the thread
      listener - The listener of updates
      iasPeriodicSendingTime - The time interval (secs) to periodically send the last computed value to the BSDB
    • MonitoredValue

      public MonitoredValue(String id, long refreshRate, ScheduledExecutorService executorSvc, ChangeValueListener listener, int iasPeriodicSendingTime)
      Build a MonitoredValue with the default filter, NoneFilter
      Parameters:
      id - The identifier of the value
      refreshRate - The refresh time interval
      executorSvc - The executor to schedule the thread
      listener - The listener
      iasPeriodicSendingTime - The time interval (secs) to periodically send the last computed value to the BSDB
  • Method Details

    • getValueTosend

      public Optional<FilteredValue> getValueTosend()
      Get and return the value to send i.e. the value generated applying the filter to the #history of samples.
      Returns:
      The value to send
    • submitSample

      public void submitSample(Sample s) throws FilterException
      Adds a new sample to this monitor point.
      Parameters:
      s - The not-null sample to add to the monitored value
      Throws:
      FilterException - If the submitted sample caused an exception in the filter
    • run

      public void run()
      The timer task scheduled when the refresh time interval elapses.
      Specified by:
      run in interface Runnable
      See Also:
    • setRefreshRate

      public long setRefreshRate(long newRefreshRate)
      Set the new refresh rate for the monitored value with the given identifier.

      This method sets the refresh rate at which the monitored value is retrieved from the remote monitored system and not the time the value is periodically sent to the BSDB if its value did not change.

      Setting this value affects the evaluation of the validity.

      Parameters:
      newRefreshRate - The new refresh rate (msecs), must be greater then minAllowedSendRate
      Returns:
      The new refresh rate (msec)
    • enablePeriodicNotification

      public void enablePeriodicNotification(boolean enable)
      Enable or disable the periodic sending of notifications.
      Parameters:
      enable - if true enables the periodic sending;
    • setOperationalMode

      public OperationalMode setOperationalMode(OperationalMode opMode)
      Set the operational mode of this monitor point value.

      Note that this value is effectively sent to the core of the IAS only if not overridden by the plugin operational mode

      Parameters:
      opMode - The not null operational mode to set
      Returns:
      The old operational mode of the monitor point
    • start

      public void start()
      Start the MonitorValue basically activating the timer thread
    • shutdown

      public void shutdown()
      Stops the periodic thread and release all the resources