Package gda.device.scannable
Class DummyContinuouslyScannable
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.scannable.ScannableBase
gda.device.scannable.ScannableMotionBase
gda.device.scannable.ScannableMotionUnitsBase
gda.device.scannable.DummyContinuouslyScannable
- All Implemented Interfaces:
INeXusInfoWriteable,Device,Scannable,ContinuouslyScannable,SimulatedContinuouslyScannable,ScannableMotion,ScannableMotionUnits,Configurable,Findable,gda.observable.IObservable,Runnable
public class DummyContinuouslyScannable
extends ScannableMotionUnitsBase
implements SimulatedContinuouslyScannable
Dummy implementation for testing / simulations. Works with the SimulatedBufferedDetector class.
This works on the assumption that its position is defined by a single number.
-
Field Summary
Fields inherited from class gda.device.scannable.ScannableMotionUnitsBase
unitsComponentFields inherited from class gda.device.scannable.ScannableMotionBase
numberTries, toleranceFields inherited from class gda.device.scannable.ScannableBase
__doc__, DEFAULT_INPUT_NAME, DEFAULT_OUTPUT_FORMAT, extraNames, inputNames, level, outputFormatFields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTYFields inherited from interface gda.device.Scannable
ATTR_NEXUS_CATEGORY, ATTR_NX_CLASS, DEFAULT_INPUT_NAME, VALUE_UNAVAILABLEFields inherited from interface gda.device.ScannableMotion
FIRSTINPUTLIMITSFields inherited from interface gda.device.ScannableMotionUnits
HARDWAREUNITS, USERUNITS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddObserver(SimulatedBufferedDetector detector) For testing and simulation only.voidasynchronousMoveTo(Object externalPosition) Trigger a move/operation and return immediately.doublecalculateEnergy(int frameIndex) As this scannable controls the motion, it is responsible for knowing the energy at each framecheckPositionValid(Object illDefinedPosObject) Checks the position against the Scannable's limits and against any additional position validators added with additionalPositionValidators().voidDefault 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.voidOnce move and data collection complete, reverts any hardware settings etc.intThe actual hardware might not be able to return exactly the numbner of points requested.Returns the current position of the Scannable.booleanisBusy()Check if the Scannable is moving/operating.voidPerform the move based on the supplied continuous parameters.voidPrepare hardware for the continuous move.voidremoveObserver(SimulatedBufferedDetector detector) For testing and simulation only.voidrun()voidsetContinuousParameters(ContinuousParameters parameters) Sets the parameters which define the continuous movement to useMethods inherited from class gda.device.scannable.ScannableMotionUnitsBase
addAcceptableUnit, externalToInternal, getAcceptableUnits, getAttribute, getHardwareUnitString, getInitialUserUnits, getOffset, getUserUnits, internalToExternal, isAt, setHardwareUnitString, setInitialUserUnits, setOffset, setOffset, setUserUnits, toFormattedStringMethods inherited from class gda.device.scannable.ScannableMotionBase
a, addPositionValidator, ar, checkPositionWithinGdaLimits, checkPositionWithinGdaLimits, completeInstantiation, generateScannableLimitsReport, getAdditionalPositionValidators, getFirstInputLimits, getInputLimits, getInputLimits, getLimitsComponent, getLowerGdaLimits, getNumberTries, getScalingFactor, getTolerances, getUpperGdaLimits, moveTo, r, rawIsBusy, removePositionValidator, setAdditionalPositionValidators, setLimitsComponent, setLowerGdaLimits, setLowerGdaLimits, setNumberTries, setOffsetAndScalingComponent, setScalingFactor, setTolerance, setTolerances, setUpperGdaLimits, setUpperGdaLimits, writeNeXusInformation, writeNeXusInformationLimitsMethods inherited from class gda.device.scannable.ScannableBase
__call__, __call__, __doc__, __getitem__, __len__, __repr__, __str__, atCommandFailure, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanEnd, atScanLineEnd, atScanLineStart, atScanStart, getExtraNames, getInputNames, getLevel, getOutputFormat, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, rawAsynchronousMoveTo, rawGetPosition, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, stop, throwExceptionIfInvalidTarget, toString, validateScannable, valueUnavailableString, waitWhileBusy, waitWhileBusyMethods inherited from class gda.device.DeviceBase
addIObserver, close, deleteIObserver, deleteIObservers, 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, deleteIObserversMethods inherited from interface gda.device.Scannable
atCommandFailure, atLevelEnd, atLevelMoveStart, atLevelStart, atPointEnd, atPointStart, atScanEnd, atScanLineEnd, atScanLineStart, atScanStart, getExtraNames, getInputNames, getLevel, getOutputFormat, getScanMetadataAttribute, getScanMetadataAttributeNames, getScanMetadataAttributes, isAt, moveTo, setExtraNames, setInputNames, setLevel, setOutputFormat, setScanMetadataAttribute, setScanMetadataAttributes, stop, toFormattedString, waitWhileBusyMethods inherited from interface gda.device.ScannableMotion
a, ar, checkPositionWithinGdaLimits, checkPositionWithinGdaLimits, getLowerGdaLimits, getNumberTries, getOffset, getScalingFactor, getTolerances, getUpperGdaLimits, r, setLowerGdaLimits, setLowerGdaLimits, setNumberTries, setOffset, setScalingFactor, setTolerance, setTolerances, setUpperGdaLimits, setUpperGdaLimitsMethods inherited from interface gda.device.ScannableMotionUnits
addAcceptableUnit, getAcceptableUnits, getHardwareUnitString, getUserUnits, setHardwareUnitString, setOffset, setUserUnits
-
Constructor Details
-
DummyContinuouslyScannable
public DummyContinuouslyScannable()
-
-
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
-
asynchronousMoveTo
Description copied from class:ScannableBaseTrigger 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:
asynchronousMoveToin interfaceScannable- Overrides:
asynchronousMoveToin classScannableMotionBase- Parameters:
externalPosition- Position to move to should have an element for each input field.- Throws:
DeviceException
-
performContinuousMove
Description copied from interface:ContinuouslyScannablePerform the move based on the supplied continuous parameters.- Specified by:
performContinuousMovein interfaceContinuouslyScannable- Throws:
DeviceException
-
run
public void run() -
getPosition
Description copied from class:ScannableBaseReturns the current position of the Scannable. Called by ConcurentScan at the end of the point. Reads an internal (hardware) position from rawGetPosition, converts this to an external (user) position and returns it.- Specified by:
getPositionin interfaceScannable- Overrides:
getPositionin classScannableBase- Returns:
- Current position with an element for each input and extra field. null if their are no fields.
- Throws:
DeviceException
-
isBusy
public boolean isBusy()Description copied from class:ScannableMotionBaseCheck if the Scannable is moving/operating.. Calls onto rawIsBusy for historical reasons, although there is currently no need for this.- Specified by:
isBusyin interfaceScannable- Overrides:
isBusyin classScannableMotionBase- Returns:
- true - if operation carried out by moveTo has not completed yet
- See Also:
-
addObserver
For testing and simulation only. Real hardware represented by the ContinuousScannable and DummyHistogramDetector interfaces would be physically wired together.- Parameters:
detector-
-
removeObserver
For testing and simulation only.- Parameters:
detector-
-
checkPositionValid
Description copied from class:ScannableMotionBaseChecks the position against the Scannable's limits and against any additional position validators added with additionalPositionValidators().- Specified by:
checkPositionValidin interfaceScannable- Overrides:
checkPositionValidin classScannableMotionBase- Parameters:
illDefinedPosObject-- Returns:
- null if position is valid, or returns a description if not.
- See Also:
-
getContinuousParameters
- Specified by:
getContinuousParametersin interfaceContinuouslyScannable- Returns:
- ContinuousParameters
-
setContinuousParameters
Description copied from interface:ContinuouslyScannableSets the parameters which define the continuous movement to use- Specified by:
setContinuousParametersin interfaceContinuouslyScannable- Parameters:
parameters-
-
continuousMoveComplete
Description copied from interface:ContinuouslyScannableOnce move and data collection complete, reverts any hardware settings etc. set for the move.- Specified by:
continuousMoveCompletein interfaceContinuouslyScannable- Throws:
DeviceException
-
prepareForContinuousMove
Description copied from interface:ContinuouslyScannablePrepare hardware for the continuous move. This assumes that continuous parameters have been supplied.- Specified by:
prepareForContinuousMovein interfaceContinuouslyScannable- Throws:
DeviceException
-
calculateEnergy
public double calculateEnergy(int frameIndex) Description copied from interface:ContinuouslyScannableAs this scannable controls the motion, it is responsible for knowing the energy at each frame- Specified by:
calculateEnergyin interfaceContinuouslyScannable- Parameters:
frameIndex-- Returns:
- double energy in eV of the given frame
-
getNumberOfDataPoints
public int getNumberOfDataPoints()Description copied from interface:ContinuouslyScannableThe actual hardware might not be able to return exactly the numbner of points requested. This method returns the actaul number the scan should expect.- Specified by:
getNumberOfDataPointsin interfaceContinuouslyScannable- Returns:
- int - the number of data points which would be actually returned based on the given ContinuousParameters
-