Class LatticeSequence

java.lang.Object
xal.sim.scenario.LatticeElement
xal.sim.scenario.LatticeSequence
All Implemented Interfaces:
Comparable<LatticeElement>, Iterable<LatticeElement>
Direct Known Subclasses:
LatticeSequenceCombo

public class LatticeSequence extends LatticeElement implements Iterable<LatticeElement>

The Open XAL online model lattice generator is primarily contained here.

Given a valid ElementMapping object, AcceleratorSeq object, and SynchronizationManager for the online model, the LatticeSequence will create an online model Lattice object. This object is used by a ScenarioGenerator to create a new Scenario object.

Thus, the actual "lattice generation" is done here. The peripheral resources such as hardware node to model element mappings and synchronization managers are created outside this class.

Since:
Dec 8, 2014
Author:
Christopher K. Allen
  • Field Details

    • EPS

      public static final double EPS
      Small number - usually the minimum drift length
      See Also:
  • Constructor Details

    • LatticeSequence

      public LatticeSequence(AcceleratorSeq smfSeqRoot, ElementMapping mapNodeToElem)

      Constructor for lattice sequences. Instantiates a new LatticeSequence object for the given accelerator sequence under the assumption that that sequence is the top level (i.e., not a sub-sequence).

      NOTES

      · The lattice element position and index parameters for the base class are both set to zero since this is the root of the lattice structure.

      Parameters:
      smfSeqRoot - top level associated hardware accelerator sequence
      mapNodeToElem - the mapping of SMF hardware nodes to modeling element class types
      Since:
      Dec 8, 2014 @author Christopher K. Allen
  • Method Details

    • isRfCavity

      public boolean isRfCavity()
      Indicates whether or not the associated hardware accelerator sequence is an RF cavity structure. Such structures are derived from the base class RfCavity.
      Returns:
      true if the accelerator sequence is and RF cavity, false otherwise
      Since:
      Dec 9, 2014
    • isAxisOriginCentered

      public boolean isAxisOriginCentered()
      Returns whether or the origin of the axis is at the center of the sequence, normally it is located at the entrance of the sequence.
      Returns:
      true if the axis origin is at the center of the sequence, false otherwise (likely at the sequence entrance)
      Since:
      Jan 29, 2015 by Christopher K. Allen
    • getSequenceModelType

      public Class<? extends IComposite> getSequenceModelType(AcceleratorSeq smfSeq)
      Convenience method for getting the modeling element type for the given accelerator sequence according to the current node to element mapping.
      Parameters:
      smfSeq - accelerator sequence hardware object to be looked up in the map
      Returns:
      modeling class for the given accelerator sequence
      Since:
      Dec 12, 2014 @author Christopher K. Allen
    • getNodeToElementMap

      public ElementMapping getNodeToElementMap()
      Returns the map of SMF hardware nodes to online modeling elements, or more specifically, modeling element class types. This map is used when creating a modeling element for any given hardware node.
      Returns:
      mapping between hardware nodes and modeling elements used to generate the model lattice
      Since:
      Jan 21, 2015 by Christopher K. Allen
    • createModelLattice

      public Lattice createModelLattice(SynchronizationManager mgrSync) throws ModelException
      Creates a new model lattice object according to the configuration of this lattice sequence. The given synchronization manager is populated with synchronization associations for the returned model lattice. However, the synchronization manager is still unbound to any scenario.
      Parameters:
      mgrSync - synchronization manager to receive synchronization associations for the model elements in the returned model lattice
      Returns:
      new model lattice with the configuration provided by the accelerator sequence given to the public constructor
      Throws:
      ModelException - problem instantiating modeling elements
      Since:
      Dec 11, 2014
    • getSubSequences

      public final List<LatticeSequence> getSubSequences()
      Returns an iterator that will visit all the direct subsequences of this sequence.
      Returns:
      iterator for all the direct subsequences of this sequence
      Since:
      Jan 29, 2015 by Christopher K. Allen
    • iterator

      public Iterator<LatticeElement> iterator()
      Iterates element by element through the element lattice from head to tail.
      Specified by:
      iterator in interface Iterable<LatticeElement>
      Since:
      Dec 9, 2014
      See Also:
    • isThin

      public boolean isThin()
      Always returns false
      Overrides:
      isThin in class LatticeElement
      Returns:
      true if a modeling element derived from ThinElement will be returned, false otherwise
      Since:
      Dec 9, 2014
      See Also:
    • getModelingClass

      public Class<? extends IComposite> getModelingClass()
      Description copied from class: LatticeElement
      Returns the class type of the modeling element used to represent the associated hardware node.
      Overrides:
      getModelingClass in class LatticeElement
      Returns:
      class type of the modeling element to be created
      Since:
      Dec 9, 2014
      See Also:
    • getHardwareNode

      public AcceleratorSeq getHardwareNode()
      Overrides the base class LatticeElement.getHardwareNode() method so that it down casts the result to the tighter type of AcceleratorSeq rather than AcceleratorNode. This class can be instantiated only with a AcceleratorSeq derived hardware node, we are just enforcing it here.
      Overrides:
      getHardwareNode in class LatticeElement
      Returns:
      the accelerator sequence hardware associated with this lattice sequence object
      Since:
      Dec 11, 2014
      See Also:
    • createModelingElement

      public IComposite createModelingElement() throws ModelException

      Creates and initializes a new modeling composite sequence represented by this object. Java reflection is used to create a new instance from the sequence's class type. There must be a zero constructor for the element.

      CKA Notes

      · The parameter initialization is done by calling the IComponent.initializeFrom(LatticeElement). This design effectively couples the xal.model online model subsystem to the xal.smf hardware representation subsystem. These systems should be independent, able to function without each other.

      Overrides:
      createModelingElement in class LatticeElement
      Returns:
      a new modeling sequence for the hardware proxied by this object
      Throws:
      ModelException - Java reflection threw an InstantiationException
      Since:
      Jan 16, 2015
    • toString

      public String toString()
      Lists all the internal lattice elements line by line.
      Overrides:
      toString in class LatticeElement
      Since:
      Dec 9, 2014
      See Also:
    • createModelSequence

      protected IComposite createModelSequence(SynchronizationManager mgrSync) throws ModelException
      Builds an online model element sequence for the accelerator sequence provided to the public constructor of this class. This is done by calling the private methods populateLatticeSeq(), splitSequenceElements(), and createModelElements(SynchronizationManager) in that order. When the actual modeling elements are instantiated (via createModelElements(SynchronizationManager)) they are connected to the given synchronization manager.
      Parameters:
      mgrSync - synchronization manager to receive synchronization associations for the new created model elements
      Returns:
      new online model sequence with the configuration provided by the accelerator sequence given to the public constructor
      Throws:
      ModelException - problem instantiating modeling elements
      Since:
      Jan 21, 2015 by Christopher K. Allen
    • createParentLattice

      protected Lattice createParentLattice()
      Creates the actual model lattice object from the given element sequence.Some of the cursory fields of the lattice are populated.
      Returns:
      model lattice object containing the given root sequence
      Since:
      Jan 20, 2015 by Christopher K. Allen