Package xal.smf

Class ElementFactory

java.lang.Object
xal.smf.ElementFactory

public class ElementFactory extends Object
Factory class for creation of AcceleratorNode elements, primarily designed to be used by importers from external accelerator formats to openxal.
Author:
Blaz Kranjc
  • Method Details

    • createMainSupply

      public static MagnetMainSupply createMainSupply(String name, Accelerator acc)
      Creates a power supply and adds it to the accelerator.
      Parameters:
      name - Name of the power supply.
      acc - Accelerator that will contains the power supply.
      Returns:
      Power supply object.
    • createMarker

      public static Marker createMarker(String name, double position)
      Creates the Marker node with specified properties.
      Parameters:
      name - Name of the marker.
      position - Position of the marker in the accelerator.
      Returns:
      Marker object.
    • createBPM

      public static BPM createBPM(String name, double frequency, double length, double position)
      Creates the BPM node with specified properties.
      Parameters:
      name - Name of the BPM.
      frequency - Frequency before this element.
      length - Length of the BPM in meters.
      position - Position of BPM.
      Returns:
      BPM object.
    • createQuadrupole

      public static Quadrupole createQuadrupole(String name, double length, double gradient, ApertureBucket aper, MagnetMainSupply ps, double position)
      Creates the Quadrupole node with specified properties.
      Parameters:
      name - Name of the Quadrupole.
      length - Length of the Quadrupole in meters.
      gradient - Magnetic field gradient in T/m.
      aper - Aperture details.
      ps - Power supply for the magnet. Can be null.
      position - Position of Quadrupole.
      Returns:
      Quadrupole object.
    • createPermQuadrupole

      public static PermQuadrupole createPermQuadrupole(String name, double length, double gradient, ApertureBucket aper, double position)
      Creates the PemQuadrupole node with specified properties.
      Parameters:
      name - Name of the Quadrupole.
      length - Length of the Quadrupole in meters.
      gradient - Magnetic field gradient in T/m.
      aper - Aperture details.
      position - Position of Quadrupole.
      Returns:
      PermQuadrupole object.
    • createCorrector

      public static DipoleCorr createCorrector(String name, int orientation, double length, ApertureBucket aper, MagnetMainSupply ps, double position)
      Creates the DipoleCorrector node with specified properties.
      Parameters:
      name - Name of the corrector.
      orientation - Orientation of the corrector.
      length - Length of the corrector in meters.
      aper - Aperture details.
      ps - Power supply for the magnet. Can be null.
      position - Position of the corrector in the accelerator.
      Returns:
      Dipole correctors.
    • createBend

      public static Bend createBend(String name, double alpha, double k, double rho, double entryAngle, double exitAngle, double quadComp, ApertureBucket aper, MagnetMainSupply ps, double position)
      Creates the Bend node with specified properties. Length of the magnet and magnetic field are calculated from provided arguments.
      Parameters:
      name - Name of the bend magnets.
      alpha - Bend angle in degrees.
      k - beta*gamma*Er/(e0*c).
      rho - Curvature radius in meter.
      entryAngle - Entry angle in degrees.
      exitAngle - Exit angle in degrees.
      quadComp - Quadrupole component error on dipole.
      aper - Aperture details.
      ps - Power supply for the magnet. Can be null.
      position - Position of the magnet in the accelerator.
      Returns:
      Bend object.
    • createRfGap

      public static RfGap createRfGap(String name, boolean isFirst, double ampFactor, ApertureBucket aper, double length, double position)
      Creates the RfGap node with specified properties.
      Parameters:
      name - Name of the RF gap.
      isFirst - Is this the first gap in cavity.
      ampFactor - Amplification factor.
      aper - Aperture details.
      length - Length of gap in meters.
      position - Position of RF gap.
      Returns:
      RfGap object.
    • createRfCavity

      public static RfCavity createRfCavity(String name, double length, AcceleratorNode node, double phiS, double amplitude, double frequency, double position)
      Creates the RfCavity node with specified properties. TTF and STF coefficients are not overwritten.
      Parameters:
      name - Name of the RF cavity.
      length - Length of the cavity in meters.
      node - Node to include in the cavity.
      phiS - Phase.
      amplitude - Amplitude.
      frequency - Frequency at the start of the element.
      position - Position of the cavity.
      Returns:
      RfCavity object.
    • createRfCavity

      public static RfCavity createRfCavity(String name, double length, AcceleratorNode[] nodes, double phiS, double amplitude, double frequency, double position)
      Creates the RfCavity node with specified properties. TTF and STF coefficients are not overwritten.
      Parameters:
      name - Name of the RF cavity.
      length - Length of the cavity in meters.
      nodes - Nodes to include in the cavity.
      phiS - Phase.
      amplitude - Amplitude.
      frequency - Frequency at the start of the element.
      position - Position of the cavity.
      Returns:
      RfCavity object.