AUTOMATIC SOFTWARE PROCESSES AT THE APS
R. Flood, C. Y. Yao, G. Banks, G. Decker
ANL, Argonne, IL 60439, USAAbstract
The Advanced Photon Source (APS) storage ring is athird-generation X-ray synchrotron radiation user facility.
Many automatic execution and correction software tools
have been developed to increase productivity and reduce
potential human errors. These include: the injection/topup script, Procedure Execution Manager (PEM), orbit
correction configuration and execution tool, and beamsteering. We will present the applications and benefits ofthese software tools in this paper.

1 INTRODUCTION
The APS uses a wide variety of tools to automate
processes and assist operators. These tools expedite
processes, reduce human error, and increase machine
repeatability. However, these tools are not designed toeliminate the human element to operations, merely tofacilitate machine operations. Each machine has its own
level of automation, but automatic processes are available
for each machine.

2 INJECTION HANDLING
A script created in Tcl/Tk called the bunch train handles
the storage ring injection process (see Fig. 1). The bunchtrain script allows users to select bunch fill pattern,injection mode, current limits for the beam position
monitor (BPM) timing bunch, and normal bunch train.
Certain injection parameters are selectable as well. For
top-up injection, the options list expands to include
current tolerance, target current, injection interval, and thenumber of linac bunches used.

zero and injection occurs in two stages. The first stage isthe filling of the BPM timing bunch. This injection
provides a concentrated level of beam to trigger the BPMs.
The fill resumes with the remaining buckets, dependingon the selected fill pattern. A fill on fill is essentially thesame as a fill from zero, except there is beam in the ring.
During a fill on fill, beamline x-ray shutters may or may
not be open. We use BPM sum signals for the timinggroup, instead of the total current value. Total current is
the monitoring variable for the remainder of the fill. Topup injection operates at a fixed 120-second interval. Abucket selection process monitors the buckets and selects
the weakest bunch. Injecting into the weakest bunch
ensures a uniform fill distribution. The top-up process
issues a twenty-second warning and enables the injectors’
pulsed supplies. At the designated time, one of two things
happens: the storage ring septa and kickers fire for one
pulse or, if current is at or above the target threshold, thepulse cycle is skipped. The top-up process also performs
calculations based on beam current. If the current issignificantly greater than the target current, the script
recalculates the interval automatically to a higher multipleof 120 seconds.
The bunch train script checks for abnormal conditionsin the beam transfer line, radio frequency (rf) systems,
user insertion devices (ID), and the machine protection
system (MPS) before injection. During sustained
injections (fill from zero and fill on fill), we use a processmonitoring system to monitor storage ring radiation
monitor levels. If any radiation monitor exceeds a preset
limit, the script suspends the injection and allows
operators to troubleshoot and correct potential efficiencyproblems.

3 USER ORBIT STEERING
3.1 User Orbit Steering

Figure 1: Storage ring bunch train.
The APS storage ring has three commonly used
injection modes: fill from zero, fill on fill, and top-up. Ina fill from zero, storage ring current starts at a value ofThe APS routinely performs user orbit steering.
Because of the complexity of steering manually, we use
an automated steering tool. The local steering script is a
Procedure Execution Manager (PEM) that saves existing
BPM and corrector setpoints, zeros out orbit errors bytransferring present orbit to BPM setpoints, and prompts
for desired beamline and steering parameters. A setpointchange is applied to the local BPMs, and the orbit
correction algorithm adjusts the steering correctors tobring the error back to zero. The PEM then stores the new
local BPM and corrector setpoints. After steering, the tool
restores BPM setpoints of the nonsteered sectors.

3.2 Orbit Correction and Reconfiguration
Programbetween the guns, their functions have been expanded toinclude linac start up and shutdown.

