Digital RF Control System for the Pulsed Superconducting Linear Accelerator

The FLASH (Free Electron Laser in Hamburg) (Ackermann et al., 2007) is a user facility providing high brilliant laser light for experiments. It is also a unique facility for testing the superconducting accelerator technology for the European XFEL (Weise, 2004) and the International Linear Collider (Ross et al., 2011). The LLRF (low level RF) system is used to maintain the beam stabilities by stabilizing the RF field in the superconducting cavities with feedback and feed-forward algorithms. In the RF system for FLASH linear accelerator each klystron supplies RF power to up to 16 cavities. The superconducting cavities are operating in pulsed mode and high accelerating gradients close to the performance limit. The RF control of the cavity fields to the level of 10-4 for amplitude and 0.1 degree for phase however presents a significant technical challenge due to the narrow bandwidth of the cavities which results in high sensitivity to perturbations of the resonance frequency by mechanical vibrations (microphonics) and Lorentz force detuning. FLASH accelerator LLRF control system employs a completely digital feedback system to provide flexibility in the control algorithms, precise calibration of the accelerating field, and extensive diagnostics and exception handling capabilities. The LLRF control algorithms are implemented in FPGAs (field programmable gate array) firmware and DOOCS (Distributed Object Oriented Control System) (Rehlich, 2007) control system servers.


Introduction
The FLASH (Free Electron Laser in Hamburg) (Ackermann et al., 2007) is a user facility providing high brilliant laser light for experiments. It is also a unique facility for testing the superconducting accelerator technology for the European XFEL (Weise, 2004) and the International Linear Collider (Ross et al., 2011). The LLRF (low level RF) system is used to maintain the beam stabilities by stabilizing the RF field in the superconducting cavities with feedback and feed-forward algorithms. In the RF system for FLASH linear accelerator each klystron supplies RF power to up to 16 cavities. The superconducting cavities are operating in pulsed mode and high accelerating gradients close to the performance limit. The RF control of the cavity fields to the level of 10 -4 for amplitude and 0.1 degree for phase however presents a significant technical challenge due to the narrow bandwidth of the cavities which results in high sensitivity to perturbations of the resonance frequency by mechanical vibrations (microphonics) and Lorentz force detuning. FLASH accelerator LLRF control system employs a completely digital feedback system to provide flexibility in the control algorithms, precise calibration of the accelerating field, and extensive diagnostics and exception handling capabilities. The LLRF control algorithms are implemented in FPGAs (field programmable gate array) firmware and DOOCS (Distributed Object Oriented Control System) (Rehlich, 2007) control system servers.

Brief description of FLASH facility
The FLASH consists of a 256 m long electron linear accelerator followed by a photon transport line equipped with photon diagnostics and 5 experimental beam lines for users (Vogt et al., 2011). A schematic layout of the facility is shown in fig. 1. The injector consists of a laser-driven photocathode in a 1.5-cell RF cavity operating at 1.3 GHz with a peak accelerating field of 40 MV/m on the cathode. The electron injector section is followed by a total of seven 12.2 m long accelerating modules each containing eight 9-cell L-band superconducting niobium cavities. The maximum accelerating gradient in the best cavities is 35 MV/m. The average gradient is about 22 MV/m. With seven accelerating modules the maximum energy of the FLASH linac is about 1250 MeV.
In order to remove the RF induced curvature, a module with four superconducting cavities operating at 3.9 GHz (third harmonic of 1.3 GHz) is installed downstream of the first accelerating module (Harms et al., 2009). Downstream of the last accelerating module FLASH has a transverse collimation section and a dispersive "dog-leg" for energy collimation upstream of the undulators. At intermediate energies of 150 MeV and 500 MeV the electron bunches are longitudinally compressed, thereby increasing the peak current. The FEL radiation is produced by six 4.5 m long undulators. The undulators consist of permanent NdFeB magnets with a fixed gap of 12 mm, a period length of 27.3 mm and peak magnetic field of 0.47 T. The wavelength of the FEL radiation depends on the energy of the accelerated electrons. It can be tuned between 4.1 nm and 44 nm. In addition, an experiment for seeded FEL radiation, sFLASH, is integrated to the FLASH linac. One bunch per RF pulse can be seeded in 4 tunable (variable gap) undulators.

