12th Int. Beam Instrum. Conf.
ISBN: 9 7 8 - 3 - 9 5 4 5 0 - 2 3 6 - 3IBIC2023, Saskatoon, CanadaJACoW Publishing
ISSN: 2 6 7 3 - 5 3 5 0d o i : 1 0 . 1 8 4 2 9 / J A C o W - I B I C 2 0 2 3 - M O P 0 3 7

Content from this work may be used under the terms of the CC-BY-4.0 licence (© 2023). Any distribution of this work must maintain attribution to the author(s), title of the work, publisher, and DOI

TUNE FEEDBACK AT THE CANADIAN LIGHT SOURCE
W. A. Wurtz∗ , C. K. Baribeau, A. M. Duffy
Canadian Light Source, Saskatoon, Saskatchewan, Canada
Abstract
In order to maintain good injection efficiency for top-up
operation at the Canadian Light Source, we must keep thebetatron tunes constant even as changes in insertion device
fields cause the tunes to vary. To meet this requirement, we
implemented a tune feedback system. We measure the tunes
at a rate of 1 Hz using Dimtel bunch-by-bunch systems. The
transverse feedback function of the bunch-by-bunch systems
provides tune measurements without disturbing the electron
beam. We adjust two quadrupole families at a rate of 0.25 Hz
to control the horizontal and vertical tunes. In this article
we describe the tune feedback system, its development andits performance. The system has proven to be very robust,enabling reliable top-up operation.

updated injection efficiency tune scans for these devices inFig. 1. The nominal tunes, represented by a diamond marker,
are 10.242 for the horizontal and 4.290 for the vertical. We
see that the nominal tunes are on a small island of good
injection efficiency, and if the tunes were to shift, the stage 2
efficiency would quickly become unacceptable. Tune shifts
are mostly caused by insertion device field changes.

INTRODUCTION
The Canadian Light Source (CLS) began operating in topup mode for user operations in 2021. In top-up mode, charge
is injected into the storage ring every few minutes to maintaina constant current with the present target being between 219
and 220 mA. Top-up requires reliable and efficient injection,and the tune feedback application is an important part of ourtop-up implementation. We developed the tune feedback application in an iterative manner, incorporating feedback fromoperators and subject matter experts. Through each iteration
we identified operational issues, implemented corrections
or new features to resolve the issues, tested the new features
and their interactions with existing features and deployed thenew version. The resulting product can gracefully handle avariety of situations and provides an alarm and diagnostic
information for the operators. The algorithm is adjustable
for machine studies outside of user mode, or to implement
workarounds while we resolve issues with external systems.
Overall, the tune feedback application has been successfuland top-up operation has been reliable.

TUNE AND INJECTION
For top-up mode, we desire that >90% of the charge injected into the storage ring be captured. We measure thestage 2 injection efficiency using an integrating current transformer (ICT) at the end of the transfer line and the parametriccurrent transformer (PCT) in the storage ring. Because there
is some uncertainty in the ICT calibration, we give the stage 2
injection efficiency in arbitrary units (a.u.) with a stage 2
efficiency of 97 a.u. meaning that somewhere between 94
and 100% of the electrons were captured.
We have previously reported on injection efficiency issues
caused by a superconducting wiggler, BMIT SCW4 [1], andan elliptically polarizing undulator, SM EPU75 [2]. We show
∗ ward.wurtz@lightsource.ca

Figure 1: Measurements of injection efficiency as a functionof the fractional tunes for two insertion devices with all otherinsertion devices forced open or turned off. We operated theBMIT SCW4 at approximately half its maximum field inorder to avoid quenching the device during the measurement.

We do not measure the integer portions of the tunes during
normal operations and obtain the fractional portions by performing a Fourier transform of position data. In this work, if
we say that the horizontal tune is 0.242, the integer portionis understood to be 10, and similar for the vertical with an
integer portion of 4.

MOP03710608 Feedback Systems and Beam Stability

IBIC2023, Saskatoon, Canada
JACoW Publishing
ISSN: 2 6 7 3 - 5 3 5 0
d o i : 1 0 . 1 8 4 2 9 / J A C o W - I B I C 2 0 2 3 - M O P 0 3 7

