How PC helps to develop new small control system for new small accelerator.
A.S.Chepurnov, A.S.Alimov, D.I. Ermakov, V.I. Shvedunov
Institute of Nuclear Physics, Moscow State University.
F.N.Nedeoglo, V.V.Garbuzov, D.V. Komissarov, N.S.Kochetkov, A.S.Lisjutin, R.E.Shugaley
Department of Physics, Moscow State University.
level with fast control algorithms, hardware locking, fastfeedback loops and signal conditioning hardware.

Abstract
A task to develop control system (cs) for newly
designed compact electron linac which being planned tobe industrial installation was solved. During the firststage of cs development, flexible modern DAQ boards
were installed in conventional PC and were used tocontrol subsystems of the accelerator. To normalize
signals for acquisition and generate signals to control,
existing analogue blocks were applied. All dataacquisition and control algorithms were implemented
under PC version of LabView 4.0 together with some
simple operator interface to test and study subsystems ofthe accelerator. The PC, played a role of front-end level,
was connected through Ethernet to another remote PC
worked under Linux and supported operator interface
and simple data-base. During the second, final stage of cs
development "industrial type" control system wasdeveloped. Front-end PC with analogue electronics wasreplaced with few members of "Smart device" family -intelligent front-end devices, while the same operator
console under Linux was used. The approach allows
parallel work of people involved in developing
accelerator hardware, software and hardware of cs.

2.1 Control system helps to investigate theaccelerator.
The cs fulfilled data acquisition functions other thancontrol functions during the stage of initial testing ofdifferent parts of the accelerator: klystron, e-gun, etc. It
is important because main task on this stage is to study
carefully newly created parts of accelerator as objects tobe controlled.
Top level consists of PC-N1 running under Linux
2.1.x. It communicates with middle level throughseparate segment of Ethernet.
Middle level consists of PC-N2 together with ISAcompatible DAQ add-on boards running underWindows-NT. Boards of two types have the following
overall I/O characteristics: 32 channels of ADC with 12bits 2 µs/channel resolution; 2 isolated channels of DAC
with 12 bits resolution and 32 digital I/O. Signal
conditioning hardware and galvanic isolation were used
between accelerator and DAQ boards. Interlocks and fast
feedback loops were implemented in hardware.
First Stage

Second StageT im e1 INTRODUCTION

2 STRUCTURE OF CONTROL SYSTEM
The cs (Fig.1) consists from three levels -- non realtime top level, soft real-time middle level whererelatively slow algorithms are implemented and front-end

PC -N 1
LinuxT oplevel

Ethernet

Ethernet

A new cs was developed for new small cw linac. It wasnecessary to design and construct cs as quick as possible,
to use as low financial resources as possible and to makecs as smart as possible. Additional difficulties lied in thefact that new accelerator planned to be constructed fromnewly designed components: new rf channel with new
klystron, new accelerating section, new electron gun,new set of high voltage power supplies. So, cs should
support providing of research experiments to study as
separate components of accelerator as a wholeaccelerator. At the same time, the accelerator and it’s csshould fit the requirements imposed upon installations
for industrial applications. Development of cs wassubdivided under two stages corresponding with thestages of accelerator constructing.

CA NPC -N 2
LabV iew

PC -N 1
LinuxK nobs

PC -N 2LinuxCA N

M idd lelevel

D A Q B oards

Signal C onditioning

C o ntrolled O bject

Front-Endlevel"Sm art D evices"

C o ntrolled O bject

Figure 1. Stages of control system development.

2.2 Control system of industrial style.
The cs should be converted from research style system
to industrial style finally.
CAN fieldbus is used on both levels of cs now. Tosupport work of operator knobs-type devices will be usedon the PC-N1. CAN adapter installed in PC-N2 controls
embedded controllers belonged to family of “SmartDevices”--intelligent controllers which support functions

of real-time digital feedback control, data acquisition andprocessing [1].

3 CONTROL SYSTEM SOFTWARE
Application software of cs is based on architecturewith Distributed Shared Memory (DSM) [1,2].

3.1 Application and system software on PC-N2.
While the software of top level is the same for bothstages of cs development, the software of middle level
differs from stage to stage.
For research stage of development, application
software was developed under LabVIEW 4.0 and consistsof three components: data acquisition and processing,
software control algorithms (for example, slow PID
feedback control), local man-machine interface andserver program to support mirroring of DSM. Flexibilityof combination composed of LabVIEW and DAQ boards
allowed to provide different kind of experiments withaccelerator hardware, develop and improve control
algorithms.
On the second stage, PCs see as operator as control
object through CAN. We have selected DeviceNet highlevel protocol for CAN -- one of the three most widely
usedprotocols
forindustrial
applications(CAL/CANopen, DeviceNet, SDS). Software supporting
DeviceNet for Linux is under development now. Kernel
driver for CAN-bus adapter has been developed forLinux. PC-N2 will be run under RT-Linux, so kernel
real-time module for RT-Linux for CAN-bus adapter isunder development.

and control an accelerator through segment of DSM.
Every module of application software accesses thesegment of DSM through individual describing structure.
Data from particular blocks of DSM belonged to othercomponents of cs (f.e. modules of front-end level) arereflected in the segment of DSM on top level (Figure.3).

