SEQUENCING AND RAMPING IN HERA
Jürgen Maass, DESY, Hamburg, Germany

Abstract
For all accelerators at DESY we use so called fileoperating or ramp programs to save and set the magnetcurrents. Hera, the biggest accelerator at DESY, consistsof two coupled machines with both seperate and commonmagnets. The HERA proton machine has normal andsuperconducting magnets with very different changes intheir magnetic fields. The ramp software must take all ofthesefactors into consideration during magnet operation.
The sequencer is responsible for processing the task list
nessessary to store colliding proton and electron beams.
During the winter shut down 1997/98 the PC
dominated control system for HERA was largely in place.
The ramp program like all HERA console programs iswritten in Visual Basic 5 with ActiveX controls and runsin the control room on Windows NT workstations. The
graphic display for the control of the magnet ramp and thedata exchange with the magnet server (a SUNworkstation running under solar 2.6)are implemented withthe ACOP-control.The new ramp program has been in
operation and running reliably since May 1998.We report
here on our experiences and note that the combination ofVisual Basic plus ActiveX controls has been invaluable indebugging and fine-tuning the application to meet theneeds of the operators.

1 PREVIOUS DEVELOP MENTS
The first development of a file operating program
began in 1977 / 78 during construction of the accelerator
PETRA. At that time we used 16 bit minicomputers from
Norsk Data for the machine control. The program
development was done in POCAL [1] an interpretative
language. At that time the demands on a file operating
program were relatively low. The program only needed tostore the present currents of all PETRA magnets on a disc
file and to reproduce the magnet settings from that file.
The operator had a catalogue to manage all the storedmachine settings.
During subsequent years all existing DESY
accelerators received a computer aided control system andconsequently a file operating program. After achieving
reliable magnet operation with this program, requests for
improvements to store and reproduce values of otherdevices came up. So we expanded the programs to handle
a few other devices. This was limited by the 16 bit
POCAL interpreter.
The complexety and the fast changing operating modesof the accelerators and beam lines place high demands tothe file operating programs now. For suppling theaccelerators with different particles we need a fastswitching of the Linac’s and the beamlines.
With the new PC based control system we had todevelop a new file operating program. J. Wilgenpresented his project as a poster on the PCaPAC 1996 at
DESY [2]. This program is now in use on all DESY
accelerators and beamlines with the exception HERA.
HERA is a much longer and complex accelerator and uses
a different control system than the other DESY
accelerators [3]. It was not possible to adapt the programfor all specific and expanded needs at HERA also thisprogram was written in Visual Basic 3 and lives in a 16
bit world with IPX data exchange.

2 HERA
2.1 Storage ring
HERA is a 6.3 km long proton-electron storage ring.
Both machines are build up in one common tunnel. In twoof the four experimental areas the vacuum chambers ofboth machines are connected together. This means bothparticle beams use the same vacuum chamber and areinfluenced by the same common magnets.
The energy of the proton machine has to be ramped
from 40 GeV (the energy for proton injection) up to 920
GeV (the energy for the experiments). The energy in theelectron machine has to be ramped between 12 GeV and
27.5 GeV.

2.2 Special Features
The proton machine has superconducting dipole
circuits and normal conducting circuits for all othermagnets. The magnetic field changes of normal andsuperconducting magnets are very different. If we have astored beam in the machine, the fields of the magnets
have to fit together at all time. Therefore we need a
special procedure to steer the magnets during accelerationof the particle beam. We measure the field in asuperconducting reference dipole and produce fielddependent pulses to steer the normal conducting magnets.
Additional correction for sextupole fields have to bedone in the energy range between 40 and 150 GeV.

3 RAMP PROGRAM AND SEQUENCER
This program is like all other HERA consol programs
written in Visual Basic 5 with ActiveX controls and runs
on Windows NT workstations in the control room. The
data exchange with the magnet server, a SUN workstation,
all other servers and the graphic display to control themagnet ramp is done by the TINE protocol [4] with theACOP control [5].

3.1 Ramping the magnets
To raise the energy of the accelerator (ramping) thecurrents of all magnets have to be increased from its
present values to the values given from the file in asynchronous way. The program calculates an individual
current increment for each power supply and writes thisvalue to its controler. Then a generator sends the maximal
count of pulses needed to all power supply controlers. By
receiving a pulse each controler changes its current by its
individual increment.
To adjust reproduceable magnet fields we have to avoid
hysteresis effects. To achieve this we cycle all magnets
between their minimal and maximal currents. We call thisa magnet massage.

