Commissioning and Operation Applications of ELETTRA
M.Plesko, Institute Jozef Stefan, Ljubljana, Slovenia
C.J. Bocchetta, F. Iazzourene, E. Karantzoulis, R. Nagaoka and L. Tosi
Sincrotrone Trieste, Trieste, Italy
ABSTRACTELETTRA is a third generation light source with an electron beam energy of 1.5 to 2 GeV. For the commissioning andoperation a large amount of high level software (HLS) was prepared and has been successfully used. We believe that this is
the first time that the HLS had been developed well in advance and was ready for the operating personnel. The application
programs cover the whole range of needs, have a consistent graphical user interface (GUI) and give a fast response to user
actions. Almost all the commissioning tools have now been reused as operational ones, also maximizing the value of
manpower
The state-of-the-art applications, which were designed systematically, were the key to the rapid commissioning and great
success of ELETTRA. The applications use a common data structure based on machine physics and a set of routines whichtransparently access the control system. This environment greatly simplifies the development of applications, because theprogrammers can concentrate on the GUI, which gives immediate information on the status of the machine. This approachsignificantly reduced the development time and will simplify future maintenance. It is easy to implement new programs invery short time whenever the needs for additional actions arise.
The content of the data structure is not specific to ELETTRA, since it is generated dynamically at run-time from several
text-only editable data files. Most of the applications can be easily transferred to other accelerators as long as their control
system uses UNIX workstations. The use of standards (C and X11/Motif) and the transparency in the access to the actual
control system implementation assure this.

I. INTRODUCTION
The third generation light source ELETTRA [1] consists of a linear accelerator, a storage ring and a 100 m long transfer
line between them. Both the transfer line and the storage ring are attached to a distributed control system, which has beendeveloped in-house[2].
Most of the machine-physics related tasks that were previously done manually and analysed off-line can now be
automated via software which has direct access to the equipment through the control system. The software which performs
these tasks is generally called high level software (HLS). The topics of typical HLS applications include measurements andanalyses of measurements, orbit correction, modelling and machine monitoring.
The HLS which was used during commissioning and later for the operation of ELETTRA had been defined well inadvance [3]. It was ready and tested on “day one”. This had been achieved by the use of a common data structure which wasused by all programs and a simulation program with which the applications had been tested and debugged before they wereused on the real accelerator.
A common data structure which provides all relevant machine physics parameters readily in the data structure or on afunction call was used in order to have a standardised approach thus simplifying maintenance of the HLS. The call to control
system functions is made through only one routine, which is hidden from the application programmer through a layer ofutility routines for setting and reading one or several control parameters. The HLS data structure and the utility routines aredescribed in detail in a separate contribution [4].
All application programs are written in C. The reason for this choice was that the graphical interface used by the
programs is based on the X11/Motif tool kit, which is supported only in C. The programs run in a UNIX-like environment
on Hewlett-Packard 9000/700 series workstations.
Great emphasis has been placed on the graphical user interface of each program. The interaction with the user iscompletely event driven. The power of X-Windows and the Motif window manager is exploited, using buttons, pull downmenus, sub windows, etc. Graphical output is presented in a special plot-widget [5], which has been developed in-house.
The applications are running on the normal control system workstations. However, due to their distinct functionality, they
are invoked and run independently of the control system man-machine-interface.
The following chapters present all the main applications, sorted by their function and purpose. All applications have agraphical user interface unless noted otherwise.

II. COMMISSIONING APPLICATIONS
Display is an interactive optics design tool. The user may visualise through graphs and numbers the optics associatedwith the actual power supply settings. By zooming into one section, the user sees a layout of the elements and may changeinteractively the quadrupole settings and the insertion device gaps and visualise the resulting optics in the model.
The programs EnergyTL and EnergySR scale the optics of the transfer line and storage ring, respectively, to anotherenergy set by the user. Those programs were extensively used during linac and transfer line commissioning, and storage ringfirst turn steering and initial accumulation, respectively. EnergyTL is still used during linac optimisation, which is being
performed frequently during the user mode, i.e., when the electrons are circulating in the storage ring.
GAP (Ghost Accelerator Program) [6] is a code which simulates an operating accelerator. It was used for thecommissioning of the HLS and for testing of the application programs. The program mainly performs two tasks: modellingof a real accelerator lattice and simulation of the ELETTRA control system response to application programs. The code ismade so that the application programs can run either with the real control system machine or with GAP without any
change. GAP is based on the modelling and tracking code RACETRACK and is therefore written in FORTRAN. This poses
no problems as GAP is called as a subroutine instead of as a call to the control system.

