TOOL FOR DEVICE HISTORIES AT THE KEK LINAC
Norihiko Kamikubota and Kazuro Furukawa
National Laboratory for High Energy Physics (KEK)
1-1 Oho, Tsukuba, Ibaraki 305, JapanAbstract
Almost all of the signals of the linac control devices, roughly
6000 bytes in total, are scanned with a one-second interval. Thechanges are recorded into log files during the linac operation aslong as three months. A tool, called ’dev hist’, has been developed in order to display the histories of specified devices fromthese log files. This tool provides mouse-oriented controls to select a device and a time-window of interest.

VME #1workstation
changemonitoralarm
application

Readshared memory area
Write

polling
processalarm
application

Write
Write

pollingprocesspolling
processalarm
application

Introduction
The KEK injector-linac has provided 2.5-GeV electron andpositron beams to the downstream rings, Photon Factory and
TRISTAN. The control system for the linac was replaced by a
new one in 1993 [1, 2]. The system comprises: a) 7–8 VME stations running under the OS-9 operating system, b) a few Unixbased servers, and c) a communication network by which computers are connected. So far it has operated successfully [3].
The present control system includes surveillance processes
which survey almost all of the signals of the linac control devices at a one-second interval. The total amount of signals isroughly 6000 bytes. The change reports from these processes
are recorded into log files.
Since the log files consist of a large bulk of ASCII strings, it is
not easy to extract useful information from them. Thus, a tool,
called ’dev hist’, has been developed in order to provide an easyto-use environment to display the histories of specified devices
from these log files.
This article describes how log files are created in the section”Processes and log files”. In the section ”Tool for deivice histories”, the components of the tool are presented with some examples for a performance demonstration.

VME #2changemonitor

history log
VME #nFigure 1: Relations between the processes and logs.
from all of the VME stations are collected at a workstation, andare redirected to some alarm applications as well as to log files.
The number of signals with one change monitor in a VME
is: a) 440 bytes for eight klystrons and one booster, b) 160–600
bytes for 3–8 power-supply controllers for magnets, c) 60–180
bytes for 1–3 vacuum system controllers, and d) 10–120 bytes ofother signals. As a result, the whole system takes care of 6000
bytes of the signals.
The average number of reports during normal operations is 10
per one second. It is also worth noting that the CPU consumption rate by a change monitor is roughly 10% with a 68040 CPU
running at 25 MHz.

Processes and log files
Processes
Each VME station has a few (typically 4) field network lines.
These field networks have been used to link the distributed device controllers [4]. As shown in Fig. 1, polling processes are
running at each VME station. They scan all of the signals of thedevice controllers, and write them in the shared memory area.
The scan rates are set at 1–2 Hz. As a matter of fact, the sharedmemory area keeps up-to-date values of all the controller signals.
A surveillance process, called ”change monitor”, surveys thevalues on the shared memory area with a one-second interval.
It creates reports only when changes are detected. The reports

Log files
The reports from the change monitors consist of ASCII strings.
They are identified and redirected into appropriate log files,
which exist for each device controller.
Fig. 2 shows a part of the log file for the klystron ’K42’. The
first line shows that the 28-th1 signal of the klystron changed
from 036b to 04d7 at the time 10:21:08. The next change of thesame data is found in the third line, which shows that the signal
changed to 0634 at 10:21:13.
During the three-month operation from October to December
in 1995, the total amount of log files was 1.7 GB. The number
1 ’1c’ is the hexadecimal expression of the decimal ’28’.

of files is about 200, and the largest one has a size of 130 MB.
27/Nov/1995 10:21:08> K42-ADC
27/Nov/1995 10:21:13> K42-ADC
27/Nov/1995 10:21:13> K42-ADC
27/Nov/1995 10:21:19> K42-ADC
27/Nov/1995 10:21:19> K42-ADC

procedures in order to draw a history graph in the drawing area.
An overlook of dev hist is shown in Fig. 4.

1c,04d7,036b
1a,0c14,0aa7
1c,0634,04d7
1a,0a67,0c14
1c,0497,0634

