Class Element

java.lang.Object
xal.model.elem.Element
All Implemented Interfaces:
IComponent, IElement
Direct Known Subclasses:
ThickElement, ThinElement

public abstract class Element extends Object implements IElement
Convenience abstract base class for constructing XAL modeling elements. This class implements many of the general methods for the IElement interface that are not element specific.
Author:
Christopher Allen, Craig McChesney
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected double
    total length of the node before it was sliced by scenario generator
    protected double
    position of the node before it was sliced by scenario generator

    Fields inherited from interface xal.model.IElement

    LIGHT_SPEED, PERMEABILITY, PERMITTIVITY, UNIT_CHARGE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Element(String strType)
    Creates a new instance of Element
    protected
    Element(String strType, String strId)
    Creates a new instance of Element
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add an element to the list of nearest neighbor elements used when considering the effects of PMQs
    void
    Back propagates the Probe object through this element based on the associated algorithm.
    void
    backPropagate(IProbe probe, double pos)
    Back propagates the Probe object through this element based on the associated algorithm.
    double
    compDriftingTime(IProbe probe, double dblLen)
    Compute the time the probe probe spends drifting a a distance dblLen.
    double
     
    abstract double
    elapsedTime(IProbe probe, double dblLen)
    Returns the time taken for the probe probe to propagate through a subsection of the element with length dblLen.
    abstract double
    energyGain(IProbe probe, double dblLen)
    Returns energy gain for subsection of this element of length dblLen for the specified given probe.
    double
    Get the horizontal misalignment
    double
    Get the vertical misalignment
    double
    Get the longitudinal misalignment
    Return the list of nearest adjacent elements to this element.
    Returns the string identifier of the hardware node which this element models.
    Returns the string identifier for this element.
    double
    Return the (center) position of this component within the global lattice structure to which it belongs.
    abstract double
    Return the length of this element.
    double
    Returns the total length of the node, before the element was sliced by scenario generator
    double
    Returns the position of the node, before the element was sliced by scenario generator
    Returns the composite structure (if any) that owns this component.
    double
     
    double
     
    double
     
    double
    Return the center position of the element along the design trajectory.
    Return the element type identifier
    int
    Return the internal class unique identifier of this element.
    void
    Conversion method to be provided by the user
    abstract double
    longitudinalPhaseAdvance(IProbe probe, double dblLen)
    This is a kluge to make RF gaps work, since frequency is not defined for most modeling elements.
    void
    Dump current state and content to output stream.
    void
    Override of IComponent.propagate(xal.model.IProbe, double) Propagates the Probe object through this element based on the associated algorithm.
    void
    propagate(IProbe probe, double pos)
    Override of IComponent.propagate(xal.model.IProbe, double) Propagates the Probe object through this element based on the associated algorithm.
    void
    setAlign(R3 vecAlign)
    Set the alignment parameters all at once.
    void
    setAlignX(double x)
    Set the horizontal misalignment
    void
    setAlignY(double y)
    Set the vertical misalignment
    void
    setAlignZ(double z)
    Set the longitudinal misalignment
    void
    Sets the string identifier of the hardware node which this element models.
    void
    setId(String strId)
    Set the string identifier for the element.
    void
    setParent(IComposite cpsParent)
    Sets the parent structure containing this component.
    void
    setPhiX(double phix)
     
    void
    setPhiY(double phiy)
     
    void
    setPhiZ(double phiz)
     
    void
    setPosition(double dblPos)
    Set the center position of the element with the containing lattice.
     
    abstract PhaseMap
    transferMap(IProbe probe, double dblLen)
    Compute the transfer matrix for subsection of this element of length dblLen for the specified given probe.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • dblNodeLen

      protected double dblNodeLen
      total length of the node before it was sliced by scenario generator
    • dblNodePos

      protected double dblNodePos
      position of the node before it was sliced by scenario generator
  • Constructor Details

    • Element

      protected Element(String strType)
      Creates a new instance of Element
      Parameters:
      strType - type identifier of the element
    • Element

      protected Element(String strType, String strId)
      Creates a new instance of Element
      Parameters:
      strType - type identifier of the element
      strId - string identifier of the element
  • Method Details

    • setId

      public void setId(String strId)
      Set the string identifier for the element.
      Parameters:
      strId - new string identifier for element
    • setHardwareNodeId

      public void setHardwareNodeId(String strSmfId)
      Sets the string identifier of the hardware node which this element models. Node that this element may only model part of the underlying hardware node or simply some aspect of it. Thus, this is not a unique value amount all modeling elements.
      Parameters:
      strSmfId - identifier for the modeled hardware node (SMF object)
      Since:
      Sep 2, 2014
    • setPosition

      public void setPosition(double dblPos)
      Set the center position of the element with the containing lattice.
      Parameters:
      dblPos - center position along the design trajectory (meters)
    • setAlign

      public void setAlign(R3 vecAlign)
      Set the alignment parameters all at once.
      Parameters:
      vecAlign - (dx,dy,dz)
    • setAlignX

      public void setAlignX(double x)
      Set the horizontal misalignment
      Parameters:
      x - misalignment (in m)
      Since:
      Dec 17, 2014 by Christopher K. Allen
    • setAlignY

      public void setAlignY(double y)
      Set the vertical misalignment
      Parameters:
      y - misalignment (in m)
      Since:
      Dec 17, 2014 by Christopher K. Allen
    • setAlignZ

      public void setAlignZ(double z)
      Set the longitudinal misalignment
      Parameters:
      z - misalignment (in m)
      Since:
      Dec 17, 2014 by Christopher K. Allen
    • getUID

      public int getUID()
      Return the internal class unique identifier of this element.
      Returns:
      the unique identifier of this object
    • getAlignX

      public double getAlignX()
      Get the horizontal misalignment
      Returns:
      the misalignment (in meters)
      Since:
      Dec 17, 2014 by Christopher K. Allen
    • getAlignY

      public double getAlignY()
      Get the vertical misalignment
      Returns:
      the misalignment (in meters)
      Since:
      Dec 17, 2014 by Christopher K. Allen
    • getAlignZ

      public double getAlignZ()
      Get the longitudinal misalignment
      Returns:
      the misalignment (in meters)
      Since:
      Dec 17, 2014 by Christopher K. Allen
    • getPhiX

      public double getPhiX()
    • getPhiY

      public double getPhiY()
    • getPhiZ

      public double getPhiZ()
    • setPhiX

      public void setPhiX(double phix)
    • setPhiY

      public void setPhiY(double phiy)
    • setPhiZ

      public void setPhiZ(double phiz)
    • addCloseElements

      public void addCloseElements(Element closeElem)
      Add an element to the list of nearest neighbor elements used when considering the effects of PMQs
      Parameters:
      closeElem - an adjacent element
    • compProbeLocation

      public double compProbeLocation(IProbe probe)
    • getCloseElements

      public List<Element> getCloseElements()
      Return the list of nearest adjacent elements to this element. THis is used primarily in permanent magnet quadrupole considerations.
      Returns:
      List of adjacent modeling elements
    • compDriftingTime

      public double compDriftingTime(IProbe probe, double dblLen)
      Compute the time the probe probe spends drifting a a distance dblLen.
      Parameters:
      probe - interface to drifting probe
      dblLen - length of drift in meters
      Returns:
      time interval during drift in seconds
    • getType

      public String getType()
      Return the element type identifier
      Specified by:
      getType in interface IComponent
      Returns:
      element type string
    • getId

      public String getId()
      Returns the string identifier for this element.
      Specified by:
      getId in interface IComponent
      Returns:
      string identifier
    • getHardwareNodeId

      public String getHardwareNodeId()
      Returns the string identifier of the hardware node which this element models. Note that the element may model only a portion of the hardware object or simply an aspect of it. Thus, this is not a unique values among modeling elements.
      Specified by:
      getHardwareNodeId in interface IComponent
      Returns:
      the identifier string of the hardware this element models
      Since:
      Sep 2, 2014
    • initializeFrom

      public void initializeFrom(LatticeElement latticeElement)
      Conversion method to be provided by the user
      Specified by:
      initializeFrom in interface IComponent
      Parameters:
      latticeElement - the SMF node to convert
    • getLength

      public abstract double getLength()
      Return the length of this element. Derived class must implement this because it is undetermined whether or not this is a thin or thick element.
      Specified by:
      getLength in interface IComponent
      Returns:
      length of the element (in meters)
    • getPosition

      public double getPosition()
      Return the center position of the element along the design trajectory. This is the position with the containing lattice.
      Specified by:
      getPosition in interface IComponent
      Returns:
      center position of the element (meters)
    • getNodeLen

      public double getNodeLen()
      Returns the total length of the node, before the element was sliced by scenario generator
      Returns:
      original node length
    • getNodePos

      public double getNodePos()
      Returns the position of the node, before the element was sliced by scenario generator
      Returns:
      original node length
    • getLatticePosition

      public double getLatticePosition()
      Description copied from interface: IComponent

      Return the (center) position of this component within the global lattice structure to which it belongs. Note the difference between this parameter and that returned by IComponentIComponent.getLength() which returns the position with respect to the direct parent.

      The returned value is not usually a design parameter, in particular if composites are pasted together or otherwise form a larger tree structure. It should be computed according to the current structure of the global composite structure. Thus, moving this element in the lattice should change this value.

      Specified by:
      getLatticePosition in interface IComponent
      Returns:
      the center position of this component within the entire lattice containing this element (not just the parent)
      Since:
      Dec 3, 2015, Christopher K. Allen
      See Also:
    • getParent

      public IComposite getParent()
      Description copied from interface: IComponent
      Returns the composite structure (if any) that owns this component.
      Specified by:
      getParent in interface IComponent
      Returns:
      returns the composite structure owning this element, or null if this component is isolated
      Since:
      Jan 22, 2015 by Christopher K. Allen
      See Also:
    • setParent

      public void setParent(IComposite cpsParent)
      Description copied from interface: IComponent
      Sets the parent structure containing this component. The parent is assumed to be a composite structure built from component elements.
      Specified by:
      setParent in interface IComponent
      Parameters:
      cpsParent - the composite structure built from this component
      Since:
      Jan 22, 2015 by Christopher K. Allen
      See Also:
    • propagate

      public void propagate(IProbe probe, double pos) throws ModelException

      Override of IComponent.propagate(xal.model.IProbe, double) Propagates the Probe object through this element based on the associated algorithm.

      NOTE: CKA
      The position of the probe within the element appears to be kept as a field of the algorithm object. I am not exactly sure of any side-effects of this implementation when using the Tracker.propagate(IProbe, IElement) of the Tracker class. Careful when modifying.

      Specified by:
      propagate in interface IComponent
      Parameters:
      probe - probe object to propagate
      pos - I think it is position of the probe within this element
      Throws:
      ModelException - error occurred during propagation
      See Also:
    • propagate

      public void propagate(IProbe probe) throws ModelException

      Override of IComponent.propagate(xal.model.IProbe, double) Propagates the Probe object through this element based on the associated algorithm.

      Specified by:
      propagate in interface IComponent
      Parameters:
      probe - probe object to propagate
      Throws:
      ModelException - error occurred during propagation
      See Also:
    • backPropagate

      public void backPropagate(IProbe probe, double pos) throws ModelException

      Back propagates the Probe object through this element based on the associated algorithm.

      NOTES: CKA
      The position of the probe within the element appears to be kept as a field of the algorithm object. I am not exactly sure of any side-effects of this implementation when using the Tracker.propagate(IProbe, IElement) of the Tracker class. Careful when modifying.
      · Support for backward propagation February, 2009.
      · You must use the proper algorithm object for this method to work correctly!

      Specified by:
      backPropagate in interface IComponent
      Parameters:
      probe - probe object to propagate
      pos - I think it is position of the probe within this element
      Throws:
      ModelException - error occurred during propagation
      See Also:
    • backPropagate

      public void backPropagate(IProbe probe) throws ModelException

      Back propagates the Probe object through this element based on the associated algorithm.

      NOTES: CKA
      · Support for backward propagation February, 2009.
      · You must use the proper algorithm object for this method to work correctly!

      Specified by:
      backPropagate in interface IComponent
      Parameters:
      probe - probe object to propagate
      Throws:
      ModelException - error occurred during propagation
      See Also:
    • elapsedTime

      public abstract double elapsedTime(IProbe probe, double dblLen)
      Returns the time taken for the probe probe to propagate through a subsection of the element with length dblLen.
      Specified by:
      elapsedTime in interface IElement
      Parameters:
      probe - determine energy gain for this probe
      dblLen - length of subsection to calculate energy gain for
      Returns:
      the elapsed time through sectionUnits: seconds
    • energyGain

      public abstract double energyGain(IProbe probe, double dblLen)
      Returns energy gain for subsection of this element of length dblLen for the specified given probe.
      Specified by:
      energyGain in interface IElement
      Parameters:
      probe - determine energy gain for this probe
      dblLen - length of subsection to calculate energy gain
      Returns:
      the energy gain provided by this element Units: eV
    • longitudinalPhaseAdvance

      public abstract double longitudinalPhaseAdvance(IProbe probe, double dblLen)
      This is a kluge to make RF gaps work, since frequency is not defined for most modeling elements. For such elements we simply return 0 phase advance. For elements where frequency is defined, we can override this.
      Specified by:
      longitudinalPhaseAdvance in interface IElement
      Parameters:
      probe - the probe propagating through this element
      dblLen - distance the probe propagates through the element
      Returns:
      longitudinal phase advance of the probe through given distance
      Since:
      Nov 23, 2014
      See Also:
    • transferMap

      public abstract PhaseMap transferMap(IProbe probe, double dblLen) throws ModelException
      Compute the transfer matrix for subsection of this element of length dblLen for the specified given probe. That is, this method should return the incremental transfer matrix.
      Specified by:
      transferMap in interface IElement
      Parameters:
      dblLen - length of sub-element
      probe - probe containing parameters for the sub-sectional transfer matrix
      Returns:
      transfer map for an element of length dblLen
      Throws:
      ModelException - unable to compute transfer map
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Since:
      Jan 22, 2015 by Christopher K. Allen
      See Also:
    • print

      public void print(PrintWriter os)
      Dump current state and content to output stream.
      Parameters:
      os - output stream object