Package gda.device.motor
Class EpicsMotorDecorator
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.motor.MotorBase
gda.device.motor.MotorIocDecorator
gda.device.motor.EpicsMotorDecorator
- All Implemented Interfaces:
Device,Motor,Configurable,Findable,gda.observable.IObservable,gda.observable.IObserver,Serializable,org.springframework.beans.factory.InitializingBean
Decorator for EPICS Motor which checks IOC status before connecting and accessing EPICS motor PVs.
This class doesn't decorate all the methods in an
EpicsMotor, but only those methods that
access to EPICS PVs in the specified IOC. If IOC is up and running, access is delegated to the
decorated motor instance; If IOC is down, any access to PVs in the specified IOC will throw MotorException
except for configure() which throws FactoryException if
DeviceBase.isConfigureAtStartup() is set to true, otherwise it just delays the configure later.
Spring XML configuration example:
<bean id="d6x_mtr" class="gda.device.motor.EpicsMotorDecorator">
<property name="iocPv" value="BL11I-MO-IOC-03:STATUS"/>
<constructor-arg>
<bean class="gda.device.motor.EpicsMotor">
<property name="deviceName" value="D6.X"/>
</bean>
</constructor-arg>
<property name="configureAtStartup" value="true">
</bean>
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class gda.device.motor.MotorIocDecorator
MotorIocDecorator.IOCStatusMonitorListener -
Field Summary
Fields inherited from class gda.device.motor.MotorIocDecorator
decoratedMotor, iocPv, iocRunningFields inherited from class gda.device.motor.MotorBase
correctBacklash, isInitialised, maxPosition, minPositionFields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Motor
FAST, MEDIUM, SLOW, SPEED_LEVELS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MotorStatusvoidDefault 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.protected doubleprotected doubledoubleGets the maximum or upper soft limits of the motor itself (i.e.doubleGets the minimum or lower soft limits of the motor itself (i.e.doubledoubleGets the current position of the motordoublereturn the position tolerance or accuracydoublegetSpeed()Gets the current speed setting of the motorGets the state of the motordoubleReturns this motor's time to velocity.doublevoidhome()Moves the motor to a repeatable starting location.booleanisHomed()Checks if the motor is homed or not.booleanisHomedFromMSTAValue(double msta) booleanisMoving()Returns whether or not motor is actually movingvoidmoveBy(double steps) Moves the motor by the specified number of stepsvoidmoveContinuously(int direction) Moves the motor in a continuous modevoidmoveTo(double steps) Moves the motor to the specified position in stepsvoidmoveTo(double position, double timeout) voidmoveTo(double position, gov.aps.jca.event.PutListener moveListener) voidBrings the motor to an uncontrolled stop if possibledoublereadMsta()voidsetMaxPosition(double maximumPosition) Set the upper soft limit of the motorvoidsetMinPosition(double minimumPosition) Set the lower soft limit of the motorvoidsetPosition(double steps) Sets the current position of the motorvoidsetSpeed(double speed) Sets the speed of the motorvoidsetTimeToVelocity(double timeToVelocity) Sets this motor's time to velocity.voidsetUserOffset(double userOffset) voidstop()Brings the motor to a controlled stop if possiblevoidstopGo()voidMethods inherited from class gda.device.motor.MotorIocDecorator
afterPropertiesSet, getDecoratedMotor, getIocPv, isIocRunning, setDecoratedMotor, setIocPv, setIocRunningMethods inherited from class gda.device.motor.MotorBase
addInBacklash, correctBacklash, getBacklashSteps, getFastSpeed, getMediumSpeed, getSlowSpeed, isHomeable, isInitialised, isLimitsSettable, setBacklashSteps, setFastSpeed, setInitialised, setLimitsSettable, setMediumSpeed, setMotorResolution, setSlowSpeed, setSoftLimits, setSpeedLevel, waitWhileStatusBusyMethods inherited from class gda.device.DeviceBase
addIObserver, close, deleteIObserver, deleteIObservers, getAttribute, getName, getProtectionLevel, isBeingObserved, isConfigureAtStartup, notifyIObservers, setAttribute, setConfigureAtStartup, setName, setProtectionLevelMethods inherited from class gda.factory.ConfigurableBase
isConfigured, reconfigure, setConfiguredMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface gda.factory.Configurable
isConfigureAtStartup, isConfigured, reconfigureMethods inherited from interface gda.device.Device
close, getAttribute, getProtectionLevel, setAttribute, setProtectionLevelMethods inherited from interface gda.observable.IObservable
addIObserver, deleteIObserver, deleteIObservers
-
Constructor Details
-
EpicsMotorDecorator
public EpicsMotorDecorator() -
EpicsMotorDecorator
-
-
Method Details
-
configure
Description copied from class:ConfigurableBaseDefault 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:
configurein interfaceConfigurable- Overrides:
configurein classConfigurableBase- Throws:
FactoryException- if there is an error in configuration e.g. required variable not set or cannot connect to device
-
getUnitString
- Specified by:
getUnitStringin interfaceMotor- Overrides:
getUnitStringin classMotorBase- Returns:
- unit as a String
- Throws:
MotorException
-
setSpeed
Description copied from interface:MotorSets the speed of the motor- Specified by:
setSpeedin interfaceMotor- Parameters:
speed- the speed- Throws:
MotorException
-
getSpeed
Description copied from interface:MotorGets the current speed setting of the motor- Specified by:
getSpeedin interfaceMotor- Returns:
- the speed in steps per second
- Throws:
MotorException
-
setTimeToVelocity
Description copied from interface:MotorSets this motor's time to velocity.- Specified by:
setTimeToVelocityin interfaceMotor- Overrides:
setTimeToVelocityin classMotorBase- Throws:
MotorException
-
getTimeToVelocity
Description copied from interface:MotorReturns this motor's time to velocity.- Specified by:
getTimeToVelocityin interfaceMotor- Overrides:
getTimeToVelocityin classMotorBase- Throws:
MotorException
-
getRetryDeadband
Description copied from interface:Motorreturn the position tolerance or accuracy- Specified by:
getRetryDeadbandin interfaceMotor- Overrides:
getRetryDeadbandin classMotorBase- Returns:
- positioning tolerance
- Throws:
MotorException
-
getMotorResolution
- Specified by:
getMotorResolutionin interfaceMotor- Overrides:
getMotorResolutionin classMotorBase- Throws:
MotorException
-
getUserOffset
- Specified by:
getUserOffsetin interfaceMotor- Overrides:
getUserOffsetin classMotorBase- Returns:
- the user offset set on the motor
- Throws:
MotorException
-
setUserOffset
- Throws:
MotorException
-
isMoving
Description copied from interface:MotorReturns whether or not motor is actually moving- Specified by:
isMovingin interfaceMotor- Returns:
- true if moving
- Throws:
MotorException
-
checkStatus
- Throws:
MotorException
-
getStatus
Description copied from interface:MotorGets the state of the motor- Specified by:
getStatusin interfaceMotor- Returns:
- a value from the MotorStatus enum
- Throws:
MotorException
-
moveBy
Description copied from interface:MotorMoves the motor by the specified number of steps- Specified by:
moveByin interfaceMotor- Parameters:
steps- the number of steps to move by- Throws:
MotorException
-
moveTo
Description copied from interface:MotorMoves the motor to the specified position in steps- Specified by:
moveToin interfaceMotor- Parameters:
steps- the number of steps to move to- Throws:
MotorException
-
moveTo
public void moveTo(double position, double timeout) throws MotorException, gov.aps.jca.TimeoutException, InterruptedException - Throws:
MotorExceptiongov.aps.jca.TimeoutExceptionInterruptedException
-
moveTo
public void moveTo(double position, gov.aps.jca.event.PutListener moveListener) throws MotorException - Throws:
MotorException
-
getDialLowLimit
- Throws:
MotorException
-
getDialHighLimit
- Throws:
MotorException
-
setMinPosition
Description copied from interface:MotorSet the lower soft limit of the motor- Specified by:
setMinPositionin interfaceMotor- Overrides:
setMinPositionin classMotorBase- Parameters:
minimumPosition- the lower limit to set- Throws:
MotorException
-
getMinPosition
Description copied from interface:MotorGets 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.- Specified by:
getMinPositionin interfaceMotor- Overrides:
getMinPositionin classMotorBase- Returns:
- the lower soft limit of the motor
- Throws:
MotorException
-
setMaxPosition
Description copied from interface:MotorSet the upper soft limit of the motor- Specified by:
setMaxPositionin interfaceMotor- Overrides:
setMaxPositionin classMotorBase- Parameters:
maximumPosition- upper limit to set- Throws:
MotorException
-
getMaxPosition
Description copied from interface:MotorGets 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.- Specified by:
getMaxPositionin interfaceMotor- Overrides:
getMaxPositionin classMotorBase- Returns:
- the upper soft limit of the motor
- Throws:
MotorException
-
stop
Description copied from interface:MotorBrings the motor to a controlled stop if possible- Specified by:
stopin interfaceMotor- Throws:
MotorException
-
stopGo
- Throws:
MotorException
-
panicStop
Description copied from interface:MotorBrings the motor to an uncontrolled stop if possible- Specified by:
panicStopin interfaceMotor- Throws:
MotorException
-
moveContinuously
Description copied from interface:MotorMoves the motor in a continuous mode- Specified by:
moveContinuouslyin interfaceMotor- Parameters:
direction- direction to move in- Throws:
MotorException
-
setPosition
Description copied from interface:MotorSets the current position of the motor- Specified by:
setPositionin interfaceMotor- Parameters:
steps- the position to be set as current- Throws:
MotorException
-
getPosition
Description copied from interface:MotorGets the current position of the motor- Specified by:
getPositionin interfaceMotor- Returns:
- the current position
- Throws:
MotorException
-
home
Description copied from class:MotorBaseMoves the motor to a repeatable starting location. Motor implementations should overide this method if required.- Specified by:
homein interfaceMotor- Overrides:
homein classMotorBase- Throws:
MotorException
-
isHomedFromMSTAValue
public boolean isHomedFromMSTAValue(double msta) -
isHomed
Description copied from class:MotorBaseChecks if the motor is homed or not. Motor implementations should overide this method if required.- Specified by:
isHomedin interfaceMotor- Overrides:
isHomedin classMotorBase- Returns:
- if the motor is homed. Returns false!
- Throws:
MotorException
-
readMsta
public double readMsta() throws gov.aps.jca.TimeoutException, gov.aps.jca.CAException, InterruptedException- Throws:
gov.aps.jca.TimeoutExceptiongov.aps.jca.CAExceptionInterruptedException
-
update
- Specified by:
updatein interfacegda.observable.IObserver
-