Frequency-Locked Loop Based on a Repetitive Controller for Grid Synchronization Systems

The frequency-locked loop based on a second-order generalized integrator has been widely used in grid synchronization systems but featuring unfavorable harmonics filtering performance. To solve this issue, a frequency-locked loop based on multiple second-order generalized integrators was proposed, which is to realize harmonics attenuation and frequency synchronization concurrently. Nevertheless, it is inconvenient for implementation for the complex structure and burdensome calculation. The target of this work is to solve these issues by proposing two novel frequency-locked loop structures based on repetitive controllers. The proposed solutions show many favorable features simultaneously, $i$ ) they are resilient to all the commonly confronted grid interferences, such as harmonics, dc components, voltage sages, frequency variations, etc.; ii) they are convenient to implement thanks to the simpler structure and significantly alleviated computation load; iii) they have satisfying dynamic performance. Eventually, the effectiveness of the proposed frequency-locked loops is comprehensively verified by experiments under different working conditions.


I. INTRODUCTION
With the rapid penetration of renewable energy, power systems are facing ever-increasing challenges in terms of grid impedance changes, voltage sags, frequency variations, harmonics, etc. To maintain an efficient and smooth operation of the whole power system, all the grid-interfacing converters need to synchronized with the grid even under the aforementioned abnormal conditions [1]. The frequency-locked loop (FLL), proposed in [2], has been widely used in grid synchronization systems for frequency estimation of the grid voltage. It is equivalent to a typical first-order system, featuring both simple structure and high precision. To realize grid frequency estimation, FLL requires the essential information of orthogonal signal and voltage error, which can be generated by a second-order generalized integrator (SOGI) [3], [4], the resulted organization is called SOGI-FLL.
The associate editor coordinating the review of this manuscript and approving it for publication was Gerard-Andre Capolino. SOGI-FLL includes a SOGI-based bandpass/lowpass filter for extracting orthogonal signals for the input signals and a frequency estimator for estimating the grid frequency [5]. However, the grid voltage is rich in harmonics, which can easily result in significant oscillations in the estimated frequency. Work [6], therefore, presented an enhanced transfer delay-based frequency locked loop (ETD-FLL) with strong immunity against dc offsets. For better attenuating other interferences, paper [7] utilized the synergy of multiple bandpass filters (BPF) to achieve the effect of pre-filtering, called SOGI-FLL with prefilter (WPF). With the suitable design of BPFs' bandwidth, they can significantly eliminate both the dc offset and grid harmonics. A SOGI-FLL with inloop filter (SOGI-FLL-WIF) was applied in [8]- [10], which confirmed experimentally that SOGI-FLL-WPF and SOGI-FLL-WIF have a similar filtering capability. Still, both of them were at the cost of lower stability margin. The multiple second-order generalized integrators (MSOGI) were proposed in [11], which parallel multiple SOGIs to decouple grid harmonics. But the issue of MSOGI is each part VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ of MSOGI can only estimate only one specific harmonic component. Indeed, the power grid is usually subject to multiple interferences (e.g., dc component, harmonics, interharmonics), which causes the multiplex structure and burdensome calculation limiting its usage in the extensive range. In paper [12], [13], a model of the repetitive controller (RC) was proposed, which had been verified theoretically equivalent to MSOGI. Inspired by this idea, two novel FLLs based on RCs, named as RC-FLL, are proposed in this paper. The proposed FLLs can significantly attenuate grid harmonics and dc components using dedicatedly designed delay modules, and extract fundamental grid component precisely through a SOGI. However, the fluctuated grid frequency can easily result in fractional order delays [14], which conflict with the integral delay requirement in discrete domain implementation. Given the reason that fractional-order delays are complicated to implement practically, a finite impulse response (FIR) filter based on Lagrange interpolation is also proposed in [15] to mimic fractional delays.
This paper includes the following main parts. The structural characteristics of SOGI-FLL, MSOGI, and a simplified model of MSOGI are introduced in section II. Section III presents the RC-FLL models in terms of eliminating odd harmonics and all harmonics, respectively, and then model optimization is performed to eliminate dc components. The proposed structure is finally verified through experiments in Section IV, before summarizing the findings in Section V.

