Application Software for New BEPC Interlock System
S.M.Tang X.Y. Na J.S. Chen Y.L. Yu J.X. Yan
J.M.Wu T.H.Li H.J.Cheng
Institute of High Energy Physics(IHEP)
P.O. Box 918, Post code 100039, Beijing, China

Abstract
New BEPC ( Beijing Electron Positron collider )interlock system has been built in order to improve thereliability of personnel safety and interlock functions.
Moreover, the interlock system updates BEPC operation
message once 6 seconds, which are displayed on TV sets atthe major entrances. Since March of 1996, the interlock
system has been in operation normally. This paper
describes mainly the design idea and the structure of theapplication software for the interlock system.
1 Introduction
The hardware of new BEPC interlock system is based on
OMRON C200H-series Programmable Logic Controllers(PLC). One multimedia IBM/PC-Pentium as the hostcomputer, monitors the PLC system via serial port COM2.
It communicates with the central computer VAX-4500 ofBEPC control system via serial port COM3 and getscurrent operation massage on the storage ring, such as
beam energy, beam current intensity and life time,luminosity, operation mode etc.
SCREEN 1SCREEN 2

COM3 TO
VAX(On CONSOLE)

VGA TO
VEDIO
COM2 TO
PLC'S

HOST LINKVEDIO FANOUT

I/O
UNITS

CPU'MOSAIC'OPERATION PANEL

I/O
UNITS

P.S.

5 TV SETS

I/O SIGNAL

PC_LINKS TO
SUBSYSTEMS

Fig.1 Central Interlock System
The central interlock system, located in the BEPC
control room, is shown in Fig.1. There are two PLC racksof the system, the I/O units connect cardinal I/O signals tosubsystems and the operation panel on the console. One
HOST_LINK unit with an RS-232C port is mounted in theCPU rack and is connected to COM2 port of the hostcomputer. Two PC_LINK units, which are mounted in theexpansion rack, link all PC_LINK units of subsystems withRS-485 port, so that BEPC interlock system is a distributed
PLC system. Using an automatic polling method, the ‘0’level PC_LINK unit exchanges data with the subsystems inthe storage ring area, the ‘1’ level PC_LINK unit
exchanges data with the subsystems in the LINAC andTransport area. These data are kept in LR (Link Relay) areaof the CPU unit.
The host computer PC is equipped with a Multi-Screeninterface card which connects two color monitors. One isused to show BEPC interlock information and another isused to display the BEPC operation message. OneVGA/Video converter converts the latter signal to video
and is sent to five TV sets at the major entrances via thevideo fan-out box.
2 Software features
MS-Window Chinese V3.2 is selected as the operating
system, because it provides several major programing
capabilities. These include standardized graphics userinterface, a multitasking capability, an object oriented
programming (OOP) approach, memory control, and theuse of dynamic link libraries (DDLs). To display Chinesecharacters on screen is also an important reason for thisselection. The application software has been developed on
the Microsoft Visual C++ 1.51 workbench. The VisualC++ workbench is an integrated environment that allows
user to develop window′s applications easily. It provides
advanced programming tools such as APP STUDIO agraphic editor, APP WIZARD an application template
generator, MFC, CLASS WIZARD a class generator andDebugger etc, therefore the software development process
can be simplified.
Easy operation and friendly Man-Machine Interface isdesign idea of the application program. The block diagramof the application program is shown in Fig.2. It consists offollowing five tasks:¡ ¤COM2_PLC Communication is used to fetch theinterlock data from central interlock system via serial port
COM2 and update common data pool once per second.
¡ ¤COM3_VAX Communication gets current beam
parameters and operation mode of the Storage Ring fromthe central computer VAX-4500 of the BEPC controlsystem.
¡ ¤Update Display fetches the data from the common
data pool and updates two screens.
The initial View on the first screen for the interlock
application is shown on Fig. 3. Every row of the left
column, representing a control of child window, iscomposed of one color icon , one button and one
rectangular indicator. Each icon reminds the operator thatthe error message should be displayed on screen 1.

COM3_VAXCOMMUNICATION(RATE:1/SEC)"VOICE CALL"HISTORY
RECORD

