Transient beam loading effects in harmonic rf systems for light sources

Harmonic cavities have been used in storage rings to lengthen bunches and increase beam lifetimes dominated by Touschek scattering. Transient beam loading in the harmonic cavities generated by asymmetries in the fill pattern causes significant variation of the bunch synchronous phase and bunch length along the bunch train when the longitudinal restoring force has been reduced. This results in a significant reduction in the mean bunch lengthening and potential lifetime increase. We describe how beam current modulations give rise to transient effects much larger than expected from the linear model of the beam cavity interaction. We also develop a tracking simulation to predict results and apply this simulation to an analysis of the beam loading transients for the case of passive and active normal and superconducting third harmonic rf systems using Advanced Light Source parameters.


I. INTRODUCTION
The beam lifetime in low-medium energy third generation synchrotron light sources is typically dominated by large-angle intrabeam (Touschek) scattering. Much attention has been paid to the use of harmonic rf systems to lengthen the bunches and improve the lifetime [1][2][3][4]. Under ideal conditions, one expects lifetime improvements of a factor of 2-4, depending on the machine parameters. Harmonic rf systems have recently been installed and commissioned on several third generation light sources, with varying degrees of lifetime improvement [5][6][7]. There are also several proposed installations [8][9][10][11]. In these rings, the distribution of current in rf buckets is rarely uniform because of limitations in the injector, gaps for beam kicker rise times or for clearing trapped ions, or because of user requirements. For example, the Advanced Light Source (ALS) presently operates with a 17% gap in the fill pattern which is necessary for one class of synchrotron light experiments. We have observed in the ALS that gaps in the fill pattern create transient beam loading effects along the bunch train which significantly degrade the total amount of bunch lengthening and thus the lifetime improvement. There is an additional side effect of a large variation in bunch synchronous phase along the bunch train, causing problems for a number of ALS technical systems. For example, shown in Fig. 1 is a measurement of the transient effects observed in the ALS for both the nominal 17% gap and for a 2.5% gap in the fill pattern. Figure 1a shows the variation of the relative synchronous phase and Fig. 1b the variation of the bunch length along the bunch train. Both figures were extracted from a streak camera image of the bunch train. For the larger gap, there is a large variation in the relative phase and bunch length. We have been able to quantitatively explain this behavior by analyzing the transient beam loading of the harmonic cavities induced by the gaps in the fill pattern. We believe that the transient behavior is not specific to the ALS and presents a serious limitation to the lifetime improvement which can be achieved with harmonic systems in third generation light sources, regardless of whether the system is active or passive, normal or superconducting.
In this paper we present both a qualitative and a quantitative analysis of the transient loading effects in harmonic rf systems. Section II presents an introduction to harmonic rf systems and the longitudinal beam dynamics with harmonic cavities. Transient beam loading of the main rf system has been studied in a variety of storage rings. In this paper, we refer to transient loading only in the context of a steady-state condition which arises from an asymmetric fill pattern and not to transient effects from a perturbation of a steady-state condition such as injection. For most main rf systems, it is possible to use a linear model of the beam cavity interaction to estimate the level of transient effects. However, because of the inherent nonlinearity of the longitudinal beam dynamics with a harmonic rf system, the linear model tends to underestimate the degree of the transient. For this reason we have developed a computer tracking code to model the transient. This code is described in Sec. III along with several examples of how it can be used. Section IV presents our results of a survey comparing four cases: passive and active normal conducting (NC) harmonic cavities and passive and active superconducting (SC) harmonic cavities. We believe these results may apply to the operation of such systems which are in either the design or the construction stage at light sources around the world. Section V presents a discussion and conclusions.

