APP下载

Advanced topics on RF amplitude and phase detection for lowlevel RF systems

2019-10-18ZheQiaoGengRogerKalt

Nuclear Science and Techniques 2019年10期

Zhe-Qiao Geng · Roger Kalt

Abstract Low-level radio frequency (LLRF) systems stabilize the electromagnetic field in the RF cavities used for beam acceleration in particle accelerators. Reliable, accurate, and precise detection of RF amplitude and phase is particularly important to achieve high field stability for pulsed accelerators of free-electron lasers (FEL). The digital LLRF systems employ analog-to-digital converters to sample the frequency down-converted RF signal and use digital demodulation algorithms to calculate the RF amplitude and phase. Different sampling strategies and demodulation algorithms have been developed for these purposes and are introduced in this paper. This article focuses on advanced topics concerning RF detection,including accurate RF transient measurement, wideband RF detection, and RF detection with an asynchronous trigger, local oscillator, or clock. The analysis is based on the SwissFEL measurements,but the algorithms introduced are general for RF signal detection in particle accelerators.

Keywords Low-level radio frequency · RF detector · RF transient detection · Asynchronous RF detection

1 Introduction

Detection of the amplitude and phase of an RF signal is widely required in many subsystems of a particle accelerator, such as LLRF systems [1-8], beam diagnostics[9-11], and synchronization systems [12-14]. In LLRF systems, the RF detector is one of the key devices used to diagnose and control the RF fields in the cavities used for beam acceleration.

The major requirements for an RF detector include accuracy,precision,and response latency.With an accurate measurement of the RF amplitude and phase,we are able to capture the exact changes in the RF field that are really encountered by the beam. A precise RF detector is able to detect small changes in the RF field or, in other words,provide high-resolution RF measurements. The latency of the RF detector is critical when using an RF feedback loop for which the overall loop delay will limit the closed-loop bandwidth that the feedback loop can achieve [15, 16].Generally, an RF detector with high accuracy, high precision, and low latency is required in many LLRF systems.

Recently, digital RF detectors [17-19] are more often adopted in LLRF systems. In this paper, we will assume that the RF detector has the general architecture depicted in Fig. 1.The RF signal to be detected is first down-converted by mixing with a local oscillator (LO) signal with a frequency different (normally lower) than the RF signal frequency.The lower side-band signal in the product from the mixer is picked up with a low-pass filter(LPF),resulting in an intermediate frequency (IF) signal. The IF signal is sampled with an analog-to-digital converter (ADC) and then demodulated with some digital algorithms to calculate the amplitude and phase of the RF signal. For pulsed RF signals, a trigger can be used to start the demodulation process. In this paper, we focused on the digital demodulation algorithms[20-23]with the RF,LO,and ADC clock frequencies fixed.

Fig. 1 General architecture of an RF detector

In most LLRF systems, the trigger, LO, and clock are derived from the RF frequency to achieve synchronous sampling. This allows the implementation of simple demodulation algorithms due to the deterministic relation between the clock and IF frequencies. With a synchronous sampling scheme, the RF phase measurement will contain an error if the relative phases of the clock and IF signals are changed, which is usually the case when power cycling of the LO and clock generator occurs. To overcome this problem,some LLRF systems use an asynchronous trigger,LO, and clock signals generated by separate oscillators,resulting in the asynchronous sampling scheme. The asynchronous sampling scheme does not require deterministic phase relations between the trigger,LO,clock,and RF signals, but causes difficulties in the design of the demodulation algorithms.

There are already quite a few articles that discuss RF signal detection with focus on the accuracy, precision, and latency requirements described above [24-28]. In this paper, some advanced topics for RF signal detection with special requirements are discussed. These conditions can be met in different ways under different conditions, when designing an RF detector. For these special requirements,different demodulation algorithms are needed based on the common RF detector architecture shown in Fig. 1. The following topics will be discussed:

(1) RF transient detection with non-IQ:some RF signals may have transients with fast changing amplitude or phase that need to be measured accurately by the RF detector. This discussion will be based on the traditional non-IQ demodulation algorithm [21-23].

