APPLICATION OF PC IN BEPC INTERLOCK SYSTEM
S.M.Tang X.Y. Na J.S. Chan 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
BEPC ( Beijing Electron Positron collider ) interlock
system is based on Programmable Logic Controllers, hasbeen built in order to improve the reliability of personnel
safety and interlock functions. One multimedia PC as thehost computer, monitors the PLC system. This paper
describes the hardware configuration of the PC, thedesign idea of the application software for the interlocksystem.

1 INTRODUCTION
The BEPC interlock system has four-level structure:•
the central layer, which manages the interlocks
among BES ( Beijing Spectrometer ), BSRF•
( Beijing Synchrotron Radiation Facility ) ,LINAC and Storage Ring.
•
the system layer, which implements the interlock
among the subsystems belong to the system.
•
the subsystem layer, which manages theinterlock among the equipment in a local controlstation.
•
the equipment layer, which is included inequipment. For example, one power supply forsome Q-magnets should not feeds the current
and alarm while the magnets lost cooling water.
The hardware of the system is based on OMRONC200H series PLC as shown in Fig. 1.

2 CENTRAL INTERLOCK SYSTEM AND
ITS HOST COMPUTER
The central interlock system, located in the BEPC
control room, is shown in Fig.2. There are two PLC racksof the system. The I/O units are used to connect theoperation panel on the console, and a few I/O cardinalsignals are connected to subsystems. One multimedia
IBM/PC 586 acts as the host computer and monitors thePLC system via a serial port COM2 which is connected tothe HOST_LINK mounted in the CPU rack. The PC
communicates with the server VAX-4500 and obtains
BEPC operation message through a serial port COM3.

Fig.2. Central Interlock SystemFig. 1. Layout of the BEPC Interlock System
By means of PC_LINK units, all subsystems arelinked to central interlock system with a RS-485 port.

Two PC_LINK units, which link all PC_LINK units inPLCs of subsystems with their RS-485 ports, are mounted
in the expansion rack. Using an automatic polling method,the ‘0’ level PC_LINK unit exchanges data with PLCs inthe storage ring area, the ‘1’ level PC_LINK unit
exchanges data with PLCs in the LINAC and Transport
Line area. These data are kept in LR (Link Relay) area ofthe CPU unit. Due to using PC_LINKs, a few cables areused in the interlock system.
The host computer PC is equipped with a Multi-Screeninterface card which supports two color monitors. First
one is used to show BEPC interlock information andanother is used to display the BEPC operation message.
The second VGA signal is converted to video signal byVGA/Video converter and sent to five TV sets at themajor entrances via the video fan-out box .

3 SOFTWARE FEATURES ON PC
3.1 The Software Development Environment

one colour icon, one button and one rectangular indicator.
Each icon reminds the operator that one child window is
pop-up by clicking the mouse on the right button and willshow the message of assigned subsystem. Each indicator
displays one subsystem’s status. The green, red andyellow colour of the indicator indicates fatal failure,secondary failure and normal respectively.

MS-Window Chinese V3.2 is selected as the operating
system on the host PC, because it provides several major
programming capabilities that include standardisedgraphics user interface, a multitasking capability, anobject oriented programming (OOP) approach, memory
control and dynamic link libraries (DDLs). To display
Chinese characters on screen is also an important reason
for this selection. The application software has beendeveloped on the MS Visual C++ workbench. It is an
integrated environment that allows user to develop
window’s applications easily. It provides advanced
programming tool kits such as APP STUDIO a graphiceditor, APP WIZARD a application template generator,MFC, CLASS WIZARD a class generator and Debuggeretc., therefore the software development process can be
simplified.
Fig. 4. Initial View on First Screen

3.2 Application Programs
Easy operation and friendly Man-Machine Interface isdesign idea of the application programs. The block
diagram of the application program is shown in Fig. 3. It
consists of following five tasks:•COM2_PLC Communication is used to fetches
the interlock data from the COM2 and update
common data pool once per second.

The second screen is used to display current BEPC
operation message and time as shown in Fig.5. In order toput some short notice on TVs, a edit child window can be
opened at the bottom of the screen 2.

Fig.5. BEPC Operation Message on Second Screen•

Fig3. Block Diagram of the application•

COM3_VAX Communication gets current beam
parameters and operation mode of the Storage
Ring from the server VAX-4500 of the BEPC
control system.
•Update Display fetches the data from thecommon data pool and updates two screens.
The initial View on the first screen for the windows
application is shown on Fig. 4. Every row of the left
column, representing a child window control, consists ofHistory Record records failure status ofdevices and the failure time .
•Voice Call In case a event or hardware
trouble occurs, in addition to the alarm
message is displayed on the screens, theVoice Call task plays a waveform sound of
the *.wav file which is related to the event. It
makes the operator to pay attention and assoon as possible to solve the trouble.
In order to prevent the application from ‘dead lock’,
error tolerance is taken into consideration. For example, If
the host computer gets some trouble on its serial port,
communication time-out is caused, the program should

pause the communication and the error message should be
displayed on screen 1.

3.3 SMALL Database
A small database file RUN_BASE for the applicationis created and modified by means of a dedicated program
RUN_DB.C off-line. When the interlock application
starts to run, RUN_BASE file is loaded to the memory.
All of the I/O signals in BEPC interlock system are
logical signals, but not anolog signals. For convenience ofserial 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. 6.

As software products are developed at high speed,
software tools are becoming increasingly automated,easy-to-use and suitable for customer applications.
Besides Visual C++, there are available PC-based tools aswell. For example, FoxPro and PowerBuilder for building
databases , Fix32 and KingView for supervisory control
and data acquisition. So a new control system will
implemented more fast than before.

5 ACKNOWLEDGMENT
One of the authors (S.M.Tang) would like to thankMr. L.F.Liu for his contribution to the personal safetysystem. We would like to acknowledge the people ofother divisions for their co-operation and the technicalsuggestions.

REFERENCES[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
Fig. 6. Data Structure of RUN_BASE
Every record represents a 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 be filled. The remark occupies 10 letters and helps
the programmer to know the implication of the signal.

4 CONCLUSION
The BEPC new interlock system was completed by
the Control & Instrumentation division and the Radiation
Protection division before the end of 1995. Since March
1996, the system has been operational normally. PLC
products are very applicable to accelerator’s interlock
system, due to their reliability, flexibility as well as easeof maintenance. As a result of providing multimedia
technology to accelerator control, the operators run themachine easier than before.
The design idea and experiences will be used toupgrade the vacuum local control stations for the Storage
Ring of BEPC. The application software will be upgradedon MS-WIN 98 operating system.