Class TfgScaler

All Implemented Interfaces:
CounterTimer, Detector, Device, Scannable, Configurable, Findable, gda.observable.IObservable, Serializable
Direct Known Subclasses:
TfgScalerWithDarkCurrent

public class TfgScaler extends TFGCounterTimer
A distributed counter/timer class implemented using DA.Server at present on OS-9 systems using VME Time Frame Generator and multichannel scaler.
See Also:
  • Field Details

    • scaler

      protected Memory scaler
    • timeChannelRequired

      protected boolean timeChannelRequired
    • numChannelsToRead

      protected Integer numChannelsToRead
  • Constructor Details

    • TfgScaler

      public TfgScaler()
  • 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 CounterTimerBase
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • setScalerName

      public void setScalerName(String scalerName)
      Set the name of the scaler for the Finder
      Parameters:
      scalerName -
    • getScalerName

      public String getScalerName()
      Used by Castor for instantiation.
      Returns:
      the scaler name
    • getScaler

      public Memory getScaler()
    • setScaler

      public void setScaler(Memory scaler)
    • isTimeChannelRequired

      public boolean isTimeChannelRequired()
    • setTimeChannelRequired

      public void setTimeChannelRequired(boolean timeChannelRequired)
    • getTotalChans

      public int getTotalChans() throws DeviceException
      Returns the total number of available counter-timer readout channels that will be returned by calls to readChans() For a time-framing device it is the number of channels per frame. All counter-timers must fully implement this.
      Returns:
      total number of readout channels
      Throws:
      DeviceException
    • countAsync

      public void countAsync(double time) throws DeviceException
      Initiates a single specified timing period and allows the counter-timer to proceed asynchronously. The end of period can be determined by calls to isCounting() returning false. All counter-timers must fully implement this.
      Parameters:
      time - the requested counting time in milliseconds
      Throws:
      DeviceException
    • start

      public void start() throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer this initiates framing.
      Specified by:
      start in interface CounterTimer
      Overrides:
      start in class CounterTimerBase
      Throws:
      DeviceException
    • stop

      public void stop() throws DeviceException
      Description copied from class: ScannableBase
      Stop the current move/operation. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
      Specified by:
      stop in interface Scannable
      Overrides:
      stop in class CounterTimerBase
      Throws:
      DeviceException
      See Also:
    • addFrameSet

      public void addFrameSet(int frameCount, double requestedDeadTime, double requestedLiveTime) throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer a single frameSet object is created for a specified live and dead time. A count for identical frames is specified by the frameCount.
      Specified by:
      addFrameSet in interface CounterTimer
      Overrides:
      addFrameSet in class CounterTimerBase
      Parameters:
      frameCount - number of frames required of this type
      requestedDeadTime - frame live time in milliseconds
      requestedLiveTime - frame dead time in milliseconds
      Throws:
      DeviceException
    • addFrameSet

      public void addFrameSet(int frameCount, double requestedDeadTime, double requestedLiveTime, int deadPort, int livePort, int deadPause, int livePause) throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer a single frameSet object is created for a specified live and dead time. A count for identical frames is specified by the frameCount.
      Specified by:
      addFrameSet in interface CounterTimer
      Overrides:
      addFrameSet in class CounterTimerBase
      Parameters:
      frameCount - requested number of frames required of this type
      requestedDeadTime - requested frame live time in milliseconds
      requestedLiveTime - requested frame dead time in milliseconds
      deadPort - wait period output level 0 or 1
      livePort - run period output level 0 or 1
      deadPause - pause before wait period 0 or 1
      livePause - pause before run period 0 or 1
      Throws:
      DeviceException
    • clearFrameSets

      public void clearFrameSets() throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer all current frameSets are cleared.
      Specified by:
      clearFrameSets in interface CounterTimer
      Overrides:
      clearFrameSets in class CounterTimerBase
      Throws:
      DeviceException
    • atScanLineStart

      public void atScanLineStart() throws DeviceException
      Description copied from class: ScannableBase
      Called for every Scannable at the start of every scan Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.
      Specified by:
      atScanLineStart in interface Scannable
      Overrides:
      atScanLineStart in class ScannableBase
      Throws:
      DeviceException
      See Also:
    • atCommandFailure

      public void atCommandFailure() throws DeviceException
      Description copied from class: ScannableBase
      Hook to be used by Scan and pos commands to inform the Scannable that an exception, such as a DeviceExcpetion, has occurred. However not called when the command is aborted using an InterruptionException. If a Scan is aborted then only Scannable.stop() will be called by the Scan or pos command.

      Useful for telling Scannables which hold state during a scan for example, to reset themselves. Used for example by CoordinatedMotionScannables. This hook should be used not in the same way as the stop hook. Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.

      Specified by:
      atCommandFailure in interface Scannable
      Overrides:
      atCommandFailure in class ScannableBase
      Throws:
      DeviceException
      See Also:
    • atScanEnd

      public void atScanEnd() throws DeviceException
      Description copied from class: ScannableBase
      Called for every Scannable at the end of a group of nested scans (or a single scan if that is the case).

      Note that this is only called if the Scan finishes normally, or has been requested to finish early. This will not be called if the scan finishes due to an exception of any kind. See Scannable.atCommandFailure() Default behaviour is to do nothing. Inheriting classes have the option to implement this if their specific behaviour requires it.

      Specified by:
      atScanEnd in interface Scannable
      Overrides:
      atScanEnd in class ScannableBase
      Throws:
      DeviceException
      See Also:
    • readChans

      public double[] readChans() throws DeviceException
      Obtain an array of available readout channels. This should be available at any time. If the hardware does not allow it during active counter-timing periods, it should return zero values. High level counter-timers may return values in user units. All counter-timers must fully implement this.
      Returns:
      array of all channel readout values
      Throws:
      DeviceException
    • readChannel

      public double[] readChannel(int startFrame, int frameCount, int channel) throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer read out a specified channel, beginning from the specified start frame number using the requested frame count.
      Parameters:
      startFrame - starting frame number (1st=0)
      frameCount - number of frames to read the counter data out from
      channel - read this channel
      Returns:
      array of requested readout counter-timer data
      Throws:
      DeviceException
    • readFrame

      public double[] readFrame(int startChannel, int channelCount, int frame) throws DeviceException
      Description copied from interface: CounterTimer
      For a time framing counter-timer read out a specified frame, beginning from the specified start channel number using the requested channel count.
      Parameters:
      startChannel - starting channel number (1st=0)
      channelCount - number of channels to read the counter data out from
      frame - read this frame
      Returns:
      array of requested readout counter-timer data
      Throws:
      DeviceException
    • readFrame

      public double[] readFrame(int frame) throws DeviceException
      For a time framing counter-timer, read out from channel 0 beginning from the specified start frame number using all the scaler dimensions.
      Parameters:
      frame - read this frame
      Returns:
      array of requested readout counter-timer data
      Throws:
      DeviceException
    • setAttribute

      public void setAttribute(String attributeName, Object value) throws DeviceException
      Description copied from interface: Device
      Set any attribute the implementing classes may provide
      Specified by:
      setAttribute in interface Device
      Overrides:
      setAttribute in class DeviceBase
      Parameters:
      attributeName - is the name of the attribute
      value - is the value of the attribute
      Throws:
      DeviceException - if an attribute cannot be set
    • getAttribute

      public Object getAttribute(String attributeName) throws DeviceException
      Description copied from interface: Device
      Get the value of the specified attribute
      Specified by:
      getAttribute in interface Device
      Overrides:
      getAttribute in class DeviceBase
      Parameters:
      attributeName - is the name of the attribute
      Returns:
      the value of the attribute as an Object type
      Throws:
      DeviceException - if an attribute cannot be retrieved
    • 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.
      Throws:
      DeviceException
    • 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.

      Returns:
      the data collected
      Throws:
      DeviceException
      See Also:
    • readoutCurrentFrame

      public double[] readoutCurrentFrame() throws DeviceException
      Returns the current data but does not increment the frame counter if frames are being used.
      Returns:
      double[]
      Throws:
      DeviceException
    • readoutFrames

      public double[][] readoutFrames(int startFrame, int finalFrame) throws DeviceException
      Throws:
      DeviceException
    • 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.
      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
    • getInputNames

      public String[] getInputNames()
      Override ScannableBase to work within scans
      Specified by:
      getInputNames in interface Scannable
      Overrides:
      getInputNames in class ScannableBase
      Returns:
      array of the names of the elements of the object returned by getPosition
    • setNumChannelsToRead

      public void setNumChannelsToRead(int numChannelsToRead)
    • getNumChannelsToRead

      public int getNumChannelsToRead()
    • getMinimumReadoutDelay

      public int getMinimumReadoutDelay()
    • setMinimumReadoutDelay

      public void setMinimumReadoutDelay(int minimumReadoutDelay)
    • getFirstDataChannel

      public Integer getFirstDataChannel()
    • setFirstDataChannel

      public void setFirstDataChannel(Integer firstDataChannel)