III. MEASUREMENT, ANALYSIS AND MODELLING APPLICATIONS
Those applications were used intensively during the early days of the commissioning. Currently they are used duringmachine studies mainly for chromaticity correction and compensation and for dispersion measurements.
The emittance of the linac is measured in the transfer line with the program Emittance. It varies one or several
quadrupoles and determines the emittance and Twiss functions at the linac exit from the change in the beam profile. The
beam size variation with quadruple current and the resulting phase space ellipses are displayed graphically.
The program Tune [7] has been written mainly for applying desired tune values to the storage ring. During the settingof the tunes, the user may also record the associated lifetime and beam current and perform a correlation between theseparameters and the tunes currently being set by the program, thus giving a measurement of the stop bands of any resonances
encountered.
Optiks [8] is a program that measures and corrects the optical functions (i.e. beta functions, phase advances, tunes,dispersion and chromaticity) in a circular accelerator. The program offers in a user friendly and compact manner almost all
the information that the operator wishes to know about the machine optics as well as the means for correcting. It makes awide use of the high-level software data structure including its built-in Twiss function calculation that permits thedetermination of the nominal machine optics in a fast and easy manner. The measured machine optics functions are obtainedby analysing the closed orbit data. Alternatively the quadrupole strength variation technique is also employed to measure thebeta function at the quadrupole locations. The user may also measure and correct the dispersion and chromaticity
independently.
The integer part of the tunes is determined by a Fourier transform of the orbit. One can also get the Fourier transform of
the corrector strengths. Since this routine does not need a closed orbit, it may be used for injection studies and wasparticularly useful at the initial stages of the commissioning. This routine called Harma is also a separate program.

IV. OPERATION APPLICATIONS
The following applications were used and are still used on a daily basis during the operation of ELETTRA.
The machine file allows one to save and restore the status of the machine - the transfer line and the storage ring in thecase of ELETTRA. The machine file is used to restore the equipment which is relevant for machine physics and machine
operation. It therefore contains the currents of all magnets (bending, quadrupole, sextupole and correctors), the insertion
device gaps and the injection element settings. Both the set values and the actual read values are recorded.
This machine file can be considered to be a snapshot of the machine. All HLS applications can access either the actualmachine directly or alternatively a machine file. Conversion routines convert the currents from the machine file intomachine physics variables and vice versa. The operator loads and saves a machine file with the application MachineFile.
Since a tune feedback system [9] has been implemented in Elettra, the program TransferTune has been written in order
to transfer, once the system is no longer in use, the residual current settings of the quadrupoles used by the feedback to otherquadrupole power supplies which are optically more suitable.
The PStool is a relatively low level application, which cycles all or a set of magnets and switches them on or off
according to a requested procedure. This application is used at every injection, because the storage ring is running at 2 GeV,while the injection energy is 1 GeV. Before each injection all storage ring magnets must be cycled. Eventually, thisapplication will be replaced by the automatic start-up program.
With increasing time being dedicated to users of the machine, an automatic program which prepares the machine forinjection has been written. The program Automat, currently in a draft version, performs all the necessary work which anormal operator should perform in order to be ready for the injection procedure. While most of the actions are performed
sequentially, others such as opening the insertion devices and cycling of the transfer line are done in parallel as backgroundprocesses. Special care has been taken both in error handling and in the graphical interface in order to give a feeling to theoperator of the actual actions being taken on the machine. The main lack of the present version is the primitive
communication with the background processes which is done via files. At the present, a new version is under progress incollaboration with the Elettra Control Group [10] in which all actions on the machine will be in parallel and managed
intelligently via pipes. Furthermore, the final version will be extended in order to include the ramping and the positioning of
the beam at the centre of the insertion devices, in order to achieve a full automatic preparation of the machine for the users.

