Class EpicsScaler

All Implemented Interfaces:
Detector, Device, Scannable, InitializationListener, Configurable, Findable, gda.observable.IObservable, Serializable

public class EpicsScaler extends DetectorBase implements InitializationListener
Epics scaler class.
See Also:
  • Constructor Details

    • EpicsScaler

      public EpicsScaler()
      Constructor.
  • Method Details

    • configure

      public void configure() throws FactoryException
      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. initialisation - create all channels to PVs and setup monitoring.
      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
    • getCountMode

      public EpicsScaler.CountMode getCountMode() throws DeviceException
      Throws:
      DeviceException
    • setCountMode

      public void setCountMode(EpicsScaler.CountMode value) throws DeviceException
      Throws:
      DeviceException
    • getTotalChans

      public int getTotalChans() throws DeviceException
      Gets the total number of channels actually supported by the scaler hardware
      Returns:
      integer number of channels
      Throws:
      DeviceException
    • loadPresetChans

      public void loadPresetChans(double[] value) throws DeviceException
      Loads the user set preset values to the scaler channels. If scaler channel n has been designated as a preset scaler channel , then when the scaler channel reaches the preset count , all scaler channels will be disabled, and the record will report counting has completed . When Preset changes to any positive value, the record will set gate of that corresponding scaler channel to 1.
      Parameters:
      value - double array of the preset values
      Throws:
      DeviceException
    • start

      public void start() throws DeviceException
      Starts the counting in the Scaler
      Throws:
      DeviceException
    • stop

      public void stop() throws DeviceException
      Stops the counting in the Scaler
      Specified by:
      stop in interface Scannable
      Overrides:
      stop in class ScannableBase
      Throws:
      DeviceException
      See Also:
    • readChans

      public double[] readChans() throws DeviceException
      Reads the counts accumulated by all the scalers
      Returns:
      a double array of the scaler counts
      Throws:
      DeviceException
    • getChannelLabel

      public String getChannelLabel(int channel) throws DeviceException
      Gets the user set name of the Channel
      Parameters:
      channel - integer channel number - zero based
      Returns:
      the Name of the channel associated with a channel number
      Throws:
      DeviceException
    • setChannelLabel

      public void setChannelLabel(int channel, String label) throws DeviceException
      Sets the name of the Channel
      Parameters:
      channel - integer channel number - zero based
      label - name to be associated with that channel
      Throws:
      DeviceException
    • getExtraNames

      public String[] getExtraNames()
      Gets the names of all the channels as a list
      Specified by:
      getExtraNames in interface Scannable
      Overrides:
      getExtraNames in class ScannableBase
      Returns:
      list of all the channel names
    • collectData

      public void collectData() throws DeviceException
      Description copied from interface: Detector
      Tells the detector to begin to collect a set of data, then returns immediately. Should cause the hardware to start collecting immediately: if there is any delay then detectors used in the same scan would collect over different times when beam conditions may differ.
      Specified by:
      collectData in interface Detector
      Throws:
      DeviceException
    • setCollectionTime

      public void setCollectionTime(double time)
      Sets the collection time for the scalers
      Specified by:
      setCollectionTime in interface Detector
      Overrides:
      setCollectionTime in class DetectorBase
      Parameters:
      time - period to count
    • getCollectionTime

      public double getCollectionTime()
      Gets the collection time from the scalers
      Specified by:
      getCollectionTime in interface Detector
      Overrides:
      getCollectionTime in class DetectorBase
      Returns:
      double collectionTime
    • getStatus

      public int getStatus()
      Description copied from interface: Detector
      Returns the current collecting state of the device.
      Specified by:
      getStatus in interface Detector
      Returns:
      BUSY if the detector has not finished the requested operation(s), IDLE if in an completely idle state and STANDBY if temporarily suspended.
    • readout

      public double[] readout() throws DeviceException
      Description copied from interface: Detector
      Returns the latest data collected. The size of the Object returned must be consistent with the values returned by getDataDimensions and getExtraNames.

      If LocalProperties.GDA_SCAN_CONCURRENTSCAN_READOUT_CONCURRENTLY is true then motors may be moved while the detector readouts. The value returned must not be effected by any concurrent motor or shutter movements. See Detector.waitWhileBusy() and ConcurrentScan. Readout must block until the detector is ready to respond quickly to Detector.collectData() again.

      Specified by:
      readout in interface Detector
      Returns:
      the data collected
      Throws:
      DeviceException
    • readout

      public int readout(int channel) throws DeviceException
      Parameters:
      channel -
      Returns:
      data
      Throws:
      DeviceException
    • getFrequency

      public double getFrequency()
      Gets the clock frequency of the Scaler
      Returns:
      double frequency
    • setFrequency

      public void setFrequency(double frequency)
      Sets the clock frequency of the scaler
      Parameters:
      frequency -
    • getDataDimensions

      public int[] getDataDimensions() throws DeviceException
      Description copied from class: DetectorBase
      Default which should be overridden by subclasses.
      Specified by:
      getDataDimensions in interface Detector
      Overrides:
      getDataDimensions in class DetectorBase
      Returns:
      the dimensions of the data object returned by the Detector.readout() method
      Throws:
      DeviceException
      See Also:
    • addMonitor

      public void addMonitor(int channel, gov.aps.jca.event.MonitorListener l) throws DeviceException
      adds a monitor to the specified channel
      Parameters:
      channel -
      l -
      Throws:
      DeviceException
    • initializationCompleted

      public void initializationCompleted()
      Description copied from interface: InitializationListener
      Called when all critical channels are connected.
      Specified by:
      initializationCompleted in interface InitializationListener
    • formatPosition

      public String formatPosition(int format, double number)
      Does the same job as the other formatPosition method except rather than using a supplied format string, use the index of the array of formats this object holds. This is to be used when an object has multiple elements which descibe its position and those element require different formatting.
      Parameters:
      format - the index in the array of formats to use
      number - the number to format
      Returns:
      a formatted string
    • toString

      public String toString()
      Overrides:
      toString in class ScannableBase
    • setPvName

      public void setPvName(String pvName)
      Parameters:
      pvName -
    • getPvName

      public String getPvName()
      Returns:
      pv name
    • createsOwnFiles

      public boolean createsOwnFiles() throws DeviceException
      Description copied from interface: Detector
      Returns a value which indicates whether the detector creates its own files. If it does (return true) the readout() method returns the name of the latest file created as a string. If it does not (return false) the readout() method will return the data directly.
      Specified by:
      createsOwnFiles in interface Detector
      Returns:
      true if readout() returns filenames
      Throws:
      DeviceException
    • getDescription

      public String getDescription() throws DeviceException
      Specified by:
      getDescription in interface Detector
      Overrides:
      getDescription in class DetectorBase
      Returns:
      A description of the detector.
      Throws:
      DeviceException
    • getDetectorID

      public String getDetectorID() throws DeviceException
      Specified by:
      getDetectorID in interface Detector
      Overrides:
      getDetectorID in class DetectorBase
      Returns:
      A identifier for this detector.
      Throws:
      DeviceException
    • getDetectorType

      public String getDetectorType() throws DeviceException
      Specified by:
      getDetectorType in interface Detector
      Overrides:
      getDetectorType in class DetectorBase
      Returns:
      The type of detector.
      Throws:
      DeviceException
    • isControlCountMode

      public boolean isControlCountMode()
    • setControlCountMode

      public void setControlCountMode(boolean controlCountMode)