DEVELOPMENT
The tune feedback application began with a simple
script written by an accelerator physicist in Python using
PyEpics [3]. While it was able to control the tunes during
an eight hour machine development shift, it was far frombeing the robust tool that we needed for reliable operationin user mode.
The script was given to a system analyst and we began
developing it into a useful application, taking an approachheavily influenced by flow-based agile [4]. The productvision was for a robust application that would function withessentially 100% uptime and would be easy for the operators
to use. For each iteration, we created a backlog of features,ranked them in priority, and implemented them. The CLS
machine schedule provides a maintenance shift every week,
which allowed us to test our software without beam. If thetest was successful, we would then schedule a dedicatedshift for online testing with beam. The results from eachtest informed our revisions to the backlog of features for thenext iteration.
As soon as we had a version that was robust enough tosurvive our attempts to make it fail, we called this version
the minimum viable product and began running it in normal
operations. We quickly built a new backlog using feedback
from our operators and our own observations of how thesystem functioned in the real environment. We continued toiterate, first quickly, then more slowly until we had a robust
application with the features necessary to survive all thecases that it encountered in user and machine studies modesof operations.
The iterative process was essential for this project, and we
could not have been successful with a traditional/waterfall
approach. With a system as complex and dynamic as astorage ring, there was no way for us to foresee all the featuresthat were needed to make the tune feedback application
robust.

THE TUNE FEEDBACK SYSTEM
Figure 2 shows the tune feedback system expert panel.
The data and controls displayed on this panel are the resultof several development iterations. Grayed fields can only bechanged while the tune feedback loop is open.
The CLS storage ring uses Dimtel iGp12 bunch-by-bunchsystems [5] for transverse feedback and other bunch-bybunch applications. When transverse feedback is running,
the averaged bunch spectra from these systems containnotches at the tune frequencies due to the negative feedback
loop [6, 7]. These notches have proven to be robust measurements of the fractional betatron tunes. The plots ‘TFC:2405101:X:SRAM:SPEC’ and ‘TFC:2405-102:Y:SRAM:SPEC’in Fig. 2 show example spectral data with notches at thehorizontal and vertical tunes, respectively.
We input the CLS injection timing trigger, which has aconstant rate of 1 Hz whether we are injecting or not, tothe bunch-by-bunch system. The bunch-by-bunch system
captures the data to calculate the notched spectra beforethe trigger. Without this deliberate choice of timing, theinjection transient caused when the kickers do trigger would
obscure the notches.
There are a variety of circumstances where we require
the tune feedback application to cease adjustments to thequadrupoles, such as when the betatron tunes cannot beaccurately measured. We have codified these circumstanceswith a signal status, where the application will only adjust
quadrupole settings when the signal status is deemed GOOD.
The circumstances that render the signal status anythingother than GOOD are configurable in the application’s expert
panel, however, we permit most settings to be adjusted only
when the feedback loop is open.
The notch is always negative in the spectral waveforms
and we require that it crosses a threshold, represented by thehorizontal lines in the plots. The threshold is determinedby calculating the standard deviation of the waveform in aregion away from the notch, then multiplying the standard
deviation by a user defined number, which is 10.0 in Fig. 2 forboth the horizontal and vertical. If the notch does not crossthe threshold, which occurs if the stored beam is lost or if thestored current is too low, then the signal is declared LOW
and the tune feedback loop will open after a user specified
number of attempts, which is set to 3 in Fig. 2.
If a vacuum transient occurred in the storage ring, or if atrigger was misconfigured such that the injection transient
appeared in the spectral waveforms, then the waveforms
would be positive going, obscuring the notch. To handle thissituation we calculate the skewness of the waveforms,
𝑔1 ≡𝑚3𝑠3(1)where 𝑠 is the sample standard deviation and𝑁𝑚3 ≡1 ∑︁
(𝑥𝑖 − 𝑥)¯ 3
𝑁 𝑖=1(2)is the third central moment of the waveform data, 𝑥 𝑖 withsample mean 𝑥.
¯ Skewness is a dimensionless number thatis easy to understand intuitively; it tells us whether, and by
how much, the distribution is skewed positive or negative.
The application has a user defined maximum skewness
threshold, set to 0.0 in Fig. 2 for both horizontal and vertical.
If the skewness is above this threshold, the signal is declared
BAD and the tune feedback loop will open after a given
number of attempted tune measurements, which is set to 15in Fig. 2.
If the application does not receive fresh data from thebunch-by-bunch system in a given number of seconds, set
to 10.0 s in Fig. 2, the signal is declared TIMEOUT and thetune feedback loop will open.
In normal conditions, for the signal to have status GOOD
and allow the tune feedback loop to be closed, the notch mustbe large, the skewness must be negative and the waveforms
from the bunch-by-bunch system must be updating.
If we lose the beam in the storage ring, the tune feedback
loop opens because the signal goes LOW. It might also beMOP037

08 Feedback Systems and Beam Stability

107