Picture 1 : Mainform of the Rampprogram and Sequencer
On the left side of picture 1, one can see the filecatalogue divided into 6 tables according to the 6 different
file types. On the right side some important general datafrom the selected file :• Kommentar : a comment line
• Datum : date and time of file creation• Zuletzt benutzt : date, time of last use and ausecount• FileType : type of file
• Energy : only important in magnet files, shows theend energy of the machine if one has tranfered thefile to the machine• Optik : name of the machine optic which belongs
to this file.

3.2 Catalogue
The catalogue holds a list af all stored machine states,
the reference to the disk file and some other importantdata which are needed in the program.

3.3 Magnet files
A magnet file holds the device names, the currents, thestatus and a flag of all ~1200 HERA magnets. The devicename decides in which power supply the current has to beloaded. The flag means whether the device has to beaccessed or not. The status is not used at the moment.

3.4 Scratch files
The catalogue holds a fixed list of scratch files. Thesefiles are rewritable files. The operator can simply selectone of this files to store a machine state in it. But he has
to be very carefully because someone else could overwrite
this file at any time.

3.5 Simple magnet files
At the store operation of such file the operator will be
ask to define a catalogue name for that machine state. The
data will be stored under an automaticly generated file
name. The catalogue administrates the connection
between file name and catalogue name.
It is not possible to overwrite such a named file.
Because the data in this file are read directly from themachine it holds only valid values and can always betransferred back to the machine. If a device is notaccessable or produces an error during readout this will bemarked in the device flag. A device with a marked flag
will not be accessed during a transfer of the file data tothe machine.

3.6 Symbolic files
For the standard operation of HERA we need about 20
important magnet states. Each of these states has an
assigned symbolic file. The operator has to know and touse only these few files. He doesn’t have to remember orto search for the best or last used file in the list of about
400 simple files.
A symbolic file holds no data. It has only a reference toa simple file. If someone generates a new file with a bettermachine state of HERA he should also update thereference in the symbolic file which will be used toidentify this machine state.

The next step for a more easier operation of HERA isthe file sequence. A file sequence should bring themachine from one main operating state to another. Thismeans for example from injection up to 920 GeV. To dothis one has to start 5 symbolic files by hand. The file
sequence holds the commands to start the symbolic files
and a list of the needed symbolic files. For the standard
operation of HERA we need only 5 file sequences :Hera-p Rampe
Hera-e Rampe
Hera-e Refill

Hera Lumi

A workfile is something like an experimental file. The
simple magnet files and scratch files always hold the dataof a complete HERA state. These states come from themachine and can consequently be written back to themachine. A workfile can hold the imported values of acalculated machine state. Such a calculated state knows
only currents for the main magnets, and has no values forthe correction power supplies. In this case the file does
not hold a complete machine state. The program thancares only about the devices which are specified in thisfile. All other devices will not be influenced.
During import of a file it is possible to mix theimported data with the data of an existing file. It is forexample possible to import new calculated values for themain magnets and mix it with a well known corrector
state of an existing file.
In addition it is allowed to edit a workfile. Therefore it
is possible that a workfile contains illegal values.

3.9 Generator adjustments
One can also adjust the ramp speed, ramp modes and socalled soft times of the puls generator. The soft timemeans a time in which the pulse generator increases hisfrequency from zero to the selected speed and at the endof the transfer it decreses the frequency down to zeroagain.
Each stored magnet file and symbolic file has his own
set of generator parameters. The dataset contains also thename of the desired magnet groups.

3.10 Magnet groups

3.7 File sequence

File sequence
Hera-p Massage

3.8 Work files

Description
Massage of all HERA-p magnets,
end conditon : Injection
HERA-p ramp from 40 GeV to920 GeV
HERA-e ramp from 12 GeV to27.5 GeV
Separation of particles, massage ofHERA-e magnets, end conditon :Injection
Preparing luminosity

Appropriate to the two coupled accelerators withcommon magnets in the experimental areas and someother special requirements of HERA it has to be possible
to operate different magnet groups of the machine. For themain operation we have defined the following groups:
Group nameHera-eHera-e & gemeinsame
MagneteHera-p nur Dipol
Hera-p ohne Dipol

Hera-p rampen

