PERSONAL COMPUTER IN THE NSRL CONTROL SYSTEM
Shouming Hu, Weimin Li, Jingyi Li, Gongfa Liu, Songqiang Liu
National Synchrotron Radiation Laboratory,
University of Science and Technology of China,Hefei, Anhui 230029, P. R. China
Abstract
The National Synchrotron Radiation Laboratory(NSRL) control system is a distributed control system,
based on personal computers. It has been in operation forabout ten years. Personal computers are used in the800Mev Storage Ring and 200Mev Linac to control theaccelerator subsystems, they are playing not only
important roles as operation interface and databaseservers, but also the device controllers. At the front-endlevel, IPCs control physical devices in the field.
Beamlines and insert devices also use PCs for controland data acquisition.
In phase II project of the NSRL, EPICS will be
introduced into the NSRL control system, many PCs will
be utilized as device controllers, OPIs and IOCs alongwith some VME crates and workstations.

1 INTRODUCTIONNSRL is the first dedicated synchrotron radiation
facility in China, located on the West Campus of theUniversity of Science and Technology of China (USTC),in Hefei city, Anhui Province. The facility is mainlycomposed of an 800 MeV electron storage ring, namedthe Hefei Light Source (HLS), and a 200 MeV Linac
functioning as its injector. So far, the NSRL has
equipped 6 beamlines and their experimental stations forresearch on Photoelectron Spectroscopy, X-ray
Lithography, Soft X-ray Microscopy, Time-Resolved
Spectroscopy, Photo-chemistry and XAFS, respectively.
The XAFS station is a newly built experimental station
for XAFS research, together with a 6 Tesla Superconducting Wiggler, or Wavelength Shifter (WLS),
which has been put into service at the end of 1998.
The NSRL control system is a distributed control
system based on personal computers. Its main structure
was completed in 1990 [1][2]. It has been in regular
operation since 1992. During the past yeas, some newsubsystems, new control components and applications areintroduced into the system, along with the developmentof personal computers and network techniques [3].
The system consists of two main parts: the Linac control
system and the storage ring control system. The designprinciple of the system follows the goal of convenient
control, reasonable system response, reliable operationand easy maintenance, with provisions for future
improvement and expansion.
The existing control system is also composed of a few
separate subsystems that were self-developed during theHLS commissioning in late 1980’s for immediatefunctions.
Most of the subsystems use PC forcontrolling its own devices. Although some of thesubsystems have been upgraded on the grounds ofmachine operating requirement, but some are still
without much communication with others. During thecontrol system upgrade plan [4] of the NSRL phase II
project [5], this situation will be changed and improved.
In the upgraded control system, EPICS will beintroduced into the system. The hardware will be in’Standard Mode’ made up of PCs and Unix workstations,
IO controllers (mainly use IPC with few VMEs andVXIs) and distributed intelligent modules inside thedevices. They are connected to each other via ether local
area networks or field buses. And the new software will
be developed in the frame of the international shared
EPICS system.

2 SYSTEM ENVIROMENTPC (Intel X86) is the primary kind of computer usedin the NSRL control system, the type of computers arechanged in the wake of the PC market, from AT286 toPentium II. The operating system on PCs encompasses
MS DOS, Windows, Windows 95, WNT, Linux andNetware. C, C++, VB, VC, Delphi and LabWindows areutilized for the subsystems use PCs as their controls. Thesubsystems include ring main magnets power control,beam transport line power control, linac power control,linac energy stabilizer, timing system, injection control,
vacuum system, radiation safety monitoring andprotecting, thermal control system, beam position
monitor and correct, storage beam current measurementand display, beam profile measurement, inserting devices(wiggler and undulator) control, operation databaseserver. And all of the experimental stations use personal
computers for data acquisition and processing.
The network environment has been set up in thecontrol system since 1994, the 10M Ethernet (fiber andcable) has serviced the system without major problems atpresent. 100M fast Ethernet routers and switches arebeing employed.

3 HARDWARE CONFIGRATION

4 SYSTEM UPGRADE

3.1 Basic structure

4.1 Upgrade plan

The basic configuration of the control subsystems isshown in fig. 1. It is the common mode of subsystem
configuration. PC is used for both OPI consoles anddevice controllers. In addition to the PC controllers, there
are MULTIBUS, CAMAC, STD bus and PLC controllers.

As a part of the NSRL Phase II project, the upgraded
control system will be based on EPICS, following thestandard model of I/O controllers (IOC) connected toworkstations (OPI) via Ethernet. Since VxWorks support
PC as a target, we use PCs as IOCs for most subsystems.
The I/O modules inside the IOCs are basicallycommercial products. Usually, IOC has disks with
operating system and local applications installed, this isparticularly useful when the system is in the development
and test stage, and it is available for maintenance andmodification later.
The OPIs will be SUN WS and PC Windows, develop
tools are MEDM and Tcl/Tk.
The common system architecture is shown in fig. 3.

Ethernet
ConsolePC

UNIX/NT
OPTO-RS422

PC/WS

ConsoleI/O Controller

Comm..
Controller

Servers

Devices.. . .

I/O Controller

I/O Controller

IPC/Micro/

IPC/Micro/

CAMAC

CAMAC

Devices

DevicesO P Is
SUN W SO P Is
P C W ind o w s

E th ern e tFig. 1 The basic configuration
IO C
IP C