Figure 2: Example of a history log.

Tool for device histories
Overview
In order to display the histories of linac devices, a graphic tool,
called dev hist, has been developed. This tool is based on a commercial graphic package2 which provides command-driven interactive functions. We have developed three essential procedures.
hist read - read a history log The hist read reads a specified log
file and loads the values into internal arrays. Since the sizes ofthe log files are typically a few MB, and it takes a few minutes toread a file, a special read-in routine was developed with C language instead of using a default read-in procedure. The present
read-in times are less than 10 seconds for most cases. It may takea minute when the size is as large as 100 MB.
hist draw - draw a history graph The hist draw displays a history graph according to the contents of internal arrays. The timewindow can be issued in a command-line with keywords. A typical example of a history graph is shown in Fig. 3.

Figure 4: View of the tool ’dev hist’.

Demonstration
Some examples to demonstrate the performance of the tool arepresented.

A typical example: A typical example is already shown in
Fig. 3, which shows a one-week history for the RF phase ofklystron ’K58’. The phase alternates between 170 degrees and90 degrees several times. These two values correspond to thosefor electron and positron injection, respectively. In addition,
zero values for very short duration (actually a few seconds)
are observed, which implies the occurrences of a self-reset procedure of the klystron controller due to large electro-magnetic
noise from the klystron itself.
A graph with log scaling: Fig. 5 is an example with log scaling on the Y-axis. Note that the values of the Y-axis are calculated with pre-defined calibration coefficients. In Fig. 5 the vacuum level of the ion-pump ’IPK3-1’ is shown for two weeks.
Some obvious peaks, which result from sudden changes in thevacuum to worse, are observed on Tuesdays and in the afternoons of Thursdays. Those originated from the occasional output stops of all the klystrons due to the weekly maintenance every Thursday afternoon and accelerator studies every Tuesday.
Each time that we restart the high-power klystrons, it causes immediate changes of the vacuum to a worse condition, followed
by gradual changes which make it better.

Figure 3: One-week history for the RF phase of the klystron’K58’.

dev hist - control with menus and buttons The dev hist procedure creates a window with many buttons and menu-bars. Auser can select a device and a time-window by clicking buttons/menus with a mouse. The dev hist invokes the previous two
2 We use PVWAVE provided by Visual Numerics Co.Ltd.

A bit-style display: Another functionality is a display in bitstyle, which is suitable for indicating logic signals. Two-weekhistories of 16 logic signals of the klystron ’K54’ are shown inFig. 6. Since the 6th bit indicates the high-power output, it isusually 1 (output on). Thus, the observed changes of this bit to0 correspond to the output downs of the klystron. The same asin the above example, all of the output downs are on Tuesdays
and Thursdays.

Figure 5: Vacuum level of the ion-pump ’IPK3-1’.

Figure 6: Bit-style display for the logic signals of the klystron’K54’.
Discussion
Before the dev hist became available, only a few members whowere very familiar with text-processing tools (i.e. sed, grep, cut,etc.) could extract device histories from the log files. On thecontrary, the dev hist provides everybody possibilities of getting
device histories by themselves. The tool is especially useful incases of troubles, since it has abilities to prove the behaviors ofany device at the time of the problem.
References[1] N.Kamikubota, K.Furukawa, K.Nakahara and I.Abe, Nucl. Instr.
Meth. A352(1994)131[2] N. Kamikubota, K. Furukawa, K. Nakahara and I. Abe, Proc.
1994 Int’l Linac Conference (LINAC94), Tsukuba Japan, August
1994, p.822; KEK-Preprint 94-73[3] N. Kamikubota, K. Furukawa, K. Nakahara, I. Abe and A. Shirakawa, Proc. Int’l Conf. on Accelerator and Large Experimental Physics Control Systems (ICALEPCS’95), Chicago, October
1995, Fermi-lab. report in press; KEK-Preprint 95-142[4] K. Nakahara, I. Abe, R.P. Bissonette, A. Enomoto, Y. Otake,T. Urano, and J. Tanaka, Nucl. Instr. Meth. A251(1986)327