An Overview of XAL
XAL - A High-Level Control Application Framework

Christopher K. Allen
Los Alamos National Laboratory

KEK - February 18, 2005

XAL Developers and Collaborators
ORNL–––––

Tom Pelaia
Paul Chu
Andre Shishlo
John Galambos
Sarah Cousineau–––



ESRF
–

Wolf-Dieter Klotz

LANL
Craig McChesney
Bob Dalesio
Chris Allen

Cosylab–––Igor Kriznar
Ales Pucelj
Mark Plesko

Special thanks to John Galambos for providing much of thispresentation!
2Outline
see https://www.sns.gov/APGroup/appProg/xal/xal.htm

1.

XAL Overview

2.

Architecture3.

Simulation Subsystem

4.

Application Framework•5.
3

Sample Applications

Summary1.Overview - Conceptual Diagram

1. Overview

Application level
XAL “device”
programing layer

EPICS ChannelAccess

XML
File
GlobalDatabase

TCP IP
network

Accelerator
hardware interface
Real Time Data Link (RTDL)

XAL is a software infrastructure providing a hierarchical, device-oriented viewfor application programmers

Java based with scripting1. Overview

XAL “Lingo”
Framework or Infrastructure (gov.sns.*)–Application Framework––

Class structure for representing accelerator hardware

Online model (gov.sns.xal.model)–

5

See gov.sns.application and gov.sns.xal.application
A “template” for building gui applications

Accelerator hierarchy, or SMF (gov.sns.xal.smf )–General code sharable among applications (in xal.jar)

A physics model for doing quick linear transport modeling1. Overview

XAL in the Control System Hierarchy
ControlApplications

App *Scripting/tools

App *

App *

Matlab *

XAL
EPICS

1

App *

1

ABeansHardware6

App 1

Python *GUI

DeviceAbstraction
HardwareAbstraction

App *

1SCiP

1

2. XAL Architecture

2. XAL ArchitectureUML Subsystem Diagram
High-Level Control System for
SNS Accelerator«system»
gov::sns«import»«framework»
xal«import»«suite»apps«suite»tools«import»«subsystem»
xal::model«subsystem»
xal::smftools::ca«facade»Third Party::JCA«uses»

7«system»Third Party:: EPICS«framework»
tools::agent«framework»
tools:: application

2. XAL Architecture

Global Database Generates XML“Configuration” File

Serves as a common configuration file for all applications

Creates the accelerator hierarchy–Provides the “map” from the flat list of EPICS signals to theaccelerator hierarchy

Database

XML configuration file<node type="QH" id="MEBT_Mag:QH01" pos="0.135" len="0.061"><attributes><align x="10000" y="2000.046" z="19546.440844" pitch="0" yaw="0“
roll="0" type="bucket" /></attributes><channelsuite name="magnetsuite"><channel handle="fieldSet" signal="MEBT_Mag:QH01:fieldSet“settable="true" /></channelsuite></node>8

XAL Datagraph

XAL “Datagraph”–––

9

2. XAL Architecture

Class structure provides hierarchical “device view” of the accelerator
Sequences (MEBT, DTL, CCL, …)Individual Node type classes (Quads, RF, BPMs, etc.)

Sequences can be “pasted together” as ComboSequences .

2. XAL Architecture

Tools (gov.sns.tools)
Correlator (gov.sns.ca.correlator)–

Services–

Simple database communication tools (pv-logger uses this)

XML
–

10

Used for internal communication between XAL processes(clients – services )Database–Used to collect PVs with the same timestamp…

Easy interface to write / read structures, used for open/save capability forapplication documents

2. XAL Architecture

SNS HL Control Deployment
Physics Server––«executable»
apps:: High-Level Application«executable»
SNS Start Map

XAL applications deployedon separate node
XAL services andmonitoring agents live onphysics server

ControlComputer

Physics
ServerConsoleConsoleConsoleXML...
...........
...........
...........

«library»
xal:: xal.jar

Local NetworkIOC

11IOCIOCIOC

3. Simulation Subsystem
Lattice Generator (gov.sns.xal.slg)––A model of the machine is constructed from the “device” representation
Drifts are added, elements are split

Simulation Scenario (gov.sns.xal.model.scenario)––Lattice element values can be updated from the machine, user defined values or designvalues
Mostly use an envelope model for linac tracking at present
Device View
(Stored in SMF)

12

3. Online Simulation

Lattice View
(used in modeling)- Single entry per element- Elements may be split- Only physical devices-Includes drifts3. Online Simulation

Simulation Subsystem Architecture(Allen, Klotz, Galambos, Pelaia, Chu, McChesney)

Database

Accelerator
sequences + devices

Lattice
Generator

gov.sns.xal.smf

gov.sns.xal.slg

Machine data

Externallatticegeneration

Scenario
gov.sns.xal.model.scenario

User tuning
Probe:-13

initial conditions
type (single particle,envelope, multiparticle)

Online Modelgov.sns.xal.model
Trajectory- Twissoutput

3. Online Simulation

Online Model (gov.sns.xal.model)
Online beam simulation (i.e., no “decks”)–



See LA-UR-02-4979 for theory

