Lattice Modeling and Calibration with Turn-by-turn Orbit Data

Abstract A new method that explores turn-by-turn BPM data to calibrate lattice models of accelerators is proposed. The turn-by-turn phase space coordinates at one location of the ring are first established using data from two BPMs separated by a simple section with a known transfer matrix, such as a drift space. The phase space coordinates are then tracked with the model to predict positions at other BPMs, which can be compared to measurements. The model is adjusted to minimize the difference between the measured and predicted orbit data. BPM gains and rolls are included as fitting variables. This technique can be applied to either the entire or a section of the ring. We have tested the method experimentally on a part of the SPEAR3 ring.


I. INTRODUCTION
Lattice calibration is of crucial importance in the performance of storage rings and synchrotrons.An ideal lattice is often periodic and symmetric in order to minimize the resonance driving terms, the peak beta function, and the dispersion function.In reality the lattice is often distorted by imperfections of the magnets and human errors.Calibration of the machine lattice to implement the design optics with beam-based measurements can lead to increased injection efficiency, beam lifetime and reliability.
The most widely used lattice calibration technique is based on the machine's closed orbit response matrix [1].Model parameters, BPM gains, and corrector gains are fitted to match the model orbit response matrix to the measured counterpart.The differences between the fitted model and design model are then used to adjust the machine to the ideal lattice.
Turn-by-turn BPM data taken while the beam executes transverse oscillations also contains information of the machine optics.Singular value decomposition (SVD) [2] or independent component analysis (ICA) [3] techniques can be used to derive the beta functions and betatron phase advances, which in turn can be used to fit the machine models.
In the present paper we use turn-by-turn BPM data directly to fit the lattice model without the intermediate steps of deriving beta functions and phase advances.In our view this is the natural approach for lattice calibration with turn-by-turn data because there is no loss of information in this process.The intermediate parameters, such as the beta functions, themselves are not observables.In deriving these parameters, one has to decompose the beam motion, keeping only the betatron components while discarding the higher order resonance motion resulting from nonlinear dynamics.When the horizontal and vertical motions are linearly coupled, it is difficult to represent and include the coupling effects in the fitting.BPM gain errors affect the reliability of the beta function measurements, making phase advances the main source of the fitting data.However, when we compare measured turn-by-turn data directly to tracked turn-by-turn data, all linear and nonlinear factors are included.BPM gains can be included in the fitting to find a solution that is consistent with the beta functions derived from the fitted model.
The nonlinear accelerator components such as sextupoles can readily be included as fitting parameters.Compared to the nonlinear magnet calibration method proposed in Ref. [4], the fitting method has many fewer constraints on the locations of the BPMs and sextupoles and is thus more practical.
We organize this paper as follows.Section II describes the basic method for phase space coordinate measurements and its application to transfer matrix measurements.Section III lays out the fitting scheme.Section IV presents an experimental application of the fitting method to a section of a storage ring.Section V shows simulation results for a full ring.

