A FAST FEEDBACK SYSTEM FOR CEBAF*M. P. Chowdhary, G. A. Krafft, H. Shoaee, W. A. Watson, III
Continuous Electron Beam Accelerator Facility, Newport News, VA 23606 USA
A fast feedback system based on concepts of modern control theory has been implemented in the CEBAF Control System to stabilize various machine parameters. The continuous wave operation of CEBAF requires that parameters such as
beam energy and position are stabilized against fast fluctuations. The beam energy must be stabilized against fast gradientand phase fluctuations in the RF accelerating system. This fast feedback system currently operates at 60 Hz rate and is integrated with EPICS. The mathematical model of the system for various feedback loops is expressed in state space formalism. The design of control law and simulation of closed-loop system response is performed using Matlab™ and Simulink™.
This paper describes the process of designing control algorithms, implementation of the fast feedback system and operational experience with this system at CEBAF. The performance of this feedback system, while operating at much higherrates with high closed loop gain, can be enhanced by continually performing on-line identification of the system from theinput and output data. System identification is the process of developing or improving an analytically derived mathematicalrepresentation of a physical system using experimental data. The current status of this feature is presented.

I. INTRODUCTION
The CEBAF accelerator, Figure 1, consists of 45 MeV injector, two side-by-side superconducting linacs, and 9 recirculation arcs that recirculate the beam through the linacs up to 5 times for 4 GeV total energy. Beams of different energies
are separated at the first spreader and are transported through isochronous arcs to the recombiner at the entrance of the second linac. At the exit of the second linac, the beams of different energies are separated again to be sent to either Experimental Halls or through the recirculation arcs.
The beam property requirements specified for the three Experimental Halls are very stringent. The nominal value forbeam emittance is specified at 20 µm < σx , σy < 50 µm in terms of r.m.s. spot size and σx´ , σy´ < 100 µrad in terms ofangular divergence. The stability requirement is 25% of the specified nominal value. The nominal value of average beamenergy ranges between 0.5 to 4 GeV and the stability requirement range between 3 × 10-4 to 10-3. The relative energy spread
specification range between σ E ⁄ E of 5 × 10-5 to 2.5 × 10-4 with a stability requirement of 25% of the nominal value. Theenergy spread in the emerging beam is determined by the bunch length, which is tightly controlled at CEBAF, and by thestability of the amplitude and phase of the RF fields in the superconducting cavities.
Measurement of beam position perturbations and beam energy variations have indicated [1] the presence of beam energy variations of up to 0.1% and beam position fluctuations on the order of millimeters. These disturbances are related to
the first three harmonics of the AC line power. Beam instabilities of this magnitude are not acceptable through several septa
in the accelerator which have beam clearances of a few millimeters. Therefore, several fast energy and orbit lock loops areneeded at different locations in the accelerator to overcome these instabilities.
Efforts to identify the beam energy variations during pulsed mode operation of CEBAF have revealed [2] that there
are two prominent noise components at 4 Hz and 10 Hz respectively. A prototype fast energy lock system based on concepts of modern control theory was built and successfully tested [2] for validity of the concept and the proposed scheme of
implementation in existing control system hardware and software.

II. ARCHITECTURE OF THE SYSTEM
Figure 1 provides an overview of the type and location of the fast feedback loops (locks) that have been planned forthis year. A fast energy lock loop stabilizes the energy of the beam at a particular location in the accelerator against beamenergy variations caused by effects such as phase and gradient fluctuations in RF cavities. The beam energy variations fora particular lock are determined from 5 beam position monitors (BPM) installed in dispersive regions in the vicinity of thelock location. The corrective action against energy variations is made by modulating the accelerating voltage in the RF vernier cavities upstream of the lock location. The control hardware for the energy lock BPMs and the corrector cavities islocated in two separate buildings, Figure 2, and is therefore controlled by two different I/O controllers (IOC-Motorola* work supported by US DOE contract# DE-AC05-84ER40150

68040) which are linked by Ethernet. The action of a fast feedback loop can be classified into three tasks: measurement,computation of correction signal, and actuation. In the case of energy lock loops, the tasks of measurement and computation
take place on one measurement IOC and actuation takes place on a different IOC that controls RF hardware.

EL, OL

0.4-GeV Linac(20 Cryomodules)
HeliumRefrigerator
EL, OL45-MeV Injector(2 1/4 Cryomodules)
OL, EL