(2) Wideband RF detection: in some applications, a large bandwidth is required for digital demodulation to identify fast changes in the cavity field(e.g.,beam transient measurements [29-32]).

(3) RF detection regardless of trigger: in the case that a trigger is used to start the demodulation, the racing condition between the trigger and clock, which happens when the trigger rising edge is close to the clock rising edge in time, may introduce jumps inphase measurement. The RF detection must be independent of the trigger to avoid such problems.

(4) RF detection with asynchronous LO or clock: in some applications, the phase-locked LO and clock generator are not available; therefore, this demodulation algorithm must allow the use of asynchronous LO or clock sources to perform RF amplitude and phase measurements.

2 Special RF detection algorithms

2.1 RF transient detection with non-IQ

The non-IQ algorithm is a popular demodulation algorithm for RF detection based on the synchronous sampling of IF signals. The frequencies of the clock and IF signal satisfy

where n and m are integers(usually n >m for IF sampling and n <m for sub-sampling)corresponding to sampling m IF periods with n samples.If the kth sample of the IF signal is denoted as xk, the in-phase (I) and quadrature (Q) components of the RF envelope vector can be calculated with the last n samples as

where the phase step Δφ is the IF phase between two ADC samples and can be written as

The non-IQ demodulation algorithm(2)can filter out the harmonics and DC offset in the IF samples [21, 22] with reasonable latency if n is not too large. For example, the SwissFEL LLRF system [1, 2] uses a clock with a frequency 6 times the IF frequency, which corresponds to n = 6 and m = 1,resulting in a delay with only three clock cycles in the non-IQ demodulation. Due to such advantages,the non-IQ demodulation algorithm is widely used in LLRF systems.However,when using it to measure the RF transients, such as the rising or falling edge of a pulse,big jumps are observed, as shown by the solid lines in Fig. 2.The jumps shown in Fig. 2 are artifacts caused by the algorithm (2) when the changes of the IF amplitude or phase are rapid.To understand the situation,we assume an IF signal with time-varying amplitude and phase:

By sampling it at multiples of the clock period Ts= 1/fCLK, Eq. (2) can be rewritten as

Fig. 2 (Color online) Transient detection with non-IQ demodulation algorithm with an IF frequency 41.65 MHz and clock frequency 249.9 MHz.a Amplitude waveform,b amplitude zoom-in at rising edge, c phase waveform, and d phase zoom-in at rising edge

where Ak= A(kTs) and φk= φ(kTs). Here, we have used the relation kΔφ=2πfIFkTs. The Eq. (5) can be rewritten as

For both the I and Q outputs in Eq. (6), the first term includes the average I and Q values of the IF signal with n samples, which are the expected outputs of the demodulation algorithm; the second term includes the double IF frequency components, which is automatically zeroed out by summing the n points if the amplitude and phase are constant.When the IF amplitude or phase changes rapidly,as in the transients of an RF pulse,the second term does not vanish, but appears as a systematic error with its spectrum centered at twice the IF frequency.

Fig. 3 a Spectrums of the baseband RF pulse and b frequency responses of 3-tap and 6-tap moving-average FIR filters and the cascaded filter with non-IQ demodulation + 3-tap moving-average filter

The spectrum of the demodulated RF pulse is depicted in Fig. 3a. The noise power spectral density (PSD) is high at frequencies around two times IF frequency, and this is predicted in Eq. (6) for RF signals with rapid transients.The analysis above indicates that a notch filter at double the IF frequency will be able to filter out the errors of the non-IQ demodulation algorithm for RF transient detection.Due to the fact that the clock frequency is synchronized with the IF frequency, a moving-average finite impulse response (FIR) filter can also provide an accurate notch at double the IF frequency. As shown in Fig. 3b, a movingaverage FIR filter with n/2 taps(with n an even number)or n taps(with n an odd number)can be used as a notch filter at double the IF frequency. The moving-average FIR filter with 3 taps was applied to the SwissFEL LLRF system and the resulting RF pulse baseband signal and spectrum are shown as dotted-line plots in Figs. 2 and 3a.

