EVENT-BASED TIMING AND CONTROL SYSTEMFOR FAST BEAM-MODE SWITCHING AT KEK 8-GeV LINAC
K. Furukawa∗ , M. Satoh, T. Suwada, KEK, Tsukuba, 305-0801, JapanT. Kudou, S. Kusano, MELCO SC, Tsukuba, 305-0045, Japan
A. Kazakov, GUAS/SOKENDAI, Tsukuba, 305-0801, Japan
L.Y. Zhao, SINAP, Shanghai, 201800, China
Abstract
The 8-GeV linac at KEK provides electrons andpositrons to several accelerator facilities. A 50-Hz beammode switching system has been constructed to realize simultaneous top-up injections for Photon Factory and theKEKB high- and low-energy rings, which require different
beam characteristics. An event-based timing and control
system was built to change the parameters of various accelerator components within 20 ms. The components are
spread over a 600-m linac and require changes to a total of 100 timing and control parameters. The system has
been operated successfully since the autumn of 2008 andhas been improved upon as beam operation experience has
been accumulated. It is expected to enhance the quality ofthe experiments at KEKB and PF. We describe the detailsof this new and improved control system and present statusof the accelerator operation.

INTRODUCTION
The KEK 8-GeV linac injects electron and positron
beams with different characteristics into four storage rings:
KEKB high-energy ring (HER), KEKB low-energy ring(LER), Photon Factory (PF) and PF-AR. It took from 30
s to 2 min to switch the beam modes, depending on themagnet standardization and other equipment controls [1].
Crab cavities were installed at KEKB to achieve higher luminosity. However, it was found that luminosity tuning issensitive to the constant beam conditions at both the HERand LER rings. At the same time, the need to maintainstable experimental conditions led to an increasing demand
for top-up injections at PF. Thus, a simultaneous injection
system for the three rings was constructed, which provided
the following beams:• KEKB HER: 8-GeV electron, 1.2-nC, 2 bunches.
• KEKB LER: 3.5-GeV positron, 1.2-nC, 2 bunches(10-nC primary electron).
• PF ring: 2.5-GeV electron, 0.1-nC, 1 bunch.
Thus, a fast beam-mode switching system has been designed and implemented [2]. Several sets of equipment areinstalled, including pulsed magnets and a fast microwave(RF) system. Beam optics development is also performed∗ < kazuro.furukawa @ kek.jp >in parallel to support the wide dynamic range of beam energy and charge needed, namely, 3-times different energies
and 100-times different charges.
The control and timing systems are upgraded to meet therequired beam-mode switching rate of 50 Hz (20 ms). An
event system has been introduced for global notification of
an imminent switching event along the length of the 600m linac. It has been tested since 2006 and was commissioned in the autumn of 2008. The system enables the fastswitching of many parameters for timing-signals, magnets,
microwave systems, and beam instrumentation [3].

FAST BEAM-MODE SWITCHING
A linac beam pulse is generated every 20 ms (50 Hz).
Each beam pulse can currently be assigned to one of fivedifferent beam modes, namely KEKB-HER, KEKB-LER,
and PF from an electron gun called GU A1, and PF-AR
and PF from another gun, GU CT. For the KEKB injection
modes, each pulse normally contains two beam bunches
96.3 ns apart.
The new system can assign any one of the beam modes
to a pulse. Thus, the beam pulse stream is a train of different beam modes. However, there are several pulsed power
supplies that require equally separated pulses for stable operation. Thus, each beam mode is assigned an equally separated pulse train. And the beam pulse stream becomesoverlapped trains of beam modes, or a beam mode pattern.
Such a pattern is often dynamically changed to meet thebeam status at the ring and to improve luminosity and thequality of the experiment.
In order to control the generation of the beam mode pattern, an event control system was introduced.

EVENT NOTIFICATION SYSTEM
The event system comprises an event generator (EVG)
station and several event receiver (EVR) stations. Theycontain EVG230 and EVR230RF modules from MicroResearch Finland [4], an MVME5500 CPU from Emerson,and other VME components. Other types of event receivers
are also connected.

