A Parallel Controls Software Approach For Pep Ii: Aida & Matlab Middle Layer

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

MOPAS058 Proceedings of PAC07, Albuquerque, New Mexico, USA

A PARALLEL CONTROLS SOFTWARE APPROACH FOR PEP II: AIDA &


MATLAB MIDDLE LAYER ∗

W. Wittmer† , W. Colocho, G. White,


SLAC, 2575 Sand Hill Road, Menlo Park, CA 94025, USA
Abstract matlab scripts, permits MDs to be performed efficiently
and without time consuming preparations.
The controls software in use at PEP II (Stanford Con-
trol Program - SCP) had originally been developed in the Consequently, a suit of MATLAB functions, referred to
eighties. It is very successful in routine operation but due as the MML, has been developed, which handles many of
to its internal structure it is difficult and time consuming the common tasks. This allows one to rapidly create scripts
to extend its functionality. This is problematic during ma- for non-routine tasks. The biggest advantage of this pack-
chine development and when solving operational issues. age is that it is easily portable between different accelera-
Routinely, data has to be exported from the system, ana- tors. It has been ported from SSRL, where it was originally
lyzed offline, and calculated settings have to be reimported. developed, to more than ten different light sources all over
Since this is a manual process, it is time consuming and the world. The MML interface to the LLCS, is handled by
error-prone. Setting up automated processes, as is done two simple functions for input and output, and the machine
for MIA (Model Independent Analysis), is also time con- dependent features (lattice, naming convention, et cetera)
suming and specific to each application. Recently, there are handled centrally by a machine specific configuration
has been a trend at light sources to use MATLAB[1] as the file. Adapting these files to a given machine, make the ba-
platform to control accelerators using a ”MATLAB Mid- sic functionality immediately available and extensions are
dle Layer” [2] (MML), and so called channel access (CA) simple.
programs to communicate with the low level control sys-
tem (LLCS). This has proven very successful, especially IMPLEMENTATION AT PEP II
during machine development time and trouble shooting. A
special CA code, named AIDA (Accelerator Independent The above described characteristics of the MATLAB
Data Access [3]), was developed to handle the communi- MML package, make it suitable for used as a platform for
cation between MATLAB, modern software frameworks, MD at PEP II. A further advantage is that the MIA pack-
and the SCP. The MML had to be adapted for implementa- age is also based on MATLAB, so communication between
tion at PEP II. Colliders differ significantly in their designs MIA and the machine is greatly simplified through this ap-
compared to light sources, which poses a challenge. PEP proach. The main difficulty to overcome was to establish
II is the first collider at which this implementation is being the communication between the MATLAB MML and the
done. We will report on this effort, which is still ongoing. LLCS. Since EPICS is not used at PEP II greatly, a dif-
ferent route, similar to the one at NSLS, had to be taken.
Fortunately, a software project was already under way at
INTRODUCTION
SLAC, called AIDA, which provides a unified mechanism
When new methods to correct the optics of an accelera- for scientific applications to access the various control sys-
tor emerge, an implementation can take considerable effort tems of the different accelerators at SLAC. This had to be
and time. For machine development (MD), ad hoc experi- expanded to provide the needed functionality.
ments, and where resources are scarce, fully integrated ap-
plications are not developed to integrate these new meth-
ods. Experiments and measurements, which are performed
AIDA - ACCELERATOR INDEPENDENT
irregularly, are not automated. These “manual” measure- DATA ACCESS
ments are time consuming and error prone. Analyzing the AIDA is middleware for fast data exchange. It connects
data from these measurements is usually performed after online physics applications software to the various control
the MD has finished and if parts of the data are unusable it systems and data sources these programs require to do anal-
is not possible to quickly repeat a partial measurement. ysis and optimization of scientific machines. Such data
In light sources this problem has been overcome by using sources include device control, online beam model param-
MATLAB. Several CA tools have been written to import eters, archived process variable history, relational database
data directly into MATLAB and enable device set points access, and so on. As such, it is used by programs like or-
to be changed. These mostly interact with EPICS, which bit correction, emittance, and general purpose experimen-
provides the low level control. Setting up the basic data ac- tal tools like ”Correlation Plots” [5], etc, to connect them to
quisition, processing and hardware control, as pre-prepared control systems such as EPICS [6], legacy control system
∗ Supported by US DOE under Contract DE-AC03-76SF00515 programs, and ”persistent” data stores like Oracle, EPICS
[email protected] archiver and so on.
06 Instrumentation, Controls, Feedback & Operational Aspects T04 Accelerator/Storage Ring Control Systems
566 1-4244-0917-9/07/$25.00 2007
c IEEE
Proceedings of PAC07, Albuquerque, New Mexico, USA MOPAS058

