Professional Documents
Culture Documents
Czarski 2006
Czarski 2006
Abstract
The electromechanical model of the TESLA cavity has been implemented in FPGA technology for real-time testing of the control
system. The model includes Lorentz force detuning and beam loading effects. Step operation and vector stimulus operation modes are
applied for the evaluation of a FPGA cavity simulator operated by a digital controller. The performance of the cavity hardware model is
verified by comparing with a software model of the cavity implemented in the MATLAB system. The numerical aspects are considered
for an optimal DSP calculation. Some experimental results are presented for different cavity operational conditions.
r 2005 Elsevier B.V. All rights reserved.
Keywords: Superconducting cavity control; TESLA accelerator; X-ray FEL; LLRF—low level radio frequency; Control theory; FPGA; DSP; VHDL;
System simulation; Cavity controller; Cavity simulator
0168-9002/$ - see front matter r 2005 Elsevier B.V. All rights reserved.
doi:10.1016/j.nima.2005.10.122
ARTICLE IN PRESS
566 T. Czarski et al. / Nuclear Instruments and Methods in Physics Research A 556 (2006) 565–576
Coupler
sensor
Field
Klystron
Particle
Vecto r
Modulator Down-
CAV I TY ANALOG SY S T E M converter
Feed-Forward Set-point
Fig. 1. Cavity environment and simplified block diagram of the cavity control system.
intermediate frequency of 250 kHz preserving the ampli- The forward wave is represented by current Jf and
tude and phase information. The ADC and DAC voltage U f ¼ J f Z 0 . The reflected wave, represented by
converters link the analog and digital parts of the system. current Jr and voltage U r ¼ J r Z 0 is terminated by the
The digital signal processing is applied for the detection of circulator load, matched to the waveguide (J f ¼ J k ).
the field vector as the complex envelope represented by Superposition of the forward and reflected wave, repre-
real—I (in-phase) and imaginary—Q (quadrature) compo- sented by current J 1 ¼ J f J r and voltage U 1 ¼ U f þ
nents (I/Q detector). The digital controller stabilizes the U r ¼ ð2J k J 1 ÞZ0 drives the coupler, which converts the
complex envelope of the cavity wave, according to the signals according to transformation ratio 1:N. The output
desired set point. Additionally, the adaptive feed-forward is signals of the coupler are represented by current J 2 ¼ J 1 =N
applied to improve the compensation of repetitive pertur- and voltage U 2 ¼ NU 1 ¼ U c ¼ ð2J k =N J 1 =NÞN 2 Z 0 .
bations induced by the beam loading and by the dynamic Superposition of the output current of the coupler and
Lorentz force detuning. beam loading results in the cavity current Jc and cavity
The theoretical verification of the existing superconduct- voltage Uc, related by impedance Zc.
ing cavity model [1–3] lead to the synthesis of a digital Introducing the cavity loaded impedance ZL ¼ N2Z0JZc
algorithm efficiently implemented in the FPGA structure. (parallel connection) and defining the transformed gen-
This cavity simulator was used for evaluation of the control erator current J g J k =N, results in the cavity voltage
algorithms and for investigation of the optimal control U c ¼ ð2J g J b ÞZ L ¼ JZ L . Therefore, the cavity loaded
method. The FPGA hardware implementation of the impedance ZL(s) can be represented by the transfer
cavity model is intended for real-time operation. function in the corresponding forms:
Circulator
Zc
1 MHz
Reflected wave Ur = Z0·Jr
Fig. 4. The step response of the cavity voltage envelope represented by [I, Q]—components and the corresponding envelope graph—trajectory of the [I, Q]
vector for different detuning.
Table 1
Main parameters of the cavity electromechanical model
frequency. The cavity model is non-stationary with a time where the parameter Km is the Lorentz force detuning
varying detuning Do. A value of the cavity detuning can be constant.
comparable to the cavity bandwidth in the real operation The resulting cavity detuning is DoðtÞ ¼ SDom ðtÞ þ Do0 ,
condition. This cavity parameter has two dominant where Do0 is the initial predetuning.
deterministic components: the Lorentz force detuning and The main parameters of the cavity electromechanical
the initial predetuning. The mechanically biased predetun- model are gathered in Table 1. The three dominating
ing attempts to compensate the EM forced detuning factor, modes are considered for the mechanical model.
during operation of the cavity. The mechanical model of The pure mechanical model is weakly damped. The
the cavity describes the dynamic Lorentz force detuning dominating oscillations are caused by the mechanical
which depends on the time varying field gradient [2]. It is modes (Table 1) driven by the square of the field gradient.
based on a linear relationship for each of the independent
mechanical modes of the cavity with resonance frequency
fm and mechanical quality factor Qm for a given mode. 3. Digital processing of the cavity model
Each of the mechanical modes is driven by the square of
the cavity field gradient v2 according to the state space 3.1. Discrete cavity model
equation for the mth mode:
A discrete processing of the cavity algorithm has been
dwm ðtÞ=dt ¼ Am wm ðtÞ þ Bm v2 ðtÞ, (9) developed for a digital implementation of the cavity model.
The continuous model of the cavity behavior, presented in
where wm(t) ¼ [Dom(t); d[Dom(t)]/dt] is the state vector and Eqs. (7) and (9), can be approximated by recursive
consists of the time-varying detuning Dom(t) and its time calculations in a finite number of steps. Applying the Euler
derivative; Am[2 2] ¼ [0,1; (2pfm)2, 2pfm/Qm] is the system approximation for time the derivative of a general variable
matrix; vector Bm[2 1] ¼ [0;(2pfm)2 Km] is the input matrix x: dx/dtE(xn+1xn)/T, yields for successive nth and
ARTICLE IN PRESS
T. Czarski et al. / Nuclear Instruments and Methods in Physics Research A 556 (2006) 565–576 569
(n+1)th samples, with time interval T and with identity The resultant detuning of the cavity is Do ¼
matrix 1, the following recursive equations, respectively: Sw(2m1)+w0, where w0 is the initial predetuning.
The discrete cavity algorithm, for the electrical and
mechanical parallel iterative processing, has been imple-
for the electrical model (7) in the vector representation mented by applying MATLAB code with the sampling
with matrix Ae ¼ [o1/2, Do; Do, o1/2], time T ¼ 1 ms.
vnþ1 ¼ ð1 þ T Ae Þ vn þ T o1=2 RL in , (10)
where 3.2. Cavity simulator algorithm
in ¼ 2ðig Þn ðib Þn ,
The functional diagram of the cavity digital simulator
algorithm, according to the electromechanical model, is
for the mechanical mth mode (9) presented in Fig. 5. The electrical part of the cavity
ðwm Þnþ1 ¼ ð1 þ T Am Þ ðwm Þn þ T Bm ðv2 Þn . (11) simulator is implemented in an arithmetical function block
using DSP functions. The arithmetic procedure is realized
Applying simplified notation by ignoring time indices according to the state-space relation with state vector v
and by introducing new symbol yields, respectively, representing [I, Q] components of the cavity output
for the electrical model: envelope. The discrete system matrix E depends on the
v ¼ E v þ ig ib, (12) cavity detuning Do and the cavity bandwidth o1/2.
A normalized current generator with input signal ig and
where E ¼ [1T o1/2, T Do; T Do, 1T o1/2] is the
the beam ib, drives the DSP unit. The non-stationary
discrete system matrix and ig ¼ T o1/2 RL 2ig is the
detuning Do is a parameter of the matrix E. The input and
unified input signal for the generator and ib ¼ T
output registers correspond to the time delay of cavity
o1/2 RL ib, for the beam loading,
environment (waveguide). The intermediate frequency IF
for the mth mechanical mode:
modulator converts the cavity output vector to the signal
wm ¼ ð1 þ T Am Þ wm þ T Bm v2 . (13) v_m of frequency 250 kHz (reciprocal operation to the I/Q
detection).
Applying the common state vector w (dim ¼ 6 1) and The mechanical model of the cavity is implemented in
the common matrix A (dim ¼ 6 6) and the common the DSP unit, according to the state space relation, with the
vector B (dim ¼ 6 1), for the mechanical model with 3 state vector w. The time-varying detuning and its time
modes, yields derivative are two state-variables for each mechanical
mode. The system matrix A and the vector B depend on the
w ¼ A w þ B v2 , (14) following cavity parameters: the resonance frequency, the
quality factor and the Lorentz force-detuning constant for
where the partial vector and matrices with indices range each mechanical mode. Each of the mechanical modes is
(2m1: 2m) for the mth mode are defined as: w(2m driven by the square of the cavity field gradient v2
1:2m) ¼ wm, A(2m1:2m, 2m1:2m) ¼ 12+T Am, B(2m generated from the electrical part of the model. Three
1:2m) ¼ T Bm for m ¼ 1 : 3. dominating resonance frequencies according to the Table 1
Beam Table w0
ib
IF modulator Output v
register w
v_m
P
are considered in the cavity model and the superposition of xk with the parameter aik as follows: P xi ¼ k aik xk . The
all modes, together with the initial predetuning w0, yield equivalent DSP operation is: X i ¼ k Aik X k =Sik , with the
the resultant detuning Do. scaled variable X i ¼ si xi with a scaling factor si, the scaled
parameter Aik ¼ sik aik with a scaling factor sik, the scaled
variable X k ¼ sk xk with scaling factor sk, and the resultant
3.3. Cavity controller algorithm
rescaling factor S ik ¼ sik sk =si . The number of bits equals to
log2(Sik) for the rescaling shift and for each multiplication.
A model of the control system has been developed to
The discrete cavity model from Section 3.1, was adapted
investigate different operational conditions of the cavity.
for the hardware implementation. The scaled model with
The functional diagram of digital controller algorithm is
integer-valued N-bit resolution was developed in the
presented in Fig. 6. The input signal v_m of intermediate
MATLAB system as the pattern for the VHDL coding
frequency f i ¼ 250 kHz from the cavity simulator is
for the FPGA implementation. The numerical accuracy of
demodulated by the I/Q detector unit. The external [I, Q]
the digital model was tested for different bit resolutions,
vector can be selected by the MUX switch. The resultant
and diverse scaling factors. The full bit resolution of the
cavity voltage envelope [I, Q] is calibrated, so as to
MATLAB cavity model, with normalized parameters and
compensate the channel attenuation and phase shifting of
variables, was considered as a reference.
individual cavities. The set-point table contains a signal
The relative step response is shown in Fig. 7 for all
level, which is compared to the actual cavity voltage. The
variables for the 18-bit resolution model compared to the
multiplier, working as a proportional controller, amplifies
reference with full resolution. Two cavity models (digital
the error signal according to the data from the GAIN table
18-bit resolution and full resolution one) were driven with
and closes the feed-back loop. The feed-forward table is
the same input signal generator, equivalent to 14.7 mA
applied and the resultant output signal ig can drive the
current pulse. The total time of the simulation is 10 000 ms
cavity simulator.
and is long compared to the real operating pulse of 1500 ms.
Due to the good agreement the curves for two models are
3.4. DSP modeling and numerical optimization hardly distinguishable.
The relative mean square error of the complex envelope
The hardware implementation of the cavity model Err(N) for N-bit resolution was calculated for n steps
(discrete one) requires numerical care due to the limited according to the expression:
resolution of the parameters and variables of the DSP. X .X
Normalization and scaling of the parameters and variables ErrðNÞ ¼ jðVN Þk ðVref Þk j2 jðVref Þk j2 ,
is an essential preparation for the DSP implementation
for k ¼ 1 : n, ð15Þ
with fixed point arithmetic. The actual range of the
involved values extends up to seven decades (223) for where (Vref)k is the complex sample of the reference
the cavity model. The best numerical accuracy for each envelope for the kth step, (VN)k is the complex sample of
linear operation can be achieved by preceding scaling the N-bit resolution envelope for the kth step.
(multiplication by power of two) and matching the values The 18-bit resolution cavity model was considered for
within the given N-bit resolution range, common for all the final hardware realization with the relative mean square
involved quantities. The range of the scaled parameters and error Err(18) ¼ 5.1e3. The results for different bit
the maximum values of the variables has been stretched to resolutions are presented in Fig. 8. However, for non-
72N1 for each operation. Concluding the DSP operation, linear systems like this they depend on the detailed
the obtained product is rescaled by bit shifting (division by simulation conditions.
power of two) to preserve its original normalization. The 18-bit resolution version of the FPGA cavity
The main arithmetic processing, for each actual variable simulator is expected to be quite sufficient for this
xi, is a linear combination of the corresponding variables simulation. The limited validity of the heuristic mechanical
M I/Q
v_m
detector
ig + +- Calibration U
X I Q
50 Amplitude
In-phase
%
0
Quadrature
-50
-100
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
Detuning and its components relative to normalized range of 2-7 equivalent to ~1243 [Hz]
100
50
predetuning = 370 Hz
w (5)
%
w(3) w(1)
-50
detuning
-100
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
w(4)
w(6)
50
w(2)
%
-50
-100
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
30
%
20
10
0
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
time [microseconds]
Fig. 7. Relative step response for the 18-bit resolution model compared to the reference full resolution (curves are hardly distinguished for two models).
model of the cavity and 14-bit resolution of the preferred integrated with a daughter board (DB). The DB is realizing
analog-to-digital converter do not require a resolution of the hardware DSP algorithms. The DB possesses two fast
better quality. The main parameters of the FPGA 14-bit, 65 MHz ADC and DAC and a FPGA VirtexII chip
simulator are combined in Table 2. equipped with 18 18 bit multiplication circuits. The
adaptation of the kit to the needs of the user standard is
4. FPGA-based cavity simulator integrated with controller realized by embedding it on a carrier board 6HE EURO, as
presented in Fig. 9. The SIMCON card occupies two slots
A hardware layer of the cavity simulator and controller in the VME 6U crate. The power supply is provided either
system (SIMCON) is realized with the commercial devel- from the VME bus or from the power unit provided with
opment kit [4]. The kit consists of the main board (MB) the board. The enhanced parallel port (EPP) protocol is
ARTICLE IN PRESS
572 T. Czarski et al. / Nuclear Instruments and Methods in Physics Research A 556 (2006) 565–576
Fig. 8. Relative mean square error of complex envelope for different bit-resolution of cavity model (total time of the simulation—10 000 ms).
Table 2
Main parameters of the FPGA simulator
DSP resolution DAC and ADC resolution Sampling time Minimum processing time Maximum carrier frequency
25
flattop 15
20
10
15
filling
10 5
decay
5 0
0
-5
-5
I
I -10
-10 Q
Q
Amplitude
Amplitude
-15 -15
0 500 1000 1500 2000 0 500 1000 1500 2000
time [10 s]-6 time [10-6 s]
300
0.5
200
0 100
0
-0.5
-100
-1 -200
-300
-1.5
Cavity -400
Controller
-2 -500
0 500 1000 1500 2000 0 500 1000 1500 2000
time [10-6 s] time [10-6 s]
Fig. 12. MATLAB simulation of the cavity model for real operation conditions.
initiates the simulation process for given primary para- resulting example, for the real operational condition, is
meters of the cavity model according to Table 1. The presented in Fig. 12. The cavity is driven in pulse mode
secondary, internal parameters for the FPGA system were forced by control feed-back together with the direct control
calculated as described in the second paragraph. The by feed-forward. During the first stage of the operation, the
required data for the set-point and feed-forward tables of cavity is filling with a constant forward power, resulting in
the controller are generated according to the cavity model an exponential increase of an electromagnetic field,
by an iterative processing striving to the optimal control. according to its natural behavior in resonance condition.
The MATLAB simulation process is verified by a plot. The When the cavity gradient reached the required final value,
ARTICLE IN PRESS
T. Czarski et al. / Nuclear Instruments and Methods in Physics Research A 556 (2006) 565–576 575
Fig. 13. Output envelope of the cavity simulator driven by feed-back and
feed-forward mode. Fig. 16. Cavity simulator output for the 250 kHz modulated signal.
6. Conclusions