Event Generator Station
The EVG station is placed at the main timing station near
the linac’s master oscillator. The bucket selection for theKEKB and PF rings is outside the EVG. A bucket selection
timing is selected by the EVG and is used as a timing fiducial. The master oscillator provides the 114.24-MHz clock
signal to the EVG, which is used as the event clock. Whilethe clock signals at KEKB are directly synchronized withcertain integer relations, the clock signals at PF do not havea common base with the linac.
This is explained by the clocks being continuously andindependently adjusted at both rings for circumferencecompensation, with the KEKB requiring tight synchronization tolerances of less than 30 ps. Thus, an accidental synchronization with a certain jitter tolerance is searched forin the PF revolution clock. Currently, the tolerance is set
to 300 ps, which is smaller than the injection acceptance of700 ps.
The EVG is loosely synchronized to a 50-Hz AC powerline before being fed the timing fiducial. While the accidental synchronized timing for the PF is normally about 10kHz, it can be lower if the clock frequencies become close
to an integer relation. Thus, the signal is always monitored
to maintain a sufficient rate. Thereafter, all the timings andevents generated are based on this 50-Hz fiducial and the114-MHz clock.
The generated event stream signal is transmitted from asmall form-factor pluggable transceiver (SFP) on the EVG
to many EVRs through optical fan-out modules in a starlike topology.

Event Receiver Stations
EVR stations are installed at six sub-control rooms to replace old and static timing systems [5], and also at the beginning of linac sectors to provide fast equipment controls.
The EVR receives the event stream though a SFP connector. While multi-mode fibers are used for most stations, asingle-mode fiber and SFPs are used for an EVR station ata distance of 400 m.
The EVR generates timing and gate signals based on theevent code provided by the EVG in order to drive the equipment. Timing signals are assigned some delay from thefiducial. Gate signals are started at the end of the previous
pulse and are stopped at the end of the next pulse.
The event also triggers an interrupt on the VME bus andthen invokes EPICS device-support software [6]. Analog
signal controls are performed using DAC and ADC modules through a CPU module.

Software Receiver Stations
Some observation stations receive events over a TCP/IP
network because such hardware cannot accommodate anEVR module. The failure rate with our current network
configuration was confirmed to be less than 1 ppm. The
hardware includes oscilloscopes with Windows embedded
and a VME system. Although the failure rate is low, the useof this scheme is restricted to observation stations. EVRs
are utilized to control equipment.

Hardware Receiver Stations
Some of the existent subsystems receive events throughhardwired cables. The EVG station also has an EVR module to provide gate signals for subsystems such as thebucket selection system and the ring injection systems. Thesystems use the gate signals to determine the local parameters.

SOFTWARE STRUCTURE
The entire event related stations run EPICS software
R3.14.8.2 or R3.14.9. These include one EVG, 13 EVRs,
and 27 software stations. EVG and EVR stations also run
V2.4.1 of their device support software with modifications
made for new hardware features.

Beam-mode Pattern Generation
In order to generate the beam mode pattern explained
above, an external program to the EVG station is used. Thisis explained by the fact that the operation requirements maychange frequently and a flexible system is required. Programs in scripting languages are utilized for rapid prototyping. The event control system together with several hardware system installations and beam optics developments
are performed simultaneously. Thus, the pattern generation
algorithm is modified almost daily.
The length of the pattern can be any number less than
500 (10 s), and it can be downloaded at any time into theEVG station as an EPICS waveform record. Once it isloaded, it repeats forever until the next pattern is loaded,then the previous one is replaced at the end of the pattern.
There are several pattern generator programs. One of theprograms accepts requests from other programs and humanoperators, and tries to arbitrate them automatically. Thus,
this program is the one most frequently used. Another manual pattern generator is also utilized, depending on the operation modes.

Event Code Generation and Processing
Every 20 ms, the EVG station reads one element fromthe beam mode pattern, to generate a sequence of eventcodes.
Linac may provide five different beam modes as described above. Each beam mode has a backup called astudy mode and sometimes a pulse does not have a beam.
Thus, a total of eleven beam modes are defined.
Three events are assigned at least for each beam mode,
one for the preparation and two others for the beam andequipment triggers. The preparation event at the end ofan event code sequence invokes EPICS process-variables(PVs) at the EVR stations to assign delay values to the EVR
itself and analog values to the DAC modules, and also togenerate gate signals. The other two events at the next pulse
generate actual timing pulses for the corresponding beammode, as set by the preparation event.

Some devices such as pulse magnets need dedicatedtreatments at the EVR stations, and they have corresponding event codes. The number of event codes is approximately 50, with approximately 120 dynamic equipment
parameters. Each dynamic parameter PV has eleven corresponding PVs tagged with the beam modes. In total, approximately 4000 EPICS PVs drive the event system andthe numbers are evolving for new operation features1 .