Content from this work may be used under the terms of the CC-BY-4.0 licence (© 2023). Any distribution of this work must maintain attribution to the author(s), title of the work, publisher, and DOI

12th Int. Beam Instrum. Conf.
ISBN: 9 7 8 - 3 - 9 5 4 5 0 - 2 3 6 - 3

IBIC2023, Saskatoon, Canada
JACoW Publishing
ISSN: 2 6 7 3 - 5 3 5 0d o i : 1 0 . 1 8 4 2 9 / J A C o W - I B I C 2 0 2 3 - M O P 0 3 7

Figure 2: Tune feedback system expert panel.
BAD, but we have specified that LOW will take priority
over BAD. After the signal goes LOW, what should thequadrupole set points do? Through testing and experience,
we found that we usually want to set the quadrupoles to theirdefault settings, zeroing any offsets that tune feedback has
applied. This makes it easier for the operators to performthe recovery injection, when many insertion device gaps areopened. However, for some machine studies activities, wewant the opposite behaviour, with the quadrupole values
staying unchanged when we intentionally dump the beam.
The checkbox ‘Set Quadrupole Delta to Zero on LOW signal’on Fig. 2 allows the operator to set the desired behaviour.
For signals that are BAD but not LOW, the tune feedback
application does not set the quadrupoles to their default
values, and this is a choice based on experience. A BAD
signal usually means a vacuum transient is occurring in thestorage ring. The desired behaviour is for tune feedback topause during a short transient, and resume after it passes.
The nominal tune feedback configuration settings are conservative to ensure that the application does not attempt
to correct the tunes using questionable data. If there is
an issue with the signals from the bunch-by-bunch system,
there are many degrees of freedom to adjust in order to keep
tune feedback operating. For example, we replaced a failed
component external to the bunch-by-bunch system and thiscaused a slight timing change for an incoming signal. This
resulted in notches that were not optimal with some positivegoing structure and small signals. We were able to adjust
the tune feedback application options in order to run withthe distorted notches until the bunch-by-bunch system wasreoptimized for the shifted timing.

Once we have the tune measurements, we can use twoquadrupole families to adjust them. We use the QFA andQFB quadrupole families, which are the two quadrupolefamilies between the ends of the straight sections and thedipoles in the double bend acromats, as shown in Fig. 3. For
the CLS storage ring, all of the vertical focusing is done inthe dipoles, so there are no vertically focusing quadrupoles.
We are able to use two horizontal focusing quadrupoles because the horizontal and vertical betatron functions are very
different at these quadrupole locations. The quadrupoles
can be adjusted together to control one tune without varying
the other.

Betatron Function (m)Content from this work may be used under the terms of the CC-BY-4.0 licence (© 2023). Any distribution of this work must maintain attribution to the author(s), title of the work, publisher, and DOI

12th Int. Beam Instrum. Conf.
ISBN: 9 7 8 - 3 - 9 5 4 5 0 - 2 3 6 - 3x25yQuadrupole
Sextupole
Bend2015
10505

QFA QFB
024Longitudinal Position (m)QFC
6Figure 3: Betatron functions for one half of a double bend
acromat cell.

MOP03710808 Feedback Systems and Beam Stability

IBIC2023, Saskatoon, Canada
JACoW Publishing
ISSN: 2 6 7 3 - 5 3 5 0
d o i : 1 0 . 1 8 4 2 9 / J A C o W - I B I C 2 0 2 3 - M O P 0 3 7As we are treating quadrupoles as families, we areperforming a global tune correction, not a local correction. The tune feedback application outputs settings to a
Quadrupole Feedforward application, which applies offsets
to the quadrupole settings without overwriting the nominalsettings.
The tune feedback application can measure a 2x2 response
matrix by varying the two quadrupole families and measuring the tune shifts. It then inverts the response matrix todetermine the necessary change in quadrupole settings toshift the tunes toward the desired setpoints. This is a simple
proportional loop and the application includes proportional
gains, which are set to 0.8 in Fig. 2. The plot ‘Tune: Setpoint- Feedback’ in Fig. 2 shows that, as the tunes vary due tonoise in magnet power supplies and insertion device motion,
the tune feedback application brings the difference towardzero.
The quadrupole power supplies date from the original
installation of the storage ring and the design is over 20years old. They are not intended to be updated quickly andwe find that updating them at 0.25 Hz works well. Thetune data update at a rate of 1 Hz and the tune feedback
application simply skips a number of tune measurements,
set to 3 in Fig. 2. The ‘Iteration Time’ plot in Fig. 2 shows thetime to take a tune measurement, the pause when skipping
measurements and the total loop time. The ‘Tune Time
Difference’, which should ideally be zero, is not always so;
this is a complex timing issue stemming from how we get
the information from the bunch-by-bunch system. We chose
not to resolve this issue as it would have required substantial
investigation time for no practical benefit.
The tune feedback application generates an alarm to tell
the operators if the loop is open when it should be closed.
The logic developed over several iterations as we worked
to suppress nuisance alarms. For modes other than user
operations (mode: STORED), tune feedback is not required.
If we are delivering low current for beamline conditioning,
the signals from the bunch-by-bunch system may not be sufficiently strong, so we don’t use tune feedback. After an
injection, completing the procedure requires a number of
seconds between the operator switching to STORED modeand closing the tune feedback loop; the alarm is suppressed
after entering STORED mode for a short time, set to 120 sin Fig. 2. Using this logic, nuisance alarms have been suppressed; if the tune feedback alarm appears in the alarm
handler, then there is a real problem. For example, a recent
vacuum issue in the storage ring caused a number of tune
feedback alarms because the loop was opening when a vacuum transient would cause the signal to be BAD for morethan 15 tune measurements. The tune feedback application
functioned as designed and the failed vacuum component
was identified and replaced.
While the expert panel of Fig. 2 contains many usefulfeatures, the operators rarely need to adjust them. Figure 4
shows a very simple GUI, which presents the most important
information, allows the operators to turn the systems on andoff, and provides access to the expert panel.

