22
XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents • Why did we introduce XAL? • Installing XAL • Developing XAL • Achievements with XAL • Summary

XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Embed Size (px)

Citation preview

Page 1: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

XAL at J-PARCHiroyuki Sako, G. Shen, JAEA

C. K. Allen, ORNL

Contents

• Why did we introduce XAL?

• Installing XAL

• Developing XAL

• Achievements with XAL

• Summary

Page 2: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Why did we introduce XAL to J-PARC?• All functions necessary for commissioning apps are there

– EPICS CA   (with a wrapper “Channel” class)– GUI (a template for GUI application)– Online model– RDB interface

• Implemented in Java – Easy development/maintenance in OO language with IDE – Code organization seemed clear and good. Each code is

understandable.• Close relation between model and device control

– Read a channel and set the value to the model– Read data from the model and set it to a channel– “Virtual Accelerator” seemed attractive

• Testing apps with simulation in CA without beam

• There are many apps which may be used in J-PARC.

Page 3: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Installing XAL

• Building XAL (Linux, Windows)– Installation of java SDK, ant, JCA/CAJ, (EPICS, PCAS)– Building XAL had no problem. Successful in the first

attempt.

• Setup– JCA/CAJ configuration– PCAS (for virtual accelerator)

• Development of XAL input files – Base for all XAL tools– Developed a RDB and an automatic generation tool input

files• XAL lattice data structure is easy to map to RDB

– Each element is located at a z-position. No need to fill drift between elements.

Page 4: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

ER diagram of Commissioning DB (for lattice info)

• PostgreSQL 8.1• Beam table

– Twiss/emittance/energy• Generation of Probe file

• Lattice data– Geometry table (static)– Device parameter table

(many sets of data with tags)

– Different tables for each device type

• Dipole magnet• Quad magnet• RF• monitor

Page 5: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Lattice Data Manager

• GUI tool for lattice related tables

• Save a lattice data set with a tag and comments

• Generation of XAL and Trace3D lattice files

• Both calculated sets and corrected sets with beam are stored with different tags

Page 6: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Developing XAL• Extension and test of the online model

– Detailed comparison of the online model with TRACE3D• Because we use also TRACE3D• As a result, we have fixed XAL bugs

– Space charge calculations

– RF gap transfer matrix

Finally difference from Trace3D becomes less than 1% (Thanks Chris)

– PMQ (QM with fringe field) element added– Emittance growth effect at RF gap

• Interface for PostgreSQL– PostgreSQL I/O class (PgsqlDatabaseAdaptor) implemented– DB tables created with same definitions from ORACLE ones. – It took only a few days.

• PVlogger and SCORE work

Page 7: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Version control• Short history

May 04 First installation of XAL (got tar file from XAL web page)Updates of XAL were done by downloading tar file

Dec 04 J-PARC version control started with CVSJun 05 Updated (merged) with newest SNS codeAug 06 Moved to SVN (then we updated again with newest

SNS version from SourceForge)• Found SVN is much nicer than CVS

– Version control as a whole set of codes

• Problem: hard to synchronize our version with SNS version– We customize our codes very much for J-PARC.– To update our version from SNS, we compared and merged every

code manually.• Takes a week. • Any better way?

Page 8: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Issues

• No official document. Only Javadoc. • There is no tutorial how to write a XAL

application• Merging version of each institute may be

necessary in near future• JCA or CAJ? (not XAL problem)

– JCA is stable but slow when treating many channels (more than a few hundreds)

– CAJ1.1.3 is fast, but has problems in disconnection and “caput”

• We identified bugs and fixed with Matej. • We still use JCA but could move to the next CAJ

version.

Page 9: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

PVlogger or SCORE?• SCORE

– Convenient for comparison and restoring functions– But heavy

• In J-PARC LINAC (RF/magnets/monitors), we save ~ 9K channels – There is no periodic logging function

• In J-PARC, some groups want to take a snapshot periodically

• PVlogger– Can take a snapshot periodically– Also has a function to take a snapshot with comments– Parameters can be read from applications (such as MPX)

• Connection with the model is there!– But restore function is not there

• We added corresponding set point record entry in the DB table• Save and Restore application (like SCORE) must be implemented

Can we use PVloggger instead of SCORE?– We’d like to have your suggestions

Page 10: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Our achievements with XAL• XAL applications for LINAC beam commissioning

– iTuning (RF tuning)– BBC (Beam Based Calibration)– Orbitcorrect (orbit correction)– EnergyMaster (beam energy analyzer)– SCORE (Save and Restore DB)– PVlogger