A. Longitudinal beam dynamics
Consider the voltage seen by the bunch generated by the main rf system as shown in Fig. 2. Near the bunch center, the restoring force of the rf voltage is approximately linear. Given a Gaussian energy spread, the resulting longitudinal distribution is also Gaussian. If another voltage is added to the main rf voltage with an amplitude and phase such that the slope at the bunch center is zero, the energy distribution is unaffected but the bunch lengthens and the peak charge density decreases. If the lifetime is dominated by Touschek scattering, the lifetime improvement is approximately equal to the reduction in peak density or bunch length increase.
To produce the harmonic voltage, a second rf cavity system is installed in the ring with a resonant frequency several times the main rf cavity. The voltage in the harmonic cavity is generated either by an external generator (active) or by the beam itself (passive). The combined voltage from the main and harmonic rf system can be written as where k is the relative harmonic voltage to the main rf voltage, f 1 and f 2 are the stable phases with respect to the main and harmonic voltages, and n is the ratio of the harmonic and main rf frequencies.
The longitudinal density distribution is given by [2,4] r͑z͒ re 2F͑z͒͞a 2 s 2 e , where r is a normalization constant such that R r͑z͒ dz 1, a is the momentum compaction, and s e is the rms energy spread. The potential, F͑z͒, is given by where C is the circumference. Using the above equations, the longitudinal bunch distribution can be shaped by varying the relative amplitude and phase of the harmonic voltage and thus the potential. To lengthen the bunch, the harmonic amplitude and phase should be adjusted to cancel the slope of the main rf voltage at the bunch center. The potential well and bunch distribution with harmonic voltage and phase adjusted to cancel the slope of the main rf voltage are shown in Fig. 3a. Shown in Fig. 3b are the potential wells and distributions for the conditions in Fig. 3a except with a 60.5 ± phase shift, indicating the sensitivity of the bunch shape and longitudinal centroid position (i.e., synchronous phase) to small variations. The reduction in longitudinal focusing needed for lengthening the bunch is the main reason for this sensitivity.
It is useful to note that if the harmonic voltage were phased such that the slopes of the main and harmonic voltages added rather than canceled, the bunch would be shortened. In this condition, the bunch shape and position are much less sensitive to variations in the harmonic voltage and phase and thus transient effects are expected to be less significant.

B. Transient effects in rf systems
Transient beam loading in storage ring rf systems has been studied for some time. Most recent studies have looked at synchronous phase transients in high current electron-positron colliders [12][13][14][15] and in harmonic rf systems [8,16]. For small perturbations in the voltage along the bunch train, one can estimate the transient bunch synchronous phase by where DV is the variation in voltage along the bunch train, Q s is the synchrotron tune, h is the harmonic number, and E is the beam energy. Note that the voltage perturbation in Eq. (4) does not account for the effect of the phase transient itself. Using ALS parameters with harmonic cavities tuned to give optimum lifetime improvement as described in [1], one can make a first-order estimate of the voltage perturbation simply by computing the decay of the voltage during the beam gap. We compute a change in voltage of about 20 kV. Assuming the nominal synchrotron tune, this results in a negligible phase transient of about 1.1 ± at the rf frequency. At full bunch lengthening, the synchrotron tune approaches zero (to first order) and the transient becomes infinite due to the absence of longitudinal focusing. As we show in Sec. III, the above argument under-or overestimates the amplitude and nature of the transient but does demonstrate the sensitivity of the phase transient on the degree of longitudinal focusing in its dependence on the synchrotron tune. An example of a more accurate model is the small-signal modulation (Pedersen) model of the beam cavity interaction [17]. The Pedersen model includes beam feedback on the transient (i.e., the effect of the beam phase transient on the voltage transient.) However, this model lacks in two respects: it assumes small amplitude modulations of the quantities such as beam synchronous phase and cavity voltages and does not account for variations in the longitudinal beam dynamics such as the variation of the synchrotron tune. For this reason, we believe that the most accurate method currently available for computing the transient effects and the resulting effect on beam lifetimes is via computer simulation. This is discussed in the next section.

III. COMPUTER SIMULATION OF PASSIVE AND ACTIVE HARMONIC CAVITIES
Given the limitations of an analytical model for describing the transient effects in the presence of a harmonic rf system, we have developed a computer tracking code to find the steady-state main and harmonic voltages and phases along the bunch train. Using these values, we compute the corresponding bunch shape and lifetime increase for each bunch and the overall lifetime increase of the beam. This section presents a description of the tracking code and several examples which we use to describe the transient effect in detail.

