at.collective.beam_loading#

Functions

add_beamloading(ring, qfactor, rshunt[, ...])

Function to add beam loading to a cavity element, the cavity element is changed to a beam loading element that combines the energy kick from both the cavity and the resonator.

remove_beamloading(ring[, cavpts, copy])

Function to remove beam loading from a cavity element, the beam loading element is changed to a beam loading element that combines the energy kick from both the cavity and the resonator.

Classes

BeamLoadingElement(family_name, length, ...)

Class to generate a beamloading element, inherits from Element additional argument are ring, cavity, qfactor, rshunt.

CavityMode(*values)

CavityMode.ACTIVE is an active feedback loop, acting on both detuning and generator voltages to compensate the beam induced voltage.

FeedbackMode(*values)

FeedbackMode.ONETURN means the feedback is only using the most recent turn, and the delta is applied each turn multiplied by VoltGain or PhaseGain.

class BeamLoadingElement(family_name, length, voltage, frequency, ring, qfactor, rshunt, detune=0.0, cavitymode=CavityMode.ACTIVE, fbmode=FeedbackMode.ONETURN, buffersize=0, **kwargs)[source]#

Bases: RFCavity, Collective

Class to generate a beamloading element, inherits from Element additional argument are ring, cavity, qfactor, rshunt.

Parameters:
  • ring (Lattice) – Lattice object

  • length (float) – Length of the cavity

  • voltage (float) – Cavity voltage [V]

  • frequency (float) – Cavity frequency [Hz]

  • qfactor (float) – Q factor

  • rshunt (float) – Shunt impedance, [\(\Omega\)].

Keyword Arguments:
  • Nslice (int) – Number of slices per bunch. Default: 101

  • Nturns (int) – Number of turn for the wake field. Default: 1

  • ZCuts – Limits for fixed slicing, default is adaptive

  • NormFact (float) – Normalization factor

  • [Hz] (detune) – Define how much to detune the cavity from resonance in unints of Hz

  • cavitymode (CavityMode) – Is cavity ACTIVE (default), PASSIVE or PASSIVE_SETVOLTAGE (Passive with a voltage feedback). For PASSIVE_SETVOLTAGE, the voltage setpoint is specified with passive_voltage

  • [V] (passive_voltage) – Voltage setpoint with the passive cavity with feedback.

  • PhaseGain (float) – Used for cavity feedbacks. States the gain on the phase correction factor to be applied.

  • VoltGain (float) – Used for cavity feedbacks. States the gain on the phase correction factor to be applied.

  • buffersize (int) – Size of the history buffer for vbeam, vgen, vbunch (default 0)

  • feedback_angle_offset – Fixed detuning from optimal tuning angle [rad]. For a negative slope of the RF voltage at the synchronous position, the optimum detuning is negative. Applying a positive feedback_angle_offset will therefore reduce the detuning. The reverse is true for positive RF slope.

  • ts (float) – The timelag of the synchronous particle in the full RF system [m]. If not specified, it will be calculated using get_timelag_fromU0. Defines the expected position of the beam to be used for the beam loading setpoints.

  • fbmode (FeedbackMode) – States the mode for the parameter calculation to be used for the loop. ONETURN (default) takes only the current turn, compared to WINDOW which takes a sliding window.

  • windowlength (int) – for WINDOW feedback mode, states the length [turns] for the sliding window. Must be smaller than buffersize.

  • system_harmonic (float) – Used to compute the nominal rf frequency for the given system. e.g. third of fourth harmonic of rf_frequency. If None, then will be computed to the nearest integer multiple of rf_frequency.

Returns:

bl_elem (Element) – beam loading element

static build_from_cav(cav, ring, qfactor, rshunt, cavitymode=CavityMode.ACTIVE, buffersize=0, **kwargs)[source]#

Function to build the BeamLoadingElement from a cavity the FamName, Length, Voltage, Frequency and HarmNumber are taken from the cavity element.

Parameters:
  • ring (Sequence) – Lattice object

  • qfactor (float) – Q factor

  • rshunt (float) – Shunt impedance, [\(\Omega\)]