AIDA is not for real-time control, but it is fast ( 2ms da.setParam(’N=1024’);


round trip for simple data over a 100mbs, network as is typ- % Make the actual acquisition
ical in an accelerator laboratory). Its client side is Java [7]. DaValue v = da.getDaValue(’P2BPMHER//BPMS’);
This means of course it can be used as the data access layer
of modern software. Notably though, this feature means it Two things are of note for middleware implementations,
can be accessed directly from MATLAB, with no interme- are illustrated in this example. Firstly, the acquisition is
diate wrapping such as Mex files necessary [8]. parameterized by timing, by a reference orbit (so a ”differ-
Initially AIDA was prototyped to verify whether pro- ence” orbit shall be returned), and by an indication of turns
jected ILC online physics applications programs, could be to average. Secondly, notice that the data returned will be
written independently of the accelerator subsystem control structured. In this specific case it’s a 2d vector of vectors.
systems with which they would have to interact. The ra- The inner vector gives the name, x, y, z, tmit, hardware
tionale was that there would probably be a number of such status, and an acquisition diagnostic value, for each beam
control systems in ILC, each quite different, and high level position monitor in the beamline whose orbit was acquired.
applications would be required to talk to all of them in their The outer vector includes them all, sorted by z position.
own language. After a successful prototype was developed, A DaValue is in fact a dynamically constructed self-
it was deployed for the B-factory accelerator at SLAC. describing data structure. On the wire it’s a CORBA[9]
AIDA is now being used for commissioning LCLS. For Any type, though AIDA wraps it into a much more user
LCLS it bridges the legacy control system and modeling friendly dynamic type called a DaValue. If a client program
environment, which is implemented on HP Alpha machines knows the structure of what it’s going to get, it can access
running VMS, to Unix and Windows users running MAT- the elements directly. Additionally, DaValue includes fa-
LAB based GUI applications. cilities for a client to dynamically inspect it (like Java ”in-
trospection”) recursively.
The AIDA Programming Interface This facility for pushing the smarts into the server (so
called Service Oriented Architecture), has technical and or-
Technically, AIDA acts as a name service and common ganizational advantages. The technical advantage is the
Applications Programming Interface (API). AIDA presents facility to interface modern applications to mature con-
the same API to client applications for all data sources. trol systems that already include much analysis code and
That is, whether you are getting the value of a magnet, or therefore can’t be accessed through a simple name/value
the value of all Beam Position Monitors in a beamline, or paradigm. Organizationally, it allows computer profession-
the transfer matrix from one device to another, the methods als to implement the server side in a rigorous way, while al-
you call are the same. Each request to get data or set it, lowing the physics professionals to concentrate on the data
includes a ”name//attribute” pair to identify the data source analysis.
to be contacted (notice that more than 1 service may be in-
volved with a device - the present value may be acquired
by AIDA via EPICS, its Twiss may come from a model MML - MATLAB MIDDLE LAYER
server, its history from Oracle etc). Since AIDA can get
As preparation to the adaption of the two interface files
any type through the same API, including structured val-
and the machine specific configuration file of the MML,
ues, the client side type must be specified. Other AIDA
the new interfaces provided by AIDA had to be tested. The
API methods allow this to be done by casting.
following capabilities, provided through AIDA, have been
tested: synchronized orbit data acquisition, magnet control,
Rich Server Side, not Rich Client Side Middle- analog channel data acquisition, SCP archive and EPICS
ware. channel archiver data access. The capability to change the
The important characteristic of AIDA for its use in mid- master oscillator has been recently added and its test is be-
dleware for optimizing the B-factory, has been that it allows ing prepared.
the use of high level applications code on the server side (as This testing also provided important insight how to per-
opposed to the client). That is, rather than simply access a form this adaption. Contrary to the other CA codes, AIDA
database of controls API like EPICS, AIDA servers can of- provides two different approaches to setup the interface be-
fer rich functionality, like beam synchronous acquisition of tween MML and LLCS as described above. We have cho-
a whole accelerator including subtraction of a reference or- sen the method that allows to use the MML without having
bit, accessible in one client call. For instance: to change interface.
The machine specific configuration file has to be written
da = DaObject; from scratch and cannot be derived from the files for other
% Specify a timing definition light sources due to the fundamental differences between
da.setParam(’BPMD=38’); colliders and light sources. This effort is ongoing. First,
% Require diff to the "GOLD" orbit applications have been written for simple tasks using the
da.setParam(’CNFTYPE=GOLD’); schematics of this approach and will be included once the
% Set num ring turns to average setup of the MML for PEP II has been completed. These
06 Instrumentation, Controls, Feedback & Operational Aspects T04 Accelerator/Storage Ring Control Systems
1-4244-0917-9/07/$25.00 2007
c IEEE 567
MOPAS058 Proceedings of PAC07, Albuquerque, New Mexico, USA

first implementations already show the benefit from this ap- package is to plot a large number of analog channels on a
proach. condensed way. For example, to plot all the HER vacuum
pumps for a given time period.Anomalous activity can then
Simultaneous Orbit Measurement with two BPM be found at a glance. One figure can show 100s of chan-
Systems. As an example, part of the data analysis for the nels with time in the x axis, channel number in the y axis
newly installed BPM (beam position monitor) electronics and vacuum amplitude as the color scale. Vaccum activity
in the LER (low energy ring) [10] is presented below. The arround the time of PEP II beam abort is sometimes easily
simple task is to plot the orbit data off the old PEP II BPM identified by these plots.
electronics plus those newly installed, in one figure. To per-
form this in the SCP would be an excessive project. This is LER Sextupole Orbit Feedback The SCP provides
due to the different underlying data structure for the differ- an orbit feedback in the LER sextupoles. This existing
ent systems. feedback only monitors and corrects orbit changes in the
With AIDA this was a fast and simple exercise finished vertical plane. Its adaption to correct both planes simulta-
in one afternoon. The interface for importing the orbit data neously would have been too large an effort. The MML
into MATLAB of the older BPM electronics was already provides the capability of orbit correction so to write a new
existing from the testing. The new units are set up as ana- routine handling this feedback task would not be a large
log channels in the SCP. The access for these were also effort.
existing and a function to import these specific channel had
to written and tested. These two functions were combined STATUS AND OUTLOOK
and the MATLAB tools to plot both data sets in one fig-
ure used. The result is shown in fig.1 The main goal of So far the major preparation for introducing the MML
for MD studies at PEP II have been successful. The basic
5 communication between MATLAB and the LLCS provided
by AIDA is completed and all tests passed. The adaption of
x (mm)

0
the MML is ongoing and will be completed in the following
months. First applications, based on the package AIDA-
−5
0 500 1000 1500 2000 2500 MML have been developed and are being used. After the
5 completion of the package MIA will immediately benefit
through its shared MATLAB platform. Small applications,
y (mm)

0 like the LER sextupole feedback, are planned for normal


operation. Once the MML is being used during MD shifts
−5
0 500 1000 1500 2000 2500 we anticipate its use also during normal operation.
11
x 10
6

4
REFERENCES
tmit

2 [1] The MathWorks. http://www.mathworks.com/


0
0 500 1000 1500 2000 2500 [2] J. Corbett, G. Portmann and A. Terebilo, “ACCELERATOR
z (m)
CONTROL MIDDLE LAYER,” PAC’03, June 2003, Port-
land, p. 2369, http://www.JACoW.org.
Figure 1: Live orbit data from the LER in PEP II. The blue [3] Accelerator Independent Data Access (AIDA).
trace represents the orbit measurement from the older sys- http://www.slac.stanford.edu/grp/cd/soft/aida/
tem. The red stars are units flagged as showing bad data.
[4] The Linac Coherent Light Source Conceptual Design Report,
The green stars are the orbit measurements with the new
SLAC-R-593
system.
[5] Correlation Plot Facility in the SLC Control System. L. Hen-
drickson, N. Phinney, L. Sanchez-Chopitea, S. Clark(SLAC).
this analysis is to track the difference between the position
SLAC-PUB-5685, Nov 1991. 3pp.
readings of the two systems. One important aspect is to
make sure only measurements from working units are used [6] Experimental Physics and Industrial Control System
for this comparison. Since this information is part of the (EPICS). http://www.aps.anl.gov/epics/index.php
data structure imported into MATLAB all needed informa- [7] Java Technology. http://java.sun.com/
tion is available. Processing and displaying was added to [8] Using AIDA from Matlab.
the function. This script is used to commission the new http://www.slac.stanford.edu/grp/cd/soft/aida/aida matlab.html
system. Using the SCP to perform this task would have [9] Common Object Request Broker Architecture,
implied checking the data manually every time. http://www.omg.org/docs/formal/04-03-12.pdf
[10] W. Wittmer, A.S. Fisher, D.J. Martin, J.J. Seebeck’ “Detec-
Vacuum monitoring A collider as large as PEPII has
tion of Instumental Drifts in the PEP II LER BPM System,”
thousands of analog channels monitoring multiple subsys- these proceedings.
tems. Another application of the AIDA/MATLAB software
06 Instrumentation, Controls, Feedback & Operational Aspects T04 Accelerator/Storage Ring Control Systems
568 1-4244-0917-9/07/$25.00 2007
c IEEE

You might also like