Class EpicsBeamMonitor

All Implemented Interfaces:
Device, Monitor, Scannable, Configurable, Findable, gda.observable.IObservable, gov.aps.jca.event.MonitorListener, EventListener

public class EpicsBeamMonitor extends MonitorBase implements gov.aps.jca.event.MonitorListener
A class to monitor the beam using an EPICS-based Detector, such as a multi-channel EpicsScaler EpicsScaler, or an ETLDetecor ETLDetector. This class monitors the specified detector count value and checks whether the data count rate has fallen below a specified threshold. If so the scan is paused and a new thread is spawned to monitor the detector until the data is above the threshold value for a given number of consecutive reads before the scan is resumed.
  • Constructor Details

    • EpicsBeamMonitor

      public EpicsBeamMonitor()
      Empty constructor for Castor configuration.
    • EpicsBeamMonitor

      public EpicsBeamMonitor(String detectorName, int channel, double threshold, int waitTime, int consecutiveCountsAboveThreshold, double countTime)
      Constructor
      Parameters:
      detectorName - the name of the detector instance.
      channel - the detector channel to use for beam monitoring.
      threshold - the threshold when the scan is paused/resumed.
      waitTime - the time (in secs) between successive monitors whilst the scan is paused.
      consecutiveCountsAboveThreshold - the number of successful readings above the threshold.
      countTime - the counting time.
  • Method Details

    • configure

      public void configure() throws FactoryException
      Description copied from class: ConfigurableBase
      Default implementation for classes that do not have to do any specific configuration.
      Classes that do their own configuration should *not* call this superclass function, as it may cause the object to appear configured before it really is.
      Specified by:
      configure in interface Configurable
      Overrides:
      configure in class ConfigurableBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • getThreshold

      public double getThreshold()
      Returns:
      Returns the threshold.
    • setThreshold

      public void setThreshold(double threshold)
      Parameters:
      threshold - The threshold to set.
    • getWaitTime

      public int getWaitTime()
      Returns:
      Returns the waitTime.
    • setWaitTime

      public void setWaitTime(int waitTime)
      Parameters:
      waitTime - The waitTime to set.
    • getConsecutiveCountsAboveThreshold

      public int getConsecutiveCountsAboveThreshold()
      Returns:
      Returns the consecutiveCountsAboveThreshold.
    • setConsecutiveCountsAboveThreshold

      public void setConsecutiveCountsAboveThreshold(int consecutiveCountsAboveThreshold)
      Parameters:
      consecutiveCountsAboveThreshold - The consecutiveCountsAboveThreshold to set.
    • getCountTime

      public double getCountTime()
      Returns:
      Returns the countTime.
    • setCountTime

      public void setCountTime(double countTime)
      Parameters:
      countTime - The countTime to set.
    • getDetectorName

      public String getDetectorName()
      Returns:
      Returns the detectorName.
    • setDetectorName

      public void setDetectorName(String detectorName)
      Parameters:
      detectorName - The detectorName to set.
    • getChannel

      public int getChannel()
      Returns:
      Returns the channel.
    • setChannel

      public void setChannel(int channel)
      Parameters:
      channel - The channel to set.
    • getPosition

      public Object getPosition() throws DeviceException
      Description copied from class: ScannableBase
      Returns the current position of the Scannable. Called by ConcurentScan at the end of the point. Reads an internal (hardware) position from rawGetPosition, converts this to an external (user) position and returns it.
      Specified by:
      getPosition in interface Scannable
      Overrides:
      getPosition in class ScannableBase
      Returns:
      Current position with an element for each input and extra field. null if their are no fields.
      Throws:
      DeviceException
    • getElementCount

      public int getElementCount() throws DeviceException
      Description copied from interface: Monitor
      returns the number of elements in this monitor.
      Specified by:
      getElementCount in interface Monitor
      Overrides:
      getElementCount in class MonitorBase
      Returns:
      int the element count
      Throws:
      DeviceException
    • getUnit

      public String getUnit() throws DeviceException
      Description copied from interface: Monitor
      gets the physical unit of the monitor.
      Specified by:
      getUnit in interface Monitor
      Overrides:
      getUnit in class MonitorBase
      Returns:
      String the physical unit
      Throws:
      DeviceException
    • monitorChanged

      public void monitorChanged(gov.aps.jca.event.MonitorEvent arg0)
      Specified by:
      monitorChanged in interface gov.aps.jca.event.MonitorListener
    • isMonitorOn

      public boolean isMonitorOn()
      checks beam monitor flag
      Returns:
      boolean
    • setMonitorOn

      public void setMonitorOn(boolean monitorOn)
      set beam monitor flag
      Parameters:
      monitorOn -
    • on

      public void on()
      switch on beam monitoring
    • off

      public void off()
      switch off beam monitoring
    • toFormattedString

      public String toFormattedString()
      Description copied from interface: Scannable
      Returns a string representation of the Scannable and its current position/value/status

      Typically should return:

      name : position

      or for detectors, name : status

      If the position/status cannot be determined, the function should return Scannable.VALUE_UNAVAILABLE in its place.

      Specified by:
      toFormattedString in interface Scannable
      Overrides:
      toFormattedString in class ScannableBase
      Returns:
      string as defined above