Improvements in Database System for Accelerator Control
M. Mutoh and M. Nanao
Laboratory of Nuclear Science, Tohoku University
1-2-1 Mikamine, Taihaku-ku, Sendai 982, Japanmutoh@lns.tohoku.ac.jp

I. AbeHigh Energy Accelerator Research Organization (KEK)
1-1 Oho, Tsukuba, Ibaraki 305, Japan

Abstract
Since the accelerator has become a large and more
complex system, the establishment of a more sophisticatedcontrol system is required. A powerful database therefore
becomes of great importance, and will enhance theflexibility and extendibility of the control system. We haveadopted MS-SQL Server as the control database. Although
MS-SQL Server is a relational database, in order toenhance the role of the database we encapsulated the dataand methods constructed by means of stored procedures.
The database must be accessed through the storedprocedures to communicate between application programsand the database. Consequently, the communication
protocol as an access method between the client
applications and the stored procedures could bestandardized; it was possible for anyone to makeapplication programs without expertise on the SQL or thedatabase structure. For real-time observations of theaccelerator operation through the Internet, a Java Applet
using the standardized protocol has been provided. The
structures of the database and interface for the application
programs are discussed
1 Introduction
The STB (STretcher-Booster ring) [1] was completedin October 1997 and has been commissioned. When designof the control system [2] began three years ago, we agreed
upon the following basic design concepts: low construction
and maintenance costs, installation of an operator-friendly
console, realization of easy operation, and establishment ofa high level of flexibility and expandability. Because theSTB has three operation modes, which include a stretcherring, a booster-ring, and a storage-ring, the operation isvery complex. Moreover, in the case of the multipurpose
accelerator for which both the beam course and beamenergy and current are changed frequently, it is generally
necessary to provide good reproductions of operation
values and statuses of device components in a short periodof time. In order to realize these requirements, a databasehas been adopted as the core of the STB control system.
The use of a database has become popular in the recent
accelerator control field, but the database primarily plays arole as a simple data storeroom. We have employed thedatabase system as a control manager therefore enhanced
the flexibility of the control system.
2 Database system
We have adopted an MS-SQL Server as a control
database. The MS-SQL Server is a relational database, but
it has some additional features: a client/sever model which
can be constructed on PCs (Personal computers), ODS(Open Database Services) which can extend the databasefunctions, a relatively low price, as well as compatibility
with WindowsNT.
2.1 Software scheme of the STB control system
The block diagram of the control software is shown inFig. 1. The control system consists of three layers; ahuman-interface layer as an operator console, a controllayer as the database, and a device layer as a devicecontroller. The control database is installed in aWindowsNT Server. Because the database is a controlmanager, every communication between the operation
console and the PLC (Programmable Logical Controller) as
a device controller must be executed through the database.
The control commands issued by an operator are checkedin a stored procedure for the database: for example, asettings for the operation values for each device are lessthan maximum values and operation commands can beadapted to actual device state diagrams such as for the stop,
ready, run and fault states. After checking the commands,
related data tables are updated, and control commands aresent to the appropriate PLC through a device manager
which establishes the magnet power supply’s current orstatus. The PLC observes the operation of each device
every time, and if operation statuses or values are changed,
the PLC informs the database of changed conditions, andthe values or state diagrams in the database are updated. Inorder to simulate a beam orbit in the stretcher-ring mode
operation and to correct a closed-orbit distortion in thebooster-ring mode operation, the simulation and orbit
correction programs written in FORTRAN have been
provided in the database server computer. These programs
also interact with information from the database, and thebeam orbits are compensated.

