UPGRADING THE CONTROL SYSTEM OF THE MOVABLE MASKS FORKEKBTakuya Nakamura∗A)
Kazuro FurukawaB) , Tatsuro NakamuraB) , Jun-Ichi OdagiriB)A)
Mitsubishi Electric System and Service Co.,Ltd.
2-8-8 Umezono, Tsukuba, Ibaraki, 305-0045
B)High Energy Accelerator Research Organization (KEK)
1–1 Oho, Tsukuba, Ibaraki, 305-0801
Abstract

FORMER CONTROL SYSTEM

The positron ring and the electron ring of KEKB havetheir own dedicated movable masks to cut off spent electrons/positrons near the beam orbit to reduce backgroundin the detector. The stepping motor drivers of the movablemasks were controlled by a Programable Logic Controller(PLC), which was supervised by a VME-based IOC (InputOutput Controller). The IOC and the PLC was connectedwith each other by using GP-IB interface for the communication. Recently, however, the GP-IB connection cameto be unstable causing communication errors between theIOC and the PLC. In order to solve the problem, a new
type of EPICS (Experimental Physics and Industrial Control System) IOC, which runs Linux on a CPU module ofFA-M3 PLC, has been adopted. The CPU functions withstandard I/O modules of FA-M3 on the PLC-bus. In thiscontrol system, we replaced an existing ladder CPU with
the IOC and the ladder program with an EPICS sequencer
program for the efﬁciency of software development andease of maintenance. The new IOC has been successfully
serving since it was put in operation in September 2008. In
this paper, we describe the details of the new control system
and its experiences up to the date.

Conﬁguration of Former Control System
The former control system was composed of a VME
computer, a PLC and a digital multimeter to read back positions of the masks. These devices are conected by a GPIB interface. The control logic of the movable masks wasexecuted by ladder programs running on PLC’s CPU.
There were four positioning modules, a digital output
module, a digital input module, and a GP-IB module in the
PLC unit. The positioning module controlled stepping motor drivers of the movable masks. One positioning module
covered two movable masks, so that one PLC took care ofeight movable masks. A digital output module were usedto generate emergency stop signal for the stepping motordrivers. A digital input module read the status signal of thecooling water system for the movable masks. And the GPIB module interfaces a digital multimeter with the VMEIOC.
The movable masks are remotely controlled through
EPICS GUI-based application. The application send aoperation-command to the VME-based IOC via Ethernet.
And then the IOC send a command to PLC’s CPU via GPIB connection.

INTRODUCTION
The KEKB main ring is comprised of a high energy ringfor the electron beam and a low energy ring for the positronbeam. In order to reduce the background in the detector itis crucial to cut off spent electrons/positrons near the beam
orbit. For this purpose, each ring has movable beam masks
at four stations, each of which installs eight masks. The positioning of the masks is executed by using FA-M3 PLCs
with positioning modules. The system had been stably operated for more than ten years without serious problems.
Recently, however, communication errors increased on theGP-IB connection between the PLC and an IOC that supervises the PLC. To solve the problem, we upgraded themovable mask control system by using a newly released
PLC’s CPU. The next section describes the former control
system and the following sections describe the upgradedsystem in detail.
∗ E-mail: < nakataku @ post.kek.jp >Figure 1: Conﬁguration of Former Control System

Problems of Former Control System
In the former system, while the control logic of the movable masks was implemented by usual ladder program,
EPICS-based control was used on the VME computer.
As a result, learning both development environments wasneeded to increase the learning cost.
In addition, the communication errors on GP-IB connection came to occur between the VME IOC and the PLC toprevent the system from stable operation.
To solve these problems, the upgrade of the movablemask control system was required.

DESIGN OF NEW CONTROL SYSTEM

Since the digital multimeter has only GP-IB interface,a GP-IB module for FA-M3 is required. Message-basedtransaction over GP-IB can also be implemented by using
the EPICS sequencer.
Another advantage is that this scheme reduces the number of devices included in the movable mask control system
to simplify the system signiﬁcantly. (as shown ﬁgure 2-C)

Feasibility Test
We carried out tests to evaluate the feasibility for bothschemes described above to conﬁrmed that they both works
ﬁne. Finally, F3RP61 was adopted because the solution
does not require additional hardware and simpliﬁes theconﬁguration of the system.

This section describes design considerations for a newsystem to eliminate the GP-IB connection between the IOC
and the PLC. Two possible candidates were available.