FLASH RF system overview and sources for field errors
The accelerating modules are powered by four RF stations consisting a klystron (three 5 MW klystrons and one 10 MW multi-beam klystron), a high voltage pulse transformer and a pulsed power supply (modulator). Third harmonic module is driven by a custom-made klystron and modulator. In addition, the RF gun has its own RF station with a 5 MW klystron. The cavities in FLASH are operating in a pulsed mode. The pulse repetition rate is 10 Hz. The RF pulse length is 1300 µs from which 500 µs are required to build up the RF field in the cavities. The beam is accelerated for 800 µs with a constant accelerating field.
The low level RF system provides field control for the RF gun and the superconducting cavities with the vector-sum group of cavities. Fig. 2 shows main components of the FLASH RF control scheme. At FLASH, with the vector-sum concept, one klystron powers a set of up to 16 cavities (for European XFEL project, this number will be 32). This is cost efficient compared to a solution where each cavity has its own RF station consisting of one controller and one amplifier. RF power is distributed from a high power klystron to the cavities via a forked set of waveguides. The synchronism of the incident waves to the cavities is ensured by waveguide tuners in front of each cavity which allow an adjustment of phases for individual cavities. A frequency tuning mechanism is used to operate the cavities on resonance. Fig. 2 also shows the reference master oscillator and the timing system which plays a central role in the LLRF system. The goal of LLRF control can be stated as locking the field inside the resonators to the reference.
Each accelerating cavity has one input coupler for RF power and a small pickup antenna to measure the cavity field. Probes measure the field directly inside the cavities by coupling out a small fraction of the power. The measured fields are digitized and further processed by FPGAs www.intechopen.com in order to calculate the vector-sum and from that, by comparison with the set-point, the drive that is applied to the klystron. The stability of the accelerating field depends critically on the precision of the calibration of the vector-sum which is based on transient beam loading.

Microphonics
Mechanical vibrations caused by the accelerator environment such as vacuum pumps at the cryogenics facility are always present and are transferred to the accelerating structures trough the beam pipe and transfer lines as well as trough ground motion. The amplitude of the excitation and associated frequency spectrum depend strongly on the coupling of the cavities and the mechanical resonance frequencies and their mechanical quality factor. Measurements in FLASH accelerating module show typical excitation amplitudes of the order of 5-10 Hz rms (Schilcher, 1998;Ayvazyan et al., 2007) and frequencies ranging from 0.1 Hz up to a few hundred Hz reflecting the convolution of mechanical resonances with the spectral components of the sources of excitation.

Lorentz force detuning
The static detuning of resonator due to Lorentz force is proportional to the square of the accelerating field. In the case of pulsed RF fields the mechanical resonances of the cavities will be excited resulting in a time varying detuning even during the flat-top portion of the RF pulse where the gradient is constant (Ayvazyan & Simrock, 2004). The lower the mechanical quality factor and the higher the resonance frequency (only longitudinal modes should be excited), the less likely is the enhancement of peak cavity detuning caused by resonant excitation by the Lorentz force. Stiffening rings at the iris are used to reduce the Lorentz force detuning constant and increase the mechanical resonance frequencies.

Beam loading
The loaded quality factor is usually chosen for matched conditions so that all of the generator power (with the exception of a small amount dissipated in the cavities) is transferred to the beam under design operating conditions. In the case of on-crest operation the magnitude of the beam induced voltage is half of the generator induced voltage.

RF control requirements
The RF control requirements for amplitude and phase stability are usually derived from the desired beam parameters. It is also important to include operational issues such as the turnon of the RF system, calibration of gradient and phase, and control of the waveguide and frequency tuners.

Amplitude and phase stability
The requirements for amplitude and phase stability of the vector-sum group of cavities are driven by the maximum tolerable energy spread for the FLASH linac. The goal is an rms energy spread of  E /E=10 -4 . The requirements for gradient and phase stability are therefore of the order of 10 -4 and 0.1 degree respectively.
The amplitude and phase errors to be controlled are of the order of 5% for the amplitude and 20 degrees for the phase as a result of Lorentz force detuning and microphonics. These errors must be suppressed by a factor of more than 100 which implies that the loop gain must be adequate to meet this goal. Fortunately, the dominant source of errors is repetitive (Lorentz force and beam loading) and can be reduced by use of feed-forward significantly.
The requirements for the phase stability become also more severe for off-crest operation. In the case of the control of the vector-sum of several cavities driven by one klystron, the requirement for the phase calibration of the vector-sum components may become critical depending on the magnitude of microphonics.

