Control Loop for a Pulse Generator of a Fast Septum Magnet using
DSP and Fuzzy Logic
E. Aldaz Carroll, E. Carlier, J.H. Dieperink, G.H. Schroer and E. Vossenberg
CERN, SL-Division, CH1211 Geneva 23, Switzerland•Abstract
A prototype of a fast pulsed eddy current septum magnet
for one of the beam extraction’s from the SPS towards
LHC is under development. The precision of the magnetic
field must be better than ±1.0 10-4 during a flat top of 30µs. The current pulse is generated by discharging thecapacitors of a LC circuit that resonates on the 1st and on
the 3rd harmonic of a sine wave with a repetition rate of 15s. The parameters of the circuit and the voltage on thecapacitors must be carefully adjusted to meet thespecifications. Drifts during operation must be corrected
between two pulses by mechanically adjusting theinductance of the coil in the generator as well as theprimary capacitor voltage.
This adjustment process is automated by acquiring thecurrent pulse waveform with sufficient time and amplituderesolution, calculating the corrections needed and applying
these corrections to the hardware for the next pulse. A very
cost-effective and practical solution for this adjustment
process is the integration of off-the-shelf commerciallyavailable boards into an active digital control loop. A 16-bit
fixed point, 33 MIPS, DSP together with a 12-bit, 500 kSPS, ADC (total cost of under 250 $) has been used for thiscontrol process. The correction algorithm developed for theDSP uses Fuzzy Logic reasoning.
1 Electrical circuit of the pulse generator
The generator, providing a current pulse with a peakcurrent of 15KA ± 1.5 A during 30 µs, is composed of fourmain elements as shown in Figure 1: two capacitors, onevariable inductance and a thyristor switch. The capacitors
are pre-charged to about 3KV and discharged into themagnet LM.

+RC1Capacitor C3 (188 µF) is connected in parallel with theabove-mentioned branch and is responsible for the 3rd
harmonic of the discharge current.
• A 4.5KV semiconductor discharge switch S, transfers
the energy from the two charged capacitors to theinductive load with a repetition rate of 15 s.
The choice of this basic circuit is determined by the pulse
shape requirements. The capacitors C1, C3 and theinductance L1 are dimensioned such that the total pulse
length is minimised for the required 30 µs duration of theflat top. The optimisation of these elements reduce thegenerator volume and also the thermal and mechanicalstresses. The pulse flatness is obtained by varying theinductance L1, which is a solenoid wound coil, within a few
nH. This adjustment is achieved by movable external disks,
which influence the solenoid stray field.
2 Requirements
2.1 Precision
The typical magnet current pulse has a length of one
cycle of the 1st harmonic sinewave, as shown in Figure 2.
The addition of a 3rd harmonic component flattens the topof the first half cycle such that during 30 s the absolute
variation is less than 1.5A or 1.0 10 -4. The two lobes are
due to the optimisation of the flat top duration versus thetotal pulse duration.
Protons pass through the magnet only in this 30 sinterval. The magnet current must be, in addition to theflatness requirements, within a window of ± 1.5A, or±1.0 10 -4.

SC33 kV-LML1

Pulse generator

MagnetFigure 1: Electrical circuit
The single elements can be described as follows:• Capacitor C1 (310 µF) is connected in series with thehigh stability water cooled variable inductance L1(6.5 µH). This circuit branch is responsible for the 1st
harmonic of the discharge current.

Figure 2: The magnet current waveform
2.2 Stability and reproducibility
The magnet current must be stable during operation.
Amplitude instabilities, or jumps, outside the tolerance
window are not allowed. However, different kinds of drift
exist and must be cancelled.
Firstly the drift during the periods after start-up, ortemporary stop, when the components of the generator andthe magnet coil must reach their stable operation temperature and that can last for about 1.5 hours. The magnet
current pulse decreases than continuously as shown in Figure 3, where the black area represents the drift trajectory.
Next there are the thermal drifts, which are slow andsmall in amplitude, and are caused by fluctuations in theambient temperature and the cooling system.
Lastly, in the long term ageing drift effects can beexpected.

15 sMagnet

GeneratorMeasurement

Control
Loop

ActionFigure 4: Control loop
A careful selected threshold level has as result that the topof the magnet current pulse falls than inside the window.
The gain of the amplifier improves the effective resolutionof an ADC with a factor 100, or about 7 bits. In this way an
18 to 19 bits resolution can be obtained with a 12-bits
ADC. The amplitude of the pulse is with this system thesum of the threshold voltage and the measured voltage by
the ADC divided by 100, thus:
UPulse = UThreshold + UADC/100
The waveforms of Figure 2 and Figure 3 have beenmeasured with this window amplifier.

