Introduction

An electronic cooler system produces intense beams of highly charged ions for HIRFL-CSR [1, 2]. As one of the important methods of beam cooling in a synchronous accelerator, an electronic cooler system is used for beam cooling in proton and ion storage rings. In the middle-energy and low-energy regions, it can effectively reduce the energy dispersion and transverse emission of the ion beam stored in the ring. Among electronic cooler devices, the electron gun is a most central part. Figure 1 is a schematic of an electron gun. An electron gun is generally composed of a cathode, a shape electrode, a control electrode, and an anode electrode. The shape electrode restrains electron emission from the side of the cathode, and the anode is mainly used for the extraction of the cathode surface electrons. The control electrode and cathode phase are adjacent. Small changes in the electric potential will affect the electron emission region and the electronic beam density distribution of the cathode [3, 4].

A control system must manage devices with a high degree of accuracy to satisfy various physical requirements, and to ensure the accuracy of the data acquisition and control characteristics, a software framework must be developed. Details of the proposed control system architecture, main test results, and performance are described in the “Hardware architecture”, “Software architecture design”, “Control interface protocol”, “Database design”. Conclusions sections are presented in “Results and conclusions” section.

Hardware architecture

Various devices must be accurately controlled, including the high-voltage power supply (HVPS), anode power supply, suppressor power supply, grid power supply, filament power supply, collector power supply, leakage current detector, and temperature monitor. Figure 2 shows the hardware setup of the proposed electronic cooler control system for CSRm. All devices in the system are controlled by network switches connected to the industrial PC, as shown in Fig. 3. The serial port servers are used to control the devices by employing RS485 serial interfaces. Thus, the related devices can be directly controlled via the RS485 ports, including the HVPS leakage current, collector leakage current, temperature sensor, and magnetic gate switches. At the same time, other aspects of the system can be controlled via an intranet, including the HVPS, grid PS, anode PS, filament PS, suppressor PS, and collector PS.

Fig. 1
figure 1

Electron gun schematic

Fig. 2
figure 2

Hardware setup of electronic cooler system for CSRm

Fig. 3
figure 3

Architectural overview of the system

In addition, all of the devices and controllers operate in strong electromagnetic fields and in radioactive and high-voltage surroundings. Given such special working requirements, single-mode glass fibers are used between devices and converters. When the surge voltage is less than the protection voltage of the devices, recoverable damage occurs and a recovery can restart. The control software can then recover from the damage by reconnection. When the surge voltage exceeds the protection voltage, irretrievable device damage will occur. The control software can then only issue an alert. Measures have therefore been taken to solve these problems. The controllers are designed with a transient voltage suppressor diode in the input port that can prevent damage to the controllers from electrical surges. Ferrite beads are fixed around the signal lines to suppress spike signals to the controllers, providing further protection from damage to the controllers caused by electrical surges.

Fig. 4
figure 4

ADC framework diagram of I-7017R module

Laboratory tests were carried out to confirm the suitability of the system before installation at CSRm. Status information of all devices and control signals were obtained and processed via the control software running on the IPC [5, 6].

Fig. 5
figure 5

Flowchart of the software system

For the detection of a leakage current on the high-voltage platform, an I-7017R module was adopted as the analog-to-digital conversion (ADC) module. The I-7017R is an eight-channel data-acquisition module that has several functions, including converting analog data to digital data, digital inputting and outputting, and serving as a timer and a counter. The communication between the modules and the host is implemented by a RS485 bidirectional serial bus. A set of ASCII format instructions in conjunction with the DCON protocol is used for remote control. Different baud rates can be chosen for different applications. The highest transmission rate can be set to 115.2 kb/s. The modules have a grounded shell and INIT switches. The grounded shell can better protect the module from damage caused by electrostatic discharge, enhancing its reliability. INIT switches allow the INIT mode to be accessed more easily. The characteristics of the I-7017R module are 3000-V (DC) module isolation and 24-bit \(\sum - \Delta \hbox {ADC}\), providing better accuracy, software calibration, and protection functions. Figure 4 shows the framework diagram of the I-7017R module.

Software architecture design

The control software was developed within the Microsoft Foundation Class (MFC) framework and its architecture conforms to the model-view-controller (MVC) model. The MVC model separates views and models by establishing a subscribe/notify protocol. A view object must ensure that its appearance reflects the state of the model. The model object is independent of both view and controller objects, so it is possible to have multiple views (presentations) of same model (data). All associated views can be subscribed to the model, and the model notifies them about its state changes. When a user interacts with the MVC-pattern-based GUI form, all fired events are captured by the controller object. The controller then decides whether the fired event is related to a change in state of the model or a change in state of the view.

The control software consists of four layers, the user interface (UI), system interaction (SI), problem domain (PD), and data-management (DM) layers. The UI corresponds to remote monitoring, SI to server control, PD to field control, and DM to database. These layers reflect the hierarchical structure of the system. The control architecture is capable of extending the system functions and upgrading devices. The server control layer plays a key role in the control system. The TCP/IP protocol is adopted for data transmission. The network controls and monitors the parameters of the electronic cooler system to achieve an optimized status. The network interconnects all of the different types of control hardware and provides a way to communicate with any other system outside the project scope. Figure 5 is a flowchart of the system software.