The moving-average FIR filter is easy to implement in digital processors like a digital signal processor(DSP)or a field-programmable gate array (FPGA). Of course, it also generates extra magnitude attenuation at the frequencies near DC and a group delay for the RF detection, which is visible in the frequency response of the cascaded filter with the non-IQ demodulation and 3-tap moving-average filter shown in Fig. 3b. When these issues are important concerns, a higher-order narrow-band notch filter can be used instead of the moving-average FIR filter.

2.2 Wideband RF detection

The non-IQ demodulation algorithm requires n samples of the IF signal to do the demodulation, which reduces the bandwidth of the sampling. From Eq. (6), the non-IQ demodulation with n samples corresponds to an n-tap moving-average FIR filter for the baseband I and Q signals.In some applications, this is needed to detect a fast transient (e.g., a beam transient in a cavity), which requires maximizing the detection bandwidth with the same time series as for the IF signal.In principle,with fewer samples needed to calculate the I and Q components, greater bandwidth could be achieved. Here, we still consider synchronous sampling with a deterministic IF phase lag Δφ between two ADC samples.Assume that the ADC data are collected after a trigger and that the first sample corresponds to phase φ0of the IF signal (see Fig. 4 below).

Fig. 4 Synchronous sampling of IF signal

The I and Q components of the IF samples in Fig. 4 are represented by the amplitude A0and initial phase φ0of the IF signal:

In order to get the I and Q components, at least two samples are needed,resulting in the maximum possible RF detection bandwidth.We need to work out a demodulation algorithm that allows calculation of the I and Q components from two adjacent samples. Counting from the first sample after the trigger, the kth and (k + 1)th samples of an ideal IF signal (single-tone without amplitude or phase noises) can be written as

From (7) and (8), we can get

The phase lag Δφ between the ADC samples should not be close to the integer times of π. This is to avoid the denominator sinΔφ to close-to zero and cause singularities in the division. Considering the physical meaning, a phase lag close-to-π may cause IF sampling close to the zerocrossing points of the IF signal,resulting in a low signal-tonoise ratio in the ADC samples.This situation can occur if the phases of the IF and clock signals are aligned at some time point, when the clock samples a point close to the zero-crossing of the IF signal, and a considerable number of samples afterward will still be around the zero-crossing points of the IF signal due to the close-to-π phase lag.

The demodulation algorithm above was applied to the same ADC samples as in Sect. 2.1, and the results are plotted in Fig. 5, together with the results from non-IQ demodulation without moving-average filtering.Compared to the non-IQ demodulation algorithm, the wideband detection algorithm (9) is able to capture a more quickly rising edge of the RF pulse. This can also be explained by the spectra of the baseband signals in Fig. 6a, where more high-frequency components are kept with the wideband detection algorithm. The frequency responses of the non-IQ demodulation algorithm with n = 6 and the wideband detection algorithm (9) are compared in Fig. 6b. It can be seen that the wideband detection algorithm has larger bandwidth without notches at the IF frequency and at double the IF frequency.

The wideband detection algorithm can detect faster transients in the RF pulse, at the cost of keeping all the unwanted frequency components introduced in the downconversion mixing and ADC sampling processes. These include the DC offset in the ADC samples, leakage of IF frequency in demodulation and all higher-order harmonics of the IF frequency due to nonlinearity in the RF detector.When handling the results of the wideband detection algorithm, proper filtering is required to remove the unwanted frequency components or to pick up the wanted frequency components. For example, a narrow-band notch filter may be needed to remove the harmonics of the IF frequency.

Fig. 5 (Color online)Results of the wideband detection algorithm and non-IQ demodulation algorithm for the same data in Fig. 2:a amplitude waveform;b amplitude zoom-in at rising edge; c phase waveform;and d phase zoom-in at rising edge

Fig. 6 (Color online) a Spectra of the baseband RF pulse and b frequency responses of the non-IQ demodulation and wideband detection algorithms

Another advantage of the rapid detection algorithm (9)is that we can demodulate the samples of an IF signal only if the relationship between the IF and clock frequencies is known. The non-IQ demodulation algorithm (2) requires that the IF and clock frequencies satisfy(1).In some cases,the IF and clock frequencies may not have a simple relation(as in Eq. 1), or the n or m values may become too large;therefore, algorithm (2) becomes impractical for implementation, but algorithm (9) can still be applied.

