The PC-Based Archive System at BEPC
L.Ma and P.Shi
Institute of High Energy Physics, Beijing 100039, China

The Beijing Electron-Positron Collider (BEPC), whichincludes a 202-meter linac injector, an 120-meter beamtransport line for each beam and a 240-meter circumference storage ring, is a large experimental facility for thehigh energy physics and the synchrotron radiation research. The BEPC has been in operation for around 10years. Until autumn of 1996, there was no an archive system which uses an unified way of collecting and storing
BEPC data for the off-line retrieval and analysis. The experience of running the BEPC machine showed that if wehad a detailed record of the machine conditions preserved
from a time ago for the comparison, it might have beeneasier to track changes and locate problems. The requirement of providing such an archive system was raised bymore and more people, such as accelerator physicists,
machine operators, equipment group people and administrative personnel.
In 1995, a project was started to upgrade the beam diagnostic instrumentation system of the BEPC. The technical solution is formed by the PC-based hardware andsoftware. One task of the project is the creation of an archiving database with the Microsoft SQL server. The database can store beam parameters (such as intensity, lifetime, longitudinal and transverse size, closed orbit position, …) from the beam diagnostic instrumentation system. The try operation during the BEPC spring run in1996 showed that the archiving database system functions
well and is very useful. A proposal was brought forward
to expend the archiving database so that it can store not
only the beam characteristics from the beam diagnostic
instrumentation system but also all equipment settings andmachine conditions, such as power converter currents, thereference magnet field, voltages of accelerating RF cavities, vacuum pressures, etc.
After about half an year of working, the upgraded ar-

2.1 Hardware Structure
Figure 1 shows a schematic block diagram of the hardware structure related to the BEPC archive system. There
are several PCs distributed at different places and all ofthem are connected to the Ethernet network. These frontend PCs were added for the purpose of upgrading the[1]beam diagnostic instrumentation system and they aremainly used for acquiring beam parameters. Among thesePCs, the BIPC7 is served as the dynamic database and thearchiving database server. This PC is the Model Compaq
ProSignia 300 with a 120-MHz Pentium processor, 256Kbyte two-way set-associative write-back cache, 64Kbyte ECC memory and a 4-Gbyte SCSI-type hard disk.
The BIPC7 is also equipped with a CD ROM driver and aModel HP SureStore Tape 5000 tape driver.
Many other data of hardware settings and environmental conditions are gathered from the on-line control
mini-computer VAX4500 running under VMS.
VT1300
X-TerminalVAX4090
Workstation

VAX4500

Ethernet TCP/IPLINPC1

BIPC4

BIPC6

bucketselection
beam position
and intensity
measurement

BIPC7

BIPC3Database
ServerDomain
Controller

Spectrum Analyzer
for tune measurement
GPIB

1 INTRUDUCTION

2 SYSTEM DESCRIPTIONCAMAC

For a better understanding of the machine performance, aPC-based archive system was introduced for the BeijingElectron-Positron Collider (BEPC) in 1996. The kernel ofthe system is a Microsoft SQL server database. The datataking is based on client and server application programs
running on PCs with the operating system of the Microsoft Windows NT and on the DEC mini-computer underVMS. The archive system can provide various services ofthe data storage, query and analysis to the accelerator
physicists and machine operators. This paper will give thedetailed description of the archive system at BEPC.

chive system was put into operation routinely during theBEPC autumn run in 1996. The system has been runningsuccessfully since then.

CAMAC

Abstract

Oscilloscope
for transverse beam
size measurement

DVM for bunch
length measurement

Figure 1: Hardware structure
2.2 Windows NT Platform
With the rapid progress of the computer technology, it isdifficult to make a suitable choice of a computer modeland an operating system. Many issues have to be carefully
considered, such as modularity, reliability, hardware andsoftware support, documentation, cost and budget.

Being an excellent application service platform, Microsoft Windows NT Server (Version 4.0 with service
pack 3) was chosen as the primary software platform. The
Windows NT Server is the network operating system(NOS), and also the application server. It is the most stable operating system for the IBM PCs or compatible andhas a good price-performance ratio. All PCs used in theBEPC beam diagnostic instrumentation system are members of a Windows NT domain (called BEPCBI) for thesecurity and easy management considerations. As it canbe seen in Figure 1, the BIPC3 is the primary domaincontroller. Both Windows NT Workstation 4.0 and Windows 95 operating systems are also used for some clientPCs.

2.4 Microsoft SQL Server

2.3 Client/Server Model

3.1 Database Structure

The software of the system is based on the client/server
model which is the most commonly used paradigm inconstructing distributed applications. Figure 2 shows thesoftware structure of the system. It can be divided into
three layers. The server application running on BIPC7
plays a role of a dynamic database server and provides
access to the dynamic database. This is the key application program in the system. The server application services the requests from the client applications which aredistributed on the various PCs and VAX computers.

Within a relational database, data are stored in tables.
There are eight tables in the BEPC archiving database.
These tables are:
• R_PS_MAIN_ yymm
• R_PS_CORR_DESI_ yymm
• R_PS_CORR_IMON_ yymm
• R_BPM_ yymm
• R_INJ_VA_RF_ yymm
• R_BI_ yymm
• T_PS_DESI_ yymm
• T_PS_IMON_ yymm
The names of the tables are self-explanatory, such as
the table R_PS_CORR_IMON stores the read-back valuesof the power converters for corrector magnets of the ring.
The yymm is a 4-digit number which means the year andthe month in which the data were filled into the table.
Eight new tables can be generated at the first day ofeach month. Any of the eight tables has two fields(columns) with the same names, _date and _time. These
two fields store the date and the time at which the data
filling was taken. All other data in data columns of a table
have the float-point data type.