Uses N. Malitsky’s Element/Algorithm/Probe architecture:–

Element: Machine representation
 basic objects that affects the beam (e.g. quad, thin lens, drift)–

Probe: Represents the beam (or aspects of the beam)
 Envelope, Single-particle, Multi-particle, etc.

–Algorithm: how to propogate the beamBinds Probe to Element and provides dynamics
 Linear dynamics, higher-order dynamics, etc.
14

4. Appl Framework

4. XAL Application Framework(T. Pelaia)

Save/open app Error logging
setup

Html help
Toolbar for common actions

Accelerator navigating

Application Framework used as a common starting point•Provides a common look and feel for all applications•Quick jump-start for application development•Easy retro-fixes across many apps
•Incorporates a document/view/control architecture(Software Engineering!)
15

1-D Scan Application

4. Appl Framework(A. Shishlo)Provides an easy way to scan one quantity and monitor others
Can average over pulses, scan multiple times, pause
Analysis includes fitting, intersection finding, min/max, etc.
Easy way to do a quick unanticipated experiment
Predefined scans with specialized analysis are possible–DTL and MEBT phase + amplitude setting applications

Faraday cup amplitudes vs. DTL RF settings

16

2-D Scan Application

4. Appl Framework(A. Shishlo)


Added 2-D scan capability (parametric scans)
Define preset configurations–



Used for DTL acceptance scans for phase/amplitude setting–

17

Optional analysis capability
Scan DTL phase + amplitude, monitor Faraday Cup signal

Scope Application
Triggered Acquisition

4. Appl Framework(T. Pelaia)
The Digital Oscilloscope – with a similar user interface as analog scopes



MEBT rebuncher (RF) forward power trace with beam loading:––18

RF = 1 msec @ 20 Hz, beam = 50 msec @ 1 Hz
Use the correlator to filter only RF signals with beam pulses

Potential for future applications

Requires vigilance on good signal time stamps and proper time waveform
packagingLoss Viewer Application

4. Appl Framework(S.Cousineau)View a summary of beam loss bymachine section––

19“Zoomable” to specific BLMs
Viewable as fraction of permissibleloss

Waterfall display of a specific beamline
portion–Faraday cup inserted here

Service Applications

4. Appl Framework(T. Pelaia)

 MPS post-mortem (tracks

first fault incidents)
posts statistics to elog daily– history views–

Client MPS Postmortem viewer
 PV Logger – posts

sets of data to thedatabaseperiodically orpushbutton– Generalized toallow for custom
PV sets–20

Client PV LoggerBrowser

XYZ Correlator Application

4. Appl Framework(P. Chu)Pick 2 (or three) signals and monitor them together
Can use the time correlator to ensure signals are from the same pulse
Added customization features + added to the framework
Can export or fit the acquired data

Correlation between phasemeasurements of 2 BPMs21

4. Appl Framework

Save-Compare-Restore (Score) Application(J. Galambos)
Provides a means to capture machine setup, compare live values to a saved set, andto restore values to a saved set–22Grabs settable + readback signals

Can sort by system and device type

This is theprimary means tosnap-shot themachine stateXio Application

4. Appl Framework(P. Chu)

General purpose value displayer (tables, and or plots) Added to application framework, works for MEBT + DTL
Pickaccelerator
Pick device + signal types

MEBT + DTL ->Online Model Application

4. Appl Framework(W.-D. Klotz)

An online model is now available within the XAL framework
Online model can be run for 1) live values, 2) design values and 3) user defined
what-if changes
Can display or dump beam Twiss output•Vertical and horizontal
beta functions through theMEBT, DTL + D-plate fordesign values

24External Lattice Generator(P. Chu)

25



Generate an external lattice file forselected part of the accelerator

Uses the online model latticegeneration

Tested though DTL (+ HEBT)Can use live or design valuesTrace3D or Dynac input files can becreated.

May be incorporated into the online
model application.

4. Appl Framework

4. Appl Framework

Orbit-Difference Application(P. Chu) Compares differences in beam orbits, for both BPMs and calculated

Online model is also used in the Orbit Difference Application, in addition torunning Trace 3D (external fortran code)

Kick applied here

•Orbit difference example using
the online model•Used to observe orbit
difference in the horizontal
direction•Helped resolve sign issue inBPMs26

Summary The XAL application programming infrastructure is inplace and working at SNS> 20 applications written – actively used in commissioning
activities– Online model used more extensively–

 SLAC will employ XAL in the LCLS Issues

Java – “heavier” than typical X-widgets.
– Need to revisit some applications to make them more efficient.
–27

2. XAL Architecture“Device View” EnvironmentClass structure provides
hierarchical “device view” of
the accelerator to theapplication programmers––

Accelerator
AcceleratorSequence

Sequences (MEBT, DTL, CCL,…)
Individual Node type classes(Quads, RF, BPMs, etc.)

AcceleratorNode

BPM

Sequences can be “pastedtogether” as
ComboSequences .

RF Cavity

Magnet

EM Magnet

BCM

WireScanner

Perm Magnet
PMQ

DipoleQuadrupole
Hor.

Hor.
Corr.

28

Ver.
Corr.

Hor.

Ver.

Ver.