A. Tracking model
To find the steady-state harmonic and fundamental voltage along the bunch train, we model each bunch as a macroparticle [18,19] and develop difference equations which track the motion of each bunch and the voltage and phase in the main and harmonic cavities. Difference equations for the synchrotron oscillations of each bunch can be expressed aś and where´is the relative beam energy deviation, and f is the bunch phase with respect to the nominal synchronous phase. l rad is the radiation damping rate expressed in units of the rotation frequency and U 0 is the radiation loss per turn. V g and V b are the sums of the generator and beam-induced voltages in the main and harmonic cavities and are defined further below. V g is given by where f 1 and f 2 are the relative stable phases for the main and harmonic voltages, c 1,2 are the tuning angles for either cavity, and f L1,2 are the load angles for either cavity [17].
In all of our simulations, we assume that beam loading in the main cavity and actively driven harmonic cavity is compensated to maintain a constant voltage assuming no transient effects (i.e., no gap). To compensate for beam loading, the amplitude of the generator voltage, V gj ͑j 1, 2͒, is increased as a function of beam current according to the following: where I b is the dc beam current, and the loss current I 0 V cell ͞R l . V cell is the voltage per cell and R l is the loaded shunt impedance. The tuning angle c j is given by where y j 2I b ͞I 0 , assuming short bunches. The tuning angle is related to the detuning of the cavity by The beam voltages for both main and harmonic cavities are found from the difference equatioñ whereṼ b,i11 is the phasor representation of the beam voltage and k v res,n R ln ͞2Q ln . Dt is the difference in arrival times of the current (tth) and previous bunch (t 2 1th) given by where T b is the number of buckets between the bunches multiplied by the rf period.
Using the above set of equations, we can track the motions of an arbitrary number of bunches with both main and harmonic voltages, as well as any number of higher order modes. Once the macrobunches have reached their steady-state values, we use the harmonic voltage and phase at each bunch to compute the bunch lengthening and lifetime improvement for that bunch which is then used to find the average lifetime improvement.
As discussed further in the next section, we believe that this tracking model accounts for most of the important effects. However, one of the primary limitations of the macroparticle model is the absence of any intrabunch effects such as bunch lengthening and Landau damping, especially because harmonic cavities can have significant impact in both of these areas. For the scope of this paper, Landau damping is not a major concern since we are studying only steady-state effects. However, bunch lengthening can affect the voltage generated in the harmonic cavity in the passive case by reducing the Fourier component of the beam current exciting the cavity. For ALS conditions, we believe this is a small effect since the current component driving the harmonic cavities (1.5 GHz) is reduced only by 4% at full bunch lengthening due to the relatively short natural bunch length. In other rings, the effect could be much larger depending on which harmonic is used and the natural bunch length.
Another limitation of the macroparticle model is that it restricts modeling to the "understretched" regime of bunch lengthening where there is only a single fixed point in the rf bucket. In the "overstretched" regime, two fixed points are formed and the macroparticle damps to one or the other depending on the initial conditions whereas an actual bunch will tend to fill both minibuckets. We believe that extending the code to include these effects is straightforward but operation will be CPU intensive.