modules, etc.
(3) A simulation and orbit
Client computer
Operator console
LabVIEW
correction
database
constructedwithDLL
geometrical parameters,
AccessJava applet
Net-libraryDB-libraryorbit-calculation
parameters, and beam
parameters (e.g. twissparameters).
Database serverStored procedure(4) An operation status
JDBC
database composed ofactual operation values
Replication
Simulation andsuch as set and real
Database
orbit correction
Databaseprogramcurrent/voltage
for(FORTRAN)
magnets,
vacuumStored procedurepressures, operation state
WWW server
ODS
diagrams,
interlockstatuses, wave-form dataon pulse operation power
supplies and pulsed beam,
Device manager
Device controller
image data from beam
PLC network
screen monitors, etc.
(5) An operation record
PLC
database constructed from
historical operation data,        
operation and maintenancelogs, etc.
EveryPLC
isforced
torunwith the same control
2.2 Functional requirements for the databaseprogram, but because each individual PLC must work with
Functional requirements for the database system are asdifferent specifications depending on the connected devices,
follows:
the PLCs then download the necessary configuration tables(1) Available for real-time operation at high throughput.
from the device configuration database.
(2) Good connection with application programs.
(3) Provides extendable functions such as the ODS.
2.4 Stored procedure(4) Database available for use in a personal computer.
If the control data were rewritten by a mistake, muchdamage would be caused to the control system. The data is
As for item (1), we expect the time from receiving aencapsulated with stored procedures which behave like aquery to replying from/to client computers to be less thanmethod in object-oriented programming, and is hidden toten milliseconds. For (2), the use of a commerciallybe protected from improper access. All access to theavailable software lightens the burden of software
database must be executed through the stored procedures,developments. In addition, fewer program bugs are foundand direct access to the database is not allowed except by ain commercial than in laboratory-designed ones, and theyfew special programs for an administrator. The stored
generally come with thorough manuals and regular versionprocedures are classified according to the kinds of devices,updates. For (3), the ODS is a mechanism which
as shown in Fig. 2. Common control methods in the same
incorporates user programs into the database in order tocategory are collected together and put in an upper layer
enhance the stored procedure functions, because the SQL
and can be used from lower layers.
alone can not treat all required control methods.
It become possible to use the stored procedure as astandardized
protocol to communicate between the2.3 Database structure
database system and other programs, such as the operation
The control database system consists of some databases:
console, the simulation and orbit correction programs, the(1) A device property database constructed with maximum
device controller, and so on. An example of the protocol isoutput current/voltage, ramp-up rate of the output,
shown in Fig. 3. The message is comprised of the classcoefficient/offset values for setting/displaying , etc.
name, object name, method, property, and values, and it(2) A device configuration database constructed withbecomes simpler than commands using the SQL. The
module allocation tables in the PLC units, nodestandardized protocol provides a good environment for theaddresses of the PLC units, specifications of the PLC
control system because even if people who are notm on(M onitor)
sc(S cree n)vc(V acu um )wi(W ire)bt(B utton)vl(V alve)gg(G auge)rec(R ecord)
ip(Ion pu m p)

ps(Pow er supply)stc(S teering)km(K icker)bm(B end m ag)

qm(Q m ag)ru(R am p u p)

ct
(C reate table)dl(D ow n load)rqm(Q m ag)

Structure of the stored procedure.

Communication
Class Object, Method [, Property [, Value1 [, Value2, ]]]stc ISC01, Set , X_current , ‘ -2.5 ’Class (Procedure name)Object (Device name)Method (Action)
Property or Attribute
Value (Current)log(O p. lo g)plc(PL C )rbm(B end m ag)

Figure 2:op(O peration): stc (steering coil): ISC01: Set: X axis current: -2.5 (A)Figure 3: An example of standardized communication
protocol.

acquainted with the SQL or do not know about the structureof database can make application programs in the clientcomputers.
2.5 Distribution of the database
As shown in Fig. 1, the database for off-line processing
and for servicing real-time information to the Internet isseparated from the control database and installed in theWWW server, because the control database must beprotected against illegal access from the Internet. Moreover,the separating of the database is advantageous in reducing
the CPU load in the server computer for the accelerator
control. The transmission of the data from the control
database to the WWW database is achieved using a

replication function provided by the MS-SQL. The control
database is defined as a publication-server, and the WWW
database is defined as a subscription-server. The data
allowed to be referred to off-line processing and theInternet browser is replicated at intervals of a few minutes.
Vacuum pressures in the STB are being displayed on ourlaboratory’s home [3] page using Java-applet, and we will
provide other operation statuses soon.
3 Conclusion
The cost and manpower for constructing the STB control
system was low because we used a database in the core of
the control system, employing commercially available
software, and PCs, and PLCs. The database and astandardized protocol have especially enhanced flexibility
and extendibility of this control system. We will continue
expanding this control system into the Tohoku University
electron linear accelerator until late in1998.

4 Reference[1] Oyamada et al., “The Tohoku University Stretcherbooster ring”, Proceedings of the 10th symposium onAccelerator Science and technology, Hitachinaka,
Japan 1995
[2] Mutoh et al., “A New Approach to Control System for
Medium-Scale Accelerators”, International Conferenceon Accelerator and Large Experimental Physics
Control system, Chicago 1995
[3] URL:http://www.lns.tohoku.ac.jp/stb/disp2/display2.html