II. REVIEW OF SOGI-FLL AND MSOGI-FLL
A. SOGI-FLL Fig. 1 shows the structure of SOGI-FLL [3], which is combined by two blocks, a SOGI-QSG block for quadrature signal generation and an FLL block for frequency estimation. Transfer functions of the SOGI-QSG for relating its two outputs and error signal to its input are given by (1), (2), and (3). To better analyze the performance of FLL, the bode diagrams of qv and ε v are given in Fig. 2, where qv is the low-pass filter, ε v is a notch filter, ω is the frequency of the input signal, ω is the frequency of the output signal, andω err is the input signal of FLL in steady-state. They are in phase if the resonance frequency of SOGI is higher than that of the input signal (ω > ω). Instead, they are reversed-phase when ω < ω. Therefore, multiplying qv and ε v gives the error signal ω err . To make the system reach a steady-state, the system automatically and continuously adjusts the output signal of FLL, ω , to make the error signal ω err zero [11].
Despite the simplicity and wide application of SOGI-FLL, its quadrature output signals will be distorted by the low-order harmonics of the input grid signal. The reason can be explained by the bode diagrams in Fig. 2, where Q(s) have quite limited attenuation around the fundamental frequency. Furthermore, the distorted qv and ε v , after going into the FLL, can cause an error in the estimated frequency   as well. To illustrate, we performed simulations using MAT-LAB/Simulink, where a 50 Hz sinusoidal signal accompanied by 5th, 7th, and 11th harmonics (20% of the fundamental magnitude), which is shown in Fig. 3(a), is fed to the SOGI-FLL. Figs. 3(a) and (b) show the steady-state waveforms of the quadrature signals and the estimated frequency, both of which are inaccurate with either distortion or noticeable oscillations. The inaccurate frequency, when fed back to the SOGI-QSG, can further distort the output quadrature signals.

B. MSOGI-QSG
MSOGI-FLL's structure was proposed in [11], which is composed of multiple SOGI-QSGs, a harmonic decoupling network (HDN), and an FLL block connected to the fundamental SOGI-QSG as shown in Fig. 4. The frequency estimated by FLL feeds back to all SOGI-QSGs tuned at either fundamental or harmonic frequencies decided by the coefficient before the frequency input. The HDN, which contains a cross-feedback network, works by eliminating the influence of other frequency components on each channel. Reference [11] shows the transfer functions of the MSOGI-FLL, whose bode diagrams are plotted in Fig. 5 with three harmonic blocks tuned at 5th, 7th, and 11th harmonics, respectively. We noted that the notch characteristic is obvious at frequencies where the SOGI-QSGs are tuned. As a result, the input harmonics can be eliminated by MSOGI before going into the fundamental SOGI-QSG block, and finally, it can ensure the accuracy of the estimated frequency. Compared with Fig. 3, both the output signal and estimated frequency in Fig. 6 are less polluted, showing the effectiveness of MSOGI in filtering grid harmonics.

C. EQUIVALENT STRUCTURE OF MSOGI-QSG
To facilitate the derivation of the later proposed scheme, a more intuitive structure of the MSOGI-QSG is presented using equivalent transformation. Firstly, taking the first channel of the HDN as an example, only the harmonics estimated  by other channels are subtracted by HDN from the input. Actually, inside each SOGI-QSG block, the output v is subtracted from its reference as well (see Fig. 1). Therefore, coming back to Fig. 4, if we move the feedback point of v inside each SOGI-QSG block into the HDN, all channels in HDN will become the same, i.e. subtract the summation of all the estimated components from v 1 to v n . Next, by moving the summation operator behind the SOGI-QSG blocks, and using transfer functions to replace the inner part of each SOGI-QSG, an equivalent structure can be obtained as shown in Fig. 7.

III. PROPOSED FLL BASED ON REPETITIVE CONTROLLERS
The MSOGI-FLL shown in Fig. 4 can indeed eliminate harmonics in steady-state. But as the number of harmonics to be processed increases, the computational burden increases proportionally, which will cause inaccuracy when it reaches an upper limit. Instead of using resonant controllers, the RC, which contains a bank of resonant controllers and can be implemented with a simple time delay function, can be employed to simplify the implementation of MSOGI-FLL. The resulting structure is RC-FLL.