Operational requirements
Besides field stabilization the RF control system must provide diagnostics for the calibration of gradient and beam phase, measurement of the loop phase, cavity detuning, and control of the cavity frequency tuners. Exception handling capability must be implemented to avoid unnecessary beam loss. Features such as automated fault recovery will help to maximize accelerator up-time. The RF control must be fully functional over a wide range of operating parameters such as gradients and beam current. For efficiency reasons the RF system should provide sufficient control close to klystron saturation.

Design choices for the RF control
Control of the RF power normally takes place on the low power level before the amplification of the signals. The main components are detectors for amplitude and phase of the individual cavity fields, the controller for the feedback itself, and actuators to regulate the incident wave to the klystron and thus to the cavities. There are different ways to drive an RF cavity (Schilcher, 1998): the generator driven resonator, the self-excited loop and the direct RF feedback. In the first two cases one can choose to control amplitude and phase or the real and imaginary parts of the incident RF vector.
Apart from the direct RF feedback all other introduced RF control systems include elements to detect amplitude and phase of the RF field. In general an RF field is described by a vector in the complex plane. This RF vector can be represented either by its amplitude and phase with respects to a reference oscillator or by its real and imaginary parts. These are sometimes called the I (in-phase, 0 degree) and the Q (quadrature, 90 degree) components of a vector. The appropriate choice of representation depends on the requirements. An amplitude detector is usually a Schottky diode and a widely used phase detector is a double balanced RF mixer. The determination of real and imaginary parts is completely based on RF mixers. Phase noise from the master oscillator directly influences the measurement of real and imaginary parts while in the traditional amplitude and phase control only the phase measurement is affected. If the disturbance of the RF field is mainly on the amplitude, gradient and phase control might be preferable. On the other hand, vector control by real and imaginary parts is preferred in systems with large errors in amplitude and phase where sufficiently high feedback gains have to be used. It should be noted that a phase controller can cause a phase correction in a wrong quadrant if the gain is too high. Besides that the phase is not well defined if the input signal of the phase detector is too small. As a result it is not possible to control the zero set point with amplitude and phase controllers.

LLRF control implementation at FLASH
In the linac of FLASH the cavities are operated with a driven feedback system. Lorentz force detuning and microphonics lead to considerable amplitude and phase disturbances in the superconducting cavities with their high quality factors. The expected errors are in the order of a few percent for amplitude and above 20 degrees for the phase during the 800 µs long beam pulse. Therefore a vector control has been chosen. RF mixers decompose the cavity RF vector into the real and imaginary parts. The incident RF wave is regulated by a vector modulator. In principle the feedback controller can be realized as an analog or a completely digital system. In the case of a digital system ADCs digitize the decomposed RF signal from the cavity. A following digital signal processing stage performs the feedback algorithm before the calculated actuator signals are reconverted to analog signals. For the RF control in the FLASH a fully digital system has been implemented and it has several stages of major developments (Simrock et al., 1996;Schilcher, 1998;Ayvazyan et al., 2005Ayvazyan et al., , 2007Ayvazyan et al., , 2010.

Principles for LLRF control
The RF system signal flow is shown in fig. 3. The cavity probe signal is down converted from the cavity frequency of 1.3 GHz (3.9 GHz) to an intermediate frequency (IF) of 250 kHz for superconducting modules and 54 MHz for the 3 rd harmonic module. This lower IF holds the original amplitude and phase information of the field inside the cavity.
The control algorithm employs tables for feed-forward, set-point and feedback gain settings to allow time varying of those parameters. The down converted signal is digitized with ADCs (sampling rates of 1 MHz or 81 MHz are used). The digitized signal is going to the digital field detector which extracts the I and Q components out of the input stream. We use two different methods: IQ-sampling and so-called non-IQ-sampling or IF-sampling. The resulting field vector of each cavity is multiplied by a rotation matrix to calibrate amplitude and phase. Finally the field vectors of 8 cavities are summed up for the vector-sum of a whole cryogenic module, and those of 2 cryogenic modules are summed up to the vectorsum of the RF station which is driven by single klystron. The vector-sum of the 16 cavity fields represents the total voltage and phase seen by the beam. This signal is regulated by a feedback control algorithm which calculates corrections to the driving signal of the klystron: the measured vector-sum is subtracted from the set-point table and the resulting error signal is amplified and filtered to provide a feedback signal to the vector modulator controlling the incident wave. A feed-forward signal is added to correct the averaged repetitive error components. Beam current information (measured by toroids) is used to scale the feedforward table to provide fast feed-forward corrections if the beam current varies. In addition beam diagnostics signals are in use for fast intra-pulse feedback . The cavity detuning is determined from forward power reflected power, and probe signal and is used to control the fast piezo tuners to reduce cavity detuning errors to less than a tenth of the cavity bandwidth.  . 4) which has a VME interface, 10 ADCs to digitize the intermediate frequency signal from the field probe signals, FPGAs and DSPs to execute the control algorithms and 8 DACs, 2 of them drives the vector modulator for field control. Other components include a timing and synchronization module. The field detection hardware consists of a down converter which converts the cavity field frequency of 1.3 GHz (3.9 GHz) to an intermediate frequency. Additional features included variable input attenuators for level adjustment, an input for a calibration signal and a local oscillator distribution system. The challenging requirements of the down converters are low noise, good linearity over large dynamic range, and small crosstalk. A function generator with VME interface drives a vector-modulator which produces the local www.intechopen.com oscillator signal generated from the 1.3 GHz. It switches the local oscillator phase by 90 degrees every microsecond.