Figure 3: Start-up drift

PulseFlat Top-3 Control loop

X100

Amplified
flattop

3.1 General
To achieve the required stability and reproducibility, adigital control loop is used. This control loop, shown in
Figure 4, measures from pulse to pulse the magnet current
and makes the necessary adjustment so that it can be
expected that the next pulse will satisfy the specifications.
3.2 Precision measurement of the waveform
The magnet current is measured with a high precision
double shielded current transformer having a large
bandwidth and a droop of 0.09 %/ms. The output source
impedance is 1 Ohm giving a signal of 1KV/Amp.
To measure the shape of the current waveform and theamplitude during the flat top with sufficient precision,
several samples with a resolution at least a factor 10 times
better than the required precision are needed, thus ±1.0 105. Taking into account that the preferable operation point ofan ADC is well below the full scale, this would require a17-bits ADC. About 10 samples along the flat top are
sufficient for determining the shape, but this requires
nevertheless a sampling rate above 300 kHz.
ADCs with these requirements are not (yet) available.Therefore the signal of the magnet current pick-up is
first applied to a window amplifier with variable threshold.
The amplifier has a gain of 100 and let thus pass
1 % of the full-scale signal. Figure 5 shows this principle.

ThresholdFigure 5: Precision window amplifier
3.3 Precision of the threshold and the reference setting
In order to be able to make adjustments of ±1.0 10-4 a
better resolution for the settings of the threshold level of
the window amplifier and pulse generator amplitudereference is needed. This can easily be obtained with 15-bit
DACs that have a resolution of 3.0 10-5, allowing about 6
distinct set points in the adjustment area.
3.4 Adjustment of the shape and the amplitude
The generator has two elements that allow adjustment of
the waveform, a variable inductance and the voltage towhich the capacitors are charged. As can be seen in
Figure 6, a variation in the value of the inductance changes
the slope between the two peaks of the lobes and theamplitude of the pulse. On the contrary, a variation in thecapacitor voltage changes only the amplitude of thewaveform.
It is thus possible, by varying the inductance and thecapacitor charging voltage simultaneously, to modify andadjust the current pulse waveform. The correction factors
to be used initially can be derived from Figure 6. A fullyadjusted generator delivers a pulse with the correct
amplitude and which has two lobes of equal amplitude(slope zero).
The inductance is changed by moving one of the externaldisks of inductor L1 with a DC motor; whilst the capacitor
voltage is simply changed by modifying the reference ofthe high voltage power supply.

StartR

3 kV fs

C3L1

10 V fs

CurrentTransformer

C1
DCmotor

Pulse generator

Magnet+-16-bits
A
D

DCommunication
networkS+*100

16-bits
MotordriverLMA

12-bitsA

D

D

Tasks:- Signal Filtering- Offset Adjustment- Waveform Adjustment
P- Communication

Controls of a pulsed septum magnet for the SPS extraction to LHC.

Figure 7: Block diagramll

Figure 6: Variation of the inductance L1
3.5 Implementation
Figure 7 shows the block diagram of the pulse generator
and magnet system together with the implementation of its
control loop.
The control loop is build around a Digital Signal
Processor (DSP) that executes the algorithms thatacquire the data of the measured waveform, condition
and filter this data, and finally calculate the corrections
to be applied for tuning to the generator.
ADC, DACs and motor driver for the inductancevariation are directly controlled by the DSP. Via acommunications port remote control can be done.
The hardware used consist of:lThe EZ KIT LITE evaluation kit, that provides accessto the on board DSP via a serial port. The on-board
DSP is the ADSP2181; a 16-bit fixed point processor
having 33 MIPS. On-chip have been integrated 80K
bytes RAM and a separate I/O memory space that
permits glueless system design.
l
Another evaluation board, the EVAL-AD7891-2CB
takes care of the data acquisition. The on-board
ADC is the AD7891-2, which is an eight-channel
multiplexed, sample, and hold buffered, 12-bit dataacquisition system. The sample rate is maximum
500KSPS and the input range is +5 V. The analogue
inputs are buffered with OP467 high-speed opamps.AnAD780 ultra high precision bandgap
refe-rence is used for the ADC.
lA G-64 bus standard dual 16-bit DAC module is used
for the generation of the threshold and reference
settings. Both DAC’s are completely optoisolatedfrom the bus. The output voltage range isfrom -10 V to +10V with 16-bit resolution.

l

