The Use of ARTEMIS With High-Level Applications*B. A. Bowling, H. Shoaee, S. Witherspoon, J. Van Zeijts
Continuous Electron Beam Accelerator Facility, Newport News, VA 23606 USAAbstract
ARTEMIS is an on-line accelerator modeling server developed at CEBAF. One of the design goals of ARTEMIS is toprovide an integrated modeling environment for high-level accelerator control codes, for example, an automated beam steering
application. This report illustrates the use of ARTEMIS in various high-level applications, including the application interface
using the cdev device support API above EPICS. Emphasis is placed on the design and implementation aspects of high-levelapplications which utilize the ARTEMIS server for information on beam dynamics.
Introduction
CEBAF is a 4 GEV electron accelerator facility which is in the final stages of commissioning. It consists of two 400 MeV
superconducting linacs with a 5-pass beam recirculation system. The facility is capable of simultaneously serving three experimental halls with beams of differing energies.
The goal of delivering high quality beams to experimenters requires the availability of appropriate control, diagnostics,
and monitoring functions to direct the complex operation of the accelerator. In addition, the efficient operation of a complex
accelerator requires the automation of as many routine machine functions as possible. Automated computer algorithms are often
assisted by a numerical representation of the system under control, or model. Many differing applications require the same modeling information, so centralizing the source of the various model data has many distinct advantages.
An early decision in the design phase of the control system for CEBAF was to base all high level functions involving
machine setup and operation on accelerator models rather than resorting to a “look-and adjust” method of operation. This wasdeemed particularly crucial during the commissioning phase of CEBAF, when it was required to reconcile the machine behavior
with its model.

I.

ARTEMIS Model

The Accelerator Real TimE Modeling Information Server (ARTEMIS), currently under integration with operations
codes, is a central server/client facility in the CEBAF accelerator control system, providing various model data (transfer matrices, twiss parameters, etc.) and supporting computations (e.g. quad strength calculation for matching) for all model-driven facilities. Centralizing the model calculations provides a uniform and consistent data collection mechanism for these and otherapplications, while eliminating the need for redundant calculations by different application software.
There are numerous optics calculations which are required for high-level controls. ARTEMIS currently provides the following optics calculations:• First and second-order transfer functions for all optical elements at CEBAF.
• Lattice information (element position, type, etc.).
• Beam parameterization functions.
• Second-order ray tracing.
Calculations slated for inclusion in the near future include:• Non-relativistic particle propagation.
• Spin polarization tracking.
One of the main objectives for ARTEMIS was to make available accurate accelerator lattice information on a timely
scale, which implies the capability for the model to reflect changes in machine parameters at an acceptable rate. This led to thedifferent update mechanisms for the model, which are periodic model update (time-based), event-triggered update (such as control system parameter modification) and user-initiated update.
The server/client facility of ARTEMIS is achieved by the use of cdev, a common object protocol currently under development at CEBAF which provides a standard interface to any data which can communicate with any source, including accelerator control systems, high-level applications, and now ARTEMIS. This integration of data representation is highly useful tothe application developer and user, since this allows the origin of data to be abstract and of no consequence to the application
and/or user. The facility of obtaining modeling operations, such as machine beta functions, by a standard mechanism is immediately evident.

*

Supported by U.S. DOE Contract DE-AC05-84-ER40150

ARTEMIS is currently interfaced with several on-line facilities such as Tcl/Tk, allowing for the rapid prototyping ofmodel-based algorithms and applications before they are made a permanent part of the control system, which will be illustrated
below.

II.

High-level Applications

