Package xal.smf.impl

Class Electromagnet

All Implemented Interfaces:
Comparable, ElementType, MagnetType, DataListener
Direct Known Subclasses:
Dipole, MagFieldMap, Quadrupole, Sextupole, Solenoid

public abstract class Electromagnet extends Magnet
Electromagnet is the base class representation of an electromagnet.
Author:
tap
  • Field Details

  • Constructor Details

    • Electromagnet

      public Electromagnet(String strId, ChannelFactory channelFactory)
      Primary Constructor
    • Electromagnet

      public Electromagnet(String strId)
      Constructor
  • Method Details

    • update

      public void update(DataAdaptor adaptor) throws NumberFormatException
      Update the node with data from the provided adaptor.
      Specified by:
      update in interface DataListener
      Overrides:
      update in class AcceleratorNode
      Parameters:
      adaptor - The data provider
      Throws:
      NumberFormatException
    • updatePowerSupplies

      protected void updatePowerSupplies(DataAdaptor powerSupplyAdaptor)
      Update data from the power supply data adaptor. Get the main power supply information.
      Parameters:
      powerSupplyAdaptor - The data provider of power supply information.
    • write

      public void write(DataAdaptor adaptor)
      Encode data from the node into the provided adaptor. Overrides to provide support for power supplies.
      Specified by:
      write in interface DataListener
      Overrides:
      write in class AcceleratorNode
      Parameters:
      adaptor - The data store
    • writePowerSupplies

      protected void writePowerSupplies(DataAdaptor powerSupplyAdaptor)
      Write data to the power supply data adaptor. Put the information about the main power supply into the data adaptor.
      Parameters:
      powerSupplyAdaptor - The data sink for the power supply information
    • setUseFieldReadback

      public void setUseFieldReadback(boolean useFieldReadback)
      Set whether or not to use the field readback in the getField() method.
      Parameters:
      useFieldReadback - true to use the field readback and false to use the field setting.
    • useFieldReadback

      public boolean useFieldReadback()
      Determines whether the field readback is used in the getField() method.
      Returns:
      true if the field readback is used in getField() and false if instead the field setting is used.
    • getHandles

      public Collection<String> getHandles()
      Get the channel handles. Overrides the default method to add handles from the main power supply.
      Overrides:
      getHandles in class AcceleratorNode
      Returns:
      The channel handles associated with this node
    • getDefaultHandles

      public Collection<String> getDefaultHandles()
      Overrides:
      getDefaultHandles in class AcceleratorNode
      Returns:
      a list with expected channel handles by default.
    • getReadbackHandles

      public String[] getReadbackHandles(String setHandle)
      Get the readback handle corresponding to a set channel.
      Overrides:
      getReadbackHandles in class AcceleratorNode
      Parameters:
      setHandle - The set handle. public String getReadbackHandle(String setHandle) {
      Returns:
      The corresponding readback handle.
    • getSetHandle

      public String getSetHandle(String readbackHandle)
      Get the set handle corresponding to a readback channel.
      Overrides:
      getSetHandle in class AcceleratorNode
      Parameters:
      readbackHandle - The readback handle.
      Returns:
      The corresponding set handle.
    • findChannel

      public Channel findChannel(String handle)
      Find the channel for the specified handle searching the main supply if necessary.
      Overrides:
      findChannel in class AcceleratorNode
      Parameters:
      handle - The handle for the channel to get.
      Returns:
      The channel associated with this node and the specified handle or null if there is no match.
    • isChannelSettable

      public boolean isChannelSettable(String handle)
      Overrides:
      isChannelSettable in class AcceleratorNode
    • getMainSupply

      public MagnetMainSupply getMainSupply()
      Get the main power supply for this magnet.
      Returns:
      The main power supply for this magnet
    • setMainSupplyId

      public void setMainSupplyId(String id)
      Set the main power supply for this magnet by id.
      Parameters:
      id - Id of main power supply;
    • getAccessibleProperties

      public List<AccessibleProperty> getAccessibleProperties()
      Description copied from class: AcceleratorNode
      Get a list of properties that can be accessed through EPICS.
      Overrides:
      getAccessibleProperties in class AcceleratorNode
      Returns:
      properties that can be accessed via EPICS.
    • setCycleEnable

      public void setCycleEnable(boolean enable) throws PutException
      Set the cycle enable state of the magnet. If enabled, the magnet will be cycled when the field is set.
      Parameters:
      enable - True to enable cycling; false to disable cycling.
      Throws:
      PutException
    • getCycleState

      public int getCycleState() throws GetException
      Gets the cycle state of the magnet. The magnet may be in one of three states: cycle is invalid (field changed in reverse direction of initial setting), cycling in progress or cycle is valid
      Returns:
      One of CYCLE_INVALID, CYCLING or CYCLE_VALID
      Throws:
      GetException
    • getField

      public double getField() throws GetException
      Get the field in this electromagnet via ca.
      Returns:
      the field in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • getFieldReadback

      public double getFieldReadback() throws GetException
      Get the field in this electromagnet via ca.
      Returns:
      the readback field in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • getFieldInt

      public double getFieldInt() throws GetException
      Get the integrated field in this electromagnet T-m/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • setField

      public void setField(double newField) throws PutException
      Set the main power supply field contribution in the magnet. If cycle enable is true then the magnet is cycled before the field is set to the specified value.
      Parameters:
      newField - is the new field level in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      PutException
    • getFieldSetting

      public double getFieldSetting() throws GetException
      Get the value to which the main power supply's field contribution is set. Note that this is not the readback.
      Returns:
      the field setting in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • getTotalFieldSetting

      public double getTotalFieldSetting() throws GetException
      Get the value to which the field is set including both the main supply and possible trim supply contributions. Note that this is not the readback.
      Returns:
      the field setting in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • toFieldFromCA

      public final double toFieldFromCA(double rawValue)
      Convert the raw channel access value to get the field.
      Parameters:
      rawValue - the raw channel value
      Returns:
      the magnetic field in T/m^(n-1)
    • toCAFromField

      public final double toCAFromField(double field)
      Convert the field value to a channel access value.
      Parameters:
      field - the magnetic field in T/m^(n-1)
      Returns:
      the channel access value
    • toFieldFromCurrent

      public final double toFieldFromCurrent(double current)
      Convert the current value in the power supply to field value.
      Parameters:
      current - the current in the magnet in A
      Returns:
      the channel access value
    • toCurrentFromField

      public final double toCurrentFromField(double field)
      Convert the field value to a current value for the power supply.
      Parameters:
      field - the magnetic field in T/m^(n-1)
      Returns:
      the channel access value
    • upperFieldLimit

      public double upperFieldLimit() throws GetException
      Get the field upper settable limit of the main power supply in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • lowerFieldLimit

      public double lowerFieldLimit() throws GetException
      Get the field lower settable limit of the main power supply in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • upperDisplayFieldLimit

      public double upperDisplayFieldLimit() throws GetException
      Get the field upper settable limit of the main power supply in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • lowerDisplayFieldLimit

      public double lowerDisplayFieldLimit() throws GetException
      Get the field lower settable limit of the main power supply in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • upperWarningFieldLimit

      public double upperWarningFieldLimit() throws GetException
      Get the field upper settable limit of the main power supply in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • lowerWarningFieldLimit

      public double lowerWarningFieldLimit() throws GetException
      Get the field lower settable limit of the main power supply in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • upperAlarmFieldLimit

      public double upperAlarmFieldLimit() throws GetException
      Get the field upper settable limit of the main power supply in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • lowerAlarmFieldLimit

      public double lowerAlarmFieldLimit() throws GetException
      Get the field lower settable limit of the main power supply in T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
      Throws:
      GetException
    • getCurrent

      public double getCurrent() throws GetException
      Get the main power supply current in this electromagnet via ca (A)
      Throws:
      GetException
    • setCurrent

      public void setCurrent(double newCurrent) throws PutException
      set the main power supply current in the magnet (A)
      Parameters:
      newCurrent - is the new current (A)
      Throws:
      PutException
    • upperCurrentLimit

      public double upperCurrentLimit() throws GetException
      get the main power supply current lower settable limit (A)
      Throws:
      GetException
    • lowerCurrentLimit

      public double lowerCurrentLimit() throws GetException
      get the main power supply current lower settable limit (A)
      Throws:
      GetException
    • isPermanent

      public boolean isPermanent()
      Since this is an electro-magnet we override the inherited method to advertise this characteristic.
      Specified by:
      isPermanent in interface MagnetType
      Overrides:
      isPermanent in class Magnet
      Returns:
      false since all Electromagnet instances are not permanent magnets.