In addition, it is very important to control the system with robust flexibility and universality, including both hardware and software. The module mechanism provides a flexible reconfiguration function in the control software, and different functions are implemented in different modules. The control software is composed of function modules and their communication, including but not limited to the communication, data-decoding, data-display, and data storage. Any module can be added or deleted from the software to meet the requirements of the control system. This structure allows new devices to be easily added .

The data-acquisition module is used to obtain data from the controllers in addition to setting appropriate parameters, sending the correct commands, and acquiring data. After the data-acquisition module obtains relevant information, it then sends the data to the display module for presentation. The data-storage module uses a timer to sample and save the device data. Should an error occur, the module would send the interlock protection signal to the relevant controllers in case of damage to any device. At the same time, the alarm would be triggered, notifying the person on duty.

Control interface protocol

The control commands include boot, shutdown, reset, states-query, DC-set, data-write, and data-read. The underlying data are transmitted through the RS485 protocol [7]. The communication rate is 115.2 kbps with 1 start bit, 8 data bits, 1 stop bit, and a parity check. The formats of communication byte and protocol frames are listed in Table 1.

Table 1 Detailed description of protocol-frame format
Table 2 Detailed description of PS status protocol
Fig. 6
figure 6

Remote-control software interface

The calculation method of CHKSUM is that the ASCII code value of characters is accumulated except for SOI, EOI, and CHKSUM, and the remainder of modulo 65536 is reversed and then 1 is added to it. For example, for character string “\(-1203400456\hbox {ABCDEFC}72\hbox {CR}\)” (“−” is SOI and “CR” is EOI), the characters “‘FC72” comprise the CHKSUM, and the computing method proceeds as follows: “1” + “2” + “0” \(+\cdots +\) “A” + “B” \(+\cdots +\) “F” + “E” = \(31\hbox {H}+32\hbox {H}+30\hbox {H}+\cdots +41\hbox {H}+42\hbox {H}+\cdots 46\hbox {H}+45\hbox {H}=038\hbox {EH}\). “1” is the ASCII value of 1, “E” that of E, 038EH modulo 65536 is 038EH, and the reverse of 038EH is FC72H. Command words have 2 bytes ASCII code, in other words, \(41\hbox {H} + 41\hbox {H}\). The power-supply status contains 8 bytes ASCII value. Details are listed in Table 2. Current and voltage are first converted to 4 bytes float value, which is obtained by 4 bytes unsigned char pointer, and then converted to 8 bytes ASCII code to be sent. The response information of the status can be automatically uploaded when the fault occurs.

Table 3 Power-supply parameters

Database design

Based on the embedded SQLite database, a distributed data-processing system is developed for experimental data archiving, processing, and retrieval [8]. Data stored in the data server consist of historical experimental data and real-time display data of the device states. Experimental data stored in the database, labeled with a shot number, includes temperature and parameters of power supplies, configuration of the devices, experimental results, status of the field devices, information about the alarms and alerts, information about the online terminals, real-time feedback values of the key parameters, and states of the control system. The system provides the data-processing tools and data-analysis program for analysis and visualization. The system also provides data-processing and conversion tools along with data-query capabilities and a backup program.

The data are also important for system diagnosis. Data in the program are sampled every second and stored on the disk every 5 min. This method improves operational efficiency as the speed of storing data to the disk is relatively slower. In order to guarantee flexible analysis, the data are stored in list mode. All parameters are stored along with a time stamp.

The operating parameters are important for the subsequent failure analysis and facility maintenance of equipment. The effective storage of data is the main requirement of the control software. The control commands, timing sequences, and logic control orders of the system are closely related to the operating conditions of the field devices.

Results and conclusions

Figure 6 shows the remote-control software interface. The system was completed and became operational in March 2016, and it can acquire data at a minimal rate of 3 times/s and complete the entire interlock protection and alarm processes in 50 ms.

The graphical interface of the control software has been running normally in the central control room at HIRFL-CSRm since activation. The electronic cooler system was tested with the \(^{12}\hbox {C}^{3+}\) ion beam. Parameters of the power supplies are shown in Table 3. The \(^{12}\hbox {C}^{3+}\) injection beam with 4.282 MeV/u energy is successfully cooled by electrons, and the extraction beam energy is 2.4013 keV. The ion beam intensity is \(90\ \upmu \hbox {A}\). The high-voltage reliability results of the ion beam are shown by the curve plotted in Fig. 7, and the \(^{12}\hbox {C}^{3+}\) beam parameters are listed in Table 4. The experimental results are shown in Fig. 8, and, as can be seen in the figure, the ion beam current reaches an intensity of \(90\ \upmu \hbox {A}\) after a series of injections and coolings.

Fig. 7
figure 7

High-voltage reliability results of \(^{12}\hbox {C}^{3+}\) ion beam

Table 4 Beam-current parameters
Fig. 8
figure 8

Experimental results

In practice, the proposed control system ensures safe and stable operation of an electronic cooler system. Under the support of the control system, the electronic cooler has successfully cooled the \(^{12}\hbox {C}^{3+}\) ion beam according to expectations. The experimental results show that the operation and control of high-voltage power supplies are also stable, with the stability rate of the HVPS approximately \(10^{-5}\ \hbox {V}\) during the experiment. The proposed electronic cooler control system meets the requirements of the control functions in terms of making experimental operations more automatic and visual.

The system has been running successfully for several months, and experiments have shown that it offers the desired advantages of precision, efficiency, stability, and convenient operation.