gov.sns.xal.smf.impl
Class Electromagnet

java.lang.Object
  |
  +--gov.sns.xal.smf.AcceleratorNode
        |
        +--gov.sns.xal.smf.impl.Magnet
              |
              +--gov.sns.xal.smf.impl.Electromagnet
All Implemented Interfaces:
DataListener, ElementType, MagnetType
Direct Known Subclasses:
Dipole, Quadrupole

public abstract class Electromagnet
extends Magnet

Electromagnet is the base class representation of an electromagnet.


Field Summary
static java.lang.String FIELD_RB_HANDLE
           
protected  java.lang.String mainSupplyId
           
static java.lang.String s_strType
           
 
Fields inherited from class gov.sns.xal.smf.impl.Magnet
leff, m_bucMagnet
 
Fields inherited from class gov.sns.xal.smf.AcceleratorNode
channelSuite, m_bolIsSoft, m_bolStatus, m_bolValid, m_bucAlign, m_bucAper, m_bucTwiss, m_dblLen, m_dblPos, m_mapAttrs, m_objAccel, m_seqParent, m_strId
 
Fields inherited from interface gov.sns.xal.smf.impl.qualify.MagnetType
DIPOLE, HORIZONTAL, NO_ORIENTATION, OCT, OCTUPOLE, poles, QUAD, QUADRUPOLE, SEXT, SEXTUPOLE, VERTICAL
 
Constructor Summary
Electromagnet(java.lang.String strId)
          Creates new Electromagnet
 
Method Summary
 Channel getChannel(java.lang.String handle)
          Get the channel corresponding to the specified handle.
 double getCurrent()
          Get the main power supply current in this electromagnet via ca (A)
 int getCycleState()
          Gets the cycle state of the magnet.
 double getField()
          Get the field in this electromagnet via ca T/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
 double getFieldInt()
          Get the integrated field in this electromagnet T-m/(m^(n-1)), where n = 1 for dipole, 2 for quad, etc.
 java.util.Collection getHandles()
          Get the channel handles.
 MagnetMainSupply getMainSupply()
          Get the main power supply for this magnet.
 boolean isPermanent()
          Since this is an electro-magnet we override the inherited method to advertise this characteristic.
 double lowerCurrentLimit()
          get the main power supply current lower settable limit (A)
 double lowerFieldLimit()
          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.
 void setCurrent(double newCurrent)
          set the main power supply current in the magnet (A)
 void setCycleEnable(boolean enable)
          Set the cycle enable state of the magnet.
 void setField(double newField)
          Set the main power supply field contribution in the magnet.
 void update(DataAdaptor adaptor)
          Update the node with data from the provided adaptor.
protected  void updatePowerSupplies(DataAdaptor powerSupplyAdaptor)
          Update data from the power supply data adaptor.
 double upperCurrentLimit()
          get the main power supply current lower settable limit (A)
 double upperFieldLimit()
          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.
 void write(DataAdaptor adaptor)
          Encode data from the node into the provided adaptor.
protected  void writePowerSupplies(DataAdaptor powerSupplyAdaptor)
          Write data to the power supply data adaptor.
 
Methods inherited from class gov.sns.xal.smf.impl.Magnet
addBucket, getDesignField, getDfltField, getEffLength, getMagBucket, getNormField, getOrientation, getPolarity, getTangField, isCorrector, isHorizontal, isMagnet, isPole, isSkew, isVertical, setMagBucket
 
Methods inherited from class gov.sns.xal.smf.AcceleratorNode
channelSuite, clear, dataLabel, getAccelerator, getAlign, getAndConnectChannel, getAper, getBucket, getBuckets, getId, getLength, getParent, getPosition, getStatus, getTwiss, getType, getValid, hasBucket, hasParent, isKindOf, lazilyGetAndConnect, removeFromParent, setAccelerator, setAlign, setAper, setLength, setParent, setPosition, setStatus, setTwiss, setValid, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gov.sns.xal.smf.impl.qualify.ElementType
isKindOf
 

Field Detail

s_strType

public static final java.lang.String s_strType
See Also:
Constant Field Values

FIELD_RB_HANDLE

public static final java.lang.String FIELD_RB_HANDLE
See Also:
Constant Field Values

mainSupplyId

protected java.lang.String mainSupplyId
Constructor Detail

Electromagnet

public Electromagnet(java.lang.String strId)
Creates new Electromagnet

Method Detail

update

public void update(DataAdaptor adaptor)
            throws java.lang.NumberFormatException
Update the node with data from the provided adaptor. Overrides to provide support for power supplies.

Specified by:
update in interface DataListener
Overrides:
update in class AcceleratorNode
Parameters:
adaptor - The data provider
java.lang.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

getHandles

public java.util.Collection 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

getChannel

public Channel getChannel(java.lang.String handle)
                   throws NoSuchChannelException
Get the channel corresponding to the specified handle. Override the inherited method to check the main supply if the channel suite does not contain the handle.

Overrides:
getChannel 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.
Throws:
NoSuchChannelException - if no such channel as specified by the handle is associated with this node.

getMainSupply

public MagnetMainSupply getMainSupply()
Get the main power supply for this magnet.

Returns:
The main power supply for this magnet

setCycleEnable

public void setCycleEnable(boolean enable)
                    throws ConnectionException,
                           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.
ConnectionException
PutException

getCycleState

public int getCycleState()
                  throws ConnectionException,
                         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
ConnectionException
GetException

getField

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

ConnectionException
GetException

getFieldInt

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

ConnectionException
GetException

setField

public void setField(double newField)
              throws ConnectionException,
                     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.
ConnectionException
PutException

upperFieldLimit

public double upperFieldLimit()
                       throws ConnectionException,
                              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.

ConnectionException
GetException

lowerFieldLimit

public double lowerFieldLimit()
                       throws ConnectionException,
                              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.

ConnectionException
GetException

getCurrent

public double getCurrent()
                  throws ConnectionException,
                         GetException
Get the main power supply current in this electromagnet via ca (A)

ConnectionException
GetException

setCurrent

public void setCurrent(double newCurrent)
                throws ConnectionException,
                       PutException
set the main power supply current in the magnet (A)

Parameters:
newCurrent - is the new current (A)
ConnectionException
PutException

upperCurrentLimit

public double upperCurrentLimit()
                         throws ConnectionException,
                                GetException
get the main power supply current lower settable limit (A)

ConnectionException
GetException

lowerCurrentLimit

public double lowerCurrentLimit()
                         throws ConnectionException,
                                GetException
get the main power supply current lower settable limit (A)

ConnectionException
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.