Keyword Arguments:
  • Nslice (int) – Number of slices per bunch. Default: 101

  • Nturns (int) – Number of turn for the wake field. Default: 1

  • ZCuts – Limits for fixed slicing, default is adaptive

  • NormFact (float) – Normalization factor

  • cavitymode (CavityMode) – type of beam loaded cavity ACTIVE (default) for a cavity with active compensation, or PASSIVE to only include the beam induced voltage

  • buffersize (int) – Size of the history buffer for vbeam, vgen, vbunch (default 0)

Returns:

bl_elem (Element) – beam loading element

clear_history(ring=None)[source]#
is_compatible(other)[source]#

Checks if another Element can be merged.

property Buffersize#
property Nslice#

Number of slices per bunch.

property Nturns#

Number of turn for the wake field.

property ResFrequency#

Resonator frequency.

property TurnHistory#

Turn history of the slices center of mass.

property Vbeam#

Beam phasor (amplitude, phase).

property Vbeam_buffer#

Stored beam induced voltage data.

property Vbunch#

Bunch phasor (amplitude, phase).

property Vbunch_buffer#

Stored bunch induced voltage data.

property Vcav#

Cavity phasor (amplitude, phase).

property Vgen#

Generator phasor (amplitude, phase).

property Vgen_buffer#

Stored generator voltage data.

default_pass = {False: 'DriftPass', True: 'BeamLoadingCavityPass'}#
class CavityMode(*values)[source]#

Bases: IntEnum

CavityMode.ACTIVE is an active feedback loop, acting on both detuning and generator voltages to compensate the beam induced voltage.

CavityMode.PASSIVE takes a fixed cavity frequency and assumes zero generator voltage.

CavityMode.PASSIVE_SETVOLTAGE is a feedback loop for a passive harmonic cavity. The frequency of the cavity is varied in order to maintain a voltage setpoint.

ACTIVE = 1#
PASSIVE = 2#
PASSIVE_SETVOLTAGE = 3#
class FeedbackMode(*values)[source]#

Bases: IntEnum

FeedbackMode.ONETURN means the feedback is only using the most recent turn, and the delta is applied each turn multiplied by VoltGain or PhaseGain.

FeedbackMode.WINDOW means the beam voltage passed to the feedback is the average of the WINDOW. For this method, buffersize and windowlength must also be provided.

ONETURN = 1#
WINDOW = 2#
add_beamloading(ring, qfactor, rshunt, cavpts=None, copy=False, **kwargs)[source]#

Function to add beam loading to a cavity element, the cavity element is changed to a beam loading element that combines the energy kick from both the cavity and the resonator.

Parameters:
  • ring (Lattice) – Lattice object

  • qfactor (float | Sequence[float]) – Q factor. Scalar or array of float are accepted

  • rshunt (float | Sequence[float]) – Shunt impedance, [\(\Omega\)] for longitudinal Scalar or array of float are accepted

Keyword Arguments:
  • cavpts (Refpts) – refpts of the cavity. If None (default) apply to all cavity in the ring

  • Nslice (int) – Number of slices per bunch. Default: 101

  • Nturns (int) – Number of turn for the wake field. Default: 1

  • ZCuts – Limits for fixed slicing, default is adaptive

  • NormFact (float) – Normalization factor

  • copy – If True, returns a shallow copy of ring with new beam loading elements. Otherwise, modify ring in-place

  • cavitymode (CavityMode) – Define PASSIVE or ACTIVE cavity

  • buffersize (int) – Size of the history buffer for vbeam, vgen, vbunch (default 0)

remove_beamloading(ring, cavpts=None, copy=False)[source]#

Function to remove beam loading from a cavity element, the beam loading element is changed to a beam loading element that combines the energy kick from both the cavity and the resonator.

Parameters:

ring – Lattice object

Keyword Arguments:
  • cavpts (Refpts) – refpts of the beam loading Elements. If None (default) apply to all elements

  • copy – If True, returns a shallow copy of ring with new cavity elements. Otherwise, modify ring in-place