Digital feedback software
The cavity field controller algorithm consists of the field detection scheme ( fig. 5), calculation of the calibrated vector-sum, the field error measurement, the controller filter, a feed-forward signal, and the drive signal generation. Beam loading compensation through feed-forward and real time beam measurements are supported. The LLRF control system is integrated with FLASH control system DOOCS (Hensler et al., 2010) by a development of device and middle layer servers. Furthermore the DOOCS standard server is used for automation, like simple FSMs (finite state machine), and the FLASH data acquisition system for bunch-to-bunch monitoring tasks, e.g. quench detection. The control system for the cavities which are driven by a single klystron is considered as a functionally complete unit of the RF system. The feedback algorithm is implemented in the FPGA system. The digital signal processing in turn gets its parameters from the controller server. The controller server software handles: generation of set-point, feed-forward and feedback gain tables from basic settings, rotation matrices for I and Q of each cavity, loop phase constant, start-up configuration files, feedback parameters and exception handler control parameters. The functionality of the server gives the user the opportunity to down/upload data into the FPGA and download and start the controller firmware. The server calculates and adjusts the set of the feedback algorithm parameters in accordance with the required www.intechopen.com field gradient and phase value. The interrupt service routines are used to start the data reading from the controller board. The parameters of the feedback algorithm are modified by the FPGA programs in the time slot between beam macro-pulses.

Piezo control
The cavities operating with high gradient are deformed due to Lorentz force that causes detuning of the order of the cavity bandwidth from resonance frequency. Detuned cavity reflects the supplied RF power that requires excessive RF driving. For the compensation of Lorentz force detuning (LFD) the piezo actuator is used to excite the cavity mechanically. Each cavity in new accelerating modules (1 st , 6 th and 7 th ) is equipped with double piezos that allow compensating of LFD and measurement of cavity vibrations simultaneously (Przygoda et al., 2010). Fig. 6. Lorentz force detuning compensation in 6 th accelerating module (green -detuning with piezo compensation, red -without) The piezo control system is able to compute detuning in each cavity basing on RF signals and calculates the parameters of compensating piezo excitation pulse. The signal from programmable generator is amplified by high power piezo driver. The results of LFD compensation in 6 th module is presented in fig. 6. Using piezos the dynamic and static detuning was compensated to only few Hz during flattop in all cavities except the 5 th one where piezo is not fixed properly.

Application software
A set of generic and especially devoted programs provides the tools for the operators to control the RF system (Geng et al., 2011). Some of them are created based on the MATLAB, others, for example, vector-sum calibration are implemented as DOOCS middle layer servers. The adaptive feed-forward is implemented on a front end server, to allow pulse to pulse adaptation.
The application software includes automated operation of the frequency tuners, calibration, phasing of cavities, and adjustment of various control system parameters such as feedback gains, feed-forward tables, and set-point correction during cavity filling. Extensive diagnostics inform the operator about cavity quenches, cavities requiring tuning, and an excessive increase in control power.

