Using PCs in the BEPC Beam Diagnostic Instrumentation System
L. Ma, P. Shi, P. Lu, H. J. Cheng and K. R. Ye
Institute of High Energy Physics, P.O.Box 918, Beijing 100039, China

Abstract

2.1 Hardware architecture

PCs are getting more and more popular in accelerator
control and beam instrumentation systems in recent years
because of various reasons such as their inexpensive
price, the support of a large amount of commerciallyavailable hardware and software products, etc. Some PCs
are added to the BEPC beam diagnostic instrumentation
system for instrument control and data acquisition. ThesePCs are connected with each other via TCP/IP over Ethernet and are integrated into the BEPC control system. In
this paper, we will describe the implementation of PCs in
the BEPC beam diagnostic instrumentation system.

Figure 1 shows a schematic block diagram of the BEPC
beam diagnostic instrumentation system before and after
the upgrade. The beam monitors and the front-end electronics of each subsystem are not included in the figure.
The on-line control mini-computer VAX4500 with theoperator′s console, the VAX4090 workstation and theVT1300 X-terminal running under VMS form a control
room layer of the control system.
VAX4090
Workstation

VT1300
X-Terminal

Ethernet TCP/IP

1 Introduction

Spectrum Analyzer
for tune measurement
C A MAC

Oscilloscope
for transverse beam
size measurement
DVM for bunch
length measurement

beam position
and intensity
measurement(a) before the upgrade

VAX4090
Workstation

VT1300
X-Terminal

VAX4500

Ethernet TCP/IP

LIN PC1

BIPC4

BIPC6

BIPC7

BIPC2

Database
Serverbeam position
and intensity
measurement

Spectrum Analyzer
for tune measurement
BI P Gbucketselection

C A MAC

2 System hardware

VAX4500

C A MAC

The Beijing Electron Positron Collider (BEPC) facility
consists of a 202-meter linac injector, an 120-meter beamtransport line and a 240-meter storage ring. The design
energy of the storage ring is 2.8 GeV, but the machine has
been routinely operated at an energy below 2.2 GeV since
it was first put into operation at the beginning of 1989.
Electrons and positrons are injected into the ring at theenergy of 1.3 GeV and are then accelerated to and stored
at the required energy. The collider can provide beams forover 5000 hours each year for high energy physics experiments as well as the synchrotron radiation research inparasitic and dedicated modes. Some noticeable experiments have been accomplished at BEPC, such as themeasurement of the mass of the Tau lepton.[1] Beam diagnostics were very important and have been highly beneficial to the success of the BEPC operation.
As the first step, the beam diagnostic instrumentation
used in BEPC was highly necessary for the initial stage ofmachine commissioning and operation. Most of the beamdiagnostic subsystems, except for the DCCT and beam
position monitoring systems, were not connected to thecontrol computer. So, measurements with those monitoring subsystems had to be controlled manually. An upgrade
work has been carried out in the last year. The main purpose of the upgrade is to realize the computerization sothat the resolution and the speed of measurements can beimproved. PCs were chosen to be added to the BEPC
beam instrumentation system due to various reasons suchas their inexpensive price, the support of a large amountof commercially available hardware and software products, etc. All these PCs are connected with each other overthe Ethernet and are integrated into the BEPC controlsystem.

Oscilloscope
for transverse beamsize measurement
DVM for bunch
length measurement(b) after the upgradeFig. 1 Schematic block diagram of the BEPC beamdiagnostic instrumentation systemAs we can see from figure 1-(a), only the beam position
and the beam intensity measurements could be controlled
by the computer before the upgrade. Devices are directly
connected to the VAX4500 by serial CAMAC links. Reference [2] can be referred to for more detailed descriptions of the present BEPC ring control system.
After the upgrade, we added a PC layer between thecontrol room layer and the device layer. These PCs arebasically 486/66 MHz machines with 16-32 Mbytes ofmemory each. Among these PCs, LINPC1 in the linac
control room controls the selection of the injection bucket,
BIPC4 in the local beam diagnostic station of the ring isused for the beam position and the intensity measurements, BIPC6 in the center control room is for the tune,
the transverse beam size and the bunch length measurements, BIPC7 is for the dynamic and logging databaseserver, and BIPC2 is used for the display of the measured
data. The PC layer is connected to the control room layer
and the device layer by Thin-Ethernet and parallel interface buses, respectively.
2.2 Interface standard
Two control interface standards were adopted in the upgraded beam diagnostic instrumentation system: CAMACand GPIB.
The former consists of a PC interface card and a doublewidth CAMAC crate controller Model CCU-2-80B[3] developed by the Electronics Division of our institute. TheCCU-2-80B meets all the requirements of IEEE Standard
583 for CAMAC crate controllers. When used with the PC
interface card, the CCU-2-80B forms a computer-based
CAMAC system with an IBM PC or compatible processors as the host and performs a wide variety of CAMAC
commands to modules in the crate. One to eight CCU-280Bs can be connected to a single interface card. The
crate address is selected by a front-panel switch. A 50wire flat ribbon cable is connected to the computer interface card and looped-through the crate controllers. The
last CCU-2-80B terminates the bus and can be up to 12
meters from the interface card. The interface card can beinstalled in any available ISA expansion slot of the PC.
Like most PC plug-in cards, the interface card is an ″I/Omapped″ card, which uses the Intel processor′s 16-bit
continuos I/O address space for two 8-bit controller′s control/status registers. The starting address of I/O ports isdetermined by the crate address setting. The CCU-280B/interface card system is only capable of transferring
8-bit CAMAC data word.
For the GPIB (IEEE 488) standard we used theHP82341 which is a Hewlett Packard′s high-speed 16-bit
PC interface card for controlling GPIB devices with themost popular Microsoft Windows-based programming
languages. The interface card fits into one ISA/EISA expansion slot in the backplane of an industry-standard
compatible PC. The configuration switch on the HP82341
interface card sets the interface′s I/O port base address.
The build-in buffering of the card provides I/O and system

