Proceedings of the 20th Annual Meeting of Particle Accelerator Society of Japan
August 29 - September 1, 2023, Funabashi

PASJ2023 THP09

THE DEVELOPMENT OF LINUX-BASED PULSED MAGNET CONTROLSYSTEM USING PXIe DEVICES AT KEK LINAC
D. Wang1∗ , M. Satoh1 , S. Ushimoto2 ,1
KEK, Ibaraki 305-0801, Japan2
Mitsubishi Electric System & Service Co., Ltd
Abstract
The pulsed magnet control system (PMCS) at KEK electron positron injector LINAC operates at every 20 ms toachieve simultaneous injection for four rings, a 2.5 GeV Photon Factory (PF), a 6.5 GeV PF-AR, a 4 GeV SuperKEKB
lower energy ring (LER) and a 7 GeV SuperKEKB highenergy ring (HER). The system consists of a control serverthat operates on the Windows 8.1 platform, in conjunction
with a PXIe chassis equipped with a DAC, an ADC, and anevent timing module. The PXIe DAC board responds to thetrigger signal which is generated from the event receiver andsets the current of the pulsed magnet. The current readback
value of the magnet is retrieved from the ADC module. Despite its long success, the PMCS has several problems inuse. One is the discontinued support of Windows 8.1. Another key concern is the unsatisfactory long-term stability.
To solve the problems, an upgraded system using real-timeLinux to communicate with PXIe modules is adopted. The
EPICS driver for PXIe devices is developed to integrate with
the LINAC control system. The development of the new
Linux-based PMCS is introduced in this work.

that represents a kind of beam mode, it starts responding
and sets the magnet current. By using these magnets, themagnetic field can be changed pulse-to-pulse in 20 ms, andthe beam profile is optimized for each destination ring.

PULSED MAGNET CONTROL SYSTEM
HardwareFigure 2 shows the rack of one pulsed magnet controlunit. Each unit consists of a homemade server and a National Instruments (NI) PXIe-1082 chassis fitted with fourmodules, a controller control module (NI PXIe-8381), an
event receiver (EVR) board (MRF PXI-EVR-230), a DAC
board (NI PXI-6733), and an ADC board (NI PXIe-6356).

OutputModuleINTRODUCTION

PXIeChassis

The injector LINAC at KEK is responsible for the injection of 4 target rings which consist of a 7 GeV electron highenergy ring (HER), a 4 GeV positron low energy ring (LER),
a 2.5 GeV Photon Factory (PF) and a 6.5 GeV PF-AR ring,as shown in Fig. 1. It should perform simultaneous top-up
injections into four storage rings and a DR by pulse-to-pulse
modulation (PPM) [1].
e-LERSuperKEKB

e+HER

7 GeVLER

4 GeV

DR

1.1 GeVPF-AR

6.5 GeVPF

2.5 GeV

ServerUPS

PF-AR
HER
PF e+ Damping Ring

Figure 1: A schematic view of LINAC, SuperKEKB, andPF/PF-AR.
To satisfy such PPM requirements, 16 pulsed magnet control units have been installed along the 600-m LINAC since2017. When the magnet control units receive an event code
∗ di.wang@kek.jp

Figure 2: Rack of a pulsed magnet control unit.
This setup controls and monitors the output current of
up to 8 power supplies independently, offering a resolutionof 16 bits and operating at a sampling rate of 1 MSa/s. To
avoid instability stemming from power outages or signal
interference, an uninterruptible power supply (UPS) system
has been deployed to furnish seamless auxiliary electrical- 692 -Proceedings of the 20th Annual Meeting of Particle Accelerator Society of Japan
August 29 - September 1, 2023, Funabashi

PASJ2023 THP09

power. The comprehensive system is securely housed withina unified rack infrastructure.
Every individual unit can manage up to 8 pulsed magnets.
Each of these pulsed magnets is responsive to 12 distinct
beam modes. The output magnet current value is determinedby the specific injection beam mode in operation.
Each unit can control up to 8 pulsed magnets. Each pulsed
magnet responds to 12 kinds of beam modes. The output
magnet current value is determined by injection beam mode.
The data buffer functionality inherent to the Event Receiver(EVR) is utilized to transmit the beam mode information.

via the ADC can be effectively stored within an EPICS waveform record, accomplished through the utilization of thecallback function afforded by NI-DAQmx.
The mrfioc2 module from the EPICS community is used
as a low-level driver of the PXI EVR module. Additionally,
it is noteworthy that a minor modification of the mrfioc2module is necessary to facilitate the reception of the databuffer from the EVR, owing to a compatibility issue related
to CPU endianness.

Trigger System

SoftwareOn the software front, a LabVIEW application governs
the process of data acquisition and provides connectivity
through EPICS Channel Access (CA) [2].
Due to a variety of reasons, a resolution has been reached
to enhance the current system through an upgrading process.
Various justifications for this decision are enumerated asfollows.
• Windows 8.1 is discontinued.
• The trigger dropping rate is high [2].
• System restart is required occasionally [2].

Figure 4: The data flow and trigger system.

• The compatibility and performance issue of NI network
shared variable.

NEW SYSTEMPXIe modules under Linux