UPDATEDISPLAY

COMMON DATA
POOL

COM2_PLCCOMMUNICATION(RATE: 1/SEC.)SENDS MESSAGESTO "INTERLOCK" TASKSCHINESE MS-WINDOWS3.2

Fig2. Block Diagram of the application
one child window is pop-up by clicking the mouse on theright button and will show the message of assignedsubsystem. Each indicator displays one subsystem′s status.
The green, red and yellow colors of the indicator indicate
fatal failure, secondary failure and normal respectively.

Fig. 3 Initial View on First Screen¡ ¤The second screen is used to display current BEPC
operation message and time as shown in Fig.4. In order toput some short notice on TVs, a edit child window can be
opened at the bottom of the screen. History Record records
failure status of devices and the failure time.
¡ ¤Voice Call In case a event or hardware trouble
occurs, in addition to the alarm message is displayed on thescreens, the ′Voice Call ′ task plays a waveform sound of
the *.wav file which is related to the event. It makes theoperator to pay attention.
In order to prevent the application from ′dead lock′, error
tolerance is taken into consideration. For example, If thehost computer gets some trouble on its serial port COM2,
time-out of communication between the host and PLC iscaused, the program should pause the communication andFig.4 BEPC Operation Message on Second Screen
3 Small database
A small database RUN_BASE for the application iscreated and modified by means of a dedicated program
RUN_DB.C off-line. When the interlock application isrunning, RUN_BASE file is loaded to the memory. All ofthe I/O signals in BEPC interlock system are logicalsignals, but not analog signals. For convenience of serial
communication and data manipulation, the database
RUN_BASE as a text file is stored on the hard disc.
RUN_BASE file holds a maximum of 1024 records.
According to the features of the PLC and the specificcondition of BEPC interlock system, 32-byte is selected as
the record length. The data structure of RUN_BASE isshown in Fig. 5.
Every record describes one signal. The PLC address
field consists of 5 characters, explains the I/O location ofthe signal in the PLC of central interlock system. The ID
field is a signal name, includes 8 characters. The ST1, ST2
are desired and current status. If the signal is a Link Relay(LR) signal, the LINK_No. and LINK address should befilled. The remark occupies 10 letters and helps theprogrammer to know the implication of the signal.
4 Conclusion
The BEPC new interlock system was completed by theControl & Instrumentation division and Radiation
Protection division before the end of 1995. Since March1996, the system has been operational normally. PLC
products are very applicable to accelerator′s interlocksystem, due to their reliability, flexibility as well as ease ofmaintenance. As a result of providing multimedia
technology to accelerator control, the operators run themachine easier than before.
As software products are developed at high speed,
software tools are becoming increasingly automated, easyto-use and suitable for custmer applications. Besids VisualAcknowledgment
15 **ST17ST20

PLC I/O ADDRESS

31

ID (8 CHARACTERS£©

22
REMARK (10 CHARACTERS)19
LINKNo.

16
LINK
ADDRESS* Each Data -- 32 Bytes** not used

Fig. 5 Data Structure of RUN_BASE
C++, there are available PC-based tools as well. For
example, FoxPro and PowerBuilder for building databases,
Fix32 and KingView for supervisorycontrol and dataacquisition. So a new control system will be implemented
much faster and easier than before.

One of the authors (S.M.Tang) would like to thank Mr.
L.F.Liu for his contribution to the personal safety system.
In particular, we would like to thank Mr. J.W.Zhao for hishelp on database design. We also would like toacknowledge the colleagues of other divisions for theircooperation and the technical suggestions.
Reference[1] The General BEPC Interlock System, by S.Y.Chen,etc. (Internal Archives of The IHEP )[2] Interfacing Industrial Process Control System to
LEP/LHC, by Michel RaBany CERN, Proceedings ofConference on Accelerator and Large Experimental
Physics Control System, KEK, Thukuba, Japan.
(1991.11)., P269.
[3] New Interlock System for BEPC, by S.M.Tang, etc.
EuropeanParticle
Accelerator
Conference(EPAC’96), Barcelona, Spain, 1996.6.