{'fraction_non_alphanumeric': 0.023237899602002825, 'fraction_numerical': 0.008601874438310437, 'mean_word_length': 4.608351331893449, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Simulation of quench detection algorithms for Helmholtz Zentrum Berlin SRF cavities

The Helmholtz Zentrum Berlin is carrying out two accelerator projects which make use of high gradient Continuous Wave (CW) Superconducting Radiofrequency (SRF) cavities: bERLinPro and BESSY-VSR. In both projects, a prompt detection of a quench is crucial to avoid damages in the cryomodules and cavities themselves. In this paper, the response of real time estimation of the cavity parameters using the transmitted and forward RF signals is simulated, in order to perform the quench detection. The time response of the estimated half bandwidth is compared with the dissipated energy in the cavity walls for the different type of SRF cavities used in both projects, i.e., bERLinPro’s photoinjector, booster and linac, and BESSY-VSR 1.5 GHz and 1.75 GHz cavities. As an intermediate step prior to the implementation in an mTCA.4 system together with the LLRF control and test with a real cavity, the algorithm has been implemented using a National Instruments FPGA board to check its proper behavior.


Introduction
Continuous Wave (CW) high gradient operation of SRF cavities is a shared characteristic of the two projects currently in implementation phase at Helmholtz Zentrum Berlin (HZB): BESSY-VSR [1] and bERLinPro [2]. The former project consists of introducing SRF cavities at 1.5 and 1.75 GHz in the storage ring of the BESSY-II synchrotron light source to allow short and long pulses at the same time. The latter is a demonstration facility for the science and technology of ERLs for future light source applications.
During a quench the quality factor of the cavity Q0 will decay from the superconducting value (in the order of 10 10 ) to the normal conducting one (10 4 ) causing a change in the loaded quality factor, Q L = where Qe is the external quality factor whose values depend on the application. Two types of quenches can be considered: hard and soft quenches [3]. In the former the full cavity becomes normal conducting while in the latter only portions of the cavity turn normal conducting. As the heat load increases, this portion expands until the full cavity quenches. In CW operation, unlike in pulsed operation, QL cannot be calculated using the pulse decay for hard quenches detection and there is no time without RF where a soft quench can be partially recovered. Thus, when a quench occurs the dissipated power in the walls dramatically increases reaching the limit of heat transport capacity of the helium system. In this situation, it is of paramount importance to have a CW quench detection procedure integrated in the Machine Protection System (MPS). It is important to remark that ω1/2 only changes significantly when Q0 gets comparable with Qe inducing thus a change in QL and that the lower the Qe, the later the quench will be observable.
The real time cavity parameters' estimation using the transmitted and forward signals can be implemented in the Low Level RF (LLRF) control hardware [4]. In this paper the simulation of such real time estimation algorithm is presented for the SRF cavities of both HZB's projects, whose main parameters are shown in table 1 (a Q0=5•10 9 was assumed for all cavities), and the results are compared with the dissipated energy in the cavity walls.

Algorithm and implementation
As shown in [5] the detuning (Δω) and half-bandwidth (ω1/2) parameters of the SRF cavities in the absence of beam, can be obtained using the following equations: where Ic, Qc, If and Qf are respectively the in-phase and in-quadrature components of the cavity voltage measured with a pick-up antenna and the forward voltage coming from the RF amplifier (Solid State Amplifier or Klystron). K is a constant given by cavity parameters and the factors of attenuation produced by sensors, coaxial cables, and ADC conversion which relate the physical RF wave magnitudes and the numerical values used inside the FPGA and is quantified by K = ω 0 2 , where attf and attc are the relation between the physical magnitudes of the measured RF signals and the numeric fixed point values used to represent them. The schematic of the ω1/2 estimator implementation is illustrated in figure 1. Also, the latency that each arithmetic block introduces into the parameter estimation is shown. The Δω estimator is implemented using a similar structure onto the same FPGA in parallel, although its results are not shown in this paper.
Due to design constraints, the input Ic, Qc, If and Qf signals are quantized using signed 18 bit representations. As a consequence of quantization noise, derivatives become substantial noise sources. Therefore, filters are used before, during, and after the derivatives. Programmable average filters are used before and after the derivative. These can calculate the average value of the last 0 (pass-by mode), 4, 8 or 16 values depending on how much filtering the signals need. Since we expect that it will be necessary in some extreme cases, we do not use a strict derivative. Instead of it, we use an approximation of a derivative, which is obtained adding a pole to the strict one. This way, approximated derivative can be tuned depending of certain needs using the value of α, which fixes how far the added pole is from the origin, and so, how aggressive the filter is. With α = 0 the approximation will be a perfect derivative,

Results
In order to provide proper inputs to the FPGA code, the different cavities behavior controlled by the LLRF system has been simulated using Simulink. A gain scan of the Proportional-Integral controller was performed for the different cavities to optimize the control. At a certain time, quench is simulated as a Q0 drop from its superconducting value. All the signals are then sent to the FPGA where the calculation takes place.   Figure 2 shows the ω1/2 FPGA estimation of the bERLinPro's gun cavity compared with the simulation with a hard quench at 10 ms. In this case the Q0 drop follows a step function. In can be seen that the error is below 1%.
A zoom of the ω1/2 estimation compared to the dissipated energy in the cavity walls is depicted in figures 3-7 for the different parameters as in Table 1 and for soft quenches starting at 2 ms where Q0 is following an exponential decay. It is clear that when the change is above the noise level, the dissipated power still is in the order of tens of mJ. It can be seen that the FPGA estimation follows well the actual value of the detuning.

Conclusions and future work
These first results show that the ω1/2 estimator using the typical LLRF signals is fast enough to detect a soft quench for all the SRF cavities of the current HZB's projects. Moreover, as this estimator is going to be implemented in the LLRF system, it can be used to quickly switch the RF off. The next step is implementing this estimator using VHDL code and integrating it in the LLRF firmware developed by DESY for the mTCA architecture. Following this year a TESLA cavity equipped with Oscillating Superleak Tranducers (OST) [7] will be installed in the HoBiCaT testing cryomodule which will be used to test, among other things, the quench detection.
It is also planned to substitute the divider by a Piecewise linear interpolator as it was presented in [4], which would reduce the latency of the calculation dramatically and to introduce a low-pass filter at the output of the calculation to remove some spikes that appear at certain cases.
Although not shown in this paper, the Δω was also implemented and it is foreseen to use it to try to detect the detuning caused when switching from the superconducting penetration depth to the skin effect of the normal conducting state. where IB and QB are respectively the components of the beam current and KB is a scaling factor.