2.3 RF detection regardless of trigger

For RF systems working in the pulsed mode, the measurement of an RF pulse is usually started with a trigger,as shown in Fig. 4. The phase of the first sample after the trigger is defined as the reference phase that determines the absolute phase offset for the demodulation of later samples.Usually, the trigger period, clock, and IF frequencies are chosen in a proper combination (e.g., the trigger period always covers integer times of the IF period and clock period) such that the first sample after each trigger is located at the same reference phase, resulting in stable phase measurement for all pulses. In practice, the trigger and clock signals are noisy with timing jitters and are distributed via cables with unknown delays.If the rising edges of the trigger and clock signals are very closely aligned in time, the trigger may fall randomly into two adjacent clock cycles, thereby selecting different ADC samples.This is the so-called racing between the clock and trigger,resulting in a random phase jump of ± Δφ.Such a racing condition has been observed in the operation of the SwissFEL LLRF system. Even if the cable length is tuned to remove the racing condition,a change in the clock phase after the power cycling of the master oscillator or clock generator may cause the racing condition to occur again.A demodulation algorithm independent of the trigger is expected to overcome this problem.

As mentioned above, the trigger defines the reference phase, so a new reference is needed if the algorithm does not refer to the trigger.Usually,the master oscillator(MO)signal, which is the reference signal to the entire RF station, can be down-converted and sampled with the same LO and clock. The measurement of the RF signal can be referred to as the MO reference signal with the doublechannel strategy shown in Fig. 7.We still use synchronous sampling scheme with the RF, LO, and clock signals all synchronized to the MO.

In the digital signal processing part in firmware or software,the ADC samples of the reference signal are first filtered with a band-pass filter (BPF) to remove the DC offset and higher-order harmonics of the IF frequency.The time series of the reference IF signal is then split into two signals with in-phase (0° phase shifted with proper delay)and quadrature (90° phase shifted) phases. Then, the IF samples of the RF signal are multiplied with the two resulting reference signals and the I and Q components in the baseband can be calculated by low-pass filtering the results of the multiplication. The LPFs in the I and Q output paths are used to remove leakage of the IF frequency and the higher-order (especially, the second-order) harmonics of the IF frequency.

As mentioned before, the kth sample of the quadrature signal of the reference IF signal is given by

By comparing with (10), it can be calculated as

As in the discussion of Eq. (9), the phase lag Δφ between two ADC samples should not be close to the integer times of π.

It can be seen that each point in the quadrature signal can be derived from the last two samples of the reference IF signal. Figure 8 shows an example of the quadrature signal derived from the reference IF signal at SwissFEL,where the clock frequency is 6 times the IF frequency.

The LPFs in the I and Q output paths in Fig. 7 can also be implemented as simple moving-average FIR filters for synchronous sampling. As discussed in Sect. 2.1, a moving-average FIR filter with n taps,where n is the minimum number of samples to cover full IF periods, will provide notches at different harmonics of the IF frequency.

Fig. 7 Strategy of RF detection regardless of trigger

Because the RF detection strategy in Fig. 7 always compares the RF phase and the MO phase regardless of the trigger, the phase jumps caused by the racing between the trigger and clock can be avoided. For a pulsed system, the trigger is still needed to start firing the RF pulse or collecting baseband I and Q data for data acquisition.Figure 9 depicts the detection of the same RF pulse as in Sect. 2.1 using the algorithm described in this section. The non-IQ demodulation results are also plotted for comparison purposes. The absolute phases are not equal in the subplots(c) and (d) because the MO phase is also included in the phase calculation.

Fig. 8 Reference IF signal and derived quadrature signal with synchronous sampling at the SwissFEL

By using the MO signal as reference in Fig. 7, the amplitude and phase noises in the MO signal and the corresponding RF detector channel will be also transferred to the detection of the RF signal. This could reduce the signal-to-noise ratio (SNR) of the RF signal measurement and should be understood explicitly.If we assume that both of the MO and RF signals have noise, then their IF signal samples can be written as

