Package gda.device.motor
Class DummyMotor
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.motor.MotorBase
gda.device.motor.DummyMotor
- All Implemented Interfaces:
Device,Motor,Configurable,Findable,gda.observable.IObservable,Serializable
A Dummy motor class
- See Also:
-
Field Summary
Fields 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 TypeMethodDescriptionvoidDefault 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.doubledoubledoubleReturns the current positiondoubleGets the value of the trigger level for randomly produced exceptions.doubleGets the trigger level for randomly produced limits.doubledoublereturn the position tolerance or accuracydoublegetSpeed()Return the current speed.Returns the current status.doubledoubleReturns this motor's time to velocity.doublereturn the increment of tweakdoubledoublevoidhome()Tells the motor to home itself.booleanReturns whether or not the motor is homeable.booleanisHomed()Returns whether or not the motor has been homed.booleanisMoving()Returns whether or not the motor is moving.booleanReturns whether the motor will randomly produce exceptions.booleanvoidmoveBy(double amount) Moves the motor by the specified amount.voidmoveContinuously(int direction) Starts the motor moving continuouslyvoidmoveTo(double requestedPosition) Starts a move to requestedPositionvoidShould do an immediate stop but actually does the same as stop() *voidsetHomeable(boolean isHomeable) Sets the isHomeable flag - real motors would not allow this of course.voidsetLowerHardLimit(double lowerHardLimit) voidsetMaxSpeed(double maxSpeed) voidsetPosition(double newPosition) Sets the current position (i.e.voidsetRandomExceptionTriggerLevel(double randomExceptionTriggerLevel) Sets the trigger level for randomly produced exceptions.voidsetRandomLimitTriggerLevel(double randomLimitTriggerLevel) Sets the trigger level for randomly produced limits.voidsetRandomlyProduceExceptions(boolean randomlyProduceExceptions) Sets the randomlyProduceExceptions flag.voidsetRandomPositionVariation(boolean randomPositionVariation) voidsetRandomPositionVariationAmount(double randomPositionVariationAmount) voidsetRetryDeadband(double retryDeadband) Set retry dead band returned for a dummy motor, so ScannableMotors withreturnDemandPosition=truedon't constantly warn that it is undefined, for example:voidsetSpeed(double stepsPerSecond) Set the speedvoidsetStatus(MotorStatus status) voidsetTimeToVelocity(double timeToVelocity) Sets this motor's time to velocity.voidsetTweakSize(double tweakSize) set the increment for the tweakvoidsetUnitString(String unitString) voidsetUpperHardLimit(double upperHardLimit) voidstop()Stop the motortoString()Returns a string to represent the motor.voidtweak motor position forward by one incrementvoidtweak motor position backward by one incrementMethods inherited from class gda.device.motor.MotorBase
addInBacklash, correctBacklash, getBacklashSteps, getFastSpeed, getMaxPosition, getMediumSpeed, getMinPosition, getMotorResolution, getSlowSpeed, isInitialised, isLimitsSettable, setBacklashSteps, setFastSpeed, setInitialised, setLimitsSettable, setMaxPosition, setMediumSpeed, setMinPosition, 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, 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
-
DummyMotor
public DummyMotor()
-
-
Method Details
-
configure
public void 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
-
toString
Returns a string to represent the motor. -
moveTo
Starts a move to requestedPosition- Parameters:
requestedPosition-- Throws:
MotorException
-
moveContinuously
public void moveContinuously(int direction) Starts the motor moving continuously- Parameters:
direction- the direction to move in
-
moveBy
Moves the motor by the specified amount.- Parameters:
amount- the specified amount.- Throws:
MotorException
-
setPosition
public void setPosition(double newPosition) Sets the current position (i.e. changes the value without actually moving).This property can be used in Spring configuration to define what the initial position of the motor should be after the motor object has been configured.
However if a different position has previously been saved to file, the motor will instead be at that position after it has been configured.
In other words: at configuration time, a previously-saved position takes precedence over the initial position set using the
positionproperty.- Parameters:
newPosition- the current position
-
getPosition
public double getPosition()Returns the current position- Returns:
- the current position
-
setSpeed
Set the speed- Parameters:
stepsPerSecond- the new speed- Throws:
MotorException
-
getSpeed
Return the current speed.- Returns:
- the current speed
- Throws:
MotorException
-
getMaxSpeed
public double getMaxSpeed() -
setMaxSpeed
public void setMaxSpeed(double maxSpeed) -
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
-
stop
Stop the motor- Throws:
MotorException
-
panicStop
Should do an immediate stop but actually does the same as stop() *- Throws:
MotorException
-
getStatus
Returns the current status.- Returns:
- the current status
-
setStatus
-
isMoving
public boolean isMoving()Returns whether or not the motor is moving.- Returns:
- true if the motor is moving
-
isRandomlyProduceExceptions
public boolean isRandomlyProduceExceptions()Returns whether the motor will randomly produce exceptions. Stupid name of method forced by the conventions.- Returns:
- whether the motor will randomly produce exceptions
-
setRandomlyProduceExceptions
public void setRandomlyProduceExceptions(boolean randomlyProduceExceptions) Sets the randomlyProduceExceptions flag.- Parameters:
randomlyProduceExceptions-
-
isHomeable
public boolean isHomeable()Returns whether or not the motor is homeable. For real motors this is a fixed property however DummyMotor allows it to be set in XML.- Specified by:
isHomeablein interfaceMotor- Overrides:
isHomeablein classMotorBase- Returns:
- true if motor is homeable
-
home
Tells the motor to home itself.- Specified by:
homein interfaceMotor- Overrides:
homein classMotorBase- Throws:
MotorException
-
isHomed
public boolean isHomed()Returns whether or not the motor has been homed. -
getRandomExceptionTriggerLevel
public double getRandomExceptionTriggerLevel()Gets the value of the trigger level for randomly produced exceptions.- Returns:
- the trigger level
-
setRandomExceptionTriggerLevel
public void setRandomExceptionTriggerLevel(double randomExceptionTriggerLevel) Sets the trigger level for randomly produced exceptions. The value is used in the same way as the randomLimitTriggerLevel. See setRandomLimitTriggerLevel() for an explanation.- Parameters:
randomExceptionTriggerLevel- the new value
-
getRandomLimitTriggerLevel
public double getRandomLimitTriggerLevel()Gets the trigger level for randomly produced limits.- Returns:
- the trigger level for randomly produced limits
-
setRandomLimitTriggerLevel
public void setRandomLimitTriggerLevel(double randomLimitTriggerLevel) Sets the trigger level for randomly produced limits. The random number generator is used to generate a Gaussian distribution with centre 0.0 and sigma 1.0. A random limit is triggered if abs(random number) is greater than trigger level. This means a value of 1.0 will trigger roughly 40% of the time, 2.0 roughly 5% and 3.0 roughly 0.3%. The default value of 10.0 has a negligible chance of triggering an event.- Parameters:
randomLimitTriggerLevel-
-
setHomeable
public void setHomeable(boolean isHomeable) Sets the isHomeable flag - real motors would not allow this of course.- Parameters:
isHomeable-
-
isRandomPositionVariation
public boolean isRandomPositionVariation() -
setRandomPositionVariation
public void setRandomPositionVariation(boolean randomPositionVariation) -
getRandomPositionVariationAmount
public double getRandomPositionVariationAmount() -
setRandomPositionVariationAmount
public void setRandomPositionVariationAmount(double randomPositionVariationAmount) -
getUserOffset
- Specified by:
getUserOffsetin interfaceMotor- Overrides:
getUserOffsetin classMotorBase- Returns:
- the user offset set on the motor
- Throws:
MotorException
-
getUnitString
- Specified by:
getUnitStringin interfaceMotor- Overrides:
getUnitStringin classMotorBase- Returns:
- unit as a String
- Throws:
MotorException
-
setUnitString
-
getTargetPosition
public double getTargetPosition() -
getLowerHardLimit
public double getLowerHardLimit() -
setLowerHardLimit
public void setLowerHardLimit(double lowerHardLimit) -
getUpperHardLimit
public double getUpperHardLimit() -
setUpperHardLimit
public void setUpperHardLimit(double upperHardLimit) -
tweakForward
tweak motor position forward by one increment- Throws:
MotorException
-
tweakReverse
tweak motor position backward by one increment- Throws:
MotorException
-
getTweakSize
public double getTweakSize()return the increment of tweak- Returns:
- increment
-
setTweakSize
public void setTweakSize(double tweakSize) set the increment for the tweak- Parameters:
tweakSize-
-
getRetryDeadband
public double getRetryDeadband()Description copied from interface:Motorreturn the position tolerance or accuracy- Specified by:
getRetryDeadbandin interfaceMotor- Overrides:
getRetryDeadbandin classMotorBase- Returns:
- positioning tolerance
-
setRetryDeadband
public void setRetryDeadband(double retryDeadband) Set retry dead band returned for a dummy motor, so ScannableMotors withreturnDemandPosition=truedon't constantly warn that it is undefined, for example:
Alternatively, use:<gda:motor returnDemandPosition="true" dummy-retryDeadband="0.01" />
when it is being used by<bean id="xMotor" class="gda.device.motor.DummyMotor"> ... <property name="retryDeadband" value="0.01" /> </bean><bean id="x" class="gda.device.scannable.ScannableMotor"> <property name="motor" ref="xMotor" /> ... <property name="returnDemandPosition" value="true" /> </bean>- Parameters:
retryDeadband-
-