Package gda.device.attenuator
Class MultiFilterAttenuator
java.lang.Object
gda.factory.ConfigurableBase
gda.factory.FindableConfigurableBase
gda.device.DeviceBase
gda.device.attenuator.MultiFilterAttenuator
- All Implemented Interfaces:
Attenuator,Device,Configurable,Findable,gda.observable.IObservable,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
DummyMultiFilterAttenuator
public abstract class MultiFilterAttenuator
extends DeviceBase
implements Attenuator, org.springframework.beans.factory.InitializingBean
An implementation of
Attenuator that controls multiple independent filters.
This implementation does not take energy into account. It was written for Diamond's I04.1 beamline, which
operates at a fixed energy. Any method that involves energy, or takes energy as a parameter, will throw an
UnsupportedOperationException.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Transmissionprotected doubleprotected List<AttenuatorFilter> protected static final Comparator<Transmission> Comparatorthat comparesTransmissionobjects using their transmission values.protected List<Transmission> Possible transmissions for this attenuator.Fields inherited from class gda.device.DeviceBase
DEFAULT_PROTECTION_LEVEL_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidDefault 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.findClosestTransmission(double desiredTransmission) doubledoublegetClosestMatchTransmission(double transmission) Using the current beam energy, calculates the closest achievable transmission value to the given value with the set of filtersgetClosestMatchTransmission(double transmission, double energyInKeV) Uses the given energy in the calculationdoubledoubleReturns the stored desired transmission value.String[]Names available filtersintCounts the filters availabledoubleThe current transmission, assuming the energy has not changed since the last filter adjustment.booleanisReady()Determines if correct filters are in place (as attenuator makes a change of transmission): Compares the results ofAttenuator.getFilterPositions()withAttenuator.getDesiredFilterPositions().protected voidvoidsetFilters(List<AttenuatorFilter> filters) Sets the filters that make up this attenuator.protected abstract voidsetFilterStates(Transmission transmission) Changes the physical state of the attenuator filters to match the specified transmission.doublesetTransmission(double transmission) Changes the attenuation level to the closest achievable transmission to the given value.Methods 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.device.Attenuator
getDesiredFilterPositions, getFilterPositionsMethods inherited from interface gda.factory.Configurable
isConfigureAtStartup, isConfigured, reconfigure
-
Field Details
-
filters
-
transmissions
Possible transmissions for this attenuator. Calculated by considering all combinations of the individual filters. -
TRANSMISSION_COMPARATOR
Comparatorthat comparesTransmissionobjects using their transmission values. -
desiredTransmission
protected double desiredTransmission -
actualTransmission
-
-
Constructor Details
-
MultiFilterAttenuator
public MultiFilterAttenuator()
-
-
Method Details
-
setFilters
Sets the filters that make up this attenuator. -
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
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
-
prepareTransmissionLookupTable
protected void prepareTransmissionLookupTable() -
getTransmissions
-
findClosestTransmission
-
setFilterStates
Changes the physical state of the attenuator filters to match the specified transmission. -
setTransmission
Description copied from interface:AttenuatorChanges the attenuation level to the closest achievable transmission to the given value. This uses the current beam energy in its calculations.- Specified by:
setTransmissionin interfaceAttenuator- Parameters:
transmission- the desired transmission- Returns:
- the actual transmission value achieved
- Throws:
DeviceException
-
getTransmission
Description copied from interface:AttenuatorThe current transmission, assuming the energy has not changed since the last filter adjustment.- Specified by:
getTransmissionin interfaceAttenuator- Returns:
- the current actual transmission
- Throws:
DeviceException
-
getClosestMatchEnergy
- Specified by:
getClosestMatchEnergyin interfaceAttenuator- Returns:
- double - the actual energy used in calculations to determine the filter set to achieve the desired transmission
- Throws:
DeviceException
-
getClosestMatchTransmission
Description copied from interface:AttenuatorUsing the current beam energy, calculates the closest achievable transmission value to the given value with the set of filters- Specified by:
getClosestMatchTransmissionin interfaceAttenuator- Parameters:
transmission-- Returns:
- double the closest transmission value that could be achieved
- Throws:
DeviceException
-
getClosestMatchTransmission
public ClosestMatchTransmission getClosestMatchTransmission(double transmission, double energyInKeV) throws DeviceException Description copied from interface:AttenuatorUses the given energy in the calculation- Specified by:
getClosestMatchTransmissionin interfaceAttenuator- Parameters:
transmission- transmission (0 to 1)energyInKeV- x-ray energy in the stated units- Throws:
DeviceException
-
getDesiredEnergy
- Specified by:
getDesiredEnergyin interfaceAttenuator- Returns:
- double - the desired energy to use in calculations to determine the filter set to achieve the desired transmission
- Throws:
DeviceException
-
getDesiredTransmission
Description copied from interface:AttenuatorReturns the stored desired transmission value.- Specified by:
getDesiredTransmissionin interfaceAttenuator- Returns:
- the stored desired transmission value
- Throws:
DeviceException
-
isReady
Description copied from interface:AttenuatorDetermines if correct filters are in place (as attenuator makes a change of transmission): Compares the results ofAttenuator.getFilterPositions()withAttenuator.getDesiredFilterPositions().- Specified by:
isReadyin interfaceAttenuator- Throws:
DeviceException
-
getFilterNames
Description copied from interface:AttenuatorNames available filters- Specified by:
getFilterNamesin interfaceAttenuator- Returns:
- the names of the filters in this attenuator
- Throws:
DeviceException
-
getNumberFilters
Description copied from interface:AttenuatorCounts the filters available- Specified by:
getNumberFiltersin interfaceAttenuator- Returns:
- the number of filters in this attenuator
- Throws:
DeviceException
-