A. GENERAL STRUCTURE
The general structure of the proposed scheme is shown in Fig. 8, where the multiple resonant controllers of MSOGI-QSG in Fig. 7 are replaced by a single RC which has VOLUME 8, 2020  a delay module to provide infinite poles. Also shown in the figure that the fundamental resonant controller recovers from the RC for quadrature signal generation, whose block diagram representation has been provided in Fig. 7 (the shaded block).
When analyzing the frequency domain, the delay length may have a fractional part. To better simulate the fractional delay, we use the FIR filter based on Lagrange interpolation to emulate fractional delays approximately. Next, the inquadrature signals generated by the fundamental resonant controller and the error signal ε v are both fed into the FLL for frequency estimation. Thanks to the equivalence of the RC-FLL and the MSOGI-FLL, the frequency-estimation principle of RC-FLL is consistent with that of MSOGI-FLL. Transfer functions of RC-FLL are given by (4), (5), and (6), which will be used later for analyzing their characteristics.

B. FIR APPROXIMATION OF FRACTIONAL DELAYS BASED ON LAGRANGE INTERPOLATION
Through the analysis in [15], it can't fully implement the ideal fractional delay. To approximate ideal fractional delay better, [15] has been used FIR or IIR filters. In this paper, the FIR filter is chosen to approximate fractional delay, which is much simpler than IIR in terms of the design process.
First, we approximate the ideal fractional delay, where D is the fractional part of the delay, with an N -th order (length L = N + 1) FIR filter. The transfer function is represented by (7), where n is an integer and h (n) is the coefficient.
The easiest way to calculate FIR filter coefficients is to use Lagrange interpolation [21], which is illustrated in where D is the fractional part of the delay, and N is the order of the FIR filter. Fig. 9 shows the principle of the FIR filter more intuitively in the form of a block diagram. The higher the order of the FIR filter, the higher the calculation accuracy, but the corresponding calculation burden will increase. To balance the accuracy and the calculation burden, in this paper, we selected first-order Lagrange interpolation to calculate its coefficients, that is . Block diagram of the FIR filter.

C. REALIZATION OF REPETITIVE CONTROLLERS
In this sub-section, two RC-FLLs, built by two different RCs with improved harmonic rejection capabilities, will be proposed and analyzed.
The transfer function of this RC is given by where T 1 = 2π ω 1 is the fundamental cycle. Pictorially, the corresponding structure representation of (10) is shown in Fig. 10 (a), where the RC can be easily implemented by time-delay functions in the digital control system. To explore the relation of the RC to the resonant controller, transfer function (10) can be expanded as The first RC is equivalent to the summation of a bank of resonant controllers tuned at odd times of the fundamental frequency. When the block diagram in Fig. 10(a) is used to implement the RC(s) in Fig. 8, the resulting structure will be completely equivalent to the structure of an MSOGI-FLL whose SOGI-QSGs are to tune at the odd harmonics. However, to implement the MSOGI-FLL, an infinite number of resonant controllers should be applied, which is unfulfillable in practice. In comparison, the RC-FLL can implement with less burdensome, while its parameter design can still refer to that of the MSOGI-FLL. Specifically, to ensure the equivalence to MSOGI-FLL, their gains should satisfy k rc1 = T 1 k m 4 = kπ 4, and k f 1 = 4 T 1 .
(12) By substituting (10) into (5) and (6), we can easily obtain the transfer functions of D rc1 (s) and Q rc1 (s) for the first RC-FLL. To evaluate the performance of the first RC-FLL, Fig. 11 plots the bode diagrams, with the fundamental frequency set to 100πrad s. For comparison, bode diagrams of SOGI-FLL and MSOGI-FLL are also provided in Fig. 11, where the MSOGI-FLL is with three harmonic SOGI-QSGs tuned at the 5th, 7th, and 11th harmonics, respectively. The gain k of the MSOGI-FLL is set to √ 2 according to [11], and the gains of the RC-FLL can then be selected according to (12). From Figs. 11(a) and (b), the SOGI-FLL only has limited attenuation at characteristic harmonics, and the MSOGI-FLL can only notch the predefined characteristic harmonics. On the other hand, the proposed RC-FLL has an outstanding performance with notches at all characteristic harmonics. Experimental results will be provided in Section IV further to evaluate the performance of the RC-FLL for frequency estimation.

