New Man-machine Interface at the BEPC
J. Zhao, C. Wang, B. Wang, X. Geng, J. Xu, H. Luo
Institute of High Energy Physics, Chinese Academy of Sciences
P.O.Box 918-10, Beijing 100039, China
Internet: Zhaojj@bepc3.ihep.ac.cn
The BEPC (Beijing Electron Positron Collider) control system was upgraded in October 1994. Except for low level
CAMAC hardware equipment, all high level control computers and their adapters have been updated. The old console withtouch panels, color monitors and knobs has been replaced by workstations. This paper describes the methods of developing
the man-machine interface under X-windows in a network environment without having to change existing programs greatly.

1. INTRODUCTION
The BEPC control system was built by the end of 1987 and has been upgraded in October 1994.
The old control system used a VAX-11/750 computer and the VAX-CAMAC-Channel to connect to the low level
CAMAC data acquisition system. The old console has color and B/W monitors for displaying the status of the controlledequipment. A touch panel and knobs were used as the man-machine interface to operate the BEPC machine. A Grinnell
controller interfaced the color and B/W monitors to the VAX computer. This controller is no longer manufactured and the lackof spare parts made the central console unreliable. So workstations are now employed as the new man-machine interfaces ofthe control system.

Figure 1

Former BEPC console structure

Figure 2Upgraded BEPC control system

The upgraded control system, as shown in figure 2, adopts a distributed architecture based on Ethernet [1]. Both theVAX4500 and Micro VAXII can independently control all BEPC equipment or control the different devices separately. TwoVAX workstations are used as the new console to replace the old one. A mouse is utilized as the operating tool. Ethernet
connects all the computers serves for data communication. Our strategy was to avoid having to change low level programs
greatly in the development of the new console.

2. CONSOLE MANAGER.
The new console consists of two VAX4090 workstations and two X-terminals. The console manager developed under XWindows and OSF/Motif has a friendly man-machine interface which retains the former style of the control panel to reducethe training time for operators [2]. The dedicated Grinnell adapter was eliminated; thus the new system is easy to maintain. A
new knob control program has been developed, using the client-sever mode to control individual devices.
2.1. Environment of the console development.
Jointly developed by MIT and DEC, X-Windows is being widely adopted as a standard by nearly every workstation
manufacturer for its extremely convenient user interface, powerful programming ability, high quality code and distributed
processing ability, and it has been used in many large-scale control systems.
X-Toolkit is a software package established on the basis of X-windows for the convenience of users to develop interfaces.
It contains a large widget set including Motif, which provides many artistic widgets for interface design and makes it possible
for the user to do further development as required, and OPENLOOK, which adopts the concept of OOP.
2.2. Console database.
A hierarchical database was installed on the console computer with a DBMS system, DBA, which can read write, print,and backup the data record on a terminal; console manager programs can access the database by a set of subroutine calls. At
console startup whole data records, the information on the accelerator devices and console messages, are brought into physicalmemory from the disk. The console manager fetches the useful information from the database.
2.3. Program Realization.
The hardware console was replaced by a software console, which provides both controls and displays. SLAC hasdeveloped a console manager program, the principle of which is as follows: Create a window on workstation and designate
four areas (tile) simulating the original left and right touch panels, two color displays and one black and white monitor. Whenthe information with Grinnell codes is sent to the workstation from server program Newavtx running on the VAX4500, it
will be encoded into X-Window format and displayed on the workstation by the console manager. The control informationfrom an operator at the workstation is sent to through Ethernet Newavtx , where it can be interpreted and switched to thecorresponding application process.
Though this programming ingeniously avoids a great amount of work on improving the lower lever programs of theformer control system, it still has some drawbacks: (a) The weakness of XUI: it can not make a perfect interface. (b) Serious
shortcomings in operation: the size of “tile” cannot be changed and thus some tiless are too small, the text is overlapped andthe operator can not observe the contents of both tiles simultaneously. (c) Inconsistency with developmental projects for theBEPC control system.
For these reasons,the program cannot be used unmodified for practical control of BEPC. Thus we did considerable work
to analyze and regenerate it and now we use the Motif widget set. User Interface Language (UIL) is adopted to reduce programcrashes caused by mistakes in interface design. Instead of one window divided into four areas, six independent windows
represent console devices and the windows can be reduced or enlarged independently to make full use of the limited screen andto make it possible for the operator to get information on several devices at the same time. The windows adopt theApplication Shell as their top level window so that they can be turned into icons and stored in the icon box when not in use.
Each of the windows can be independently chosen to be shown on a workstation or X-terminal. Thus the inconvenience ofoverlapping windows is avoided. The improved program retains the advantages of the original and provides the operator with afriendly user interface and convenience of operation.
In addition, the operator can acquire functions by using menus. For example, using the FILE menu an operator can printand quit, the CONTROL menu can control the window state, the OPTION menu can change the foreground or backgroundcolor, the HELP menu supplies details of operation to the operator.

