DEVELOPMENT OF PC BASED FIELD CONTROLLER WITH LINUX
T.Masuda, T.Fukui, M.Kodera, R.Tanaka and A.Yamashita
SPring-8, Mikazuki, Hyogo, 679-5198, Japan
Abstract

2.1

In SPring-8 storage ring control system, VMEbus
systems with real-time UNIX(HP-RT) are used as front-endcontrollers. For increasing requirements of temporary
measurements, it is useful to introduce inexpensive I/O
controllers. Linux based PC system was adopted as asupplement system with the same functionality as that ofthe VMEs. Control software running on the VME system
was migrated to Linux system and the new system was used
for such as measurement of cooling water temperature, airtemperature at the machine tunnel and so on. At thismoment, four PC systems are actually used as fieldcontrollers. We report the development of the PC based field
controller with Linux and measured performance based on
our control software.

The main framework consists of Message Server(MS),Access Servers(ASs) and EMs. All application programs
running on operator consoles to control equipments send
control messages to MS. After checking access control, theMS sends the messages to the appropriate AS which is aclient process of ONC/RPC. The AS sends the messages tothe server process(=EM) running on each VME system. The
EM operates the VME boards according to the received
message and replies the execution result to the client. The
AS returns the result returns to the application program
through the MS.

Main Framework

Application ....

Application

On-line DB Archive DB....

1

INTRODUCTION
MSAccording to the standard model of accelerator controlsystem, VMEbus systems have been used for the SPring8 storage ring(SR) control system[1]. The CPU board isHP9000/743rt with 64MHz PA-RISC 7100LC and itsoperating system(OS) is HP-RT which is real-time UNIX
based on LynxOS. The VMEs are connected with 10Mbps
optical fiber Ethernet and linked to 100Mbps FDDI
backbone LAN through a FDDI-Ethernet switching
HUB[2]. Currently, 27 VMEs are distributed around the SR
to control equipments such as magnet power supplies,
vacuum system, and RF system.
After machine operation started, requirements oftemporary measurements mainly for machine studies havebeen increasing. The data sources are distributed around theSR and the number of data points of each source is small. Inorder to investigate the correlation with other data, it isnecessary to store those data into database. Since thetemporary measurements should not request the major
configuration change of VMEs used for the machine
operation, we introduced PC based field controllers withLinux as a supplement system of the VMEs within thesame control software framework.

2Operator consoles& DB servers

CCAS

RPC

RPC

Network(FDDI/Ethernet)
RPC

RPC

EMCS
Poller

VMEs(PCs)

sharedmemoryDevice Drivers
boardsdata/command(s)process(es)store(s)CONTROL SOFTWARE

Our control software is based on client/server scheme asshown in Figure. 1[3]. In order to install for PC based fieldcontroller to the frame, we have to migrate those processes
such as Equipment Manager(EM), poller, and Collector
Server(CS).

SYBASEIPC I/F(message)
RPC I/FSQL database accessFigure 1. The control software structure.

2.2

EMThe EM is an RPC server running on the VME
system[4]. It resolves the received message according to aconfiguration file and determines which VME boards andchannels are allocated and operates the boards by calling
appropriate control functions.

2.3 Poller/Collector Data Acquisition System
For the purpose of monitoring and logging of theequipments status, periodically data acquisition systemcalled poller/collector is adopted[5].
The poller is a stand-alone process running on the VME.
Since it was implemented with the same framework of theEM, it takes data by using the same control command asthat of the EM. The data taken by the poller is stored in ringbuffer implemented on shared memory which is used forcommunication between the poller and the CS. The CS
which is an RPC server process on the VME collects thenewest data from the ring buffer. The CS sends the dataaccording to a request of the collector client(CC) on theoperator console. After receiving the newest data, the CC
sends them to the on-line database.

3 DEVELOPMENT OF PC BASED FIELDCONTROLLER
We developed the PC based field controller realizing thealmost same functions as those of the VME system by
migrating our control software to Linux.

3.1 OS
Because our control software is built on UNIX system,
OS for the PC controller must be based on UNIX. Ourcandidates were Linux and Solaris. As far as considering thecomplete migration of the EM, the poller, and the CS,
Solaris for the real-time OS was seems to be preferable toLinux which has no real-time features. Because they werewritten with some real-time functions of HP-RT such aspriority control and real-time timer. However, the mostimportant and serious problem was how to prepare device
drivers for I/O boards, especially for GP-IB interface boards.
Since some free device drivers for I/O boards including theGP-IB were available for Linux, consequently we decided toadopt Linux. At this moment, the real-time parts of ourcontrol software was not so critical for the temporarymeasurements.
Version 2.0.30 kernel was installed to field controllers
with Slackware 3.4.0 distribution.

3.2 PC Hardware
As the PC hardware, DELL Optiplex series with minitower chassis was prepared because we needed as many ISA
slots for I/O boards as possible. It can provide maximum 4
ISA slots and has a 333MHz Pentium II CPU, 64MB main
memory, 4.3GB hard disk, and a 10/100Mbps Ethernet
Interface.

3.3 Boards and Device Drivers
For our temporary measurements, three types of ISA
boards were required, that is, GP-IB interface board forcontrolling instruments, analog input board for measuring
temperature with thermocouple, and TTL level digital
input/output board to control CATV switch.