Reference:ICALEPCS2007, Oct 18(Th) 17:40H. Sako, et al, Beam commissioning software and database for

J-PARC LINAC

Page 11: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

RF Tuning (iTuning)• Tune RF amplitude and phase to get a designed

energy gain by measuring time-of-flight with Fast Current Transformers

Energy vs RF phaseAnd fit to a model

2 of fit to a model (Parmila) as a function of RF amplitude

Page 12: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Beam Based Alignment (BBC)– Change QM and steering field and

measure beam positions with BPM– Find center of QM MEBT1 BPM05

Downstream BPM positionsvs QM field at each steerer field

Center BPM positions as a function of the slopes (left plot)

QM field

Slope (Q vs BPM)

BPM Steering field

Page 13: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Orbit Correction (orbitcorrect)

Measured BPM positions (horizontal)

Prediction by online simulator

• After correction, Measured positions agrees well with prediction

After correction

Before correction (SDTL)

Page 14: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

First Injection to RCS (H0 dump) 5 Oct 2007

1%

B

±磁場

±磁

I-BPM(324)

MWPM2QL3BT

ISEP1

QFL SB1 SB2 SB3 SB4QDXPB1 PB2

1st foil“OUT”

QDL

MWPM3

MWPM4

MWPM5

DSEP1

PB3 PB4 QFM

DSEP2

MWPM6

Dump Q

MWPM7

H0 dump  (4kW)

Big-BPM1 Big-BPM2

ISEP2

K-BPM(324)

BLM×4

Dump STR(V & H)

2nd & 3rd foils“IN” CM

Carbon plate(thermometer)

Beam profiles measured by MWPMs

Page 15: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Summary

• XAL was developed in J-PARC and successfully applied as LINAC commissioning tools

• More active collaboration sharing information is useful for development of XAL

Page 16: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Acknowledgements

• We thank collaborators for successful beam commissioning of J-PARC LINAC with XAL– Especially

• John Galambos, Chris Allen, Tom Pelaia, Paul Chu, and Andrej Shishlo

Page 17: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Save and Restore DB (SCORE)• SCORE application with PostgreSQL

– Save, Compare and Restore a set of channels– RF, magnets, monitors (~9k channels in total).

Page 18: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

EnergyMaster

• Collection of information– Beam destination– Beam current– RF timing– RF on/off

• Choose a proper FCT pair and calculate energy depending on RF acceleration

Energy evolution duringRF tuning (PVlogger)

Energy measurement status

Page 19: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

First acceleration to 181 MeV24 Jan 2007

Design Energy

Measured Energy 181MeV

Page 20: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

We thought we can use XAL apps but actually developed most of them by ourselves

- different hardware and tuning algorithms

Applications for commissioning

May06 @ collab. mtg. at TsukubaXAL apps to be used (or to be modified for J-PARC)

Oct07 (actually implemented)

RF phase/amp tuning PASTA iTuning (new XAL app)

Transverse matching with WS

AOC matcher (no XAL)

Emittance/Twiss measurements with WS

AOC, emittanceCalc.py WS profile measurer (no XAL)

Orbit correction with steering magnets

Orbitcorrect Orbitcorrect

Beam Based Alignment find_beam_center.py BBC (new XAL)

Save and Restore tools SCORE SCORE

Applications

Page 21: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Some functions which may be useful (we could contribute)

• Back propagation tracker– Starting with Twiss/emittance at downstream, calculate

those at an upstream position

• Newton-Raphson method with Response matrix– Much faster optimizing method than Simplex

• A few 10 iterations converge instead of ~ 100 with Simplex

– Proved to work in the transverse matching• Calculate Response matrix with online model

• Applications

Page 22: XAL at J-PARC Hiroyuki Sako, G. Shen, JAEA C. K. Allen, ORNL Contents Why did we introduce XAL? Installing XAL Developing XAL Achievements with XAL Summary

Newton-Raphson method

m

m

nn

m

n x

x

x

x

y

x

y

x

y

x

yx

y

x

y

x

y

x

y

y

y

y

:

:

:

............

::

::

:

......

:

:

2

1

1

2

2

1

2

1

3

1

2

1

1

1

2

1 yx

1

x

y

xxx )()1( ii

),,,,,( yxyxyx x

),...,,,...,( 1111 Nyy

Nyymyym

Nxx

Nxxmxxm y

),,,( 4321 GGGGx

),,,,,

,,,,,,(413121413121

413121413121

yyyyyyxxxxxx

yyyyyyxxxxxx

y