machine status
display

data presentation layer

COD
display

dynamic
database server

database access layer

historic dataquery

historic datalogging

data acquisition layer

dataacquirement

MicrosoftSQL Server
archive
database

dynamic
databasebeam position
measurement

beam intensity
measurementtune
measurement

BEPC
real-time
database

Figure 2: Software structure
The dynamic database is used as a data buffer between
the data acquisition layer and the data presentation layer.
It stores all important data of BEPC. The data taking ratevaries from 1 to 60 seconds, coming from several dataacquisition client applications. One of the client applications written in the Microsoft Visual C/C++ obtains thedata from the dynamic database and stores them to thearchiving database at the fixed time interval of 60 seconds.
Because PC and VAX computers in the system havedifferent operating systems, a suitable network communication protocol has to be chosen. TCP/IP is such a protocol. The inter-process communication between the serverand client applications relies on the TCP/IP socket library.
The connection oriented transmission control protocol(TCP) is used for providing a reliable data delivery.

The kernel of the archive system is the Microsoft SQL
Server (Version 6.5) relational database management system (RDBMS) which is well integrated with the Microsoft
Windows NT operating system. It is specially designed forthe distributed client/server computing environment. We
benefit from its internal data backup system, strong datamanagement tools and the open client/server architecture.
Any computer connected with the BEPC network can
be a client to the archiving database server, requestingget/put operation of values in the archiving database.
3 DATABASE IMPLEMENTATION

3.2 Data Filling
The filling of the archiving database is done by a Microsoft Visual C/C++ program called “wrdb” with embedded
SQL. The program taking data from the dynamic databaseand filling them to the appropriate table of the archiving
database at a fixed time interval. Only data available inthe dynamic database can be stored into the archiving database. A corresponding new record (row) is always appended to each table with a same date and time values, so
the data in the different tables can be correlated with thecommon fields _date and _time.
The aim of the archive system is to provide a longterm historic records of the machine, it is not a tool for thefast recording to study transient events. So the time interval is set to 1 minute to keep the disk space required to areasonable size. All data logged is to be kept on-line for atleast one year to allow comparison with data of the previ-ous year.
The TCP/IP protocol is used for taking data from thedynamic database and the Open Database Connectivity(ODBC) enables applications to gain access to the SQL
Server database.
3.3 Data Retrieval
The Microsoft Query tool, which has been integrated into
the Microsoft Office, is used for the data retrieval. One
can use the Microsoft Query to retrieve all and part of aset of data that is stored in the archiving database. You canview, edit and organize the data and insert the data into awindows-based application file, such as a Microsoft Excel
worksheet.
Figure 3 shows a window of the Microsoft Query.
There are three panes in the window. The table pane at theupper part of the window displays the field lists for thetables you add to the query. The tables contain the fields
from which you retrieve data. When there are two or more
tables in the table pane, each table must be connected by
the join line(s) to another table. The data pane at the lower
part of the window displays the result set Microsoft Query
produces after you add fields from the table pane to thedata pane and run the query. The criteria pane in the middle part of the window displays one or more conditions
you specify to limit which records are included in thequery’s result set in the data pane.

server database manager also provides the capability ofscheduling a backup task to occur on time or on a recurring schedule.
In our case, the table backup is used because the restore of a table is useful and easy in a disaster recovery
situation. Each table has been backed up automatically
onto the hard disk weekly. Under the present conditions,about 150 Mbytes of archive files are created per monthfor backing up all of 8 tables. These data are kept on thehard disk only for a limited period of time and then are
copied to the tape or the compact disk (CD) to make thehard disk space available for new data.
The backup is performed in an on-line manner without
interrupting the data storage.
4 SUMMARY
The BEPC archive system based on the Microsoft SQL
Server 6.5 and the client/server model has been in operation since the October of 1996. After using the archive
system for more than two years, it has been proved thatthe system is fully operational and useful. Over 2-Gbyte
data have been stored. These data include the beam characteristics, hardware settings and environmental conditions of BEPC. All the data logged have been backed up
to the off-line media. The technical support and data
query services are also provided by the BEPC beam diagnostic instrumentation group.
At present, the data are filled into the archiving database at a fixed interval. The data filling for different datawith variable time intervals is in consideration. The data
publication on the World Wide Web is underway. The
upgrade the Microsoft SQL Server from the version 6.5 tothe version 7.0 is also in consideration.
5 ACKNOWLEDGMENTS

Figure 3: Data query window
Users can also put/get their data to/from the archiving
database in a C/C++ program via the ODBC library.
3.4 Data Backup
For a computer based system, one of the most importation
things is the data. The data backup process has the special
position in the whole system.
The SQL server database manager provides enhanced
backup and recovery capabilities. Individual tables can bebacked up and restored. A table restore can be performed
from a table backup or full database backup. The SQL

We would like to thank all colleagues in the BEPC Beam
Instrumentation Group and the Control Group who madecontributions to this work. A special thank is given toY.Yu who wrote a computer program for obtaining machine parameters of the BEPC storage ring. We alsowould like to thank people of the accelerator physics
group for their insight and feedback during the system
upgrade. At last we are very grateful for the financial support provided by our institute.
REFERENCES[1] L.Ma, P.Shi, P.Lu, H.J.Cheng and K.Ye, “Using PCs
in the BEPC Beam Diagnostic Instrumentation System”, Proceedings of ICALEPCS’97, Beijing, China,
November 1997.
>@P.Shi and L.Ma, “BEPC Online Runtime Database
Service System”, Proceedings of ICALEPCS’97,Beijing, China, November 1997.