TRICES
The transverse phase space coordinates of an orbit can be derived from BPM measurements at two locations if the transfer matrix between those locations is known.In the simplest case, if the two BPMs are separated by only a drift space, the angle coordinates are where x 1,2 and y 1,2 are the horizontal and vertical positions measured at BPMs 1 and 2, respectively, with BPM 1 located upstream of BPM 2, and L is the length of the drift space.
When turn-by-turn phase space coordinates at two locations are known, the transfer matrix between them can be readily obtained.We construct the matrix X which contains the phase space coordinates at one location.The dimension of X is 4 × N.Each column of X is a vector containing the four phase space coordinates [x,x ′ ,y,y ′ ] T for each of the N consecutive turns.Then the transfer matrix from location 1 to 2, M 21 , satisfies M 21 X 1 = X 2 .
A least-squares solution for M 21 is This is a useful method to estimate the transfer matrix.However, the resulting matrix is usually non-symplectic because of errors in the data.
The symplectic transfer matrix can be obtained by a fitting method that imposes symplecticity.Although several methods may be used to parametrize M 21 [5,6,10], we have adopted the method of Sagan and Rubin in which M 21 is constructed with 10 free parameters and where ||C|| is the determinant of the matrix C. The merit function to be minimized may be defined by where X(i, n) is the (i, n) element of matrix X, X represents the coordinates predicted by the model, and the σ i are the rms noise level for the corresponding phase space coordinates.
The non-symplectic matrix Eq. ( 2) can be used to generate the initial parameters required for the fitting.
This method can be used to obtain the fitted, symplectic one-turn transfer matrix.In this case phase space coordinate measurements at only one location are needed.The data matrix for turns n = 2, 3, • • • , N and that for n = 1, 2, • • • , N − 1 serve as X 2 and X 1 , respectively.
It is worth noting that this method for transfer matrix measurement is completely model independent.
We have successfully tested this method with both simulations and experiments for the SPEAR3 storage ring.

III. LATTICE CALIBRATION WITH TURN-BY-TURN BPM DATA
Lattice calibration is the process of adjusting the magnet strengths of an accelerator in order to gain the desired linear and nonlinear behaviors as exhibited by the design model.
Usually data of beam-based measurements are used to measure the deviations of the present lattice of the machine from the design lattice.Then corrections are applied to eliminate the deviations.For example, the orbit response matrix method obtains the present lattice by fitting the quadrupole strengths in the lattice model in order to minimize the differences between the calculated and the measured closed-orbit response matrices [1].In the following we describe a method to calibrate lattice models with turn-by-turn BPM data.This method fits the lattice model in a similar manner to the orbit response matrix method, but uses the instantaneous beam orbit, instead of the static, averaged orbit, as the input data.The advantage of this new method is that data acquisition is much faster and has less impact on the beam.

A. The one-quadrupole case
With the initial transverse phase space coordinates at the entrance of an accelerator section and a lattice model, the beam positions at downstream BPMs can be predicted by tracking.Conversely, the lattice model can be calibrated with initial phase space coordinates and downstream BPM measurements.The idea can be illustrated with a simple case depicted in Figure 1, in which the accelerator section consists of one thin quadrupole and two drift spaces.Transverse phase space coordinates [x 1 ,x ′ 1 ,y 1 ,y ′ 1 ] T at BPM 1 are related to readings of BPM 2 (x 2 , y 2 ) through elements of the transfer matrix between BPMs 1 and 2. Explicitly, for the horizontal plane, where [KL] = 1 Bρ dBy dx ds is the integrated gradient of the quadrupole.The integrated gradient can be extracted from multi-pass coordinate data with the least-squares fitting method to yield where the summation is over n turns.