3.3 Mirroring mechanism.
Segments of DSM together with mirroring mechanism
are used to reflect data describing current state of anaccelerator and necessary for operating of application
software. Mirroring mechanism lies hidden fromapplication software. It depends on type of used feildbus
and could be implemented partially in hardware as it wasdone in one of the cs designed previously where MIL1553B fieldbus was used [1].
Mirroring mechanism was completed in software with
Ethernet interlayer communication in cs described in thearticle. It allows to use different hardware and software
components at front-end level during first and second
stages of cs development without any software changes
on top level.
Software components accessing the segment of DSM,
and not responsible for mirroring, could know nothing
about inter-level communication construction and not toworry wherever data appeared. This approach ensuresrather clear application program interface which simplify
work of programmers. It allows develop independently as
parts of application software as mirroring algorithm fordifferent types of hardware.

3.2 Software of top level.

S hare d M e m ory

As was mentioned above, PC-N1 runs under non realtime OS Linux 2.1.x. Man-machine interface is based on
X-Windows The structure of top level software is shown
on Figure 2.

T ran sp o rt
P ro g ra m -c lien t

S egm ent of
D is trib ute d
S hare d M em o ry

M a nm ac hine
interfa ce

S tru ctu red escribing
sha red m e m o ry

C o ntrol
A lg orithm sS hare d M e m ory

C o n tro lA lg o rith m srea dS tru ctu red escribing
sha red m e m o ry

E the rnet

T ran sp o rt
P ro g ra m -se rv e r

D ataba se

S tru ctu red escribing
sha red m e m o ry

D a tab as e

M an -m a c hin ein te rfac e

M irro ringM e chanism

D a ta A c q u isitio n
A lg o rith m s
C o n tro lle d O b je c tw rite
IP Cm e ssag eq u eu eM irro ringM ech anism
M ana ge r

Figure. 2. Structure of top level software.
Modules of application software (man-machineinterface, control algorithms, database, etc.) could watch

Figure 3. Structure of Distributed Shared Memory.
Mirroring mechanism on top level could be modified
dynamically by Mirroring Mechanism Manager -special-purpose software process. The process controls
software module responsible for transportation andreplication of different segments of shared memory.
Physical properties of measuring parameters and type ofcommunication are usually clear at the initial stage of cs
development and define order and period of replicationof different DSM blocks.

3.4 Why Linux?
Notice that during the process of development, Linuxshould finally replace any other OS running on PC.
Linux is one of the dynamically developing modern,
POSIX-compatible UNIX-like OS. It is freely available
together with its source code and well documented. The
idea of free distribution has unified around itself rapidly
growing society of Linux users.
Linux OS is going well known and more widely usedamong teams working under development of cs all over
the world. For example object oriented control system
TACO supports Linux OS [3]. Client of EPICS could be
run under Linux. There are few implementations of
CORBA under Linux which is discussed as considerably
promising technology for cs development [4,5]. CORBA
is one of the object oriented environments for distributed
systems which provides the ability to build distributed
applications, running on heterogeneous systems, without
knowledge of the underlying network.
Our four years experience shows that wide set of
application software and tools, high level of reliability
and supportability could be achieved with OS Linux indesktop, network and server applications. We use Linux
successfully more than two years to support operator
console of upgraded rather old control system of electronlinac.

executive runs a non-real-time kernel as it’s lowest
priority task, using a virtual machine layer to make thestandard kernel fully pre-emptable [8]. All interrupts are
initially handled by the real-time kernel and are passed to
the Linux task only when there are no real-time tasks torun. Thus, when Linux has disabled interrupts, theemulation software will queue interrupts that have been
passed on by the real-time kernel. Real-time and Linux
user tasks communicate through lock-free queues andshared memory in current version.
So, application of Linux on top level and RT-Linux on
middle level will allow us to use unified softwaredevelopment technology and tools for both real-time andnon real-time parts. It would allow to make good use of
hardware resources of PCs.

4 SIMPLEX ARCHITECTURE
The Simplex Architecture, a real-time software
technology developed at Carnegie Mellon University
Software Engineering Institute, was designed to make thecs software changes in a safe and reliable fashion while
the system is running [9]. The Simplex Architecture isbuilt upon fundamental concept of analytic redundancy.
It is achieved by implementing different types of control
algorithms. Basic architecture of Simplex Architecture(Fig.5) contains User Interface module, a decision
module, an I/O module and three control modules: abaseline controller, safety controller and an experimentalcontroller.
S afetyC o ntro l
M o d ule

3.5 Linux in real-time.
As about application of Linux for operation in realtime, it is impossible to use it “as is” but there are somedecisions and projects aimed to improve Linux to be
applicable for real-time application [6]. One of the suchproject is Real-Time Linux, or RT-Linux [7].
A p p licatio n...

U serInterface
andB aseline
C o ntro l
M o d ule

D ecisio n
M o d ule
I/O
M o d ule

P hysical
S ystemU p date
M anag ement
E xperimental
C o ntro l
M o d uleA p p licatio n