B. Examples and discussions
In this section we present several examples of the results of the tracking code and subsequent calculation using ALS parameters in order to demonstrate the method for determining the overall lifetime improvement. We also use these examples as a basis for a physical explanation of the effect.
The relevant parameters for the ALS are summarized in Table I. As described elsewhere [1], the optimum number of NC cavities for ALS parameters is about three, so we will consider the effect of only three cells tuned above the third rf harmonic to a value of h res f res ͞f 0 984.32. The tracking code shows that this working point gives the best improvement in lifetime with the standard operation conditions at ALS and we use it in this section to illustrate the effect of transient beam loading. For this case, we compute the transient effect produced by a 17% gap in the fill pattern for an average beam current of 400 mA and compare the resulting lifetime with the case of a perfectly uniform fill at the same beam intensity.
Two examples of output from the code are shown in Fig. 4. Figure 4a shows the turn by turn beam phase (relative to the nominal synchronous phase) for a uniform fill of 328 bunches. For compactness, only the phase from every fourth bunch is shown. In this case, the bunch synchronous phase converges to a single steady value for all the macroparticles: no steady-state transient effect is observed. After convergence, the tracking simulation shows good agreement with theoretical values for the bunch synchronous phase and harmonic voltage phase. From the simulated values of the harmonic voltage and phase, we calculate bunch lengthening of about a factor of 2, again in agreement with independent calculations. Figure 4b shows the result for the same average beam current but with a 17% gap in the fill pattern. In this case, the bunch synchronous phase converges to a different value for each bunch. This is more evident in Figs. 5a-5c which shows expanded views of the turn by turn phase in Fig. 4b. An initial equal beam phase evolves over a damping time to state where the head of the bunch train has a different relative phase from the tail of about 0.3 rad. This is in good agreement with the observations shown in Fig. 1. However, a detailed comparison between the tracking model and experimental results is beyond the scope of this paper and will be addressed in a subsequent paper. Figure 6 summarizes the tracking results which are used to compute the lifetime increase along the bunch train. Figure 6a shows the steady-state distribution of the relative Harmonic phase 20.0275 rad synchronous phase along the bunch train. Figure 6b shows the amplitude and phase of the harmonic voltage along the bunch train. The amplitude is the peak value of the voltage and the phase is the harmonic phase at the bunch and can be used directly to compute the bunch lengthening as described in Eqs. (2) and (3). Note that the slope of the harmonic voltage is computed as the peak voltage multiplied by the cosine of the harmonic phase. As a consequence, the relative amplitude and phase of the harmonic and main voltages vary significantly along the bunch train, leading to a variation in the bunch lengthening along the train, as shown in Fig. 6c. bunch lengthening and lifetime increase with a nonuniform fill pattern is a serious concern since this is the primary goal of the harmonic system. This example shows three surprising features which distinguishes this effect from conventional transient effects in main rf systems. The first is the modulation pattern of the harmonic voltage. For comparison, the transient loading of most fundamental rf systems results in a voltage which ramps uniformly over the bunch train with a decay during the gap. The second is that the harmonic phase varies by almost 180 ± over the bunch train. The third feature is that the peak increase in bunch length occurs at the minimum of the harmonic voltage transient.
It is worth examining these features in more detail. Consider the modulation of the harmonic voltage as shown in Fig. 6b. The maximum value of about 350 kV is close to the value needed for optimum bunch lengthening. However, the phase of the voltage is different from the optimum phase by about 90 ± . The net result is only a 37% increase in bunch length. Near the center of the bunch train, the harmonic phase is at the optimum value, but it occurs at a minimum of the harmonic voltage resulting in only a 45% increase. At the end of the bunch train, the harmonic voltage is again near optimum, but the harmonic phase is off by 90 ± in the other direction. We believe that the key to understanding this unusual transient behavior lies in the harmonic phase transient. Because of the reduction of longitudinal focusing, the bunch phase becomes very sensitive to the harmonic phase as shown in Fig. 3b. This in turn amplifies the voltage transient induced by the gap in the bunch train. At some point, the harmonic voltages at the head and tail of the train are almost completely out of phase. Thus the peak amplitude of the phase is at a minimum near the center of the train. The harmonic phase exhibits a "seesaw"-like behavior between two extreme phases and only at the midpoint of the transient is the phase at the proper value for bunch lengthening. Unfortunately, the amplitude of the harmonic voltage is at its minimum at this point, reducing the total bunch lengthening.
We believe this seesaw behavior of the harmonic phase is typical of transient effects in harmonic rf systems and is responsible for the reduction in potential lifetime increase. It does not depend greatly on the damping in the rf cavity (i.e., NC or SC) because the effect relies only on energy exchange between the beam and cavity and not on dissipation. Therefore this needs to be investigated carefully before designing an harmonic rf system for light sources which are operated with an asymmetric fill pattern. A systematic study of the transient effects for normal and superconducting harmonic cavities is presented in Sec. IV.

