Linac96

A DIGITAL SIGNAL PROCESSOR BASED RF CONTROL SYSTEM FOR THE TRIUMF ISAC RFQ PROTOTYPE

K. Fong, S. Fang, and M. Laverty

TRIUMF, 4004 Wesbrook Mall, Vancouver, B.C., Canada

Abstract

A stand alone digital signal processor is used to control the RFQ prototype in the TRIUMF ISAC development program. The advantage of a digital control system over the traditional analogue system is that it offers the higher degree of flexibility necessary for a development system. For this application the system is designed to have the outward appearance of an analogue system, and uses dials, knobs, and switches as the operator interface. The digital signal processor is used as a feedback controller during CW rf operation, with the feedback gain parameters continually adjustable. It is also able to perform the same regulation during pulsed operation, with additional feedforward compensation for initial pulse on duration. Using a low cost analogue-to-digital converter with a sample rate of 100 kHz, a regulation bandwidth of 10 kHz is achieved.

Introduction

The development of new, low cost, high speed digital signal processors, analogue-to-digital converters, and digital-to-analogue converters has given rise to important changes in regulation system design, at TRIUMF [1] and elsewhere. The ISAC RFQ prototype control system is built around such a low cost, medium performance, flexible control system using a DSP as the compensator and user interface. It uses a DSP56002 by Motorola. This is a 40 MHz, 24 bit integer DSP. The analogue voltage from the rf detector is sampled by a 100 kHz, 12 bit ADC made by Linear Technology. The digital value from the DSP is converted back to analogue form by a 400 kHz full power bandwidth, 14 bit DAC from Analog Devices. This is used to modulate the rf going into the cavity. The useable signal bandwidth is better than 10 kHz.

To minimize cost and maximize ease of use, the control unit is self-contained with a conventional user interface that includes switches and knobs for control, and warning lights and meter readbacks for status. With the DSP controlling both the duty cycle and the regulation of the rf, amplitude regulation is possible both in CW mode and in pulse mode. Advances in digital control theory have developed many new control algorithms. However, for a single-input/output system with a dominant pole (i.e., a rf cavity), the optimum controller in terms of performance and simplicity is still a proportional-integral(-derivative) controller. In our system a PID algorithm is used in feedback regulation, and in pulsing mode there is the additional possibility of adaptive feedback/feedforward control.

Digital Controller

A digital controller offers a number of advantages over its analog counterpart. The absence of resistors and capacitors in the compensator eliminates component drift associated with analog components. The use of a 24 bit DSP also gives a larger dynamic range when compared with an analog system, although now the dynamic range is determined by the ADC in the input and the DAC in the output. For the RFQ prototype control system, the dynamic range as well as the resolution of the feedback signal is enhanced by extracting the error signal in analog form as a voltage using a difference amplifier.

This error signal is then converted to digital information with 12 bits resolution. We use a 14 bits bipolar DAC in the output. Since only unipolar voltages are used to modulate the rf drive we effectively only use 13 bits, which gives a 0.01% error in regulation.

Since the controller is controlled by software, another major advantage is that of flexibility in the control algorithm. Different operating modes can be programmed into the controller and activated under operator control. In this system, there are 5 operating modes:

Normally the last 2 modes would be very difficult if not impossible to achieve using an analog system, due the presence of an integrator in the feedback loop. The integrator must be disabled during the pulse-off interval. The switching transients from the integrating capacitor can cause problems, since input offset currents must be taken into account. With a digital system, the integrator can easily be stopped during the pulse off interval. Changing controller gain and time constants are also easier in a digital system than in an analog system, where the gain can only be adjusted by switching in different resistance values. Also, the amount of reserve processing power and intelligence available to a digital system can make adaptive feedback and feedforward possible. This is implemented in the pulsed closed-loop mode to reduce the turn-on transient.

PID Controller for a Digital Control System

In time domain, the equation for a PID controller is given by

equ (1)

where e(t) is the error signal and m(t) is the control signal, and Ti is the integral time constant, Td is the derivative time constant and K is the proportional gain.

Using a bilinear transform, the PID controller z-transform is

equ (2)

Figure 1. Direct implementation of a PID controller

where kki is the integral gain, kkd is the derivative gain and k is the proportional gain. There are many different ways of implementing the above z-transform in a digital controller. These different implementations result in the same Y(z), but differ in memory requirements, processing speed, requirements of coefficient resolution, internal variable magnitude gain and, as a result, stability over the entire numerical range. For a feedback controller, the most important factor is the stability of the system, when the system is operating normally as well as when saturation occurs. Particular attention should be paid to internal variables, as these may be saturated even though the input and output appear to be within the allowable numerical range. The proportional term will always be within the number range, since fractional arithmetic is used. The integral term, however, will overflow, if the input does not average to zero due to some anomaly condition in the feedback loop. For a high voltage rf cavity, sparks occur frequently. At the instant when a spark is fully developed, the voltage across the cavity is temporarily reduced. The feedback system must be allowed to go into saturation to prevent overdriving the high power rf components such as the final amplifier, the transmission line, and the cavity. When the spark dissipates, the system should recover without becoming unstable. We found the direct form (see Fig.1) realization the most stable with respect to saturation. The Motorola DSP has internal hardware to implement this realization very effectively. In particular, it has 2 indexed cyclic buffers to access the coefficients and the variables. These data moves can occur in parallel with the multiply and accumulate instructions that are used to calculate y(kT). Thus a PID algorithm takes only 3 instructions. The DSP also has hardware test logic that detects overflows in its accumulators and substitutes into their contents a limited data value. By adding a base value to y(kT) before the saturation arithmetic and removing the base value afterward, a variable saturation level is achieved. The PID algorithm takes 3 instructions with this added feature. This restricts the output to less than an adjustable value, and is useful to limit the rf power going into the RFQ. An additional 8 instructions are needed for determination and indication of various operating modes, so the total computational delay is 550ns, which is 5.5% of the sampling period.