The precision threshold amplifier is a newly designed
module built in CERN. Very low noise precision
operational amplifiers, such as the OP27, and highstability resistors are used.
The motor driver interface is also developed in CERN
and consists of an I/O port of the DSP, which isbuffered with some transistors and relays.
All the above mentioned components have been lodged
in a 3U high 19” crate together with the necessary
low voltage power supplies.

4 The software in the DSP
The software created has mostly been made in C and thencross-compiled to the DSP assembly code.
4.1 Data acquisition
The sampling of the magnet current waveform starts on
the reception of a external timing signal. 18-19 samples arethen taken with a sampling rate of 2 µ sand stored inmemory for further use.
4.2 Filtering
The 2¦ Ìs sampling rate allows just 15-16 samples of theflat top. To calculate the amplitude and slope with more
precision more samples are needed. With digital signal
processing [1] this can artificially be obtained by insertionof “zero” samples in between the original samples and thanfiltering all samples with a low pass FIR filter.
4.3 The threshold adjustment
The window amplifier circuit requires a threshold value.
An algorithm to calculate the correct value of the thresholdhas been implemented with Fuzzy Logic [2] and works asfollows:
The amplification of the precision threshold amplifier is
100 so after subtraction of the threshold voltage (seeFigure 8), any rest voltage greater than 50 mV will be
converted by the ADC to 5 V, a “five”, and any sample
under the threshold to 0V, a “zero”. The Fuzzy
Logicalgorithm adjusts the threshold voltage so that no“fives” are present and a minimum number of “zeros” isobtained.

50 mV

x 1005V
Sampled Points

OriginalSignalThreshold

Figure 8: Threshold adjustment algorithm
4.4 The generator adjustment
After calculation of the slope and the mean amplitude it
must be decided exactly how the inductance and thereference voltage should be modified in order to obtain thedesired pulse shape. The implementation of this algorithm
in Fuzzy Logic is underway.
5 Software development and supervision
The DSP controller crate has been connected via its
RS232 port to the accelerator controls network. This meansthat the equipment can remotely be accessed andmonitored.
5.1 Remote access
The following application programs have been created:
A process supervisor surveys the control process,checks the adjustments made by the control process
and displays the results of them. The communication
with the controller crate is made with standard CERN
SL-Equip calls. From this application the parameterslike the reference value for the magnet current,
sampling rate, delay, number of samples, etc, can besent to the DSP.
• A program to download the executable file into theDSP from any PC or workstation on the network.
The following tools have been used:• A special LabVIEW http server that captures thewindow of the process supervisor and makes it
accessible through the Web by any Browser. It allows
multiple user access to the process information.
• On-line debugger. The software tool fuzzyTECH [3],running under MS-Windows, is used to develop and todebug the Fuzzy Logic algorithms that controls thegenerator.
fuzzyTECH can communicate continuously with ano•

ther program running in the same PC using DDE(DynamicDataExchange).
Anestablishedcommunication allows interactive debugging because
the parameters of the algorithm, and even the algorithm
itself can be changed while the whole control process isworking. This eases the tuning of the algorithm. Onceit performs to satisfaction fuzzyTECH creates anANSI-C version of it, that is then compiled and can be
integrated with the software running locally on theDSP. This has already been done with the thresholdadjustment algorithm.
5.2 Local access
All the features available with remote access are alsoavailable for a direct access between a serial port of a PC
and the DSP.
6 Conclusion
The feasibility of a pulse to pulse precision adjustmentof a magnet current pulse generator by using a DSP for
data acquisition and control has been successfully demonstrated.
The use of a digital control loop is simple compared to an
active analogue loop and certainly much more econo-mic.
Fuzzy Logic tools ease the development of the control
algorithm and improve flexibility and insight in theprocess.
The use of off-the-shelf boards accelerates the development phase and is an additional cost reduction factor.
Acknowledgements
The authors would like to thank Patrick Faure, Manuel
Gayoso, Jean-Paul Pianfetti and Jean Ternullo for their
help during the construction of the high voltage generator
and the installation of the control electronic.
References[1] Discrete-Time
SignalProcessing,AlanV.
Oppenheim, Ronald W. Schafer, Prentice Hall,Englewood Cliffs, New Jersey 07632.
[2] Fuzzy Logic and NeuroFuzzy, Applications Explained, Constantin von Altrock, Prentice Hall PTR,
Upper Saddle River, New Jersey 07458.
[3] fuzzyTECH User’s Manual. INFORM Software
Corportation. INFORM GmbH. Pascalstrasse 23,
D-52076Aachen,http://www.fuzzytech.com/