The APS storage ring has approximately 500 BPMs,
including broad and narrow band, rf BPMs and X-ray
BPMs. The orbit correction program uses 80 correctors(two per sector) in each plane and all known good BPMs
for orbit correction. Due to failures or erroneous readings,
the operators need to be able to modify the orbit
configuration quickly and conveniently in order to be able
to add or remove BPM and/or correctors from the system
matrix. An Orbit Correction Configuration tool facilitatesthese changes. The tool graphically represents the orbit
configuration and allows changes to in-use components
through the use of check boxes. Nonfunctional BPMs areentered at the start of a run or when a failure occurs andare disabled in the selection boxes (see Fig. 2).

Figure 3: Linac Procedure Execution Manager (PEM).
The linac start up PEM (see Fig. 3) is a comprehensive
application that accomplishes all of the following: resetsinterlocks, opens gate valves, turns on and conditions
power supplies, restores a configuration file, turns on themodulators and brings them up to power, and warms up
the rf gun cathode heater. In general, the only operator
action required is to start the PEM and verify beamtransport.
The linac shutdown PEM sets all power supply and rfvalues to zero, turns off the equipment, and closes gatevalves.
Figure 2: Storage ring orbit configuration tool.

4 MAGNET CONDITIONING
Magnet standardization and conditioning is a relatively
straightforward process. The magnets are cycled throughtheir full operating range a number of times to clear
residual fields and reset the magnets’ hystereses.
Operators select the number of cycles or length of time
for standardization. At the APS, the complications arise
due to the fact that the bending magnets have auxiliary
trim correction windings. The trim winding current mustbe zeroed before standardization. The APS conditioning
programrestoresanoperator-selectedlatticeconfiguration after finishing the selected cycles.

5 LINAC STARTUP AND SHUTDOWN
While all of the machines at the APS use PEMs, none
rely on them as extensively as the linac. The linac serves
the dual role of providing beam for storage ring injection
and providing beam for the Low-Energy Undulator Test
Line (LEUTL). To accomplish this, the linac uses eitherof two rf guns or a photocathode gun. While the linac
PEMs’ original purpose was to switch back and forth

6 WORKSPACE SETUP UTILITYThe APS Main Control Room (MCR) operates the threeinjectors, main storage ring, and rf systems via a group ofSun workstations. Because of the number of possible
control functions available, each category of machine isrun from a separate workstation. Each one of theseworkstations displays information in several formats
including EPICS display screens, Array Display Tools(ADTs), alarm handlers, strip-tools, and applications
written in Tcl/Tk. There are also workstations that display
comfort information, but are not actively used foroperation. Setting up each workstation manually is aprohibitive task that is very time consuming. Theworkspace setup tool allows operators to initiate theworkspace setup based on machine or workstation (seeFig. 4). The tool is a TCL application that reads
information contained in application resource andconfiguration files, automatically opens the screens andviews, and places them in a predetermined combination ofworkspace and geography.

Analysis Group created the tools to assist the operators,
improve machine operating efficiency, and performance.

8 REFERENCES[1] Claude Saunders, PEM - Procedure Execution
Manager, September 25, 1996,
http://www.aps.anl.gov/asd/oag/manuals/APSPEM/APSPEM4.html.

[2] L. Emery, M. Borland, “Advances in Orbit Drift
Correction in the Advanced Photon Source Storage Ring,”
Proceedings of PAC97, Vancouver, BC, Canada, pp. 742744, 1998.
[3] APS Control System High-Level Applications,Figure 4: Machine workspace setup tool.

http://www.aps.anl.gov/asd/oag/applications/OAGapps.pdf.

7 CONCLUSION

9 ACKNOWLEGEMENT

This is a small sample of the automated processes in use
during daily operation at the APS. There are many more
applications, but they all fall into the general categories
listed above. The tools act as operator aids and are very
useful in a variety of applications. The Operations

This work was supported by U. S. Department of Energy,
Office of Basic Energy Sciences, under Contract No. W31-109-ENG-38.