C. Robinson instabilities
Here we show that the simulation code correctly models Robinson instabilities in the absence of any intrabunch Landau damping. This is particularly important in this case because the harmonic cavity must be tuned to the Robinson unstable side of the rf harmonic to achieve bunch lengthening, possibly exciting the ac Robinson instability if the Robinson damping of the main rf cavities is exceeded. Furthermore, because the dc Robinson instability depends on the effective beam power loss, the additional beam power dissipated in a passive harmonic system lowers the threshold for a dc Robinson instability. Either instability may occur if the harmonic cavities are tuned too close to the third harmonic. In addition, the stability criterion can be quite different in the presence of a substantial bunch synchronous phase transient. Although these effects have been discussed elsewhere [20], we show an example of an ac and a dc Robinson instability to demonstrate the ability of the code to correctly model these effects. This is important to the study of transient effects because the Robinson instabilities limit the tuning range of cavities.
Shown in Fig. 7a is an example of an ac Robinson instability that was obtained with five cavities tuned to 984.3 3 f 0 for a uniform filling. The growing synchrotron oscillation corresponds to growth of the mode with all bunches oscillating in phase. As mentioned above, the stability of this mode may be substantially increased if Landau damping is taken into account. Figure 7b shows the evolution of the beam phase obtained in uniform filling with two cavities tuned to 984.05 3 f 0 . Here, the focusing forces driven by the rf generator are not sufficient to compensate the beam driven voltage in both the main and the harmonic cavities, and a stable phase no longer exists and the dc Robinson instability is excited.

IV. RESULTS
This section presents quantitative results from simulation of passive NC and SC systems, active NC and SC systems, a beam compensation scheme, and an energy storage cavity. In order to make as fair a comparison as possible between the various cases, our approach has been to tune the frequency of each cavity to its optimum settings for a uniform filling pattern. We then evaluate the dependence of the phase transient and bunch lengthening on the cavity frequency. Thus all cases are compared with approximately the same total voltage.

A. Normal conducting cavities
In Sec. III B it was shown that a gap in the fill pattern induces an irregular improvement in lifetime along the bunch train. With five normal conducting harmonic cavities installed on the ALS ring, several tuning combinations have been simulated with the goal of obtaining a maximum of lifetime with a 17% gap in the fill pattern for a current of 400 mA. As explained in the previous section, with four or five cavities operated in bunch lengthening, the beam systematically becomes unstable before the required harmonic voltage is reached, i.e., before substantial lengthening is obtained. Figure 8a summarizes the results for several working points making use of either two or three harmonic cavities to achieve the desired harmonic voltage. For each operating point, the extremities of the vertical bars and the marker in-between give the maximum, minimum, and average lengthening factor within the bunch train, respectively. The abscissa represents the total phase transient along the bunch train. In these examples, the maximum gain in lifetime remains below a factor 1.5 and the average does not even exceed 1.42, which is lower than the factor 2.2 that can be obtained for a uniform fill pattern. The gap in the fill pattern induces a strong modulation of the harmonic voltage and phase around the optimum values which limits the lengthening. The simulation also shows that the phase transients increase with the number of harmonic cavities in operation.
In the case of the ALS where only two or three harmonic cavities are used for bunch lengthening, the remaining cavities are tuned to minimize the interaction with the beam, usually between rotation harmonics of a few rotation harmonics away from the rf harmonic. This is referred to as "parking" the cavities. Figure 9 shows how two cavities parked at h res 986.5 and 981.5, respectively, modify the transient beam loading, when three cavities are operated in bunch lengthening with h res 984.32. One observes a modulation of the harmonic voltage at n 3 f 0 along the bunch train if the parked cavities are tuned to 6͑n 1 0.5͒ 3 f 0 with respect to 3 3 f rf . The amplitude of this modulation is lower for larger n. However, including the parked cavities in the simulations increases the overall phase transient only from 0.24 to 0.27 rad and does not significantly affect the gain in lifetime.