netDev
One possible method is to connect the IOC and the PLC
using Ethernet. For this purpose, a library, netDev, wasavailable. netDev is an EPICS device support for networkbased controllers to communicate with devices via Ethernet. In this case, however, an Ethernet module needs to beadded to the former PLC unit since it dose not have one.
Moreover, in order to connect the digital multimeter withthe IOC, an additional LAN/GP-IB Gateway, which interfaces Ethernet with GP-IB, is also necessary.(ﬁgure 2-B)
Although it is possible to connect with the digital multimeter by using the GP-IB module of the PLC, it is unsuitable
for this upgrade scheme since development of an additional
new ladder program is necessary.

F3RP61
For another possibility, we evaluated the adoption of
F3RP61 for the new system. F3RP61 is a new PLC’sCPU, which can replace or work with an ordinary CPU
that executes ladder programs. Because F3RP61 adopts
Linux for its OS, it can run EPICS IOC core program onit. As a result, PLC’s CPU itself becomes an EPICS IOC
for movable mask control to eliminate the GP-IB connection between the IOC and the PLC. In addition, by replacing ordinary PLC’s CPU with F3RP61, we can shift fromladder programs to EPICS sequencer programs. EPICS
sequencer, which is written in State Notation Language(SNL) is widely used in EPICS-based control systems.
SNL has the notion of state and a syntax to wait events ina simple manner. Moreover, C-programmers are accessible
to SNL since the syntax is similar to the language. Therefore, shifting to the EPICS sequencer improves readability
and maintainability of the software. Another advantage ofthe switchover from ladder program to EPICS sequencer isthat we only get to need only open software supported by
EPICS community. Exclusive software to develop ladderprograms is no more necessary.

Figure 2: Each Control Systems Conﬁguration

CONFIGURATION OF NEW CONTROLSYSTEMIn the upgraded system, an F3RP61 CPU executes
EPICS IOC core program on Linux to serve as a dedicatedIOC for movable masks. The IOC covers the positioning ofthe movable mask and read back of the masks positions using the digital multimeter. The I/O modules included in thePLC unit are four positioning modules, a digital input module, a digital output module and a GP-IB interface module.
By reusing all of the existing I/O modules we could save
hardware resources.
The EPICS sequencer was used for both controlling
movable masks and communication through the GP-IB interface. As a result, a ladder program for mask control anda device support for GP-IB communication were replaced

with EPICS sequencer. The EPICS sequencer programs
were implemented by using templates with associated parameter ﬁles that describes the details of each devices. It allowed us to maintain the program much easier than before.
The adoption of Linux as its OS enhanced the productivity
in the software development since developing programs in
the user space is easier and quicker than doing it in the kernel space. It is of importance to reduce the time and costrequired for the development of application software since
it was frequently updated throughout their lifetimes.
In summary, a simpler, efﬁcient system in achieved bothrespects of hardware and software.

April 2009. Up to the present, we have not experienced
any troubles at all on both of the stations. The operation ofthe remaining two stations is scheduled to start in the next
accelerator operation from October 2009.

FUTURE PLAN
There are several subsystems, of which control system tobe upgraded by using F3RP61 CPU, such as vacuum component other than movable masks, the low level RF system,and so forth. The experience acquired through the upgradeof the movable mask control system can be the base of thepossible upgrades of those systems. For this reason, weare planing to enhance the reusability of the software developed for the new mask control system so that it can bereused for other control subsystems with ease.

SUMMARY
The movable mask control system has been updated using F3RP61 CPU running Linux as an IOC. By replacing
ladder programs with EPICS sequencer programs, the burden of the maintenance of the application software was signiﬁcantly reduced. The upgraded system has been operated
stably more than a year without any troubles. The experience of the upgrade formed the base for the other control
subsystems to be upgraded in the near future.

REFERENCES
Figure 3: Conﬁguration of New Control System[1] EPICS website <http://www.aps.anl.gov/epics/>[2] J. Odagiri et al., “EPICS Device/driver Support Modules for
Network-based Intelligent Controllers”, ICALEPCS 2003,
Gyeongju, Korea, 2003
[3] A. Uchiyama et al., “Development Embedded EPICS on
F3RP61-2L”, PCaPAC08, Ljubljana, Slovenia, 20-23, 2008[4] M. Komiyama et al., “Upgrading the Control System of
RIKEN RI Beam Factory for New Injector”, in this conference[5] K. Mikawa et al., “Embedded EPICS Controller for KEKB
Pulsed Quadrupole Magnet Power Supply”, in this conference[6] M. Takagi et al., “Control of the J-PARC Slow Extraction
Line Based on Embedded EPICS”, in this conference[7] S. Motohashi et al., “Data Acquisition System of Beam Loss
Monitors of J-PARC Main Ring”, in this conference

Figure 4: F3RP61 on PLC unit

OPERATIONAL EXPERIENCEAs of October 2009, the control systems of the movablemasks has been upgraded for all of the four stations andready to run. Two out of four stations has experienced accelerator operations. The ﬁrst station had been put in operation in September 2008. The next station followed it in