2.4. Knob manager.
There are four knobs on the old console to trim the currents of magnets individually; these are connected to the VAX11/750 by an RS-232 port. In the upgraded system, the hardware knobs have been eliminated and a new knob manager
program developed, consisting of a knob client program running on the workstation and a knob server program on theVAX4500 computer. A network link is created at start-up between the knob client and the server program in order to exchange
data and commands.
The knob client program developed with Motif widgets allows the operator to tune one to four power supplies and toselect the up or down speed and size of the steps. The relative values of the current can be shown in the knob windows. Theaccuracy of the trim is a single bit. If the current setpoint value overflows, an alarm message will be shown in an information
window and the operation will be stopped. The knob server program in the VAX4500 computer sets current values for
specified devices. It waits for an event flag sent by an operator through the network. Once the event is set up, the server
program packs the I/O commands and data into CAMAC control words, resulting in the setting values being exported to thedevices.

3. NETWORK COMMUNICATION
DECnet for task-to-task non-transparent communication has been adopted to develop the network manager programs
because it can provide data exchange between programs running on different operating systems and provides many network
functions. Among such functions are rejection of the network link request, synchronous or asynchronous termination of thenet link, management of net link multi-requests, etc. [3]Figure 3

The network links

Figure 4

Relationship between the console andthe application processes

The network link in our control system is shown in Figure 3. When the control system starts up, three kinds of network
links are created by the network manager. One is a network link between the console manager and the multi-ask scheduler on
the front end computer, which sends commands and data from the console to the FEC and passes the FEC messages to theconsole manager. The second is between local databases on FEC nodes, to carry out data exchange among these databases.
There is a third network link between the knob client program on the console and the knob server program on the FEC. Allof above network links are kept open when BEPC is operating.

4. CONSOLE SEVER AND SCHEDULER.
There is a program Newavtx, a set of panel files written in FORTH and twenty application processes in the VAX4500
computer. Newavtx is used for scheduling and managing those processes. It may activate or stop any application process on
operator request [4] and supervises many processes running simultaneously. Under the control of the program any equipmentof the collider may be monitored and adjusted to ensure that the collider operates optimally.
The application programs are divided into two levels. The zero level contains programs for data input/output, on/off andramping of the magnet power supply and monitoring of vacuum, radio frequency, beam position etc. The first level software
contains the programs Orbit, Current Monitor, Lattice and so on. The program Newavtx is responsible for scheduling thoseprocesses. Because Newavtx provides the network communication by making a logical link with the console manager netlink,
it may receive the data from the console through the network. Thus it is also a sever program for the console. Its other duties
are: (1) receiving network commands, (2) interpreting and executing FORTH commands, (3) scheduling application programs,(4) diagnostics.
Here, for simplicity we only discuss some key problems.