S ys tem ca lls, P O S IX

Figure 5. Basic structure of Simplex Architecture.
L inu x O S
R T - T ask

D evice d rivers
I/O

R T - T ask

R T - T ask

I/O
R T - L inu x

S c hed uler
In t

In t

In tI/OHARDW ARE

Figure 4. RT-Linux architecture [7].
RT-Linux is operating system in which a small realtime kernel coexists with Linux kernel (Fig.4.). RTLinux is based on an approach when simple real-time

These software modules run simultaneously andexecute control algorithms in real-time. The decision
module is a central part of the architecture. Although all
three controllers may be running and generating
commands simultaneously, only one of the command will
be chosen to be sent to the object to control. I/O module
measures response of the physical system and distributes
them over other processes. I/O module transmitscommands from chosen controller to physical system.
Each of controllers can control physical system to satisfy
certain requirements. The experimental controller
contains the system upgrade to be tested. It could be
newly designed algorithm, more fast or more optimal butwith uncertain reliability. The safety controller is a highreliable controller that, in a known domain of thephysical system state space, it is able to maintain thestability of physical system. But the safety controller may
not be able to achieve the control objective of the system
in a precise manner. The problem is solved byimplementing yet another reliable controller, the baselinecontroller, which is designed to achieve the controlobjectives, but to operate within a smaller domain of thestate space.
As a control system is upgraded, both the experimentalcontroller and the safety controller are runningsimultaneously with the experimental controller actuallycontrolling the physical system initially. The state of thephysical system is monitored as the system runs. If theexperimental controller drives the physical system to an
undesirable state, which signifies possible errors in thecontroller, it will be disabled and the safety controller
will take over. While the safety controller is controlling
the physical system, the experimental controller can bechecked and fixed, and than re-installed to take back thecontrol. Such a process can be repeated dynamicallywhile reliability of experimental controller achieves
satisfactory level. So high reliability and high availability
can be achieved during the system upgrade without
shutting down the system.
During the development of cs for new accelerator oneof the task was to stabilise amplitude of rf field inaccelerating section. The rf system was newly designed
and we did not know exactly dynamic parameters of thesystem in advance. We used simplified Simplex
Architecture and found it very useful. Analogue PID
feedback controller designed former time served insteadof Safety Control Module. Reference level and closing of
feedback loop of analogue controller is controllable
digitally. Properties of controller were known well anddistinctive level of safe operation with not enoughtracking accuracy could be achieved just after starting up.
Digital PID algorithm was implemented as CodeInterface Node in LabVIEW and played a role ofexperimental controller. It allowed us to study object ofcontrol and successfully develop digital control algorithm
for new rf system of new accelerator.

5 CONCLUSIONS
DSM approach has allowed to develop application
software for cs more quickly and reliable due to simple
API. Future upgrading of the system is simplified too.
According our experience, Linux OS looks very
attractive as basic OS for development an accelerator cs,
but additional investigation and improvement of realtime compatibility should be done. Simplex Architecture
could be proposed when safe dynamic upgrading anddevelopment of feedback control algorithms arenecessary, which is often occur in development cs foraccelerator.

REFERENCES[1] A.S. Chepurnov, A.A. Dorochin, K.A. Gudkov,V.E.Mnuskin, A.V. Shumakov, Family of Smart
Devices on the base of DSP for Accelerator
Control,// Proceedings of Int. Conf. on Accelerator
and Large Experimental Physics Control Systems,
W2B-d (Chicago, Illinois USA,1995).
[2] A.S. Chepurnov, A.S. Alimov, A.A. Dorokhin, B.S.
Ishkhanov, V.M. Lipgart, V.E. Mnuskin, S.A.
Kosterin, V.I. Shvedunov, A.V. Shumakov, GradualUpgrading of the Accelerator Control// Proceedingsof the Int. Workshop on Controls for Small andMedium-Scale Accelerators, p.169 (KEK, Tsukuba,
Japan Nov.1996).
[3] A.Götz, W-D.Klotz, J.Meyer, E.Taurel, P.Makijarvi
TACO: An object oriented control system for PCs
runningLinux,
Windows/NT,//
CD-ROM
Proceedings of PCaPAC, October, 1996, DESY,Hamburg, Germany[4] S.Hunt,
B.Jeram,M.Plesko,C.Watson
The
Implementation of an OO Control System API with
CORBA,// Accelerators and Large Experimenta
Physics
Control
Systems,ProceedingsofICALEPCS'97, Science Press, 1998, p.354].
[5] TheMICO
CORBA
CompliantSystem
http://www.icsi.berkeley.edu/~mico/[6] J. Epplin Linux as an Embedded Operating System
http://www.embedded.com/97/fe39710.htm[7] Real-Time Linux http://rtlinux.cs.nmt.edu/~rtlinux[8] RT-Linux Manual Project
http://rtlinux.cs.nmt.edu/~rtlinux/whitepaper[9] D.Seto, B.H.Krogh, L.Sha, A.Chutinan Dynamic
Control System Upgrade Using the Simplex
Architecture, // IEEE Control Systems, Aug.1998.,
Vol.18, N4, p.72.