V. MACHINE MONITORING APPLICATIONS
A third generation light source is characterized by the need for an unprecedented beam stability. This requires complete
short and long term monitoring of all machine components in order to detect, understand and remove any sources of
instabilites. Although the monitoring applications might not be used by operators on a daily basis, some of them run
constantly in the background and the results are examined by experts. The use of monitoring programs grows with theefforts to increase the beam quality.
The program MonitorBPM displays the readings of all 96 BPMs in the storage ring as a function of time, thus
monitoring the drifts in the orbit. In four different display windows, the average and the r.m.s. values of each BPM areplotted for the respective planes. The programs saves the entire data collected into a file for post processing.
The program BPMexpert has been written in order to understand the functionality of the 96 beam position monitors
and their electronics. The program records all the relevant outputs of the monitors such as the readings and the electrodevoltages together with the electronic settings as a function of beam current. The annexed graphical interface permits one tocorrelate and to detect anomalities both by visualizing the above quantities and by extracting those monitors which behave
differently than the average.
The program Mramp displays the beam energy which is defined by the dipole current, the beam current, the betatrontunes and the average and r.m.s. values of the orbit as a function of time so that the operator can monitor the beam
behaviour during the course of the energy ramping.
The programs MonitorPS and Hist track the behaviour of the power supplies. Both the set current from the control
system and the actual current read from a current transformer are recorded for each power supply. The difference between theset and the reading is compared and displayed graphically with MonitorPS. Hist histograms the difference between thereading at start-up with the actual reading over longer periods and issues alarms if the differences exceed the design values.
While the monitoring applications described above specialize in quick monitoring of individual parameters, Macmon[11] not only monitors a wide range of machine parameters but also stores, analyses and compares them. Thus usefulcorrelations can be found and interesting conclusions can be drawn leading towards a better understanding of the machine andconsequently increasing its reliability.
Macmon is composed of two parts. A "low" level part that performs the data acquisition and storage and a "high" levelpart with the graphical user interface that deals with data reading, analysing, comparing and visualizing. The visualizing part
includes plots showing the value of one paramter versus time, the distribution of values in a histogram and a correlation
plot between two parameters. Additionally some high level software programs used to control and/or to measureautomatically store data in the Macmon storage files.
Macmon is monitoring the following machine parameters: machine current, lifetime, injection rate, accumulated current,
tunes, beam position in all the 2x96 beam position monitors, beam size, rf frequency, voltage and temperature for eachindividual rf cavity, injection element voltage and time delays, vacuum in each vacuum sector, insertion devices gap
opening, power supplies current read and set values, scraper positions and radiation. Additional information stored in
Macmon from application/control programs is: dispersion, chromaticity and actions such as the file name used to load themachine power supply currents, cycling and ramping.

VI. ORBIT CORRECTION, OPTICS CORRECTION
There are two HLS programs developed for the correction of orbit in ELETTRA: Orbit and Bump [12]. The program
Orbit integrates all necessary actions on the orbit of both the storage ring and the transfer line together with many options.

Its core is the orbit correction software package COCU developed at CERN [13], upgraded with other correction methods.
All operations including those required for COCU are handled through a very sophisticated graphical user interface that gives
complete control over any possible option.
A routine to correct the spurious dispersion in both planes using the steering magnets has been incorporated in Orbit. A
special effort has been made to obtain sufficiently accurate response matrices for the dispersion, by taking into account theeffects on the orbit of the feeddown from sextupoles and thick quadrupoles. By utilizing the existing six-dimensional
tracking routine in an extended version of the tracking code RACETRACK, a special routine has been developed to introduce
the notion of path length in Orbit in its simulation mode. With the new routine, the path length deformation due to a RF
frequency shift or a sudden shift in the beam energy caused by changes in the corrector strengths modifying the path length
can be simulated.
The program Bump on the other hand is a dedicated program, developed separately to create local bumps in aninteractive manner. The main characteristics of the program are:- the continuous display of the orbit, interpolating the consecutive BPM readings and also taking into account the corrector
kicks by a numerical fit of the trajectory;- the graphical scroll bars with which the user can select the bump location and set the amplitude and the slope of the orbit;- the representation of magnetic elements in terms of graphic push-buttons with which the desired correctors can be selected.
SlowFB is an extended version of Bump intended for the routine machine operation, which performs, under a certain
time interval, an automatic local correction of orbit in the insertion device straights using 4-corrector bumps. At a given
time interval the program will measure the orbit and correct it if the measured value is outside the specified tolerance. As the
suppression of bump leakage, that is to say the modification of the orbit outside the bump area, is an important issue inthird generation light sources, a special routine has been developed to calibrate empirically the coefficients for the four
corrector strengths which will result in the bumps being purely local. The routine is still under test but has been shown to
work successfully in the vertical plane.
The program IDcomp [7] has been developed in order to compensate for the linear distortions due to insertion devices.
The software presents several compensation techniques, which go from local compensations, where the distortions are forced
to be localised, to global compensations, where the variation of beta around the ring is minimised. Tune re-adjustments arealso possible. An important feature of the software is the possibility for the user to visualise the resulting optics, before any
action is performed on the machine.