2) RC-FLL WITH INTEGER HARMONICS REJECTION
The second RC-FLL, which can reject all harmonics, including both odd and even harmonics, has the strongest harmonic elimination ability. This RC-FLL is built by the RC proposed in [17], whose transfer function is given by 2s s 2 + (nω 1 ) 2 (13) Notice that, in addition to the bank of resonant controllers, the second RC also includes an additional integrator. Herein, it is temporally removed from (13) to ensure its equivalence to the MSOGI-FLL and then simplify the overall parameter design. After removing the integrator, the transfer function of the modified RC can be given by (14), and its expanded version is nest given by (15). We observe that the modified RC only contains a bank of resonant controllers tuned at all integer harmonics, which can thus be used for replacing the MSOGI-FLL.
Before building the RC-FLL, Fig. 10(b) provides the block diagram representation of the modified RC, which contains positive feedback and feedforward path delayed by the time duration of T 1 , and an additional feedforward path to cancel the effect of the integrator in (14). This block diagram is next applied to implement the RC-FLL shown in Fig. 8. To ensure the equivalence to the MSOGI-FLL, this paper designs the parameters of the second RC-FLL should according to (16). Transfer functions of D rc2 (s) and Q rc2 (s) can be derived according to (5) and (6) after substituting (14) into (5) and (6), and the bode diagrams can next be plotted in Fig. 12. As expected, notches exist at all integer harmonic frequencies for both D rc2 (s) and Q rc2 (s). Therefore, the second RC-FLL can reject the influence of all integer harmonics, which has the strongest harmonic rejection ability among the two proposed RC-FLLs. However, from Fig. 12 that a much higher gain occurs next to the fundamental frequency than the other RC-FLL, which may amplify some inter-harmonics located within this frequency range. Therefore, more considerations should be taken to solve this problem, which can be realized by either decreasing the gain k rc for RC-FLL (k for MSOGI-FLL) to reduce the bandwidth or introducing an additional negative resonant controller tuned at the 2nd-order harmonics to weaken the effect of the 2nd-order resonant controller contained in the RC.

D. MODIFIED RC-FLL WITH DC COMPONENT REJECTION
In [18], it showed that the SOGI-FLL is quite sensitive to the input dc component since qv is the low-pass version of the input. This problem is faced by the MSOGI-FLL and the two RC-FLLs as well. To overcome the drawback of the SOGI-FLL, an additional integrator is applied in [19] to extract the dc component. The integrator works in parallel with the resonant controller, similar to a harmonic SOGI-QSG block in MSOGI-FLL with its resonant frequency tuned to 0.
In this paper, the same concept is used for RC-FLL to reject the dc offset. The modified RC-FLL structure is shown in Fig. 13, where the output of the integrator is added with the output of RC before being subtracted from the input, and the error signal ε v will contain no dc offset in steady-state. The transfer function of E rc (s) in (4) for the original RC-FLL should be updated to (17) for the modified RC-FLL, while transfer functions of D rc (s) and Q rc (s) can be kept the same with (5) and (6), as long as E rc (s) in D rc (s) and Q rc (s) are implemented by (17) instead of (4).
Taking the first RC-FLL as an example, bode diagrams of D rc1 (s) and Q rc1 (s) for both original RC-FLL and modified RC-FLL are drawn in Fig. 14 for comparison, where the gain k dc for the modified RC-FLL is set to 100, while k rc and k f are both the same with that in Fig. 11. In Fig. 14(a), it observes that D rc1 (s) of the modified RC-FLL shows stronger attenuation than that of the original RC-FLL below the fundamental frequency. As already shown previously, the Q rc1 (s) in Fig. 14(b) of the original RC-FLL has no attenuation but amplification for components below the fundamental frequency. On the other hand, the modified RC-FLL shows superior performance with evident attenuation and thus can reject the dc as well as subharmonic components.

IV. EXPERIMENTAL VERIFICATION
The experiments are mainly performed in this paper referring to a single-phase grid-connected inverter, and it can be conveniently extended to the three-phase applications [3], [11]. The proposed RC-FLLs have been implemented on a dSPACE DS1202 MicroLabBox. The algorithm of the RC-FLLs is compiled in a discrete form with a sampling frequency  of 10kHz. Discrete domain models of the first RC-FLL is shown in Fig. 15, where d is the delay length of the RC, and is a gain of FLL, which are implemented through real-time adjusted ω based on first-order FIR interpolation. The conventional SOGI-FLL and MSOGI-FLL are also included for comparisons in the following results.

