Package xal.smf

Class AcceleratorNode

java.lang.Object
xal.smf.AcceleratorNode
All Implemented Interfaces:
Comparable, ElementType, DataListener
Direct Known Subclasses:
AcceleratorSeq, BLM, BPM, BunchShapeMonitor, Chopper, CurrentMonitor, Doppler, Electrostatic, EMU, ESSIonSourceCoil, ESSIonSourceMagnetron, ESSIonSourceMFC, GenericNode, Iris, Magnet, Marker, ProfileDevice, ProfileMonitor, RepellerElectrode, RfGap, RfqDummy, SpaceChargeCompensation, Vacuum

public abstract class AcceleratorNode extends Object implements ElementType, DataListener, Comparable
The base class in the hierarchy of different accelerator node types.
Author:
Nikolay Malitsky, Christopher K. Allen, Nick D. Pattengale
  • Field Details

    • strId

      protected String strId
      node identifier
    • strPId

      protected String strPId
      physics identifier
    • strEId

      protected String strEId
      engineering identifier
    • dblPos

      protected double dblPos
      position of node
    • dblLen

      protected double dblLen
      length of node
    • seqParent

      protected AcceleratorSeq seqParent
      parent sequence object
    • objAccel

      protected Accelerator objAccel
      the associated Accelerator object
    • mapAttrs

      protected Map<String,AttributeBucket> mapAttrs
      all attribute buckets for node
    • bucAlign

      protected AlignmentBucket bucAlign
      alignment attribute bucket for node
    • bucTwiss

      protected TwissBucket bucTwiss
      twiss parameter bucket for node
    • bucAper

      protected ApertureBucket bucAper
      aperture parameters for node
    • bolStatus

      protected boolean bolStatus
      Indicator as to whether the Accelerator Node is functional
    • bolValid

      protected boolean bolValid
      Indicator as to whether accelerator node is valid
    • dblS

      protected double dblS
      "s" position for global display
    • bolIsSoft

      protected boolean bolIsSoft
      Indicator if this node is a "softNode" copy
    • channelSuite

      protected ChannelSuite channelSuite
      channel suite associated with this node
  • Constructor Details

    • AcceleratorNode

      protected AcceleratorNode(String strId, ChannelFactory channelFactory)
      Designated constructor
      Parameters:
      strId - the string ID for this node
      channelFactory - channel factory (null for default) for generating this node's channels
    • AcceleratorNode

      protected AcceleratorNode(String strId)
      Convenience constructor using the default channel factory
      Parameters:
      strId - the string ID for this node
  • Method Details

    • getType

      public abstract String getType()
      Derived class must furnish a unique type id
    • getSoftType

      public String getSoftType()
      Derived class may furnish a unique software type
    • dataLabel

      public String dataLabel()
      implement DataListener interface
      Specified by:
      dataLabel in interface DataListener
      Returns:
      a tag that identifies the receiver's type
    • update

      public void update(DataAdaptor adaptor) throws NumberFormatException
      implement DataListener interface
      Specified by:
      update in interface DataListener
      Parameters:
      adaptor - The adaptor from which to update the data
      Throws:
      NumberFormatException
    • write

      public void write(DataAdaptor adaptor)
      implement DataListener interface
      Specified by:
      write in interface DataListener
      Parameters:
      adaptor - The adaptor to which the receiver's data is written
    • writeStatus

      public void writeStatus(DataAdaptor adaptor)
      method to write status of the node into a separate file
    • writeAttributes

      protected void writeAttributes(DataAdaptor adaptor)
      write the attributes of the Node. Subclasses can be override this method to write a different set of attributes
      Parameters:
      adaptor -
    • findChannel

      public Channel findChannel(String handle)
      Attempt to find a channel for the given handle.
      Parameters:
      handle - the handle for which to find an associated channel
      Returns:
      channel for the given handle or null if none could be found
    • getAllChannels

      public List<Channel> getAllChannels()
      Returns a collection of all channels
      Returns:
      channels (corresponding to all handles)
    • batchConnectAllHandles

      public BatchConnectionRequest batchConnectAllHandles()
      Do a batch connection of all handles for this node
      Returns:
      the BatchConnectionRequest object
    • batchConnectAllHandlesAndWait

      public boolean batchConnectAllHandlesAndWait(double timeout)
      Do a batch connection of all handles for this node and wait for completion
      Parameters:
      timeout - the maximum time in seconds to wait for completion
      Returns:
      true if all channels successfully connected
    • getChannel

      public Channel getChannel(String chanHandle) throws NoSuchChannelException
      this method returns the Channel object of this node, associated with a prescribed PV name. Note - xal interacts with EPICS via Channel objects.
      Parameters:
      chanHandle - The handle to the epics channel in stored in the channel suite
      Throws:
      NoSuchChannelException
    • isChannelSettable

      public boolean isChannelSettable(String handle)
    • getAndConnectChannel

      public Channel getAndConnectChannel(String handle) throws NoSuchChannelException
      Get the channel corresponding to the specified handle and connect it.
      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.
    • lazilyGetAndConnect

      public Channel lazilyGetAndConnect(String chanHandle, Channel channel) throws NoSuchChannelException
      A method to make an EPICS ca connection for a given PV name The channel connection is initiated, and no extra work is done, if the channel connection already exists
      Throws:
      NoSuchChannelException
    • getAccessibleProperties

      public List<AccessibleProperty> getAccessibleProperties()
      Get a list of properties that can be accessed through EPICS.
      Returns:
      properties that can be accessed via EPICS.
    • getAccessibleProperties

      protected List<AccessibleProperty> getAccessibleProperties(List<AccessibleProperty> properties, Class<?> cls)
    • getDefaultHandles

      public Collection<String> getDefaultHandles()
      Returns:
      a list with expected channel handles by default.
    • getAndConnectChannelSetAndReadback

      public List<Channel> getAndConnectChannelSetAndReadback(String setHandle)
      Get the channels corresponding to the specified handle and connect to them. This method is useful when setting a value and checking that the value was set.
      Parameters:
      setHandle - The set handle for the channel to set.
      Returns:
      A list containing the set (first) and readback channels (subsequent) associated with this node and the specified set handle or null if there is no match.
      Throws:
      NoSuchChannelException - if no such channel as specified by the handle is associated with this node.
    • getReadbackHandles

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

      public String getSetHandle(String readbackHandle)
      Get the set handle corresponding to a readback channel.
      Parameters:
      readbackHandle - The readback handle.
      Returns:
      The corresponding set handle.
    • setValueAndVerify

      public boolean setValueAndVerify(String setHandle, Number value, Number tolerance, double timeout) throws PutException, MonitorException
      Set a value to the set channel corresponding to the set handle, and then check on the readback channel that the value is within an interval around the set value.
      Parameters:
      setHandle - Handle corresponding to the set channel.
      value - Value to be set.
      tolerance - Defines an interval around the value (absolute value).
      timeout - Timeout in seconds for the readback to reach the set value before failing. Failure is indicated by returning false.
      Returns:
      true if the value is set correctly, otherwise false.
      Throws:
      PutException
      MonitorException
    • getProperties

      public List<String> getProperties()
      Get a list with the names of properties that can be accessed through EPICS and that are used by the model.
      Returns:
      properties that can be accessed via EPICS.
    • getDesignPropertyValue

      public double getDesignPropertyValue(String propertyName)
      Get the design value for the specified property
    • setDesignPropertyValue

      public void setDesignPropertyValue(String propertyName, double value)
      Get the design value for the specified property
    • getLivePropertyValue

      public double getLivePropertyValue(String propertyName, double[] channelValues)
      Get the live property value for the corresponding array of channel values in the order given by getLivePropertyChannels()
    • setLivePropertyValue

      public void setLivePropertyValue(String propertyName, double channelValue) throws PutException
      Set the live property value for the corresponding array of channel values in the order given by getLivePropertyChannels()
      Throws:
      PutException
    • getLivePropertyChannels

      public Channel[] getLivePropertyChannels(String propertyName)
      Get the array of channels for the specified property
    • getId

      public String getId()
      return the ID of this node
    • getEId

      public String getEId()
      return the engineering ID of this node
    • getPId

      public String getPId()
      return the physics ID of this node
    • getLength

      public double getLength()
      return the physical length of this node (m)
    • getPosition

      public double getPosition()
      return the position of this node, along the reference orbit within its sequence (m)
    • getSDisplay

      public double getSDisplay()
      return global "s" display coordinate
      Returns:
      s coordinate
    • getAccelerator

      public Accelerator getAccelerator()
      return the top level accelerator that this node belongs to
    • getParent

      public AcceleratorSeq getParent()
      return the parent sequence that this node belongs to
    • getPrimaryAncestor

      public AcceleratorSeq getPrimaryAncestor()
      get the primary ancestor sequence that is a direct child of the accelerator
    • hasParent

      public boolean hasParent()
      Indicates if the node has a parent set
    • getStatus

      public boolean getStatus()
      Runtime indication of accelerator component operation
      Returns:
      true(up and running) false(down)
    • getValid

      public boolean getValid()
      Runtime indication of the validity of component operation
      Returns:
      true(valid operation) false(questionable operation)
    • setPosition

      public void setPosition(double position)
      set the position of this accelerator node within its parent sequence
    • setLength

      public void setLength(double length)
      set the length of this accelerator node
    • setSDisplay

      public void setSDisplay(double dblS)
      set "s" coordinate
      Parameters:
      dblS - s coordinate
    • setStatus

      public void setStatus(boolean bolStatus)
      Runtime indication of accelerator operation
      Parameters:
      bolStatus - true(up and running) false(down)
    • setValid

      public void setValid(boolean bolValid)
      Runtime indication of the validity of component operation
      Parameters:
      bolValid - true(valid operation) false(questionable operation)
    • addBucket

      public void addBucket(AttributeBucket buc)
      General attribute buckets support
    • getBuckets

      public Collection<AttributeBucket> getBuckets()
    • getBucket

      public AttributeBucket getBucket(String type)
    • hasBucket

      public boolean hasBucket(AttributeBucket bucket)
    • getTwiss

      public TwissBucket getTwiss()
      returns the bucket containing the Twiss parameters - see attr.TwissBucket
    • getAlign

      public AlignmentBucket getAlign()
      returns the bucket containing the alignment parameters - see attr.AlignBucket
    • getPitchAngle

      public double getPitchAngle()
      returns device pitch angle in degrees
      Returns:
      pitch angle
    • getYawAngle

      public double getYawAngle()
      returns device yaw angle in degrees
      Returns:
      yaw angle
    • getRollAngle

      public double getRollAngle()
      returns device roll angle in degrees
      Returns:
      roll angle
    • getXOffset

      public double getXOffset()
      returns device x offset
      Returns:
      x offset
    • getYOffset

      public double getYOffset()
      returns device y offset
      Returns:
      y offset
    • getZOffset

      public double getZOffset()
      returns device z offset
      Returns:
      z offset
    • getAper

      public ApertureBucket getAper()
      returns the bucket containing the Aperture parameters - see attr.ApertureBucket
    • setAlign

      public void setAlign(AlignmentBucket buc)
      sets the bucket containing the twiss parameters - see attr.TwissBucket
    • setTwiss

      public void setTwiss(TwissBucket buc)
      sets the bucket containing the alignment parameters - see attr.AlignBucket
    • setAper

      public void setAper(ApertureBucket buc)
      sets the bucket containing the Aperture parameters - see attr.ApertureBucket
    • setPitchAngle

      public void setPitchAngle(double angle)
      set device pitch angle
      Parameters:
      angle - pitch angle in degree
    • setYawAngle

      public void setYawAngle(double angle)
      set device yaw angle
      Parameters:
      angle - yaw angle in degree
    • setRollAngle

      public void setRollAngle(double angle)
      set device roll angle
      Parameters:
      angle - roll angle in degree
    • setXOffset

      public void setXOffset(double offset)
      set device x offset
      Parameters:
      offset - x offset
    • setYOffset

      public void setYOffset(double offset)
      set device y offset
      Parameters:
      offset - y offset
    • setZOffset

      public void setZOffset(double offset)
      set device z offset
      Parameters:
      offset - z offset
    • clear

      public void clear()
      remove this node from the accelerator hieracrhcy
    • removeFromParent

      protected void removeFromParent()
      remove this node from its immediate parent sequence
    • setParent

      protected void setParent(AcceleratorSeq parent)
      define the parent sequence for this node
    • setAccelerator

      protected void setAccelerator(Accelerator accel)
      set the top level accelerator for this node
    • channelSuite

      public ChannelSuite channelSuite()
      channel suite accessor
    • getHandles

      public Collection<String> getHandles()
      accessor to channel suite handles
    • isKindOf

      public boolean isKindOf(String compType)
      Determine if a node is of the specified type. The comparison is based upon the node's class and the element type manager handles checking for inherited classes to types get inherited. Subclasses can override this method if the types comparison is more complicated (e.g. if more than one type can be associated with the same node class).
      Specified by:
      isKindOf in interface ElementType
      Parameters:
      compType - The type against which to compare.
      Returns:
      true if the node is of the specified type; false otherwise.
    • isMagnet

      public boolean isMagnet()
      Determine if the node is a magnet.
      Specified by:
      isMagnet in interface ElementType
      Returns:
      true if the node is a magnet; false other.
    • toString

      public String toString()
      Returns the identifier string of the node.
      Overrides:
      toString in class Object
      Returns:
      the physical hardware identifier
      Since:
      Aug 20, 2009
      See Also:
    • compareTo

      public int compareTo(Object node)
      Specified by:
      compareTo in interface Comparable