4.1. Data communication between the console and application processes.
By creating a logical link with the console manager using task-to-task nontransparent communication, the program
Newavtx may receive or reject the netlink request from the console manager, or synchronously or asynchronously terminate
the netlink. The maximum number of remote nodes is six. In addition, by declaring itself to be a “network object”, Newavtx
not only receives the data with FORTH command format from the console, but also sends the data, mostly Grinnell codes, tothe console. Thus it connects the console with the application processes. A mailbox created by Newavtx is used for theexchanger of data between the console and the application processes .
4..2. Interpreting commands and scheduling
Newavtx interprets the FORTH command from the console to active appropriate application processes and sends backthe result to the console. So it connects the console with the application processes. Two kinds of data are distinguished by anevent flag. One kind is for FORTH commands and the other is for Grinnell codes. The FORTH commands interpreted byNewavtx come from the two sources: the console panels and some application programs. The Grinnell codes were previously
encoded by the Grinnell hardware adapter. To avoid great changes in the application programs, they still use the Grinnell codesand send these codes to Newavtx. The console manager converts the Grinnell codes to the X-window graphic ones.
Newavtx waits for an event flag. Once the event flag N-efn is set up by a network transmission, Newavtx fetches theconsole commands and sends them to the interpreter subroutine. The appropriate process is activated after these commands
have been translated and executed. When an application process wants to send some graphic information to the console, itassembles Grinnell codes by using the Grinnell graphic library and sends them to the Newavtx mailbox with the event flag
set up. As soon as Newavtx receives the event flag , it fetches the data and sends them to the console manager. The related
graphic will be displayed in the console window after the codes are translated into X-Windows graphic codes by the console
manager. If some application processes need to send text messages about the current operation status or error to the consolepanel, they must assemble the data in FORTH command format and send them to the Newavtx mailbox with the event flag
set up. When Newavtx receives the event flag, it fetches the data and sends them to the interpreter subroutine. After these
FORTH commands are translated and executed, they are changed into Grinnell codes. Finally the Grinnell codes are sent to theconsole manager by the network. The text messages which will be shown in the console panel for these codes are converted
by the console manager.(figure 4 )4.3. Display console panel.
There are six windows on the console. One is used to display panel files, the other five are used to display the status andmessages from the controlled equipment. There are two kinds of buttons on the console panel, the panel selecting button andthe control buttons. With the control buttons, the commands and data can be issued for controlling the collider. There areabout two hundred panel files written in FORTH which are resident in the VAX4500 computer. At control system startup,
Newavtx sends an index panel to the console. When the panel selecting button is pushed, the console manager sends the Forthcommands to Newavtx through the network. Newavtx receives the commands and sends the selected panel to the console
manager for display.
In the upgraded system, one VAX4090 workstation communicates with two nodes, VAX4500 and VAX-II. So network
links are created between these nodes. A console manager program is located on the VAX4090 and two Newavtx of sameversion are running on the VAX4500 and and VAX-II. When debugging, we found the console panel “flashed” since the panel
files from the two different computers appeared simultaneously on the screen. In order to solve the problem, we modified theprogram Newavtx in the VAX-II by setting a switch to prevent the VAX-II from producing panel files.

5. CONCLUSION
The upgraded BEPC control system runs safely and reliably. The system has been successful. The new workstation
console with a friendly man-machine interface has replaced the former console. The operators can operate the machine in thesame manner as before, the only difference being the use of a workstation and mouse instead of a touch panel.

ACKNOWLEDGMENT

The author wishes to take this opportunity to thank Dr. Sam Howry, who gave us much help. We would like to thankall the members of our control group. The author gratefully acknowledges the support of the K. C. Wong Education
Foundation, Hong Kong.

REFERENCES[1] J. Zhao et al., Nucl. Instr. and Method in Phys. Res., (1994)A352.
[2] J. Zhao, B. Wang, Int. Conf. on Elec.and Infor. Tech. (1994) 337[3] J. Xu, Internal Report.
[4] C. Wang et al., Int. Conf. on Elec. and Infor. Tech. (1994)112