Adaptive Feedforward Controller

In the ISAC RFQ prototype system, we would like to measure and study the cavity parameters. Adaptive feedback control would compensate and mask variations in the cavity parameters. It was decided that the control system would only use adaptive feedforward control for regulated pulse mode operation. The goal was to provide, for vacuum conditioning purposes, a fast rise-time rf envelope with minimum overshoot. To this end, feedforward control of gain scheduling is employed. This is a form of adaptive control in which the system gain is varied according to a schedule based on a known model of the system. No estimation of system parameters is required, and the controller parameters can be changed very quickly in response to changes in system operating conditions. The trade-off for the quick response is that it is open-loop compensation, and the adaptive performance is only as good as the schedule derived from the model of the system. In the ISAC RFQ prototype system, the feedforward parameter is the timing of the pulse. The system gain during the leading edge of the pulse is reduced to allow for the rise time of the cavity. Equation 3 is used to modify the input x'(kT) to the PID algorithm to achieve this gain reduction:

equ(3)

when

where cav is the time constant of the cavity, x(kT) is the average error from previous pulses and (kT) is a scaling function chosen to best represent the rising edge of the voltage pulse.

Sources of Error in Digital Control

There are several sources of error in digital control, such as quantization errors of either data or coefficients, round off errors, and overflow error. Quantization error arises due to finite word length in either the data or the coefficients. With 24-bits of resolution, coefficient quantization errors are not significant in a PID feedback loop. Their only effect is to shift the locations of the zero's slightly, which has a negligible effect on the performance and stability of the loop. The precision and resolution of the ADC and DAC used also affect the data quantization error. With a 24 bit DSP and a 12 bit ADC, the ADC is a major contributor to quantization error. The noise variance 2 due to quantization is given by

equ (4)

Figure 2. Pulse mode underdamped response

where Q is the value of the least significant bit. For a 12 bit ADC, this gives =710-5 of full scale of ADC input. In the prototype, the feedback signal is first subtracted from the reference, and then the resultant error signal is amplified by a factor of 10. Quantizing of this error signal results in the quantization noise being 710-6 of the full scale feedback signal. The second major error source is the 14 bit bipolar DAC. Because of unipolar operation, only 13 bits are actually used. This gives a quantization noise of =310-5.

Overflow can occur in both analog and digital systems. For a digital system, overflow can result in numerical wrap around, a highly undesirable situation. In the Motorola DSP there is built-in hardware to prevent numerical wrap around, and overflow results only in saturation.

Figure 3. Pulse mode with feedforward compensation

Operator Interface

The use of a high speed DSP provides enough CPU power to implement an operator interface, as well as the PID feedforward algorithm, on a single processor. The reference setpoint and the maximum output drive are controlled by the operator via front panel dials. These are potentiometers with digital readout whose analogue voltages are digitized and read by the DSP. Three toggle switches control rf on/off, CW/pulse, and feedforward on/off respectively. There is no switch for open/closed-loop control and the PID algorithm runs full time. Open-loop operation is achieved by setting the maximum output drive lower than the reference setpoint. This lets the saturation arithmetic take over, and limits the output drive to the value set by the maximum output drive potentiometer. By raising the maximum output drive, the system goes smoothly into closed-loop operation when the drive required is less than the set maximum. A separate microcontroller with internal ADC's samples the actual readback voltage and the output drive and displays them on a fluorescent display. This gives independent confirmation that the system is operating.

Measurement

The entire rf system is first operated in pulsed mode without adaptive compensation. The transient voltage response at the cavity exhibits either underdamped (Fig.2) or overdamped behavior, depending on the initial setting of the PID parameters. Figure 3 shows the cavity voltage when adaptive feedforward is enabled. It shows that the underdamped ringing is effectively eliminated. Since the adaptive algorithm prevents overdriving the cavity at the rising edge of the pulse, the rise time is equal to the natural decay time of the cavity. To set the control system up for CW operation, the system is first operated in pulse mode with the adaptive control disabled. PID parameters are then changed to give a critically damped response on the rf cavity voltage. This gives rise to optimum closed-loop operation in CW mode. The total time required to tune the feedback loop for optimum performance using this method is less than 5 minutes.

Summary

A control system with 10 kHz of control bandwidth was built using a 100 kHz ADC and a 40 MHz DSP. Its performance in CW operation is similar to analogue control systems using conventional operational amplifiers. One of the advantages it has over an analogue system is its flexibility in changing feedback parameters. The major performance advantage lies in pulsed operation. It is able to regulate in pulse mode, and adaptive feedforward is implemented to minimize pulse-on rise time and ringing.

References

[1] K. Fong, M. Laverty, and S. Fang, "Operating Experience with the New TRIUMF RF Control System", Proc. 1995 Particle Accelerator Conference, Dallas, p2273 (1995)