Class ControllerScannable

All Implemented Interfaces:
INeXusInfoWriteable, ControllerRecord, Device, IScannableMotor, Scannable, ScannableMotion, ScannableMotionUnits, Configurable, Findable, gda.observable.IObservable

public class ControllerScannable extends ScannableMotor
Adapter class for a controller-mediated motor to work as a scannable.
  • Constructor Details

    • ControllerScannable

      public ControllerScannable()
  • Method Details

    • asynchronousMoveTo

      public void asynchronousMoveTo(Object externalPosition) throws DeviceException
      Description copied from class: ScannableBase
      Trigger a move/operation and return immediately. Implementations of this method should be non-blocking to allow concurrent motion; the isBusy method will be used to determine when the move has completed. Converts the external (user) position to an internal position and passes this to rawAsynchronousMoveTo.
      Specified by:
      asynchronousMoveTo in interface Scannable
      Overrides:
      asynchronousMoveTo in class ScannableMotionBase
      Parameters:
      externalPosition - Position to move to should have an element for each input field.
      Throws:
      DeviceException
    • controllerMoveTo

      public void controllerMoveTo(Object position) throws DeviceException
      Throws:
      DeviceException
    • 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 ScannableMotor
      Throws:
      FactoryException - if there is an error in configuration e.g. required variable not set or cannot connect to device
    • continuousMove

      public void continuousMove(double start, double width, double time)
    • getAxisNumber

      public int getAxisNumber()
    • getControllerPosition

      public Object getControllerPosition() throws DeviceException
      Throws:
      DeviceException
    • getNewportController

      public NewportVMCController getNewportController()
    • getResetSpeed

      public Double getResetSpeed()
    • getSpeed

      public double getSpeed() throws DeviceException
      Description copied from class: ScannableMotor
      Get the speed of the underlying motor
      Specified by:
      getSpeed in interface IScannableMotor
      Overrides:
      getSpeed in class ScannableMotor
      Returns:
      speed in the motor's units
      Throws:
      DeviceException
    • getTimeout

      public double getTimeout()
    • isAt

      public boolean isAt(Object position) throws DeviceException
      Description copied from class: ScannableMotionBase
      Tests if the scannable is at (or if appropriate, close to) the value positionToTest. If positionToTest is a string (as will be the case for valves or pneumatics for example), this is compared to the value obtained from getPosition(). An exception is thrown if this is not also a string.

      Otherwise if positionToTest is not a string the object is compared to the value from getPosition(), after having first pushed both values through objectToArray() from ScannableUtils.

      This behaviour should be extended where possible, and has been in ScannableMotionBase If positionToTest is a string (as will be the case for valves or pneumatics for example), this is compared to the value obtained from getPosition(). An exception is thrown if this is not also a string.

      Otherwise if positionToTest is not a string the object is compared to the value from getPosition() to see if they are within the tolerance specified in the scannable's tolerance array. Both values are first converted to arrays using objectToArray() from ScannableUtils.

      Specified by:
      isAt in interface Scannable
      Overrides:
      isAt in class ScannableMotionUnitsBase
      Parameters:
      position - The position to compare the scannable's position to.
      Returns:
      true if scannable is at positionToTest
      Throws:
      DeviceException
      See Also:
    • isBusyController

      public boolean isBusyController() throws DeviceException
      Throws:
      DeviceException
    • isBusyEpics

      public boolean isBusyEpics() throws DeviceException
      Throws:
      DeviceException
    • isInFaultEpics

      public boolean isInFaultEpics() throws DeviceException
      Throws:
      DeviceException
    • isInTolerance

      public boolean isInTolerance() throws DeviceException
      Throws:
      DeviceException
    • isProblemFlagSet

      public boolean isProblemFlagSet()
    • isReadyEpics

      public boolean isReadyEpics() throws DeviceException
      Throws:
      DeviceException
    • moveTo

      public void moveTo(Object position) throws DeviceException
      Description copied from class: ScannableMotionBase
      If the numberTries and tolerance attributes have been set then repeatedly tries to move this Scannable until the position is within the tolerance range.
      Specified by:
      moveTo in interface Scannable
      Overrides:
      moveTo in class ScannableMotionBase
      Parameters:
      position -
      Throws:
      DeviceException
      See Also:
    • rawAsynchronousMoveTo

      public void rawAsynchronousMoveTo(Object internalPosition) throws DeviceException
      Requests controller to test and trigger a motor to move. Throws a DeviceException if the motor is in alarm, in fault or is already busy. This method is synchronised so that another thread cannot enter it before the first thread has completed the motor's (asynchronous) moveTo call. For the DeviceException to be thrown properly when a move request is made of a moving motor, the motor's getStatus() method must *immediately* report BUSY after it's moveTo call has completed.
      Overrides:
      rawAsynchronousMoveTo in class ScannableMotor
      Parameters:
      internalPosition - Position in its internal/hardware representation. e.g. with units and offsets removed
      Throws:
      DeviceException
      See Also:
    • rawGetDemandPosition

      public Object rawGetDemandPosition() throws DeviceException
      Return the last demanded motor/internal position if one has been set, otherwise return the current position. If the motor is stopped, and the actual position is not close to the the demand position, then the current position is returned instead.
      Overrides:
      rawGetDemandPosition in class ScannableMotor
      Throws:
      DeviceException
    • resetSpeed

      public Double resetSpeed() throws DeviceException
      Throws:
      DeviceException
    • setAxisNumber

      public void setAxisNumber(int axisNumber)
    • setBasePV

      public void setBasePV(String basePV)
    • setNewportController

      public void setNewportController(NewportVMCController newportController)
    • setResetSpeed

      public void setResetSpeed(double speed)
    • setSpeed

      public void setSpeed(double speed) throws DeviceException
      Description copied from class: ScannableMotor
      Set the speed of the underlying motor
      Specified by:
      setSpeed in interface IScannableMotor
      Overrides:
      setSpeed in class ScannableMotor
      Parameters:
      speed - in the motor's units
      Throws:
      DeviceException
    • setTimeout

      public double setTimeout(double timeout)
    • 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 ScannableMotor
      Throws:
      DeviceException
      See Also:
    • stopController

      public void stopController() throws DeviceException
      Throws:
      DeviceException
    • stopEpics

      public void stopEpics() throws DeviceException
      Throws:
      DeviceException
    • 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 ScannableMotor
      Returns:
      string as defined above
    • waitWhileBusy

      public void waitWhileBusy() throws DeviceException, InterruptedException
      Description copied from class: ScannableBase
      Returns when operation carried out by moveTo has completed If this is to be overriden, isBusy must also be valid. Although the pos and scan command currently use this method to determine if the Scannable is busy, this must not be relied upon.
      Specified by:
      waitWhileBusy in interface Scannable
      Overrides:
      waitWhileBusy in class ScannableMotor
      Throws:
      DeviceException
      InterruptedException
    • waitWhileBusyScannable

      public void waitWhileBusyScannable() throws DeviceException, InterruptedException
      Throws:
      DeviceException
      InterruptedException
    • waitWhileBusyController

      public double waitWhileBusyController() throws DeviceException, InterruptedException
      Waits for timeout and returns Calling method to raise exception if required, depending on state of scannable
      Throws:
      DeviceException
      InterruptedException