Class EpicsMotor

All Implemented Interfaces:
ControllerRecord, Device, Motor, InitializationListener, Configurable, Findable, gda.observable.IObservable, gda.observable.IObserver, Serializable
Direct Known Subclasses:
EpicsMotorDirect, EpicsReadyMotor, FeedbackControlledEpicsMotor, PiezoEpicsMotor

public class EpicsMotor extends MotorBase implements InitializationListener, gda.observable.IObserver, ControllerRecord
EpicsMotor implements GDA Motor interface and provide mapping from GDA interface to EPICS motor record. Note only selected PVs or channels are instantiated in this class as required by the GDA motor interface.
See Also:
  • Field Details

    • val

      protected gov.aps.jca.Channel val
      EPICS channels to connect
    • rbv

      protected gov.aps.jca.Channel rbv
    • direction

      protected gov.aps.jca.Channel direction
    • offset

      protected gov.aps.jca.Channel offset
    • stop

      protected gov.aps.jca.Channel stop
    • velo

      protected gov.aps.jca.Channel velo
    • vmax

      protected gov.aps.jca.Channel vmax
    • accl

      protected gov.aps.jca.Channel accl
    • lvio

      protected gov.aps.jca.Channel lvio
    • dmov

      protected gov.aps.jca.Channel dmov
    • rdbd

      protected gov.aps.jca.Channel rdbd
    • hlm

      protected gov.aps.jca.Channel hlm
    • llm

      protected gov.aps.jca.Channel llm
    • hls

      protected gov.aps.jca.Channel hls
    • lls

      protected gov.aps.jca.Channel lls
    • dhlm

      protected gov.aps.jca.Channel dhlm
    • dllm

      protected gov.aps.jca.Channel dllm
    • homf

      protected gov.aps.jca.Channel homf
    • mres

      protected gov.aps.jca.Channel mres
    • unitString

      protected gov.aps.jca.Channel unitString
    • msta

      protected gov.aps.jca.Channel msta
    • spmg

      protected gov.aps.jca.Channel spmg
    • prec

      protected gov.aps.jca.Channel prec
    • positionMonitor

      protected gov.aps.jca.event.MonitorListener positionMonitor
      monitor EPICS motor position
    • statusMonitor

      protected gov.aps.jca.event.MonitorListener statusMonitor
      Monitor EPICS motor's DMOV - EPICS motor motion completion status
    • lowLimitMonitor

      protected gov.aps.jca.event.MonitorListener lowLimitMonitor
      Monitor EPICS motor lower limit
    • highLimitMonitor

      protected gov.aps.jca.event.MonitorListener highLimitMonitor
      Monitor EPICS motor higher limit
    • dialHighLimitMonitor

      protected gov.aps.jca.event.MonitorListener dialHighLimitMonitor
      Monitor EPICS motor dial higher limit
    • dialLowLimitMonitor

      protected gov.aps.jca.event.MonitorListener dialLowLimitMonitor
      Monitor EPICS motor dial lower limit
    • mstaMonitorListener

      protected gov.aps.jca.event.MonitorListener mstaMonitorListener
    • lvioMonitor

      protected gov.aps.jca.event.MonitorListener lvioMonitor
      Monitor EPICS motor limit violation
    • lowLimitStateMonitor

      protected gov.aps.jca.event.MonitorListener lowLimitStateMonitor
      Monitors for the limit switch states .LLS and .HLS
    • highLimitStateMonitor

      protected gov.aps.jca.event.MonitorListener highLimitStateMonitor
    • setPv

      protected gov.aps.jca.Channel setPv
    • setUseListener

      protected gov.aps.jca.event.MonitorListener setUseListener
    • putCallbackListener

      protected gov.aps.jca.event.PutListener putCallbackListener
      EPICS Put call back handler
    • pvName

      protected String pvName
    • controller

      protected EpicsController controller
      EPICS controller
    • channelManager

      protected EpicsChannelManager channelManager
      EPICS Channel Manager
  • Constructor Details

  • Method Details

    • setUnitStringOverride

      public void setUnitStringOverride(String unitStringOverride)
    • setPvName

      public void setPvName(String pvName)
      Sets the record name that this motor will link to.
      Parameters:
      pvName - the record name
    • getPvName

      public String getPvName()
    • setAccessControl

      public void setAccessControl(AccessControl accessControl)
      Sets the access control object used by this motor.
      Parameters:
      accessControl - the access control object
    • configure

      public void configure() throws FactoryException
      Initialise the motor object.
      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
    • forceCallback

      public void forceCallback() throws MotorException
      Throws:
      MotorException
    • createChannelAccess

      protected void createChannelAccess() throws FactoryException
      Create Channel access for motor. This must must on to EPICS motor record.
      Throws:
      FactoryException
    • getUnitString

      public String getUnitString() throws MotorException
      gets the unit string from EPICS motor.
      Specified by:
      getUnitString in interface Motor
      Overrides:
      getUnitString in class MotorBase
      Returns:
      unit string
      Throws:
      MotorException
    • setSpeed

      public void setSpeed(double mmPerSec) throws MotorException
      Sets the speed of the motor in IOC in mm/second.
      Specified by:
      setSpeed in interface Motor
      Parameters:
      mmPerSec - the speed
      Throws:
      MotorException
    • getSpeed

      public double getSpeed() throws MotorException
      Gets the current speed of the motor in mm/second
      Specified by:
      getSpeed in interface Motor
      Returns:
      double the motor speed in revolution per second
      Throws:
      MotorException
    • getMaxSpeed

      public double getMaxSpeed() throws MotorException
      Throws:
      MotorException
    • setTimeToVelocity

      public void setTimeToVelocity(double timeToVelocity) throws MotorException
      Description copied from interface: Motor
      Sets this motor's time to velocity.
      Specified by:
      setTimeToVelocity in interface Motor
      Overrides:
      setTimeToVelocity in class MotorBase
      Throws:
      MotorException
    • getTimeToVelocity

      public double getTimeToVelocity() throws MotorException
      Description copied from interface: Motor
      Returns this motor's time to velocity.
      Specified by:
      getTimeToVelocity in interface Motor
      Overrides:
      getTimeToVelocity in class MotorBase
      Throws:
      MotorException
    • getRetryDeadband

      public double getRetryDeadband() throws MotorException
      Gets the retry dead band for this motor from EPICS.
      Specified by:
      getRetryDeadband in interface Motor
      Overrides:
      getRetryDeadband in class MotorBase
      Returns:
      double - the retry dead band.
      Throws:
      MotorException
    • getMotorResolution

      public double getMotorResolution() throws MotorException
      Gets the motor resolution from EPICS motor.
      Specified by:
      getMotorResolution in interface Motor
      Overrides:
      getMotorResolution in class MotorBase
      Returns:
      double - the motor resolution
      Throws:
      MotorException
    • getDirection

      public MotorDirection getDirection() throws MotorException
      Throws:
      MotorException
    • getUserOffset

      public double getUserOffset() throws MotorException
      Specified by:
      getUserOffset in interface Motor
      Overrides:
      getUserOffset in class MotorBase
      Returns:
      the user offset set on the motor
      Throws:
      MotorException
    • setUserOffset

      public void setUserOffset(double userOffset) throws MotorException
      Throws:
      MotorException
    • getPrecision

      public int getPrecision() throws MotorException
      Throws:
      MotorException
    • isMoving

      public boolean isMoving() throws MotorException
      Description copied from interface: Motor
      Returns whether or not motor is actually moving
      Specified by:
      isMoving in interface Motor
      Returns:
      true if moving
      Throws:
      MotorException
    • checkStatus

      protected MotorStatus checkStatus() throws MotorException
      checks motor Status
      Throws:
      MotorException
    • getStatus

      public MotorStatus getStatus() throws MotorException
      Returns the motor status from the motor object.
      Specified by:
      getStatus in interface Motor
      Returns:
      a value from the MotorStatus enum
      Throws:
      MotorException
    • moveBy

      public void moveBy(double increament) throws MotorException
      Relative move, moves the motor by the specified mount in user coordinate system units, specified in the .EGU field of the Motor record.
      Specified by:
      moveBy in interface Motor
      Parameters:
      increament - - double the distance that motor need to travel in EGU
      Throws:
      MotorException
    • moveTo

      public void moveTo(double position) throws MotorException
      Absolute move, moves the motor to the specified position in user coordinate system units, specified by .EGU field of the Motor Record.
      Specified by:
      moveTo in interface Motor
      Parameters:
      position - - double - the absolute position of the motor in EGU (
      Throws:
      MotorException
    • moveTo

      public void moveTo(double position, double timeout) throws MotorException, gov.aps.jca.TimeoutException, InterruptedException
      moves motor to the specified position with timeout in seconds. If motor does not callback within the specified time, this method time-out.
      Throws:
      MotorException
      gov.aps.jca.TimeoutException
      InterruptedException
    • moveTo

      public void moveTo(double position, gov.aps.jca.event.PutListener moveListener) throws MotorException
      Asynchronously moves the motor to the specified position in EGU with a specified PutListener. You must handle the callback in your PutListener code.
      Parameters:
      position - the absolute position of the motor in EGU
      Throws:
      MotorException
    • getDialLowLimit

      protected double getDialLowLimit() throws MotorException
      Reads the motor's dial low limit (DLLM).
      Returns:
      the dial low limit
      Throws:
      MotorException
    • getDialHighLimit

      protected double getDialHighLimit() throws MotorException
      Reads the motor's dial high limit (DHLM).
      Returns:
      the dial high limit
      Throws:
      MotorException
    • setMinPosition

      public void setMinPosition(double minimumPosition) throws MotorException
      Sets the minimum position. This does write to EPICS database.
      Specified by:
      setMinPosition in interface Motor
      Overrides:
      setMinPosition in class MotorBase
      Parameters:
      minimumPosition - the minimum position
      Throws:
      MotorException
    • getMinPosition

      public double getMinPosition() throws MotorException
      Gets the minimum or lower soft limits of the motor itself (i.e. NOT limits cached in GDA software). By convention return NaN if not set. Get the minimum position from EPICS database.
      Specified by:
      getMinPosition in interface Motor
      Overrides:
      getMinPosition in class MotorBase
      Returns:
      the minimum position, or NaN if limits are not be checked
      Throws:
      MotorException
    • setMaxPosition

      public void setMaxPosition(double maximumPosition) throws MotorException
      Sets the maximum position. This does write to EPICS database.
      Specified by:
      setMaxPosition in interface Motor
      Overrides:
      setMaxPosition in class MotorBase
      Parameters:
      maximumPosition - the maximum position
      Throws:
      MotorException
    • getMaxPosition

      public double getMaxPosition() throws MotorException
      Gets the maximum or upper soft limits of the motor itself (i.e. NOT limits cached in GDA software). By convention return NaN if not set. Get the maximum position from EPICS database.
      Specified by:
      getMaxPosition in interface Motor
      Overrides:
      getMaxPosition in class MotorBase
      Returns:
      the maximum position, or NaN if limits are not be checked
      Throws:
      MotorException
    • stop

      public void stop() throws MotorException
      Stops the motor
      Specified by:
      stop in interface Motor
      Throws:
      MotorException
    • stopGo

      public void stopGo() throws MotorException
      Tells the motor record to stop trying to move the motor and then resets it.

      This is different to a normal stop and should be used when the motor is 'stuck' in a moving state. This is the same as using the Combo box control in the edm screens.

      This is for EpicsMotor specific error handling and would probably only need to be used when there are underlying hardware issues.

      Throws:
      MotorException
    • panicStop

      public void panicStop() throws MotorException
      Some motors offer a control for emergence stop which stop the motor and switch off the power. This is not implemented here for EPICS motor, i.e. code block is empty.
      Specified by:
      panicStop in interface Motor
      Throws:
      MotorException
    • moveContinuously

      public void moveContinuously(int direction) throws MotorException
      Description copied from interface: Motor
      Moves the motor in a continuous mode
      Specified by:
      moveContinuously in interface Motor
      Parameters:
      direction - direction to move in
      Throws:
      MotorException
    • setPosition

      public void setPosition(double position) throws MotorException
      Set the position of the motor without moving it
      Specified by:
      setPosition in interface Motor
      Parameters:
      position - the new offset in motor units
      Throws:
      MotorException
    • getPosition

      public double getPosition() throws MotorException
      This method returns the current position of the motor in user coordinates.
      Specified by:
      getPosition in interface Motor
      Returns:
      the current position
      Throws:
      MotorException
    • home

      public void home() throws MotorException
      Description copied from class: MotorBase
      Moves the motor to a repeatable starting location. Motor implementations should overide this method if required.
      Specified by:
      home in interface Motor
      Overrides:
      home in class MotorBase
      Throws:
      MotorException
    • initializationCompleted

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

      public boolean isHomedFromMSTAValue(double msta)
    • isHomed

      public boolean isHomed()
      Description copied from class: MotorBase
      Checks if the motor is homed or not. Motor implementations should overide this method if required.
      Specified by:
      isHomed in interface Motor
      Overrides:
      isHomed in class MotorBase
      Returns:
      if the motor is homed. Returns false!
    • readMsta

      public double readMsta() throws gov.aps.jca.TimeoutException, gov.aps.jca.CAException, InterruptedException
      Throws:
      gov.aps.jca.TimeoutException
      gov.aps.jca.CAException
      InterruptedException
    • getTargetPosition

      public double getTargetPosition() throws MotorException
      Throws:
      MotorException
    • getAccessControlName

      public String getAccessControlName()
      gets EPICS access control name.
      Returns:
      name of the access control.
    • setAccessControlName

      public void setAccessControlName(String accessControlName)
      sets the EPICS access control name.
    • update

      public void update(Object theObserved, Object changeCode)
      Specified by:
      update in interface gda.observable.IObserver
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isCallbackWait

      public boolean isCallbackWait()
    • setCallbackWait

      public void setCallbackWait(boolean callbackDelay)
    • setAssertHomedBeforeMoving

      public void setAssertHomedBeforeMoving(boolean assertHomedBeforeMoving)
    • isAssertHomedBeforeMoving

      public boolean isAssertHomedBeforeMoving()
    • waitWhileStatusBusy

      public MotorStatus waitWhileStatusBusy() throws InterruptedException
      Description copied from interface: Motor
      Blocks while the motors status is Busy
      Specified by:
      waitWhileStatusBusy in interface Motor
      Overrides:
      waitWhileStatusBusy in class MotorBase
      Returns:
      status after being busy
      Throws:
      InterruptedException
    • reconfigure

      public void reconfigure() throws FactoryException
      Description copied from interface: Configurable
      Re-initialisation of values and states.

      Moved from Reconfigurable which has been deleted

      Specified by:
      reconfigure in interface Configurable
      Overrides:
      reconfigure in class ConfigurableBase
      Throws:
      FactoryException
    • setMissedTargetLevel

      @Deprecated(since="9.31", forRemoval=false) public void setMissedTargetLevel(EpicsMotor.MissedTargetLevel level)
      Deprecated.
      Parameters:
      level -
    • setMissedTargetAction

      public void setMissedTargetAction(EpicsMotor.MissedTargetLevel level)
    • getControllerRecordName

      public String getControllerRecordName()
      Description copied from interface: ControllerRecord
      Gets the name of the controller record, e.g. EPICS process variable name. For example, in NeXus this value can be written as the value of the controller_record field for the NXpositioner for the scannable.
      Specified by:
      getControllerRecordName in interface ControllerRecord
      Returns:
      controller record name
      See Also:
    • isReduceExcessiveReadyLogs

      public boolean isReduceExcessiveReadyLogs()
    • setReduceExcessiveReadyLogs

      public void setReduceExcessiveReadyLogs(boolean reduceExcessiveReadyLogs)