B. Application to a general transport line
In a more complicated case that involves multiple magnets and BPMs, an explicit solution such as Eq. ( 9) may not be available.However, fitting techniques can be employed to obtain the magnet strengths by adjusting their values in the model to minimize the differences between the measured and predicted beam positions.
We consider an accelerator section that is preceded by two BPMs, labeled BPMs 0 and 1, which are separated by a drift space.We assume these two BPMs are very well characterized and calibrated so that there are no roll or gain errors.The 4-dimensional phase space coordinates at both BPMs can then be obtained.The BPMs in the accelerator section may have roll or gain errors.The observed coordinates (x,y) at any BPM are related to actual beam coordinates (x, ȳ) by where θ is the BPM roll and g x,y are horizontal and vertical gains, respectively.Given the phase space coordinate at BPM 1, T , the predicted observations at downstream BPMs can be obtained by first tracking the particle to these BPMs and then applying Eq. (10).
Suppose the accelerator section has M BPMs and P magnets to be calibrated.The target function to be minimized is defined as where N is the number of turns, i = 2, • • • , M + 1 indexes the BPMs to be calibrated, p is a vector of the fitting parameters, σ xi,yi are the horizontal and vertical noise levels for BPM i, x, ỹ are the predicted BPM readings and x,y are the actual observed coordinates.The fitting parameters include the strengths of the magnets to be calibrated and the BPM roll and gains.Therefore the fitting problem is to look for P + 3M parameters from M × N data points.The multiple beam trajectory data has considerable redundancy since they represent the same optics on successive turns.Data from each BPM provides additional sampling of the optics.The number of BPMs may need to be equal to or larger than the number of fitting parameters (magnets) to put on sufficient constraints.
The least-squares problem defined by Eq. ( 11) can be solved with an iterative approach as follows.We define the residual vector r as a column vector that contains every term in Eq. ( 11) inside the squares such that χ 2 = r T r.The Jacobian matrix consists of the derivatives of the residual vector with respect to the fitting parameters with its (i, j) element being J ij = dr i /dp j .At every iteration the change toward the next solution is found by solving J∆p = −r, or equivalently and more conveniently J T J∆p = −r T r.The Levenberg-Marquadt method gains more robustness by modifying this equation to [7] ( where λ is a constant to be adjusted after every iteration, the popular choice for the matrix Σ is a diagonal matrix with the diagonal elements taken from the matrix J T J, Σ = diag(J T J).
Additional constraints to the fitting parameters may be added to prevent large, unrealistic changes of the quadrupole parameters in the solution [8].
C. Application to a synchrotron or storage ring The fitting scheme described in the previous section is directly applicable to a circular accelerator by viewing it as a transport line.In addition, the fact that the beam comes back and sees the same BPMs in a circular machine provides some advantages.First, BPMs 0 and 1, the initial BPMs can be placed at the end of the transport line so that their positions on the next turn can be compared to the predictions based on readings of the same BPMs from one turn earlier.Second, in a storage ring a beam executing betatron oscillations naturally scans the phase space, while in a transport line the trajectories would concentrate around one point in the phase space unless upstream correctors are used to steer the beam.
Data that sample a wide region in phase space is preferable in the fitting problem since that reduces the redundancy in the data.
The predicted beam trajectory in Eq. ( 11) is based on measured initial coordinates which inevitably have noise.The noise is propagated downstream and causes errors in the predicted trajectory.However, since the noise is random, its relative importance decreases with increasing number of samples.

IV. EXPERIMENTS ON THE SPEAR3 STORAGE RING
We conducted experiments on the SPEAR3 storage ring.In the experiment we connected 8 BPMs in and around a standard cell to BPM electronics that has turn-by-turn capability.Horizontal motion was excited with an injection kicker.Vertical motion was resonantly driven by a sinusoidal signal on a stripline.This driving signal was stopped when the kicker was fired [9].Free motion in both planes was then recorded.The one-turn matrix at BPM [12 1] was measured using the method described in Section II using 200 turns of BPM data.This matrix was then diagonalized to generate the transformation between the raw coordinates and the normal mode coordinates [10].The raw and normal mode phase space coordinates at the BPM are shown in Figure 3.The horizontal and vertical motions are decoupled in the normal modes.

The configuration is shown in
The lattice model for the accelerator section between BPM [11 1] to [12 1] was fitted with the turn-by-turn data according to Eq. (11).The fitting parameters were 5 quadrupoles, horizontal and vertical gains and rolls of 6 BPMs.BPM data of 200 turns in both planes were used in fitting.The rms noise of BPM readings was estimated to be about 0.020 mm in each plane.To test the ability to recover quadrupole errors, offsets were added to the initial quadrupole values.The merit function χ 2 normalized by the number of degrees of freedom dropped from roughly 150 to 20 after the calculation converges.The fitted quadrupole strengths and statistical errors from 5 data sets are listed in Table I along with their design and orbit response matrix fit (LOCO) values.Since a correlation exists between neighboring QF and QD magnets, there may be systematic errors in the fitted solution.This is especially true for the second pair of QD and QF magnets as only two BPMs are downstream of them.
For these two magnets the initial values were set to the design values without offsets.
The fitting results agree with the orbit response matrix method reasonably well.We have verified that the quadrupole strengths can be measured directly from turn-by-turn data.The result of the orbit response matrix method may be more reliable in this case since it utilizes 60 BPMs (including all turn-by-turn BPMs in this experiment) around the entire ring.Therefore each quadrupole parameter is constrained by more data samples at different locations.However, if turn-by-turn data from the same number of BPMs are used in a global fit, the results should be equally reliable, as tested in simulation in the next section.The model parameters to be fitted are the strengths of normal and skew quadrupole magnets.Magnets that share a power supply are treated as having a single free parameter.
There are a total of 72 quadrupole parameters and 13 skew quadrupole parameters.Rolls and gains of the two initial BPMs are not fitted.There are then a total of 85 + 55 × 3 = 250 fitting parameters.
Simulated data are obtained by first launching a particle with initial horizontal and vertical offsets and then tracking it for a number of turns with the tracking code AT [11].A set of gain and roll errors are created for all BPMs except the two initial BPMs.The gain errors are drawn from a Gaussian distribution with a standard deviation of 5% and the roll errors from a distribution with a standard deviation of 12 mrad.The gains and rolls are applied to the tracking data according to Eq. (10).Gaussian random errors with an rms of 50 µm are then added to horizontal and vertical coordinates for all BPMs.
To test the algorithm we generate an uncalibrated lattice by adding errors to the strengths of some magnets.Random errors of 0. For all random seeds, the algorithm has largely converged after two iterations, at this time the χ 2 function normalized by the number of data points is brought down from an initial value of around 27 to 4. We force the algorithm to halt when the additional reduction of χ 2 after one iteration is small in order to prevent the algorithm from attempting to correct noise.Contributions to χ 2 of individual fitting parameters, defined as the change of χ 2 when a parameter is set to its initial value while all others are at the fitted values, are studied as in Ref. [8].It is found that in the test with the artificial errors given above the biggest contributions are from the quadrupole and skew quadrupole parameters.The total contribution to the normalized χ 2 is ∼ 1.6 for the horizontal BPM gains, ∼ 0.8 for the vertical BPM gains, ∼ 0.2 for the BPM rolls and ∼ 22 for the quadrupole and skew quadrupoles.
Nonlinear magnets can also be included in the fitting model.SPEAR3 has only two families of sextupoles in one DBA cell, the SF and the SD magnets.The SF magnets and SD magnets in the standard cells are each powered in series by two power supplies.The SF magnets and SD magnets in the matching cells are powered by two separate supplies.Therefore we group all sextupoles into four parameters.Because sextupole strengths affect the chromaticities, we include chromaticity measurements as fitting data in order to impose ad-ditional constraints.For this purpose Eq. ( 11) is expanded to included two additional terms (C x − Cx ) 2 /σ 2 Cx and (C y − Cy ) 2 /σ 2 Cy , where σ Cx,Cy are expected measurement uncertainties, assumed to be 0.01 in our simulations.
To determine the strengths of the sextupoles by the fitting scheme the beam must have large oscillation amplitudes in these magnets to sample the nonlinear field.The horizontal and vertical beta functions are 5.4 and 6.0 meters, respectively, for SF magnets and 2.0 and 10.6 meters for SD magnets.In a test we set the horizontal and vertical offsets to be 5 mm and 3 mm at the starting point.Based on the modified lattice that has quadrupole and skew quadrupole errors, two sextupole parameters are also changed before the lattice is used to generate tracking data.The same BPM error set is then applied.Fitting the data leads to the same results as Figure 4 and 5 for the quadrupole, skew quadrupole and BPM parameters.Figure 6 shows the fitted sextupole parameters.The target values are successfully recovered.Again there appear to be some systematic errors due to the coupling between the parameters.The coupling is a consequence of the lack of information needed to resolve the individual effects of the parameters, similar to the case of the coupling between quadrupole parameters [8].In the present setup we use three BPMs per cell, with only one in the arc between the sextupoles.Including additional BPMs may help improve the resolution for sextupole parameters.
Increasing the amplitude of the beam motion may also improve the resolution for sextupole parameters.However, in reality the BPMs have a nonlinear response to beam positions due to both the geometric configuration of the BPM buttons and the electronics.
When the beam position offset from the BPM center is large, the BPM reading differs from the real beam position.Precise characterization of the BPM non-linearity may be obtained by modeling or measurements and can be used to calibrate BPM readings.
We have assumed BPMs 0 and 1 have no gain and roll errors.Such errors would contaminate the initial phase space coordinate data and affect the fitting results.It is thus very important to choose these two BPMs properly or calibrate them with techniques such as the orbit response matrix method [1].The effects of errors in BPMs 0 and 1 are studied with 0.9 simulations.Figure 7 shows the horizontal and vertical beta-beat between the fitted and target lattices when the gain errors of BPMs 0 and 1 are varied for the case corresponding to Figure 4.Both BPMs have fixed roll errors.In the unfavorable scenario when the two BPMs have opposite gain errors up to 4%, the target lattice can still be approached to achieve a beta-beat of less than 3% in both planes.This indicates that our calibration method is applicable for reasonable gain and roll errors.
In the simulation we added 50 µm rms noise to all BPMs.In reality turn-by-turn BPMs for electron storage rings usually have lower noise.In addition, it has been demonstrated that singular value decomposition [2,3] can be used to reduce random noise from BPM data.
For example, in our simulation, if we keep 20 singular modes out of the total 57 × 2 modes, we keep all the vital information in the BPM data and the BPM noise levels are reduced to 25 µm rms.

VI. CONCLUSION
We have proposed a method to calibrate the lattice of a ring or a transport line using
5% rms are added to all quadrupoles.The skew quadrupoles are set to random values with an rms integrated gradient of 0.001 m −1 .Larger changes are made to 5 quadrupole parameters and 1 skew quadrupole parameter to simulate human or hardware errors.The uncalibrated lattice has an rms horizontal beta-beat of 10% and an rms vertical beta-beat of 4.5% compared to the ideal lattice.The initial horizontal and vertical offsets are both 2 mm at a location where the horizontal and vertical beta functions are 5 m and 9 m, respectively.The maximum horizontal and vertical beta functions in a standard DBA cell for SPEAR3 are 9 m and 13.5 m, respectively.Tracking data of 200 turns are used for fitting.The fitting algorithm starts with the nominal lattice and recovers all artificial errors.The results are shown in Figures 4 and 5.The fitted values and their error bars are the averages and standard deviations of fitting results from 10 random BPM noise seeds.The first 25 quadrupole parameters are QF magnets.The next 25 are QD magnets, followed by the QFC parameter and other quadrupoles in the matching sections.The fitted parameters are found to agree with the expected values very well.The QD parameters tend to have large error bars.This is inherent to the lattice model and is also observed in orbit response matrix fitting results.The rms beta-beat between the fitted lattice and the target lattice is 2% horizontal and 0.9% vertical.The last two BPMs in Figure 5 are BPMs 0 and 1.Their gains and rolls are not included in the fitting.

FIG. 4 :
FIG. 4: The fitted quadrupole (upper) and skew quadrupole parameters (lower) are compared to the expected values.

FIG. 5 :
FIG.5:The fitted (blue) BPM gains and roll are compared to the expected values (red).

TABLE I :
Quadrupole parameters In SPEAR3 there are 57 BPMs used for normal operation.In our simulation we assume all BPMs are capable of taking turn-by-turn data.The phase space coordinates at BPM [11 1] are generated from tracking data of BPMs[10 7] and [11 1] (which are chosen to be BPMs 0 and 1, as in Section II).