There are several high-level applications which are being modified to use modeling information from ARTEMIS. The
program currently under test is the CEBAF orbit and energy slow feedback lock, implemented in Tcl[1]. This code compensates for drifts in cavity RF phase and amplitude, which affect both beam energy and trajectory. Additionally, the code maintains a constant beam trajectory using a small number of correctors and monitors. The code requires the calculation of a response
matrix propagating the vector (x, x’, y, y’, dp/p). The slow feedback control previously employed a Tcl-based distributed model
database which serves as a prototype model.
The fast feedback control program [2], under development at CEBAF employs a modern control theory implementationof adaptive correction at a relatively fast update interval (presently 60 Hz). The optimal state estimator (determining x, x’, y, y’,dE/E) will use response matrices from ARTEMIS for initial setup. Once the feedback process has begun, the adjusted response
matrices can be compared with ARTEMIS for model verification and performance testing.
CEBAF also employs a Linac Energy Management program (LEM), which provides control over linac RF and optics tomaintain a desired energy profile. ARTEMIS will provide LEM with an energy gain profile which reflects the current energy
induced into the beam, taking into account cavity phase and gradient and relativistic phase-slip effects. Machine Twiss parameters from ARTEMIS will determine current accelerator optics, providing LEM with the information needed to efficiently
maintain a desired energy profile and corresponding machine optics. LEM may also use “scratch-model” instantiations of ARTEMIS to predict what results will be achieved with any given change in energy profile and/or optics before committing changes to actual accelerator settings.
An on-line automated beam emittance and Twiss parameter measurement facility is currently in the design phase of development. CEBAF will utilize three different measurement techniques. The first method is a varying-optics method in which
the beam is swept through a waist at a profile measurement device, using an upstream focusing element. ARTEMIS, in realtime modeling mode, will deliver transport information to the emittance calculation. The second method employs several profile
measurement devices which will yield beam cross-sections at various points on the beam transport. As in the first method, themodel server will provide transport information. The third method uses a thin “slit” aperture to determine beam position andslope. This information can be used to verify and/or update ARTEMIS model information. Once the beam parameters are measured, ARTEMIS will be utilized to perform a “back-propagation” to a selected origin in order to provide lattice matching.

blt_graph .new -height 12c -width 22c.new xaxis configure -title “Path Length (Meters)”.new yaxis configure -title “Beta (Meters)”
pack .new -expand true -fill both.new element create bx
set ElementNames [cdev model “get elements” “section arc1” “type {QUADRUPOLE SEXTUPOLES HKICK}”]
foreach Element $ElementNames {set bx [cdev $Element “get betax”]
set i [cdev $Element “get scoord”].new element append bx “$i $bx”}

Fig. 1 Beta Function Plot Example

III.

ARTEMIS Application Demonstration

ARTEMIS, with the integration of a scripting language such as Tcl, can be used to develop powerful applications withrelative ease. For instance, graphical plots of machine beta functions as a function of path length is an operation which is performed often by accelerator physicists. To illustrate such an application, refer to Figure 1.
The first five lines of Tcl code are used to create the graph object with appropriate scaling and annotations. Line six is aquery call to ARTEMIS, using the cdev data format, to retrieve the element names in the accelerator section ARC1, and of typeQUADRUPOLE, SEXTUPOLE, and HKICK (inclusive OR), with the result returned in the variable ElementNames. This
one function call initiates a connection with the ARTEMIS instantiation named model and performs the query. If the call fails,a callback procedure is executed, with the procedure defined by the application.
A loop is now defined on line 7 which loops over every element stored in ElementNames. The next line of executablecode retrieves the horizontal (x) beta function for that element. This line is accessed using a reference to the element name, inwhich cdev performs the routing to access the model to retrieve the beta function value. The next line performs a similar query,this time obtaining the path length coordinate s. The final line appends the data to the plot variable bx. Execution time for thecommands above (for 50 elements) operating on Hewlett-Packard 720 workstations (server on one workstation, client on thesecond, using ACE socket TCP/IP communications) takes approximately 3 seconds.
This application illustrates the two differing access modes to the server, which are direct model commands (elementsearch) and access of data by requesting an attribute of a particular element (beta and path length commands). Nearly all of thecommands to ARTEMIS support both access modes. The above example can easily be improved to enhance execution speed
by eliminating the loop and requesting the beta function values as a single ARTEMIS command (similarly for the path lengthvalues). This will reduce network access overhead significantly, resulting in an execution time under one second.

The above example can be easily modified to perform other useful plots. For example, one can obtain real-time beam
position information for all of the elements in ElementNames by using a single cdev call. These positions can then be divided
by the square root of the beta function values and plotted, yielding a phase advance plot, a very useful optics tool. Using thecallback mechanism, any changes in beam position or model parameters will automatically trigger an update to the graph.

IV.

Summary

Many high-level applications at CEBAF are currently being converted to use the ARTEMIS accelerator model. The example above clearly demostrates the savings in application development and execution times which can be realized by utilizing
ARTEMIS to obtain lattice and optics information. Future control applications at CEBAF will benefit.

V.

References[1] J. Van Zeijts, “Rapid Application Development Using the Tcl/Tk Language”, (PAC 1995).
[2] M. Chowdhary, G.A.Krafft, H. Shoaee, W. Watson, “A Fast Feedback System for CEBAF”, (ICALEPCS, 1995).