Class EpicsMcaController

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

public class EpicsMcaController extends DeviceBase implements InitializationListener
Class to communicate with an epics MCA record. The MCA record controls and acquires data from a multi-channel analyser (MCA).
Since:
7.3
See Also:
  • Field Details

    • NUMBER_OF_REGIONS

      public int NUMBER_OF_REGIONS
      maximum number of ROI
  • Constructor Details

    • EpicsMcaController

      public EpicsMcaController()
      Constructor, initialise this object.
    • EpicsMcaController

      public EpicsMcaController(String name)
      Constructor taking a PV name, you must run .configure() to fully initialise the object
      Parameters:
      name - String, the PV name
    • EpicsMcaController

      public EpicsMcaController(String name, String recordName)
      constructor allowing setting of object name and MCA record name, you must run .configure() to fully initialise the object
      Parameters:
      name - - the object name
      recordName - - EPICS MCA record name
  • Method Details

    • configure

      public void configure() throws FactoryException
      object initialisation - create all EPICS channels required
      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
      See Also:
    • startAcquisition

      public void startAcquisition() throws DeviceException
      starts data acquisition
      Throws:
      DeviceException
    • stopAcquisition

      public void stopAcquisition() throws DeviceException
      stops data acquisition
      Throws:
      DeviceException
    • eraseStartAcquisition

      public void eraseStartAcquisition() throws DeviceException
      Activates the MCA using the Erase invalid input: '&' Start acquire.
      Throws:
      DeviceException
    • getAcquireStatus

      public int getAcquireStatus() throws DeviceException
      gets acquire status from MCA (poll from hardware)
      Returns:
      0 done, 1 Acquire
      Throws:
      DeviceException
    • getStatus

      public MCAStatus getStatus() throws DeviceException
      get current MCA status
      Returns:
      MCA status
      Throws:
      DeviceException
    • processRecord

      public void processRecord() throws DeviceException
      initiates record process
      Throws:
      DeviceException
    • read

      public void read() throws DeviceException
      initiates reading of the MCA's data.
      Throws:
      DeviceException
    • clear

      public void clear() throws DeviceException
      erases the data array of the MCA
      Throws:
      DeviceException
    • getChannalAdvanceSource

      public short getChannalAdvanceSource() throws DeviceException
      gets the channel advance source in MCS mode
      Returns:
      0 - Internal clock, 1 - external signal
      Throws:
      DeviceException
    • setChannelAdvanceSource

      public void setChannelAdvanceSource(int s) throws DeviceException
      sets channel advance source in MCS mode
      Parameters:
      s - 0 - Internal clock or 1 - External signal.
      Throws:
      DeviceException
    • getNumberOfChannels

      public long getNumberOfChannels() throws DeviceException
      gets the number of channels to use for spectrum acquisition
      Returns:
      the number of channels to use
      Throws:
      DeviceException
    • setNumberOfChannels

      public void setNumberOfChannels(long channels) throws DeviceException
      sets the number of channels (array elements) to use for spectrum acquisition
      Parameters:
      channels -
      Throws:
      DeviceException
    • setSequence

      public void setSequence(long sequence) throws DeviceException
      sets the time sequence number which tell the hardware which memory region to use for data acquisition, readout and erasing. The main use of this field is for time-resolved spectroscopy, since it permits rapidly changing the location of data acquisition, without having to read and erase the acquisition memory between successive spectra.
      Parameters:
      sequence -
      Throws:
      DeviceException
    • getSequence

      public long getSequence() throws DeviceException
      gets the time sequence number which is the memory region hardware used for data acquisition
      Returns:
      the time sequence number
      Throws:
      DeviceException
    • getDwellTime

      public double getDwellTime() throws DeviceException
      Gets the Dwell Time (DWEL) per channel, used only in MCS mode and CHAS is internal.
      Returns:
      Dwell Time
      Throws:
      DeviceException
    • setDwellTime

      public void setDwellTime(double time) throws DeviceException
      Sets the dwell time (DWEL) to tell the hardware how many seconds to spend in each channel when the hardware is in MCS mode and the channel advance source is "Internal"
      Parameters:
      time -
      Throws:
      DeviceException
    • getChannelAdvanceFactor

      public int getChannelAdvanceFactor() throws DeviceException
      gets the Channel Advance Pre-Scale Factor when in MCS mode and source is "External". Default is 1.
      Returns:
      the channel advance pre-scale factor
      Throws:
      DeviceException
    • setChannelAdvanceFactor

      public void setChannelAdvanceFactor(int n) throws DeviceException
      sets the Channel Advance pre-Scale factor when in MCS mode and source is "External". The hardware will advance to the next channel after receiving PSCL external pulses. Default is 1.
      Parameters:
      n -
      Throws:
      DeviceException
    • getPresetRealTime

      public float getPresetRealTime() throws DeviceException
      gets the preset real time from hardware for how many seconds to acquire data according to a free running clock (real time).
      Returns:
      preset real time
      Throws:
      DeviceException
    • setPresetRealTime

      public void setPresetRealTime(double time) throws DeviceException
      sets the preset real time to the hardware for how many seconds to acquire data according to a free running clock (real time). sets 0.0 instructs the hardware to ignore it.
      Parameters:
      time -
      Throws:
      DeviceException
    • getPresetLiveTime

      public float getPresetLiveTime() throws DeviceException
      gets the preset live time from hardware for how many seconds to acquire data according to a clock which counts only when hardware is ready to accept data (live time).
      Returns:
      preset live time
      Throws:
      DeviceException
    • setPresetLiveTime

      public void setPresetLiveTime(double time) throws DeviceException
      sets the preset live time to the hardware for how many seconds to acquire data according to a clock which counts only when hardware is ready to accept data (live time). Sets it to 0.0 instructs the hardware to ignore it.
      Parameters:
      time -
      Throws:
      DeviceException
    • getPresetCounts

      public int getPresetCounts() throws DeviceException
      gets the preset counts from hardware
      Returns:
      preset counts
      Throws:
      DeviceException
    • setPresetCounts

      public void setPresetCounts(int counts) throws DeviceException
      sets the preset counts which tells the hardware that data acquisition is to be halted when the sum of the numbers of counts acquired in channels PCTL through PCTH inclusive reaches this value. Sets it to 0.0 instructs the hardware to ignore it.
      Parameters:
      counts -
      Throws:
      DeviceException
    • getPresetCountLow

      public int getPresetCountLow() throws DeviceException
      gets the preset count low channel from hardware
      Returns:
      preset count low channel
      Throws:
      DeviceException
    • setPresetCountLow

      public void setPresetCountLow(int channel) throws DeviceException
      sets the preset count low channel
      Parameters:
      channel -
      Throws:
      DeviceException
    • getPresetCountHigh

      public int getPresetCountHigh() throws DeviceException
      gets the preset count high channel from hardware
      Returns:
      preset count high channel
      Throws:
      DeviceException
    • setPresetCountHigh

      public void setPresetCountHigh(int channel) throws DeviceException
      sets the preset count high channel
      Parameters:
      channel -
      Throws:
      DeviceException
    • getPresetSweep

      public int getPresetSweep() throws DeviceException
      gets the preset number of sweeps from hardware
      Returns:
      number of sweeps
      Throws:
      DeviceException
    • setPresetSweep

      public void setPresetSweep(int sweeps) throws DeviceException
      sets the preset number of sweeps which tell the hardware that data acquisition in MCS mode is to continue until the preset number of sweeps have completed.
      Parameters:
      sweeps -
      Throws:
      DeviceException
    • setMode

      public void setMode(EpicsMcaController.Mode mode) throws DeviceException
      sets the the operation mode of the MCA
      Parameters:
      mode -
      Throws:
      DeviceException
    • getMode

      public EpicsMcaController.Mode getMode() throws DeviceException
      sets the the operation mode of the MCA
      Returns:
      mode
      Throws:
      DeviceException
    • getCalibrationUnitsName

      public String getCalibrationUnitsName() throws DeviceException
      gets calibration units name from hardware
      Returns:
      calibration units name
      Throws:
      DeviceException
    • setCalibrationUnitsName

      public void setCalibrationUnitsName(String unitName) throws DeviceException
      sets the calibration units name
      Parameters:
      unitName -
      Throws:
      DeviceException
    • getCalibrationOffset

      public double getCalibrationOffset() throws DeviceException
      gets calibration offset from hardware
      Returns:
      calibration offset
      Throws:
      DeviceException
    • setCalibrationOffset

      public void setCalibrationOffset(double value) throws DeviceException
      sets the calibration offset
      Parameters:
      value -
      Throws:
      DeviceException
    • getCalibrationSlope

      public double getCalibrationSlope() throws DeviceException
      gets calibration slope from hardware
      Returns:
      calibration slope
      Throws:
      DeviceException
    • setCalibrationSlope

      public void setCalibrationSlope(double value) throws DeviceException
      sets the calibration slope
      Parameters:
      value -
      Throws:
      DeviceException
    • getCalibrationQuadratic

      public double getCalibrationQuadratic() throws DeviceException
      gets calibration Quadratic from hardware
      Returns:
      calibration quadratic
      Throws:
      DeviceException
    • setCalibrationQuadratic

      public void setCalibrationQuadratic(double value) throws DeviceException
      sets the calibration Quadratic
      Parameters:
      value -
      Throws:
      DeviceException
    • getTwoTheta

      public double getTwoTheta() throws DeviceException
      /** gets calibration Two Theta i.e the two theta angle of the detector useful in energy-dispersive diffraction experiments
      Returns:
      two theta angle of the detector
      Throws:
      DeviceException
    • setTwoTheta

      public void setTwoTheta(double value) throws DeviceException
      sets the calibration Two Theta, i.e the two theta angle of the detector useful in energy-dispersive diffraction experiments
      Parameters:
      value -
      Throws:
      DeviceException
    • getElapsedRealTime

      public double getElapsedRealTime() throws DeviceException
      gets the elapsed real time from hardware
      Returns:
      elapsed real time
      Throws:
      DeviceException
    • getElapsedLiveTime

      public double getElapsedLiveTime() throws DeviceException
      gets the elapsed live time from hardware
      Returns:
      elapsed live time
      Throws:
      DeviceException
    • getActualCountInPresetRegion

      public double getActualCountInPresetRegion() throws DeviceException
      gets the number of actual counts in preset region
      Returns:
      number of actual counts
      Throws:
      DeviceException
    • getAverageDeadTime

      public double getAverageDeadTime() throws DeviceException
      gets the average dead time of the detector
      Returns:
      average dead time of the detector
      Throws:
      DeviceException
    • getInstantaneousDeadTime

      public double getInstantaneousDeadTime() throws DeviceException
      gets the instantaneous dead time of the detector
      Returns:
      instantaneous dead time of the detector
      Throws:
      DeviceException
    • getAcquisitionStartTime

      public String getAcquisitionStartTime() throws DeviceException
      gets the absolute acquisition start time from IOC
      Returns:
      absolute acquisition start time
      Throws:
      DeviceException
    • getRegionLowChannel

      public int getRegionLowChannel(int regionIndex) throws DeviceException
      gets the low channel for the specified region.
      Parameters:
      regionIndex -
      Returns:
      the region's low channel
      Throws:
      DeviceException
    • setRegionLowChannel

      public void setRegionLowChannel(int regionIndex, int lowChannel) throws DeviceException
      sets the low channel for the specified region.
      Parameters:
      regionIndex -
      lowChannel -
      Throws:
      DeviceException
    • getRegionHighChannel

      public int getRegionHighChannel(int regionIndex) throws DeviceException
      gets the high channel for the specified region.
      Parameters:
      regionIndex -
      Returns:
      the region's high channel
      Throws:
      DeviceException
    • setRegionHighChannel

      public void setRegionHighChannel(int regionIndex, int highChannel) throws DeviceException
      sets the high channel for the specified region.
      Parameters:
      regionIndex -
      highChannel -
      Throws:
      DeviceException
    • getRegionBackground

      public int getRegionBackground(int regionIndex) throws DeviceException
      gets the Background for the specified region.
      Parameters:
      regionIndex -
      Returns:
      the region's high channel
      Throws:
      DeviceException
    • setRegionBackground

      public void setRegionBackground(int regionIndex, int highChannel) throws DeviceException
      sets the Background for the specified region.
      Parameters:
      regionIndex -
      highChannel -
      Throws:
      DeviceException
    • isRegionPreset

      public boolean isRegionPreset(int regionIndex) throws DeviceException
      gets the is-preset for the specified region.
      Parameters:
      regionIndex -
      Returns:
      true or false
      Throws:
      DeviceException
    • setRegionPreset

      public void setRegionPreset(int regionIndex, boolean b) throws DeviceException
      sets the is-preset for the specified region.
      Parameters:
      regionIndex -
      b - true or false
      Throws:
      DeviceException
    • getRegionCounts

      public double getRegionCounts(int regionIndex) throws DeviceException
      gets the total number of counts in the specified region.
      Parameters:
      regionIndex -
      Returns:
      the region's counts
      Throws:
      DeviceException
    • getRegionNetCounts

      public double getRegionNetCounts(int regionIndex) throws DeviceException
      gets the net number of counts in the specified region.
      Parameters:
      regionIndex -
      Returns:
      the region's counts
      Throws:
      DeviceException
    • getRegionPresetCount

      public double getRegionPresetCount(int regionIndex) throws DeviceException
      gets the preset count of the specified region.
      Parameters:
      regionIndex -
      Returns:
      the region's preset count
      Throws:
      DeviceException
    • setRegionPresetCount

      public void setRegionPresetCount(int regionIndex, double count) throws DeviceException
      sets the preset count of the specified region.
      Parameters:
      regionIndex -
      count -
      Throws:
      DeviceException
    • getRegionName

      public String getRegionName(int regionIndex) throws DeviceException
      gets the preset count of the specified region.
      Parameters:
      regionIndex -
      Returns:
      the region's name
      Throws:
      DeviceException
    • setRegionName

      public void setRegionName(int regionIndex, String name) throws DeviceException
      sets the name of the specified region.
      Parameters:
      regionIndex -
      name -
      Throws:
      DeviceException
    • getData

      public int[] getData() throws DeviceException
      Returns:
      the data array
      Throws:
      DeviceException
    • setData

      public void setData(int[] data) throws DeviceException
      sets data array to the MCA
      Parameters:
      data -
      Throws:
      DeviceException
    • getMaxNumberOfChannels

      public int getMaxNumberOfChannels() throws DeviceException
      gets the maximum number of channels (array elements) allocated at iocInit.
      Returns:
      Maximum number of channels
      Throws:
      DeviceException
    • getNumberOfChannelRead

      public int getNumberOfChannelRead() throws DeviceException
      gets the number of channels read.
      Returns:
      number of channels read
      Throws:
      DeviceException
    • setNumberOfRegions

      public void setNumberOfRegions(int numberOfRegions)
      Sets number of region of interest
      Parameters:
      numberOfRegions -
    • getNumberOfRegions

      public int getNumberOfRegions()
      gets number of region of interest
      Returns:
      number of regions
    • initializationCompleted

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

      public String getMcaRecordName()
      gets MCA record name - the actual EPICS Record name after remove field name
      Returns:
      MCA record name
    • setMcaRecordName

      public void setMcaRecordName(String mcaRecordName)
      sets MCA record name - the actual EPICS Record name after remove field name
      Parameters:
      mcaRecordName -