Adaptive control
The RF field regulation is subject to various, random and deterministic disturbance sources. Both disturbance contributions are reduced in closed loop operation by applying a feedback compensator. However repetitive disturbances are particularly suppressed by adaptation of the system input drive, using the known system response from previous pulses. The reference for the RF field is in general not changed very frequently, so the control task can be seen as a repetitive process for the pulsed operation mode of this accelerator. The basic update algorithm (Schmidt, 2010) is given by where u k and e k are defined as the system input and the deviation of the measured RF output to the given set-point for the pulse number k, respectively. L(t) is a linear, non-causal, time varying filter based on the identified system model. The current implementation of the system allows changes of all controller tables inside the FPGA between two consecutive pulses. With the minimum computation time necessary for this algorithm, as well as fast data transfer is fast enough, the adaptation can be performed synchronized to the repetition rate of FLASH. Therefore three steps have to be performed between two pulses: read from previous pulse the error and feed-forward signals e and u, compute the feed-forward signal of next pulse, and write the feed-forward signals to FPGA tables.

Beam based calibration
In this section, the algorithm for system calibration based on the moderate beam (such as 30 bunches with 3nC bunch charge) is presented, including: vector-sum calibration, cavity gradient and phase calibration, forward and reflected power calibration.
For this calibration scheme, the beam pulse should be short compared to the time constant of the cavity, so that the beam induced voltage can be calculated with approximation, for the beam transient measurement (Brandt, 2007). Another more practical measurement method of the beam transient follows the steps below:  Measure the cavity probe signals without beam as reference.  Switch on the beam, and then measure the cavity probe signals with beam.  Compare the two measurements, and the beam transient can be estimated by subtracting the reference from the cavity probe signals with beam.
Note the microphonics may introduce some errors, because the reference is changing by it. Averaging can be done to reduce the errors.
The output of the beam transient measurement will include: www.intechopen.com

Cavity incident phase adjustment
The beam phase with respect to RF in each cavity can be calculated from (1) and (2) It is shown in the fig. 7 (Schilcher, 1998). In principle, the beam phase with respect to RF in all cavities of one RF station should be adjusted to be the same. Based on equation (3), waveguide tuners can be used to adjust the incident phase of each cavity. An example of the transient based measurements is shown in fig. 8 (Simrock, 2007).

Vector-sum calibration
This is to decide the rotation matrices for each cavity for vector-sum measurement. First we assume that the r/Q of each cavity should be the same, or has been known in advance, and www.intechopen.com the beam should be lossless through all the cavities. In this case, the absolute values of the beam induced voltage and its phase should be the same for all the cavities, so if the vector of the first cavity acts as reference, the rotation gain and rotation angle of the n th cavity are

Cavity voltage calibration to physical unit
The cavity voltage can be calibrated to the physical unit (MV) if the beam current of 0 b I  in the physical unit (Ampere) is known.
The cavity equation for the superconducting cavity is If we only study the beam induced voltage, we can remove the driving term from the klystron (because the system is linear, we can study the effect of different driving terms separately) If the beam pulse is very short (such as 30 microseconds), the beam induced cavity voltage will be small, while the beam induced cavity voltage is changing very fast and approximately changing linear with time, so we can drop the second item of the left side, the equation (6) changes will be So the Q L will be cancelled by each other and the cavity equation changes will be After integration of the equation, the beam induced voltage in physical unit (MV) can be calculated as If the beam current, beam pulse length, r/Q of the cavity are all known, the beam induced voltage can be calculated in the physical unit of MV.
With equation (10), (1) and (2), the cavity voltage in physical unit of MV can be calculated The coefficient between the digit unit and physical unit can be calculated as

Forward and reflected power calibration
Now we have got the waveform of the cavity voltage in the physical unit of MV, and based on the forward and reflected signal directivity calibration, the forward power and reflected power can be calculated.
With the directivity calibration, the forward and reflected signal can be measured as Note that the unit of the forward and reflected signal is digit now. And from equation (12), the forward and reflected voltage in physical unit of MV can be calculated.
The forward power and reflected power can be calculated as The loaded resistance R L can be calculated from equation (8). www.intechopen.com