Figure 4: Tune feedback operator controls.

CONCLUSION
When CLS moved from decay mode operation to top-up,
we received a very positive response from the user community. With an eclectic mix of insertion devices, the horizontal and vertical tunes will vary as insertion device setpoints
are changed. The tune feedback system has been essential
for maintaining good injection efficiency in this dynamicenvironment. The final product is the result of several development iterations and input from many individuals.

ACKNOWLEDGMENTS
We would like to thank D. Teytelman (Dimtel), T. Batten(CLS) and J. Vogt (CLS) for implementing and maintaining
the bunch-by-bunch system and teaching us how to use it.
The Canadian Light Source receives funding form theCanadian Foundation for Innovation, the Natural Scienceand Engineering Research Council of Canada, the Universityof Saskatchewan, the Canadian Institute for Health Researchand the Government of Saskatchewan.

REFERENCES[1] W. A. Wurtz, L. O. Dallin, and M. J. Sigrist, “Beam Based
Measurements with Superconducting Wigglers at the CanadianLight Source with Applications to Nonlinear Beam Dynamics”,
in Proc. IPAC’12, New Orleans, LA, USA, May 2012, paper
TUPPP001, pp. 1599–1601.
[2] W. A. Wurtz, C. K. Baribeau, and M. J. Sigrist, “Rectifying
unexpected injection issues due to an elliptically polarizingundulator”, Nucl. Instr. and Meth. A, vol. 1048, p. 168001,
2023. doi:10.1016/j.nima.2022.168001[3] The PyEpics Collaboration, https://pyepics.github.
io/pyepics/index.html[4] Project Management Institute and Agile Alliance, Agile Practical Guide, pp. 24-25, Project Management Institute Inc., 2017.
[5] Dimtel, San Jose, USA. http://www.dimtel.com

MOP03708 Feedback Systems and Beam Stability

109

Content from this work may be used under the terms of the CC-BY-4.0 licence (© 2023). Any distribution of this work must maintain attribution to the author(s), title of the work, publisher, and DOI

12th Int. Beam Instrum. Conf.
ISBN: 9 7 8 - 3 - 9 5 4 5 0 - 2 3 6 - 3

Content from this work may be used under the terms of the CC-BY-4.0 licence (© 2023). Any distribution of this work must maintain attribution to the author(s), title of the work, publisher, and DOI

12th Int. Beam Instrum. Conf.
ISBN: 9 7 8 - 3 - 9 5 4 5 0 - 2 3 6 - 3

IBIC2023, Saskatoon, Canada
JACoW Publishing
ISSN: 2 6 7 3 - 5 3 5 0d o i : 1 0 . 1 8 4 2 9 / J A C o W - I B I C 2 0 2 3 - M O P 0 3 7[6] D. Teytelman, iGp12-285F Signal Processor Technical User
Manual, Rev 2.15, 2019.
[7] D. Teytelman, “Experience with feedback systems in modern
synchrotron light sources”, presented at the Accelerator

Performance and Concepts Workshop, Frankfurt, Dec. 2018.
https://indico.gsi.de/event/7510/
contributions/33547/attachments/24263/30374/
dt_feedback_apec_20181211.pdf

MOP037110

08 Feedback Systems and Beam Stability