B. Passive superconducting harmonic cavity
ELETTRA and SLS plan to install a passive SC harmonic cavity in their ring, which has been developed in a collaboration with the CEA [21]. Compared to NC cavities, SC cavities present several advantages. Only a single SC cavity is required to provide enough harmonic voltage to significantly lengthen the bunch, even at lower currents, while dissipating only negligible power from the beam. A harmonic SC cavity is tuned far from resonance where the harmonic phase is close to optimum (ϳp͞2) and the resistive impedance at the beam harmonic is nearly zero. One therefore expects less sensitivity to the ac Robinson instability. Moreover, modern SC cavities are designed with strong higher order mode damping and the lower R͞Q is expected to induce less transients.
We performed simulations using ALS parameters for several tunings of the ELETTRA/SLS harmonic cavity in order to quantify the beam transients. Note that the simulations require substantially more time to reach steady state for the SC case because of the higher Q. The relevant cavity parameters are R͞Q 87 V, Q 2 3 10 8 . Figure 8b summarizes the lifetime improvement and phase transients obtained for various tunings of the SC cavity. A tuning according to h res 984.2 or 984.15 is still far from the condition for maximum bunch lengthening at 400 mA and the gain in lifetime is only about 1.5. We observe that the phase transients for a 17% gap are small and the whole bunch train experiences nearly the same lifetime improvement. When the cavity is tuned closer to resonance, substantial phase transients also appear with the SC cavity. Even though some bunches in the train are significantly lengthened, the average lengthening never exceeds a factor of 1.8. As compared to NC cavities, a SC cavity may be operated with much less transient effects and yields a larger average improvement in lifetime, primarily because fewer cells are needed to achieve the optimum voltage.
Because of the high Q of SC cavities, it is natural to imagine that the transient effects experienced with NC harmonic cavities will not be a problem. However, as discussed earlier, it is only the R͞Q which determines the scale of the effect. We demonstrate this here by comparing the results for a SC cavity with NC cavities for identical beam parameters and for similar amounts of bunch lengthening. The results are shown in Table II. We observe that a SC and a NC cavity with the same R͞Q 87 V induce almost the same phase transients (Df tr ). Note that the ratio of the Q for these two cases is ϳ10 4 . With an R͞Q 3 3 87 V, the phase transients are increased by a factor varying between 2 and 4. So, the lower the R͞Q, the smaller the transient effects. With respect to phase transients, SC technology has the great advantage that only one harmonic cavity suffices to provide the necessary harmonic voltage and that the total installed R͞Q can be several times smaller than for a standard NC solution. The next section describes simulation results using an energy storage cavity to reduce the R͞Q for a NC structure.

C. Energy storage cavities
For KEKB, ARES-type NC cavities exhibiting low R͞Q have been implemented in order to minimize phase transients [22]. They consist of three coupled NC cavities: an accelerating cavity, a coupling cavity, and an energy storage cavity. The latter one allows a fivefold increase in Q of the accelerating mode while its shunt impedance R is kept constant. The coupling cavity also strongly damps the impedance of the parasitic coupled modes. We have  Fig. 8b for three such cavities in the ring predict the average lifetime improvement factor of up to 1.8, which is as large a performance comparable with the best result for a SC cavity. The differential lengthening within the bunch train, however, is still not completely suppressed. A SC cell with a comparable reduction in the R͞Q would show a practically equivalent performance with the ARES cells.