VII. FUTURE DEVELOPMENTS
The high level software was used very successfully during the commissioning and first operation of ELETTRA [14]. In
order to complete the set of HLS applications, the following new developments are planned:- Automatic generation of intermediate machine files for the ramping, with automatic corrections of tunes, closed orbit,
optics, chromaticities and optionally dispersion;- Automatic orbit and vertical dispersion correction;- Implementation of the single value decomposition (SVD) method for orbit correction;- An application for changing the horizontal/vertical coupling;- Automatic change of cavity temperatures as a function of beam current;- Full automatic preparation of the machine for users;- Cascade monitoring of all the machine systems coupled with intelligence to interpret error messages, failures and downtimes.

VIII. CONCLUSIONSAll major HLS applications for ELETTRA exist. There is practically no off-line post-processing of measured data, since
all the necessary applications run interactively on the workstations in the control room. New applicationsare being
developed whenever the need for additional actions arise. Due to the well-defined environment of the data structure and theutility functions, it is relatively easy to implement new programs in very short time.
The great success of the HLS at ELETTRA is a proof that our concept of the HLS has been correct. Although the effort
has been substantial, corresponding to about 10 person-years, it was well worthwhile. The majority of the applications havebeen in principle written in a general way, not specific to ELETTRA. Therefore other accelerator centres could make use of
the human resources already invested at ELETTRA.

IX. ACKNOWLEDGEMENTS

The authors thank the members of the ELETTRA control group for their great help on the X11/Motif tool kit and othercomputer related topics. Further thanks go to R.Richter and A.Wrulich for fruitful discussions. This work is supported inpart by the Slovenian Minstry for Science and Technology.

X. REFERENCES[1] ELETTRA - Conceptual Design Report, Sincrotrone Trieste, April 1989.
[2] D.Bulfone, Status and Prospects of the ELETTRA Control System, Proc. ICALEPCS 93, Berlin 93.
[3] M.Plesko, The High Level Software Routines, Sincrotrone Trieste. ST/M-TN-91/11. 1991.
[4] M.Plesko et al., An Approach to Portable Machine Physics Applications, this conference.
[5] F.Potepan, Plot Widget 1.6, Sincrotrone Trieste, 18.5.1994.
[6] F.Iazzourene, GAP: Ghost Accelerator Program, Sincrotrone Trieste. ST/M-94/3 1994.
[7] L.Tosi, The High Level Programs: Tune and ID-COMP, Proc. EPAC 94, London 1994.
[8] E.Karantzoulis, Optiks: An Optics Measurement and Correction Program for ELETTRA, Proc. EPAC 94, London
1994.
[9] A. Carniel et al, Tune Feedback System at Elettra, Proc. EPAC 94, London 1994.
[10] D. Bulfone et al, Controls in the Past Year of Elettra Operation, this conference.
[11] E.Karantzoulis and M. Plesko, Macmon: A Monitoring Program for ELETTRA, Proc. PAC 95, Dallas 1995.
[12] R.Nagaoka et al., Orbit Correction in ELETTRA, Proc. EPAC 94, London 1994.
[13] B. Brandt et al., COCU User Guide (Version 7.0), CERN-SL/AP/Note91-19, 1991.
[14] A.Wrulich, Status of ELETTRA, Proc. EPAC 94, London 1994.