Description
Tuning luminosity in HERA-e
Ramp HERA-e and commonmagnets
Massage of the HERA-p Dipol
Changing the optic, massage ofall normal conducting magnets
in HERA-p
HERA-p ramp

The definition of these magnet groups is contained in
the programs initialisation file. For the definition of a newgroup or for changing an exiting group it is not necessary
to change the program code.

4 SEQUENCER
The operators in the control room have to process along list of tasks to bring HERA from one state to another.
The processing of this list should be automated by thesequencer part of this program. The trigger files, anadditional file type, the symbolic files and the file
sequences represent the interface to this program part.

4.1 Trigger files
In addition to magnet ramping we have to steer andcontrol nearly 50 other devices or device groups. Some
examples :• Steering and controlling of scrapers• Preparing RF-transmitters for a magnet ramp
• Adjust kicker and septa magnets for a particle
injection• Load and activate correction tables into the power
supply controler• Perpare and start special sextupol corrections
A trigger file contains the task (commented) andnecessary parameters to access a device server. The server
processes the task and returns his acknowledgement. Ifthe task could not be finished direcly the program starts apolling link to wait until the task is finished.

4.2 Symbolic files and file seq uences
In addition to the reference of a simple file this files
can have references to trigger files and can processes
commands for program steering. With this file not only
the magnets should be ramped, it should process
everything to bring the machine from one to another state.
The files are divided into two parts. The first part is aso call action list with task descriptions. The second list isa file list with the file names which are necessary toprocess the tasks.
Example with symbolic file : ‚T08 : HEP-I70U‘
Action list :Description
Dipolkorrektur : Stop
Sextupolkorr : Motor ein
Warten bis Motor laeuft
Sextupolkorr bis 70 GeV
Hera-p auf 70 GeV
Sextupolkorr : Stop

Parameter
File 8File 2

Flag
True
True
True
True
True
True

File 4File 1File 3File list :File
File 1File 2File 3File 4File 8

Catalogue Name
HP-Ramp-70GeV
Sextupolkorr_Motor_ein
Stop_SextupolKorr
Start_70GeV_Korr
Stop Dipol Korr

File Type
SimpleFileTriggerFile
TriggerFile
TriggerFile
TriggerFile

Meaning of the columns in the action list :•••Description of the tasks as simple text
Parameter necessary for processing the task. Thisfor example can be the name of a file in the file list
Flag says whether the task has to be processed ornot.

Meaning of the columns in the action list :• File is a reference to one of the tasks in the actionlist• Catalogue name of the file which has to betransferred to the machine• File type of the catalogue file.

5 CONCLUSION
During the winter shut down 1997/98 the principalcontrol system for almost all elements of HERA has beenupgraded. In particular the complete magnet control has
been rearanged from Norsk Data minicomputers to a SUNworkstation.
All PC based workstations in the control room arerunning under Windows NT now. The programs aredeveloped under Visual Basic 5. The servers are based on
different plattforms like SUN, HP, VX-Works anddifferent PCs which are running under DOS, Windows
3.11, Windows NT and Linux. On the PCs we run
programs written in ‚C‘, and Visual Basic 3 / 4 / 5.
For a nearly perfect dataexchange between all thissystems cares the ACOP control [5] and the TINE
protocol [4]Since the restart of HERA in May/June 1998 theprograms are under continuing development and had to befitted to the needs in the contol room. This is also due tothe control system software. As well the ActiveX controls
have to be further developed. In neither case has theoperation in the control room been hampered.
The windows NT workstation and the sequencer are
running very reliably and we have seen no problems withthe client server communication.
After one year of work invested in writing this program,I note further that Visual Basic 5 is a really powerful anddeveloper friendly tool.

REFERENCES[1] H. Wagner, R. Stadtmueller, “POCAL MANUAL”,
DESY M-85-01, Januar 1985
[2] J. Wilgen, “Filedriven Machine Operation atPETRA”, PCaPAC’96, DESY Hamburg (D), October
1996.
[3] J. Maass, R. Schmitz, “Kurze Uebersicht ueber das
PETRA Kontrollsytem mit PCs”, DESY HERA 9605, DESY Hamburg (D), Mai 1996.
[4] P. Duval, “TINE: An Integrated Control System forHERA”, these proceedings.
[5] I. Deloose, P. Duval and H.G. Wu, “The Use of
ACOP Tools in Writing Control System Software”,
proceedings Icalepc’97 and these proceedings.