A. STEADY-STATE PERFORMANCE
The proposed RC-FLLs are firstly tested under a highly unbalanced and distorted grid condition. Fig. 16 and Fig. 17 demonstrate the estimated frequency results, respectively. As shown in Fig. 16(a) and Fig.17(a), the grid voltage is at the nominal frequency of 50 Hz with 10% 3rd, 5th, 7th and 2nd, 5th, 7th order harmonics, respectively, together with a dc offset, whose magnitude is 10% of the fundamental signal as well. Fig.16(a) and Fig.17(a) also show the input grid voltage waveform. Fig.16(b) and Fig.17(b) compare the estimated frequency between SOGI-FLL, MSOGI-FLL, and RC-FLLs under distorted grid conditions. As far as the SOGI-FLL is concerned, the orthogonal component, qv , is the low-pass output with a unity gain, which can be harmonics-free, however, less effective in attenuating dc components. Therefore, the input component, qv , of SOGI-FLL carries harmonics, resulting in significant fluctuations in the estimated frequency around 50 Hz (the ripple coefficients of SOGI-FLL in Fig.16(b) and Fig.17(b) are 4.75% and 5.53%). In contrast, RC-FLLs present satisfying steady-state performance. As can be seen from Fig.11 and Fig.12, RC-FLL can be regarded as an ideal low-pass filter, in which the ability to attenuate the dc component and harmonics is significantly improved. This is verified by the smooth estimated frequency in Fig. 16 (b) (ripple coefficient ≈0) and Fig. 17 (b) (ripple coefficient ≈0). By adjusting the structure, MSOGI-FLL can eliminate specific frequency components, and has the same filtering performance as RC-FLL. Still, its structure is complex and requires real-time adjustments when needed.
To further verify the superiority of RC-FLL, the RC-FLL and MSOGI-FLL programs are executed successively to measure their execution time conveniently at one time. The rising edge and falling edge indicate the starting and ending of a program, respectively. As can be seen from Fig. 16(c) and Fig. 17(c), the program execution time of RC-FLL is about 2.5 µs, which is only 48% of the MSOGI-FLL case (5.2 µs).

B. DYNAMIC PERFORMANCE
In this part, the dynamic performance of SOGI-FLL, MSOGI-FLL, and the proposed RC-FLL are explicitly compared. Between the two proposed RC-FLLs, testing results of only the first RC-FLL will be shown hereafter considering the space constraint. Three different tests are distinguished as follows.

1) TEST A: GRID FREQUENCY VARIATIONS
The test is performed by applying a step change of the grid frequency from 50 Hz to 40 Hz at t 1 and a reverse step at t 2 .

2) TEST B: VOLTAGE SAGS
The test is initiated with the nominal grid voltage (220 V) and frequency (50 Hz), a 10% voltage sag, and 10Hz frequency change occur at t 3 and recover at t 4 .

3) TEST C: MULTIPLE INTERFERENCES
In this test, a heavily distorted grid voltage, as in Sec. IV-A, is assumed. A step variation of the grid frequency from 50 Hz to 40 Hz and a 10% voltage sag are performed simultaneously at t 5 , then return to the nominal voltage (50 Hz and 220 V) at t 6 . Fig.18 shows the achieved results of test a, where the input grid voltage is depicted in (a) with zoomed-in views of the transients, the estimated grid frequency from SOGI-FLL, MSOGI-FLL, and RC-FLL are illustrated in (b). Fig. 19 and Fig. 20 are the experimental results of test b and test c, respectively. As can be seen, the proposed RC-FLL shows comparable dynamic performance like the conventional SOGI-FLL and MSOGI-FLL. Even under multiple grid interferences, the proposed RC-FLL can work properly and resilient to the different transients, without any overshoot or undershoot.

V. CONCLUSION
This paper proposes two FLLs based on repetitive controllers (RC-FLL). They are theoretically equivalent to the conventional MSOGI-FLL, but with significantly simplified structure and reduced computation load, which are more implementation-friendly. The execution time of the RC-FLL program is just 48% of the MSOGI-FLL case, without any program optimization. Compared with the conventional SOGI-FLL and MSOGI-FLL, the proposed RC-FLLs show better overall performance, in terms of both static and dynamic performance. Under the two distorted grid conditions mentioned in the paper, the ripple coefficients of the estimated frequency achieved by SOGI-FLL are 4.75% and 5.53%, which is higher than that of the proposed RC-FLLs (approximately equal to 0). Experimental tests verified that the proposed solutions are resilient to multiple interferences, such as harmonics, dc bias, grid frequency variations, voltage sags, showing high potential in the upcoming micro-/nanogrid applications.