where Aref, Δαref, and Δφrefare the amplitude, relative amplitude noise, and phase noise of the reference signal and Arf, Δαrf, φ0, Δφrf, and Arf0are the amplitude, relative amplitude noise, initial phase, phase noise, and DC offset of the RF signal. Here, k denotes the values of the parameters at time kTs,where Tsis the clock period and k is an integer. The reference signal does not have DC offset due to the BPF in Fig. 7. With Eq. (12), the quadrature signal can be written as

Fig. 9 (Color online)Results of trigger independent detection algorithm and non-IQ demodulation algorithm for the same data in Fig. 2:a amplitude waveform;b amplitude zoom-in at rising edge; c phase waveform;and d phase zoom-in at rising edge and the phase difference between two cases

Here, we have assumed that the amplitude and phase noises of the reference signal are approximately constant for the two adjacent samples, which means that we only consider the noises within a bandwidth much narrower than the clock frequency. The outputs of the multipliers in Fig. 7 contain baseband signals, IF frequency signals, and double IF frequency signals. The IF frequency outputs are generated by the DC offset in the RF signal, while the double IF frequency outputs come from the multiplication of two signals, both at IF frequency. After the LPFs, the I and Q baseband outputs can be written as

It can be seen that the baseband outputs contain amplitude and phase noises from both the reference signal and RF signal.The noises can come from the common LO and clock signals,which result in correlated noises,or from RF detector electronic devices like mixers and ADCs,resulting in uncorrelated noises.The noises in Eq. (15)are summarized below:

(1) The amplitude noises of the reference and RF signals are summed up. When the two amplitude noises are correlated, they will be summed up in magnitude because the amplitude drift in the two measurement channels changes mostly in the same direction.When uncorrelated,the two amplitude noises will be summed up randomly.

(2) The phase noises of the reference and RF signals are subtracted. When the two phase noises are correlated,they will be canceled out if they change in the same direction, which is true within a certain bandwidth because they are mostly caused by the same phase drifts in the LO and clock signals.When uncorrelated, the two phase noises will be also summed up randomly because a minus sign does not influence the total power of two independent noises.

The low-frequency noises, which are from drift in the amplitude and phase of the reference and RF signals, are mostly correlated, while the high-frequency noises are mostly uncorrelated. Equation (15) shows that we will always get worse amplitude noise with the RF detection strategy in Fig. 7.For phase noise,we will get lower noise at low frequencies by tracking the reference phase drift and will get worse phase noise at high frequencies due to the sum of random noises in the two channels. This implies that two updates of the RF detection strategy in Fig. 7 are possible that could reduce the noise. First, we need to narrow the bandwidth of the BPF for the reference signal,to keep only the low-frequency noises correlated with the noise in the RF signal. Second, the amplitude of the reference signal should be replaced with a constant so that the amplitude noise in the reference signal does not appear in the I and Q outputs,thereby upgrading the reference signal path in Fig. 7 (see Fig. 10).

Compared to Fig. 7, two blocks were inserted between the 0°/90° splitter and the multipliers. The in-phase and quadrature versions of the reference signal were converted to amplitude and phase. Then, the amplitude was dropped(can be used for diagnostics) and the phase was converted back to in-phase and quadrature signals with a constant amplitude; here, we set the amplitude value to 2 to normalize the amplitude of Eq. (15) to Arf. The conversions between I/Q and amplitude and phase, which are usually implemented with the Coordinate Rotation Digital Computer(CORDIC)algorithm in FPGA[33,34],will increase the latency of the reference signal path. Practically, the latency in the reference signal path is not a big issue because we usually care only about slow drifts in the reference signal.

2.4 RF detection with asynchronous LO or clock

In many situations, we do not have frequency synthesizers to generate LO and clock signals from the reference MO signal. Instead, it might be easier to get separate oscillators to provide the LO and clock signals that are not synchronized with the RF signal, to be detected. In this case, the RF detection can still be performed with two channels as shown in Fig. 11, in which the MO signal is still used as the reference for the measurement of the RF signal (i.e., the RF signal is synchronized with the MO signal).