0.4-GeV Linac(20 Cryomodules)

Injector

OLEndStations
Figure 1: Schematic Diagram with Fast Lock Locations. EL - Energy Lock, OL - Orbit Lock
BPM data is obtained directly from low level data acquisition software. The control input signal is calculated using theBPM measurements of the current sample instant and the predicted state of the system at the same sample instant. Thiscorrection signal is sent over Ethernet to the RF IOC which, through a VME DAC resident in same crate, sends a 5 V signal
to the analog offset input on the RF control module hardware.

Controls SubnetActuation

IOCIOC

Measurement
Computation ofCorrection Signal

RFBPMsFigure 2: Schematic Layout Fast Energy Lock

The fast orbit lock system controls the beam orbit (position and angle) with respect to a desired reference orbit at aparticular location in the accelerator. As in the case of the energy locks, the orbit lock uses measurements from 5 BPMs todetermine the orbit. The magnetic field in 2 horizontal and 2 vertical correctors upstream of the lock location is modulated
to correct for fluctuations in beam position and angle. Unlike the energy lock, all the three tasks of measurement, computation of correction signal and actuation take place on the same IOC. Custom-built air-cored correctors that can produce
the desired amount of bending field for a particular orbit lock location (e.g. 750 gauss-cm for East arc orbit lock) will be
used as actuators for the fast orbit locks. These fast correctors will be powered by a modified version of a standard CEBAF
trim card. The modified trim card accepts an 2.5 V analog correction signal generated by a VME DAC. The frequency
response of the modified trim card system connected to a fast corrector is approximately 1.2 kHz.

Presently developed orbit and energy locks will operate at a 60 Hz rate, which is the frequency of the beam synchronization pulse. The currently available low-level data acquisition software for the BPMs can provide position signals at amaximum rate of 60 Hz, which limits the rate at which the feedback loops can operate. There are plans to streamline andupgrade the low-level data acquisition software for some of the BPMs so that they can provide beam position updates inthe vicinity of 1kHz rate. In order to run the energy lock loops at higher rates, a reflective memory network will have to be
set up between the measurement IOCs and the RF IOCs, since Ethernet cannot be used as a reliable means of communicating the correction signal to RF IOCs at rates greater than 240 Hz.
The feedback loop software is divided in two parts: EPICS [3] software and VxWorks [4] software. EPICS software
manages the Graphical User Interface (GUI) for the feedback loop, triggers the appropriate modules of VxWorks software
as required and monitors the status of the loop. The tasks of measurement, computation of correction signal and actuation
are done using VxWorks software. The timing for this software is synchronized from the beam synchronization pulse signal. Figure 3 shows a schematic diagram of the software layout for an energy lock loop. The organization of the VxWorks
software is described in reference [2].

EPICS part

User Interface
RF IOC

Diagnostics IOCVxWorks
partActuation

Synched_task2

Synched_task1

Actuator_set

init_params
Clk Tick1

read_GSET

EthernetBPM_read

Measurement

Compute_settings

Computation

write_GSET
Clk Tick2

mv167Delay

Figure 3: Schematic Software Layout for Energy Lock Loop