performance that is superior to direct memory access(DMA), up to 750 Kbytes/sec. GPIB cables connect thecard to GPIB devices. The maximum number of devices tobe connected is 15. In our case, BIPC6 serves as the GPIB
system controller.
3 Software
3.1 Software platform
There are two operating systems running on PCs: Microsoft Windows NT 3.51 (BIPC2, BIPC6 and BIPC7) andWindows 95 (LINPC1 and BIPC4). Some of device drivers in the Windows NT environment are not yet available,
otherwise the Windows 95 OS will be replaced by Windows NT.
Application programs were developed with the Microsoft Visual C/C++ 2.0. The high level language CAMAC
libra-ry routines supplied with the CCU-2-80B crate controller and the HP Standard Instrument Control Library(SICL)[4] supplied with the HP82341 GPIB interface card
were used in conjunction with the Microsoft C/C++ language. SICL is a modular instrument communications
library that works with a variety of computer architectures, I/O interfaces and operating systems. Applications
written in C/C++ or Visual BASIC using this library canbe ported at the source code level from one system to another without, or with very few, changes. SICL has several
features that distinguishes it from other I/O library, suchas the centralized error handling and the formatted I/O.
3.2 Client/Server model
The software of the system is based on the client/server
model which is the most commonly used paradigm inconstructing distributed applications. In this scheme client
applications request services from the server application.
The server process remains dormant until a connection isrequested by a client process. At such a time the server
process ″wakes up″ and services the client′s requests.
Figure 2 shows the software structure of the PC basedsystem. It can be divided into three layers. There are about
twenty application programs, only two of which are server
applications while others are client applications distributed on all PCs and VAX computers.
One server application running on BIPC7 plays a roleof a dynamic database server. This is the key application
program in the system. The dynamic database is used as adata buffer between the data acquisition layer and the datapre-sentation layer. The size of the database is 8 Kbytes
and it is easy to expand. The database stores all important
mach-ine parameters of BEPC. All of the parameters havethe floating-point data type with 4-byte length each. Thesemachine parameters are updated at different rates from 1
to 60 seconds by several data acquisition client applications. The data acquisition client application requests theserver application to update corresponding records of thedatabase at the end of each measurement, while the data
presentation client application receives and displays ac-lyzed with the Microsoft Office package running on anyPC. These historical data will be kept for a period of atleast one year.

quired data on the screen of the workstation or a PC.
Some beam measurement control parameters are also
stored in the database, so measurements can be controlledaccording to these parameters.
Another server application running on LINPC1 provides
a service of changing the injection bucket number bychanging settings of two CAMAC delay modules according to the operator′s request.
Both of server applications are of iterative type. The
concurrent type server is under development to improve
the response time of the system.
Because PC and VAX computer have different operating
systems, a suitable network communication protocol has
to be chosen. TCP/IP is such a protocol. The communication software relies on the TCP/IP socket library. The
connection oriented transmission control protocol (TCP) isused for providing a reliable data delivery.

4 SummaryThe beam diagnostic instrumentation system of BEPC
has been upgraded. Several PCs were added to the system.
The system is simple, flexible, expandable and is integrated into the BEPC control system. This greatly improved the system performance, for example the beam
position monitoring system[6] and the logging system. The
software modification is still underway to further improve
the system performance.
Acknowledgments
We would like to thank many colleagues in the Beam
Instrumentation Group and the Control Group of BEPC
who made contributions to this work.

3.3 Logging database
For a better understanding of the machine performance,a logging system was created with the Microsoft SQL
Server RDBMS running on the BIPC7 (see Figure 1) andput into operation at the end of last year.[5] All important
beam parameters (such as intensity, lifetime, closed orbitposition, ...) and equipment settings (such as power converter current, reference magnet field, accelerating RF
cavity voltage, vacuum pressure, ...) were stored. These
parameters are taken from the dynamic database mentioned in the previous section. The logging database is not
used for fast recording to study short time events so thedata taking rate is 1/60 Hz.
Till now, over 1 Gbyte of data of 8 months of operation
were kept on-line as well as copied to off-line media.
These logged data can be retrieved, correlated and ana-data acquisition layer[1] J.Z.Bai et al., Measurement of the Mass of the Tau
Lepton, Phys. Rev. lett., 69, 3021, (1992)[2] J.Zhao et al., BEPC Control System Upgraded,PAC′95, Dallas, USA, May 1995
[3] IHEP Electronics Division, Microcomputer CAMAC
Interface System, Internal Report[4] HP Company, HP Standard Instrument Control Library User′s Guide for Windows, 1994
[5] P.Shi and L.Ma, BEPC On-line Runtime Database
Service System, this conference[6] L.Ma and P.Shi, Upgrade of the BPM System for theBEPC Storage Ring, PAC′97, Vancouver, Canada,
May 1997

machine status
display

data presentation layer

database access layer

References

dynamic data
bufferdataacquirement

COD
display

data accessserverbeam position
measurement

beam intensity
measurement

BEPC
real-time
database

Figure 2: Software structure

historic dataquery

historic data
loggingtune
measurement

logging
database