O P T O -R S 4 2 23.2 Software structure....

O r F ie ld B u s

The most frequently used programming language forapplication development is C. The object-oriented tools
like VB, VC, Delphi, LabWindows have been applied todevelop control applications in resent years. The
componentware such as Microsoft DCOM, SUN’s
JavaBeans and Activ X, are considered for databaseaccess and application communication over the network.
But at present, the database has no many data can beshared, and the communication between subsystems andapplications are very much limited.
The basic software structure is shown in fig. 2.

IO CIP C

D e vic e
C on tro lle r

D e vic e
C o ntro lle r...

D e vic e s

Fig.3 Common system architecture

4.2 Upgrade step
Subsystems will be upgraded step by step, since themachine is in the regular operation status during theupgrade period. We select the ring main power control
system as the first subsystem to upgrade.

4.3 Status
Dial. Up
Windows/DOS/X-Windows

Database
Workstations and Servers

TCP/PPP/IPX
TCP/ IPX /PPPSQL

NetworkNetwork
TCP/IPX

The prototype design of the EPICS control system formain power supplies has been completed, and will betested in this winter shutdown time. The softwaredevelopment and improvement for subsystems is in theprocess and will be continued. The EPICS database foreach kind of hardware device is prepared one by one, thisis the major tasks not only in the control structure, butalso in the real-time database.

TCP/( ActiveX)

VB/VC/Delphi/
LabWindows

Applications
C/C++

5 MAIN POWER SUPPLY CONTROLUPGRADE
5.1 PC for IOC and controllers

Fig. 2 Software structure

We will develop 11 new controllers for main magnets

power supplies by using IPCs or PLCs, and use apersonal computer (IPC) as IOC, to control the main
magnets power supplies. Each power supply has one
controller and we call them devices.

5.2 Database for the IOC
Corresponding to the controllers there are 12 devices(Q1-Q12) in this subsystem. Each device contains 30records. The DTYP include MpsControl (bo), MpsStatus(mbbiD), GetSetpoint (ai), SetSetpoint (ao), RampTimer(ao), RampTable (sub), MpsDcct (ai).
For example, the main switch record of the storage
ring bending magnets power supply controller is named:
RING:Q9:MainSw:boThe hardware address is:
Q9 01 @“string”.

5.3 Record support
The record type: there are 12 Switch/Control record(the DTYP is MpsControl),15 Status record (DTYP isMpsStatus) and 5 other type records(such as RampTable) for each device. The Ramp Table record is asubroutine record for downloading ramp table.

5.4 Device support module
Device support module is used to send command todriver. Command name is switch ON/switch OFF, reset,read record, set setpoint.

5.5 Driver support module
The driver layer is independent to the EPICS datastructure.
The communications between IOC andcontroller use standard RS232 or RS422 serial line.
Device interface is realized in the driver support module.
The basic system directive include:(1) open (name, flags, mode)(2) read (fd, buffer, n)(3) write(fd, buffer, n)(4) ioctl (fd, function,arg)
Value
Argument
Description
namethe port name /tyCo/0 and /tyCo/1
flags
access mode
O_RDWR
mode
UNIX style fileaccess control0functionfunction code
FIOBAUDRATE
arg = 9600
function code
FIOSETOPTIONS
arg = OPT_RAW
Driver Support Module subroutine entrance include:
set232Link()
initialize the serial port
send232Command() send command to controller
check232Message() check the message come fromcontroller
send232RampTable download ramp table

Thecommunication
follows
communication protocol [6].

theHESYRL

5.6 OPI application design
Host operation is mainly realized by MEDM andTcl/Tk. Two display windows for main operation havebeen designed, one is status display window and theother is control window.
The operation mode includes single/group channel
access and ramping/setting selection.
The Calibration, demagnetization and ramp table
download
operatingfunctionsaredesignedindependently and run script in MEDM or under Xwindows.

6 NETWORKThe 100M fast Ethernet routers and switches are being
employed. This not only enables faster throughout butalso helps application run more efficiently. The routerand firewall filter or interrogate all traffic before
allowing access into the control system, they not only
guard against unwanted access, but also can be used tocreate a secure channel through the campus network.

7 CONCLUSION
The personal computers have been successfully appliedin variety subsystems of the NSRL control system. Thesystem upgrade will greatly enhance the control system
abilities in efficient and reliable control, convenient
operation, and systems’ response. The real-time database
will be set up and the system maintains will be easierthan before.

8 ACKNOWLEDGEMENTS
We would like to thank the colleagues, who devoted
their contributions or helps to the NSRL control system,
both in China and abroad.

REFERENCES[1] Yao Chih-Yuan, ICALEPCS’91, KEK, Japan,
1997,p.40[2] C.Yao et al., Proc. Int. Conf. on SR Apl. Hefei,
China,1989[3] Proceedings of the Second National Symposium onParticle Accelerator Technology, China, 1998
[4] Weimin Li et al., ICALEPCS’97, Beijing, China,
1997, p.19
[5] Zuping Liu et al., “NSRL Phase II Project”, SRI’97,
Japan, 1997
[6] S.Liu “Software for Local control and DataCommunication”, Proc. Of Conf. on SR Apl., 1989
[7] N.Liu, et al. “The Influence of Superconducting
Wiggler on HLS Storage Ring” China-Japan Joint
Symposium, 1996