The blocks in the firmware or software side of Fig. 11 are the same as the blocks in Fig. 7.The major differences are the implementations of the 0°/90° splitter and the lowpass filter (LPF) due to asynchronous sampling. With asynchronous sampling, the IF phase lag Δ^φ between two adjacent ADC samples is unknown so we cannot use the simple algorithm in (12) to calculate the quadrature signal of the reference signal. Instead, the Hilbert transform algorithm can be used to generate the expected 90° phase shift for the quadrature signal, see Fig. 12.

For a real time-domain signal x(t), its Hilbert transform is defined as

The Hilbert transform xH(t) is also a real time-domain signal that is the convolution of x(t)with a function 1/(πt).In the frequency domain,the Hilbert transform introduces a phase shift of 90° to every Fourier component of x(t). A full implementation of the Hilbert transform for a time series adopts fast Fourier transform (FFT) and inverse fast Fourier transform (IFFT) [35], which are not suitable for real-time processing of the reference signal. It is more practical to use a FIR filter to approximately implement the Hilbert transform.Figure 13 shows the frequency response of a 16-tap Hilbert transform FIR filter designed with the‘‘Filter Designer’’ of MATLAB.

Fig. 10 Generation of the reference quadrature signal with amplitude noise reduction

Fig. 11 RF detection with asynchronous LO or clock signals

Fig. 12 Implementation of 0°/90° splitter with Hilbert transform

Fig. 13 Frequency response of a FIR filter for a Hilbert transform:the clock frequency is 249.9 MHz. The phase lag caused by group delay has been removed from the phase response

It can be seen from Fig. 13 that the FIR-based implementation of the Hilbert transform has perfect phase response, but there are large ripples in the amplitude response that should be 0 dB for all frequencies. The error in the Hilbert transform implementation at the IF frequency can be modeled as an amplitude imbalance g and phase imbalance φ, as in Fig. 12. These imbalances are systematic errors at a fixed IF frequency and can be compensated using the matrix [36] shown in Fig. 12, which can be represented as

Fig. 14 (Color online)Generation of in-phase and quadrature signals of the reference IF signal with FIR-based Hilbert transform and the calibration of imbalances

where

Here, we have used N samples (N >3) resulting in N equations about the unknown parameters a,b,and c.This is a typical multivariable linear fitting problem and can be solved with MATLAB. Then, the amplitude and phase of the in-phase signal can be calculated as

Fig. 15 (Color online) Results of asynchronous detection algorithm and non-IQ demodulation algorithm for the same data in Fig. 2:a amplitude waveform;b amplitude zoom-in at rising edge; c phase waveform;and d phase zoom-in at rising edge and the phase difference between the two cases

The algorithm described above was applied to samples of the reference signal of an RF station in the SwissFEL,and the results of the calibrated in-phase and quadrature signals are shown in Fig. 14. The estimated amplitude and phase imbalances are g = 1.02 (or 0.17 dB) and φ = - 1.52e-4°, which agree well with the frequency responses of the FIR-based Hilbert transform at the IF frequency (41.65 MHz) in Fig. 13.

Due to the asynchronous sampling, the moving-average FIR filter is no longer suitable to implement the LPFs in the firmware or software shown in Fig. 11. We should use a general format of low-pass filters, such as the FIR filter,infinite impulse response (IIR) filter, or cascaded integrator-comb (CIC) filter [22, 37]. The design of the low-pass filter is beyond the scope of this study and is reviewed in digital signal processing books [38].

The algorithms described in this section were applied to the same data as in Fig. 2, and the results are depicted in Fig. 15. The results of the non-IQ demodulation algorithm are also shown for comparison purposes.

3 Conclusions and outlook

The digital RF amplitude and phase detector are one of the key components in LLRF systems. Based on the same hardware, different digital demodulation algorithms need to be implemented to address different requirements of the RF detection. This study proposes several RF detection algorithms that satisfy the different requirements that the author has met when working on different LLRF systems,which can be used in other machines under similar conditions. New algorithms should be developed for newly emerging requirements with regard to the performance,reliability, and robustness of RF detectors. If the requirements (e.g., bandwidth requirements) exceed the limits of the existing hardware, a modification of the RF detector hardware may also be needed, together with the development of a new demodulation algorithm.