Figure 3: Diagram of the PMCS.
Figure 3 shows the structure of the new PMCS. The initial
step of the upgrade process involves the preparation of theAlmaLinux distribution, after which an evaluation of theviability of the operation is conducted through the testing ofdrivers and access libraries.
In the case of NI modules, the server establishes a connection with the chassis using an NI PCIe-8381 module via anMXI-Express cable, which can transmit at a rate of 40 Gbps
in each direction simultaneously. The Linux kernel driveris provided within the NI-DAQmx package. This package
offers comprehensive assistance for devices oriented towards
data acquisition and signal conditioning. The data acquired

As shown in Fig. 4, every 20 ms, the PMCS is triggeredby a magnet trigger event. The current beam mode andshot ID are extracted from the data buffer of EVR. Meanwhile, the DAC outputs a waveform spanning a duration of
4 ms, directed towards the pulse driver. Upon completionof waveform acquisition by the ADC, an interrupt is generated, subsequently prompting the initiation of the logging
system to store data originating from 8 distinct channels.
Concurrently, the output waveform of the subsequent pulse
is determined by the specific shot ID. The callback function
also triggers the initiation of the record processing procedure. Finally, after writing a new waveform of the next pulse
to the memory, the DAC enters a standby state and preparesfor the forthcoming trigger event.
The synchronization mechanism between the DAC andADC is established by configuring the trigger mode to operate in an external trigger. In this setup, the DAC is triggered
through an external signal. The ADC performs a continuous
process of data sampling, although the generation of thesample clock is synchronized to the arrival of the externaltrigger signal.

Real Time Configuration
The implementation of a real-time operating system plays
a significant role in mitigating the concern of trigger drop
occurrences. This brings the installation of a real-time kernel and the optimization of its policy settings to ensure ahigh-performance mode. With the help of the MCoreUtils
module, the configuration of real-time parameters for EPICSInput/Output Controller (IOC) threads is also accomplished.

- 693 -

Proceedings of the 20th Annual Meeting of Particle Accelerator Society of Japan
August 29 - September 1, 2023, Funabashi

PASJ2023 THP09

Performance and Stability
The stability result measured in 2018 is reported in thepaper [3]. Similarly, we undertook measurements of a test
magnet and subsequently computed the relative stability
utilizing statistical metrics including the mean value andstandard deviation. The result is shown in Fig. 7. During
the 8-hour experiment, the relative stability was 88 ppm,
corresponding to the level with the precedent measurement.
Figure 5: A real-time IOC configuration with different priorities, FIFO scheduling policy, and defined CPU affinity.
Adapting the MCoreUtils module allows for the adjustment of thread priorities, and scheduling policies (FIFO orRound-Robin). Additionally, optimizing the CPU affinity
of IOC threads can enhance system performance, achieved
through the segregation of CPU cores utilized by the housekeeping threads and the EPICS IOC threads. Figure 5 shows
the result of our real-time IOC configuration.

Monitoring and Log System
Instead of employing EPICS channel access for logging
purposes, an independent log thread is created. This approach serves to avoid potential performance complications
caused by an excessive number of EPICS channel accessclients. A ring buffer is established to accept log data fromthe ADC waveform every 20 ms and write them to a local
SSD storage.
The log entries consist of three process variables associated with magnet currents, along with pulse information.
The process variables include the magnet current’s designated set value, its actual output value, and the value retrieved from ADC readback. All data from 8 channels isrecorded within a log waveform, tagged with a timestampsourced from the EVR, the shot ID of current pulse, andinjection beam mode of current pulse. These appended attributes facilitate the subsequent diagnostic analysis in caseof system failures.
PC Stats

Figure 7: The measured magnet current result of a test magnet for 8 hours operation. The mean value and standard
deviation of the current were 160 A and 0.0141 A, respectively.
For the long-term stability, after establishing 10 thousand channel access connections to the EPICS IOC, the newsystem demonstrated sustained and consistent performance
during the operation of one month. Notably, no failures wereobserved during this period.

CONCLUSION
The pulsed magnet control system is upgraded from aWindows 8.1-based LabVIEW program to a non-proprietary
operating system and software. We implement, test, validate,and modify the control software under the PXIe platform
while keeping the available hardware. The experiment shows
both the performance and stability are satisfactory.

REFERENCESEVR Stats[1] K. Furukawa, M. Satoh, T. Suwada, and T. Nakamura, “Pulseto-pulse Beam Modulation and Event-based Beam Feedback
System at KEKB Linac,” in Proceedings of IPAC’10, 2010, pp.
1271–1273. https://accelconf.web.cern.ch/IPAC10/papers/tuocmh01.pdf

Magnet current StatsIOC Stats[2] Y. Enomoto, K. Furukawa, T. Natsui, H. Saotome, and M.
Satoh, “Pulsed Magnet Control System Using COTS PXIe Devices and LabVIEW,” in Proceedings of the 17th International
Conference on Accelerator and Large Experimental Physics
Control Systems, vol. ICALEPCS2019, 2020, pp. 946–949.
doi:10.18429/JACOW-ICALEPCS2019-WECPR05

Figure 6: A monitoring OPI for PMCS.
An operator interface (OPI) panel is also provided to help
operators monitor the IOC status and quickly find any anomalies. Figure 6 shows the interface.

[3] Y. Enomoto et al., “Pulse-to-pulse Beam Modulation for 4
Storage Rings with 64 Pulsed Magnets,” in Proceedings ofthe 29th Linear Accelerator Conf., vol. LINAC2018, 2018, pp.
609–614. doi:10.18429/JACOW-LINAC2018-WE1A06/- 694 -