Event Transmission over Network
For each pulse, the beam event code is also transmitted
from the EVG station over a TCP/IP network using EPICS
channel access (CA) protocol. Software receivers accept
the beam event code and decide the operation based on thedelivered code and update the observed values. EPICS PVstagged with eleven beam modes are prepared for each observation value. All of the beam position monitor (BPM)
stations are driven under this scheme [7].

COMMISSIONING AND OPERATIONThe event system was installed in the summer of 2008,
replacing the hardware element of the slow beam-switchingsystem. The new system was utilized with static parameters
and operated statically in the autumn of 2008.
Each piece of the newly installed equipment was individually tested with the event system. We generally havea four-hour maintenance period every other week during
which time new EPICS IOC software was installed and new
hardware was connected. During the commissioning stage,
running until the spring of 2009, fast controls were confirmed for these devices and sub-systems.
• 13 EVR stations• voltages and picosecond-timing controls for an electron gun• low-level RF timing and phase controls for 11 RF stations• high-level RF timings for 60 RF stations• 12 pulsed magnets• 24 linac beam position monitor stations for 100 BPMs
• 2 beam-transport line monitor stations for 50 BPMs
• 4 RF monitor stations• injection RF phase controls for KEKB rings• injection bucket selections for KEKB rings
Adaptive beam optics developments were also performed to support simultaneous injections to three rings
with the same parameters for static magnets [8]. Duringthat period, operational software written in scripting languages was enhanced on a daily basis in order to meetthe requirements stemming from daily discussions. The
programs include the beam mode pattern generators, dynamic parameter manipulators, beam-mode dependent display panels, data archivers, etc.
1 PVs for the observation stations are not counted.

Actual simultaneous injection for the three rings started
in the middle of April 2009. Although the operational parameters are not yet optimal, the beam current at the PF ringis kept within 0.1 mA, and those of KEKB rings are kept
within 2 mA. Such stable beam conditions should enhance
the beam quality at the rings.
Some of the observation stations do not recognize 50-Hz
beam-mode switching yet, including streak cameras, beam
wire-scanners and RF monitors, for which a timing signal
only for a selected beam mode is delivered.
Missing pulse detectors are installed at several locations,and no anomalies have been observed during normal operation. An integrity timing monitor for the system is being
developed to ensure correct operation. Since the summer of2008, one of the EVR stations unexpectedly stopped working on two occasions, forcing a reboot. Electronic noise
elimination is considered for this.

CONCLUSION
The new event-based control system was validated under the beam operation. It was proven to satisfy the fastswitching requirements. The system is expected to realize
a sensitive and stable tuning of KEKB with crab cavities
for improved luminosity and higher-quality experiments simultaneously at the PF ring. Further software development
is planned to support the beam operation with the three virtual accelerators enabled by the event system.

ACKNOWLEDGMENTS
The authors would like to thank Dr. E. Björklund at
LANL and Dr. T. Korhonen at PSI for providing the EPICS
event software.

REFERENCES[1] K. Furukawa et al., “Beam Switching and Beam Feedback
Systems at KEKB Linac”, Proc. LINAC2000, Monterey,USA, 2000, p. 633.
[2] M. Satoh et al., “Present Status of the KEK Injector Upgrade
for the Fast Beam-Mode Switch”, Proc. LINAC2008, Vancouver, Canada, 2008, p. 409.
[3] K. Furukawa et al., “Development of Timing and Control
Systems for Fast Beam Switching at KEK 8-GeV Linac”,
Proc. LINAC2008, Vancouver, Canada, 2008, p. 397.
[4] <http://www.mrf.fi/>.
[5] K. Furukawa et al., “The Timing System of KEKB 8GeV Linac”, Proc. ICALEPCS2003, Gyeongju, Korea, 2003,
p. 130.
[6] <http://www.aps.anl.gov/epics/>.
[7] M. Satoh et al., “Fast BPM DAQ System Using Windows
Oscilloscope-based EPICS IOC”, Proc. ICALEPCS2007,Knoxville, USA, 2007, p. 469.
[8] N. Iida et al., “Pulse-to-Pulse Switching Injections to ThreeRings of Different Energies from a Single Electron Linac atKEK”, in these proceedings (WE6PFP110).