D. Transient compensation with beam
Since most synchrotron light users are not sensitive to variations of the bunch intensity along the train, we have investigated the effects of tailoring the fill pattern to partially compensate for the beam loading transient.
The theoretical study of the beam loading transient for nonuniform fills in the presence of a higher harmonic rf system is extremely complicated, nonetheless simulations can give some insight and suggest the best course of action. Our idea was to concentrate the phase transient over a smaller number of bunches while keeping the others at the optimal phase as much as possible. Figure 10 shows the effect of adding an additional charge to 40 bunches at the head and the tail of the train. The intensity of the remaining 192 bunches in the middle has to be reduced to keep the total current at 400 mA. In this particular case the higher current bunches have 47% more current than the standard 1.47 mA for a uniform fill and the reduced current bunches have therefore only 80% of the usual charge. The corresponding bunch phase function is flat in the middle of the train and it is worth noticing that the overall phase variation is smaller compared to the uniform fill with a gap, though the reason for this is not yet clear and still requires further investigation.
Since the Touschek lifetime is inversely proportional to each bunch charge, it is obvious to expect a reduction in the lifetime for the higher current bunches. This is true for only part of them, as shown in Fig. 10c, and overall it is more than compensated by the increased lifetime for all the bunches in the middle of the train. The average lifetime improvement is 2.09.

E. Active cavities
The main interest in using an active harmonic system is to reach the conditions for maximum bunch lengthening independent of the beam current. In this section, we apply the tracking simulation to the same cases studied earlier as passive cavities. We varied a number of parameters including the harmonic cavity tuning, generator power, and generator coupling. Figures 11a-11c give some of the best results obtained in terms of lifetime improvement for standard ALS NC cavities, a SC cavity, and ARES cavities, respectively.
Our results showed that even for active cavities, substantial phase transients are observed with a 17% gap in the fill at 400 mA. This is mainly due to the fact that a substantial beam voltage is still present in the active case and variations thereof have a similar effect as before. We found we were able to phase the generator voltage in such a way as to cancel the beam voltage. In this case, we were able to almost completely eliminate the transients. Unfortunately, this required an impractical amount of harmonic power (.1 MW).
As shown in Fig. 11a, a single active harmonic cavity, with a voltage limited to 125 kV, allows us to lengthen the bunches by a factor of about 1.55, which is already more than the factor of 1.42 achieved with two or three passive cavities (Fig. 8a). The transient effects remain small. Two active cavities would basically allow an operation closer to the optimum voltage. However, the transient effects become stronger, and only little improvement in average lifetime is obtained at the expense of a larger spread within the bunch train. This surprising result arises simply because of the reduction of the transient effects. Although the effective voltage is much lower than optimum, it is applied more uniformly to the bunch train and thus a higher average lifetime increase is achieved.
In the case of the SC cavity, the comparison between Figs. 8b and 11b shows that the external generator does not allow significant reduction of the transient effects. Moreover, because a SC cavity can still produce large harmonic voltage at even low currents, there is less interest in the implementation of an external harmonic generator. Four actively operated ARES-type harmonic cavities give the best results with respect to average lifetime improvement with a factor of about 2.1 as shown in Fig. 11c.

V. CONCLUSIONS
Phase transients and subsequent differential lengthening within the bunch train have been computed for various types of active and passive harmonic cavities by means of a tracking simulation. It has been shown that the adverse transient effects increase with the total R͞Q of the harmonic system. Normal conducting ARES systems using energy storage cavities to minimize the R͞Q or a SC cell with reduced R͞Q yield the highest average lifetime improvement in the presence of a gap in the fill pattern. However, several cells would still be required to achieve the desired voltage. In general, superconducting harmonic cavities are less sensitive to transients than standard normal conducting cavities and appear to give a better overall lifetime improvement compared with NC cavities. The most promising method for compensating for the beam loading transient appears to be a tailored fill pattern. Our example of a 50% current increase at both ends of the bunch train appears to flatten the harmonic phase over a large fraction of the bunch train and provide the best lifetime increase. There may be even better solutions and we are still investigating whether these gains are possible given practical considerations such as the achievable fill uniformity.
For normal conducting systems, an external generator has two advantages. It allows bunch lengthening down to low beam currents and helps reduce the impact of phase transients on the gain in lifetime. However, for large beam loading, an unreasonable amount of generator power is needed to cancel the transient. For a superconducting cavity, we believe a generator is of little interest for lifetime improvements.