III. MODELLING OF SYSTEM
The objective of using fast energy and orbit locks is to lock the beam energy and beam orbit at a desired location in
the accelerator. Thus, the quantities of interest at the desired lock location are [ X , X', Y , Y', ∆E ⁄ E ] , namely the position andangle of trajectory of beam in X and Y planes and the energy variation. The variations in these quantities need to be estimated from BPM measurements in the presence of sensor noise and a corrective action needs to be taken using actuatorssuch as corrector magnets and RF vernier cavities in the presence of process noise. Thus, modelling of the system in thestate space formalism of digital control theory [5] and design of an optimal state estimator which estimates[ X , X', Y , Y', ∆E ⁄ E ] and an optimal controller provide a suitable solution. The description of the system in state space formalism is given byx ( k + 1 ) = Ax ( k ) + Bu ( k ) + w ( k )(1)y ( k ) = Cx ( k ) + Du ( k ) + v ( k )(2)x(k) is the state vector which contains the attributes of the system that are dynamically significant, A is the system dy-namic matrix which takes system states from sample instant k to k+1, B is the control input matrix which takes the control
inputs to the state vector, u(k) is the vector of control inputs to the system, w(k) is the process noise vector. y(k) is the vectorof measurements, C is the measurement matrix which takes the measurements to states, v(k) is the measurement noise vector. The state vector is x = [ X o, X' o, Y o, Y o', ∆E ⁄ E ] . The C matrix contains the transfer matrix terms R11, R12, R33, R34, R16
for the BPMs from a reference point.
A Kalman filter is used to estimate the states from the BPM measurements. The measurement update from sample instant k is obtained usingx̂ ( k ) = x ( k ) + L ( y ( k ) – C x ( k ) – Du ( k ) )(3)and the time update that takes the state vector from sample instant k to k+1 is obtained usingx ( k + 1 ) = Ax̂ ( k ) + Bu ( k )(4)Here x̂ ( k ) is the estimated state vector and x ( k + 1 ) is the predicted state vector for sample instant k+1 obtained fromthe estimated state at time instant k. The controller equations that are used for the feedback loop can be obtained by combining the above two equations and are described asx ( k + 1 ) = Ax ( k ) + Bu ( k ) + AL ( y ( k ) – C x ( k ) – Du ( k ) )(5)

u ( k ) = – K ⋅ x̂ ( k )(6)

L is the state estimator gain matrix and K is the controller gain matrix. The equation 5 is used to estimate the statevector at next sample instant k+1. This equation contains three terms. The first term uses the system dynamic matrix A andthe state vector at time k and calculates the new state. The second term which uses the control input matrix B and puts inthe effect of actuator settings on the state. The third term is the correction term between estimated and actual states obtained
from the measurements. Equation 6 is used to calculate the actuator setting based on the current state estimate using negative state feedback through an optimal gain matrix K.
Matrices A, B, C, D, K and L that are used to compute control input u(k) can be calculated from the analytically obtained model of the relevant subsystem of the accelerator and an estimate of process and sensor noises. These matrices canalso be extracted from experimentally collected pulsed response input/output data for a given set of BPMs and actuators
for a particular lock using the ERA system identification algorithm [6]. Satisfactory response of controller and estimator isverified by performing simulations of the closed loop system using Simulink™. If the response of controller and estimatorfor system performance specification is found satisfactory, then the identified matrices are stored in a file which is read at
the time of feedback loop initialization.

IV. EXTRACTION OF THE SYSTEM MODEL USING SYSTEM IDENTIFICATION
The advantages of using an identified system model and estimator gain matrices in calculating the control input for afeedback loop are described by following two arguments. Firstly, an analytically derived model for a feedback loop may
not accurately represent the actual hardware in the accelerator. Secondly, a Kalman filter is used as a state estimator forboth orbit and energy lock systems; one of its well known disadvantages is that it can neither adjust itself to track a changing
environment, nor can it correct the error caused by incorrect assumptions of measurement and process noise covariancesthat are used to design it. Thus, if the system matrices, along with the estimator and the controller gain matrices that areused by a feedback loop, are constantly updated to reflect the actual system environment, then the performance of the feedback system can be substantially improved. Currently available system identification algorithms cannot be used for on-line
implementation and a suitable algorithm is being developed.
The scheme of obtaining a system model using system identification was tested for the injector energy lock. The firststep in this process was to collect pulse response input/output data for a given set of BPMs and RF vernier cavities. The
accelerating gradient in the vernier cavities was modulated with a sinusoidal wave with different sets of frequencies andamplitudes and corresponding BPM measurements were recorded along with the modulation signal. Pulse response data
for each set of modulation (fixed frequency and amplitude) was processed through the system identification toolbox SOCIT[7] to obtain the system matrices for the feedback loop.
The algorithm used for system identification is known as Eigensystem Realization Algorithm (ERA) which is discussed in detail in references [6] and [8]. The basic scheme of system realization from the experimental input/output data
is described here. Consider a system characterized in state space formalism asx ( k + 1 ) = Ax ( k ) + Bu ( k )(7)y ( k ) = Cx ( k ) + Du ( k )(8)

If an input described by u i ( k ) = 1 for (i = 1,2, .., r) and u i ( k ) = 0 for ( k=1, 2, 3, ...) is substituted in equations 8 and
9 and results are assembled into a pulse response matrix with dimensions m x r (where r = number of inputs, m = numberof outputs) then we get
Yo = D, Y1 = CB, Y2 = CAB, .... , Yk = CAk-1B
These matrices in sequence are known as Markov parameters. System realization begins by forming a generalized
αm × βr Hankel matrix from measured Markov parameters.

