Class 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 Details

    • filters

      protected List<AttenuatorFilter> filters
    • transmissions

      protected List<Transmission> transmissions
      Possible transmissions for this attenuator. Calculated by considering all combinations of the individual filters.
    • TRANSMISSION_COMPARATOR

      protected static final Comparator<Transmission> TRANSMISSION_COMPARATOR
      Comparator that compares Transmission objects using their transmission values.
    • desiredTransmission

      protected double desiredTransmission
    • actualTransmission

      protected Transmission actualTransmission
  • Constructor Details

    • MultiFilterAttenuator

      public MultiFilterAttenuator()
  • Method Details

    • setFilters

      public void setFilters(List<AttenuatorFilter> filters)
      Sets the filters that make up this attenuator.
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • 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 ConfigurableBase
      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

      public List<Transmission> getTransmissions()
    • findClosestTransmission

      public Transmission findClosestTransmission(double desiredTransmission)
    • setFilterStates

      protected abstract void setFilterStates(Transmission transmission)
      Changes the physical state of the attenuator filters to match the specified transmission.
    • setTransmission

      public double setTransmission(double transmission) throws DeviceException
      Description copied from interface: Attenuator
      Changes the attenuation level to the closest achievable transmission to the given value. This uses the current beam energy in its calculations.
      Specified by:
      setTransmission in interface Attenuator
      Parameters:
      transmission - the desired transmission
      Returns:
      the actual transmission value achieved
      Throws:
      DeviceException
    • getTransmission

      public double getTransmission() throws DeviceException
      Description copied from interface: Attenuator
      The current transmission, assuming the energy has not changed since the last filter adjustment.
      Specified by:
      getTransmission in interface Attenuator
      Returns:
      the current actual transmission
      Throws:
      DeviceException
    • getClosestMatchEnergy

      public double getClosestMatchEnergy() throws DeviceException
      Specified by:
      getClosestMatchEnergy in interface Attenuator
      Returns:
      double - the actual energy used in calculations to determine the filter set to achieve the desired transmission
      Throws:
      DeviceException
    • getClosestMatchTransmission

      public double getClosestMatchTransmission(double transmission) throws DeviceException
      Description copied from interface: Attenuator
      Using the current beam energy, calculates the closest achievable transmission value to the given value with the set of filters
      Specified by:
      getClosestMatchTransmission in interface Attenuator
      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: Attenuator
      Uses the given energy in the calculation
      Specified by:
      getClosestMatchTransmission in interface Attenuator
      Parameters:
      transmission - transmission (0 to 1)
      energyInKeV - x-ray energy in the stated units
      Throws:
      DeviceException
    • getDesiredEnergy

      public double getDesiredEnergy() throws DeviceException
      Specified by:
      getDesiredEnergy in interface Attenuator
      Returns:
      double - the desired energy to use in calculations to determine the filter set to achieve the desired transmission
      Throws:
      DeviceException
    • getDesiredTransmission

      public double getDesiredTransmission() throws DeviceException
      Description copied from interface: Attenuator
      Returns the stored desired transmission value.
      Specified by:
      getDesiredTransmission in interface Attenuator
      Returns:
      the stored desired transmission value
      Throws:
      DeviceException
    • isReady

      public boolean isReady() throws DeviceException
      Description copied from interface: Attenuator
      Determines if correct filters are in place (as attenuator makes a change of transmission): Compares the results of Attenuator.getFilterPositions() with Attenuator.getDesiredFilterPositions().
      Specified by:
      isReady in interface Attenuator
      Throws:
      DeviceException
    • getFilterNames

      public String[] getFilterNames() throws DeviceException
      Description copied from interface: Attenuator
      Names available filters
      Specified by:
      getFilterNames in interface Attenuator
      Returns:
      the names of the filters in this attenuator
      Throws:
      DeviceException
    • getNumberFilters

      public int getNumberFilters() throws DeviceException
      Description copied from interface: Attenuator
      Counts the filters available
      Specified by:
      getNumberFilters in interface Attenuator
      Returns:
      the number of filters in this attenuator
      Throws:
      DeviceException