As the GP-IB interface board, AT-GPIB/TNT from
National Instruments was selected because its free device
driver was available1. For the analog input board,AISA2606 from Advanet Inc. was used since it could beconsidered as the ISAbus version of Advme2602 VMEbus
board which was already introduced to temperature
measurements. This board has 4 channels for wide range of
analog input and thermocouples can be connected directly toit. For TTL level digital input/output board, 32-bits
AISA1422 from Advanet Inc. was adopted.
We developed Linux device drivers for the later twoboards by ourselves with the help of our experience inHP-RT. The both were very simple I/O boards, so thatwriting drivers was not so difficult. From the experience ofthe development of simple drivers, the basic differences
between Linux and HP-RT drivers are summarized asfollows.
•For board register access, we have to use service
calls according to the data size and the datadirection(read/write) with an argument of hardware
address in Linux device drivers. On the other hand,
HP-RT allows to use a memory pointer to thevirtual address translated from the hardware address
at the driver installation.
•To transfer data between user and kernel space,
Linux requires to use service calls with giving theaddress of user space buffer as an argument. But
HP-RT handles this transfer by itself.
•Loadable module function supported on Linux is
not available on HP-RT.
Loadable module function helps to reduce development
and debugging time.

3.4 Migration of Control Software
Since our control software was written with UNIX
System V system calls and POSIX system calls, themigration from HP-RT to Linux was really easy. We
succeeded to migrate the EM, the poller and the CS except
the real-time parts of HP-RT described below.
•In order for the EM to respond operators' demands assoon as possible, the poller should run at lower
priority than the EM. The CS on HP-RT realizes
this by using priority control function which Linux
does not support.
•For providing high resolution(~200µs) sleep
function, the EM on HP-RT uses timer functions
handling hardware timer.
About the former, we replaced the priority control
function of HP-RT with nice value control function ofLinux. And about the later, we did not realize such a highresolutuion sleep function on the EM on Linux.
Another main modification was to change stub function
names between Linux and HP-RT generated by rpcgencommand.
1

ftp://ftp.llp.fu-berlin.de/pub/linux/LINUX-LAB/IEEE488

By using XDR format of ONC/RPC, we didn't have toconsider the endian difference between PA-RISC andPentium II.

4 APPLICATIONThe PC based field controllers have been applied mainly
to the measurement of cooling water temperature for the SRmagnets. For this measurement, three PCs are used and they
have three AISA2606 boards with 7 thermocouples inputs
and 3 another level of analog inputs. The poller is runningon the each PC to take temperature data periodically and put
them on shared memory. By receiving request from a CC
with 5 seconds interval, the CS collects the newest data set
from the shared memory and sends them back to the CC tostore those data into database.
Also a PC controller has been used to control CATVswitches with a AISA1422 board and to get the data from atime interval counter with a AT-GPIB/TNT board. The EM
manages the operator's demand to switch the CATV, and theCS collects and sends the interval data taken by the poller toan appropriate CC.
Above application systems had been working with notroubles for three months during the machine operation.

5 PERFORMANCEFor the comparison of performance between the PC
based controller and the VME, we measured some execution
times of our control software. PC and VME system used forthe measurement of cooling water temperature were selected
as the test system. The VME system consisted of two
Advme2602 boards occupied with the same number of
inputs as that of the PC. Both controller were connectedwith 10Mbps Ethernet.
Table 1 shows the average processing times of one
control message to get one temperature value in each EM.
The board access time with the device driver shown in Table
1 is included in the whole processing time. By comparing
the whole processing time, the PC controller marked about
5 times faster than the VME controller. Even the board
access time of PC through the slower ISA bus is about 2.5times faster than that of the VME system.
Table 1: Processing time in EM
PC controller VME controller
processing time of one
239
1225
control message (µs)
board access time with514
device driver (µs)
Table 2 shows the average data collection time of the CC
which takes the same size of data from the each CS throughthe network. The PC controller is about 3 times faster thanthe VME controller.

Table 2: Data collection time of CC
PC controller VME controller
whole processing(µs)
1361
3924
data collection in CS(µs)
1692transfer to XDR in CS(µs)
24130transfer from XDR in3531CC(µs)

6 SUMMARYThe PC based field controller with Linux was developed
based on the SPring-8 control software as thesupplementary system of the VMEs. It was easy to migrate
the control software from HP-RT to Linux without thereal-time features. The PC controllers was actually applied
to the measurement of cooling water temperature of the SR
magnets and so on. They have been working well and arevery stable. The performance of the PC including network
access is about three times faster than that of the VME, on
the other hand the cost is less than about one sixth. The PC
field controller with Linux provides very powerful andeconomical solution to the temporary measurement orcontrol over the network.
As the next step to use real-time feature, it is interesting
to intend the system to introduce real-time Linux.

REFERENCES[1] R.Tanaka et al., "Control System of the SPring-8
Storage Ring", Proc. of ICALEPCS '95, Chicago,
USA, 1995, p.201.
[2] T.Fukui et al., "Design and Performance of the Network
System for the Storage Ring Control at the SPring-8",
Proc. of ICALEPCS '97, Beijing, China, 1997, p.312.
[3] R.Tanaka et al., "The First Operation of Control Systemat the SPring-8 Storage Ring", Proc. of ICALEPCS'97, Beijing, China, 1997, p.1.
[4] A.Taketani et al. "Equipment Manager of the VME
Control System for the SPring-8 Storage Ring", Proc.
of ICALEPCS '95, Chicago, USA, 1995, p.625.
[5] A.Taketani et al. "Data Acquisition System withDatabase at the SPring-8 Storage Ring", Proc. ofICALEPCS '97, Beijing, China, 1997, p.437.