H (k – 1) =Yk

Yk + 1 …

Yk + β – 1

Yk + 1

Yk + 2 …

Yk + β…

…

…
…
Yk + α – 1 Yk + α … Yk + α + β – 2(9)The singular value decomposition [9] of the above matrix for k =1 is given byH (0) = R ⋅ Σ ⋅ ST(10)Now, the system matrices A, B, C can be obtained from the above equation asB = Σ1⁄2T⋅ S ⋅ Er

C = Em ⋅ R ⋅ ΣA = Σ–1 ⁄ 2T(11)1⁄2⋅ R ⋅ H (1) ⋅ S ⋅ Σ(12)–1 ⁄ 2(13)where Em and Er are matrices of ones and zeros with dimensions m and r used to filter B and C matrices from R and S.

V. RESULTS AND CONCLUSIONS
The injector energy lock has been tested successfully. One of the requirements on the state estimator for this systemis that the estimator should be able to distinguish between position changes caused by energy variations and that caused bybetatron oscillations.
Figure 4 shows a screen of the injector energy lock user interface displaying the effect of closing the loop on the states
X, X´, ∆E/E. An energy change of 0.225 MeV was introduced upstream of the lock location while the energy lock loop wasoperating in “Compute mode” (i.e. actuators were disabled). Figure 4 indicates that the state estimator accurately showsthe energy change that was introduced and when the loop was closed (i.e. actuators enabled) the energy error was corrected.
During the commissioning stage of the injector energy lock loop a series of open loop tests were performed to study theestimator response to position and energy changes upstream of the lock location. The results of these tests indicate a satisfactory response by the state estimator.
The injector energy lock loop has been operated for several 6-7 hour periods without user intervention. The closed loop
system characteristics (Bode plot) are currently being studied.
The injector energy lock was operated using the system matrices that were obtained by processing pulsed response
data using the ERA system identification algorithm. A marked improvement in closed loop system performance has beenobserved when the energy lock was run using identified system matrices.
Currently the fast feedback software is being replicated for the installation of fast locks at various locations in the accelerator. A set of orbit and energy lock loops at the end of first linac will be commissioned in a couple of weeks. Work iscurrently under progress to develop an on-line system identification mechanism that will continually observe (at a slower
rate compared with the operating rate of the feedback loop) the feedback loop input/output data and update the system matrices used by feedback loops in order to enhance their closed loop performance.

Figure 4: Injector Energy Lock - Effect of closing the loop on X, X´, ∆E/E

VI. REFERENCES[1] M.G. Tiefenback, Rui Li, “Survey and Analysis of Line-Frequency Interference in the CEBAF Accelerator,” 1995
Particle Accelerator Conference, May 1995, Dallas, Texas, USA[2] M. Chowdhary, G.A. Krafft, H. Shoaee, S.N. Simrock, W.A. Watson, “A Prototype Fast Feedback System for Energy
Lock at CEBAF,” 1995 Particle Accelerator Conference, May 1995, Dallas, Texas, USA[3] Leo R. Dalesio, et. al. “The Experimental Physics and Industrial Control System Architecture: Past, Present, and Future,” International Conference on Accelerator and Large Experimental Physics Control Systems, October 1993.
[4] VxWorks Reference Manual, Copyright Wind River Systems, Inc., 1984-1993[5] B. Kuo, Digital Control Systems, Harcourt Brace Jovanovich College Publisher, New York, 1992,[6] J.-N. Juang, and R. S. Pappa, “An Eigensystem Realization Algorithm for Modal Parameter Identification and ModelReduction,” Journal of Guidance, Control, and Dynamics, Vol. 8, No. 5, September-October 1985, pp. 620-627[7] J.-N. Juang, L.G. Horta, and M. Phan, “User’s Guide for System/Observer/Controller Identification Toolbox,” NASA
Technical Memorandum 107566, 1992[8] J.-N. Juang, Applied System Identification, PTR Prentice Hall, Englewood Cliffs, NJ 1994
[9] G.H. Goulab, and C.F. Van Loan, Matrix Computation, Johns Hopkins University Press, 1989-1991