RF system modeling
The RF control relevant electrical and mechanical characteristics of the cavity are described in form of time varying state space models. Included are perturbations from Lorentz force detuning and microphonics with the appropriate parameters for several mechanical resonances. The power source is calibrated in terms of actual power and includes saturation characteristics and noise. An arbitrary time structure can be imposed on the beam current to reflect a macro-pulse structure and bunch charge fluctuations. For RF feedback several schemes can be selected: generator driven system or self-excited loop, traditional amplitude and phase control or IQ control. The choices for the feedback controller include analog or digital approaches and various choices of filters for the gain stages. Feed-forward can be added to further suppress repetitive errors. An analysis tool has been developed for RF control for superconducting cavities (Vardanyan et al., 2002).
The concept of the analysis tool for RF control systems is based on library of sub-system blocks used in SIMULINK. The RF system is usually modeled as a combination of such subsystem blocks as shown in fig. 9. The key properties of the RF system analysis tool are:


Main blocks for major RF sub-subsystems.  Well defined interface for inputs and outputs for the sub-systems with possibility to add ports and new parameters.  Initialization files for sub-systems parameters and simulation parameters.  Variable interconnection structure between sub-systems.  Possibility of adding various new sub-subsystems.
Once the library is established the user can simply select the desired sub-systems from the RF component library to develop a new model. The user has the possibility to use also other SIMULINK library blocks. The RF sub-systems contain user defined blocks with accompanying initialization files.
These RF system specific blocks are added to a library. The beam can be modeled with arbitrary time varying amplitude and phase. It is also possible to use pulse generators for a repetitive pulse structure and add a noise source to simulate bunch charge fluctuations. For the amplifier it is possible to use the measured non-linear characteristics of a klystron to create an input-output mapping table. The present klystron library contains a linear amplifier with a table of real klystron saturation curve which can be normalized for maximum output and drive power.
The use of superconducting cavities implies that Lorentz force detuning and microphonics are included in the model. The state space representation of a cavity including Lorentz force detuning. The controller ( fig. 10) is generic for different type of controls (self-exited loop, generator driven resonator amplitude and phase detectors and controllers, and IQ detectors and controller) composed of the sub-system's feedback, feed-forward, and tuner control. It is possible to mix different types of controls during simulation and/or simultaneously.

Conclusion
A digital RF control system has been developed to control the vector-sum of the accelerating field of group of superconducting cavities powered by a single klystron. The RF control system is realized as a driven feedback system and has proven that the phase and amplitude stability requirements can be meeting even in the case of control of the vector-sum of multiple cavities. The goal to provide a constant accelerating field in order to minimize the energy spread has been successfully reached. The major advantages of the system are the built-in diagnostics, configurationally flexibility which is essential for the extension of up to 32 cavities driven by one klystron. The digital boards have been upgraded to latest generation controller hardware. All modules are controlled by similar modern FPGA based controller boards with unified firmware and software. They are generic and flexible enough to be usable for a variety of control and data processing applications. Algorithms are improved: beam loading compensation, feed-forward waveform generation, etc. Beam diagnostics signals are in use for fast intra-pulse feedback. For cavity frequency fast tuning piezo control has been implemented. FLASH achieved beam energy above 1.25 GeV and lasing below 4.12 nm with a remarkably improved LLRF control performance. Basic automation schemes have been implemented for loop phase, loop gain, cavity detuning and loaded quality factor measurement as well as fault recovery. These features allow a high availability which has been demonstrated during long term user operation.

Acknowledgment
I gratefully acknowledge the contributions from LLRF team members for their dedicated support. I also want to express my thanks to the FLASH operation team for their valuable comments and helpful discussions. Free Electron Lasers consists of 10 chapters, which refer to fundamentals and design of various free electron laser systems, from the infrared to the xuv wavelength regimes. In addition to making a comparison with conventional lasers, a couple of special topics concerning near-field and cavity electrodynamics, compact and table-top arrangements and strong radiation induced exotic states of matter are analyzed as well. The control and diagnostics of such devices and radiation safety issues are also discussed. Free Electron Lasers provides a selection of research results on these special sources of radiation, concerning basic principles, applications and some interesting new ideas of current interest.