A Harmonic Compensation Method Using a Lock-In Ampliﬁer under Non-Sinusoidal Grid Conditions for Single Phase Grid Connected Inverters

: The power quality of grid-connected inverters (GCIs) is attracting a lot of attention as the number of distributed generation systems with renewable energy sources are increased. It is well known that the harmonics present in the grid have a lot of detrimental effects on the equipment and devices connected to a power system network such as heating and derating. These effects lead to problems in terms of safety and lifespan. Therefore, harmonic standards such as IEEE 519 and P1547 suggest that GCIs should achieve total harmonic distortion (THD) of the output current that is less than 5%. However, it is not easy to achieve the current THD of GCIs that is less than 5% with only an output ﬁlter under distorted grid conditions. In this paper, a harmonic compensation method using a lock-in ampliﬁer (LIA) is proposed. Due to the outstanding performance of the LIA, accurate information of the harmonics can be obtained. This information is used to eliminate the harmonics by the simple PI controller. To demonstrate the superiority of the proposed method, it is applied to a 5 kW single phase GCI connected to the real grid. The results obtained are compared with those of the conventional harmonic compensation methods.


Motivation
The grid connected inverters (GCIs) play a crucial role in transferring power from renewable energy sources to the grid [1][2][3][4][5]. The increasing number of GCIs has received a great deal of attention regarding their effects on the power quality and harmonic pollution of the grid. Typically, the output quality of GCI is ensured by the total harmonic distortion (THD) of the injected current into the grid. According to the harmonic standards such as IEEE 519 and P1547, the THD of the injected current into the grid should be less than 5% [6,7].
There are several factors that lead to an increase in the output current THD of the GCIs, such as the dead time, dc-offset, scaling error in current and voltage sensing circuits, and the harmonics that are already present in the grid due to the extensive use of non-linear loads [8,9]. Recently, the LCL output filters are preferred to reduce the switching frequency harmonics in GCIs due to their excellent high-frequency attenuation performance. However, they dramatically increase the susceptibility to low-order current distortions due to their low inductance when compared to L or LC filters [10]. Therefore, instead of increasing the inductance (hence the cost and volume) of the output filter, it is preferred to use harmonic compensation methods [11][12][13][14][15].
To ensure the output quality of the GCIs, the current controller plays a critical role. The well-known current control method for GCIs is a Rotatory Reference Frame (RRF) control,

Literature
The first conventional method is to introduce harmonic compensators in parallel with the fundamental current controller as shown in Figure 1a. This method is widely used, and several variations can be found in the literature [21][22][23][24][25][26][27][28]. In [21][22][23][24], the proportional resonant (PR), SOGI [25] and repetitive controller (RC) [26][27][28] are employed in parallel with the fundamental current controller (PI) in the D and Q axis, to detect a certain harmonic and compensate it in a feedforward manner. Although this control method is effective in harmonic rejection, it still has many limitations such as: (1) This method requires two compensators for each D and Q axis to eliminate a certain harmonic. Since a harmonic component in the SRF appears as two different frequency components in the RRF, it should be compensated for both the D and Q axis [32]. (2) Another disadvantage is that the orthogonal signals are generated by the SOGI, which is composed of a low pass filter (LPF) and a band pass filter (BPF). As a result, it attenuates the harmonic information due to filtering, which makes it impossible to extract accurate information about the harmonic component. Thus, the harmonic compensator is not able to perfectly compensate the harmonic.
The second conventional method is to compensate the harmonic on its individual multiple frame as shown in Figure 1b. In this method, an individual harmonic is detected at its own frequency frame and compensated after it is converted to a DC component [29][30][31]. This method has several advantages over the first approach due to the fact that it is: (1) independent of the frequency; (2) simple to design the harmonic compensator (PI controller); and (3) simple to implement and tune the parameters. However, this method has several disadvantages, such as: (1) The computational burden is high, and its dynamic characteristics are not good enough due to the delay produced by the OSG block, high order LPF for multiple numbers of RRFs, and the transformations required to transform AC components into DC components and vice versa. (2) In these transformations, the information of the grid theta generated by the phase locked loop (PLL) is needed. However, it is often polluted by distorted grid conditions such as grid harmonics, DC offset, etc., which significantly affect the GCI output current quality [33][34][35]. (3) Furthermore, the OSG may generate asymmetric signals, which degrades the performance of the harmonic compensator (PI controller). (4) In addition, when a SOGI is used to generate the orthogonal signals, it attenuates the harmonic information due to filtering, which makes it difficult to perfectly eliminate the harmonic.

Advancement
In this paper, to overcome the problems associated with the conventional methods, a harmonic compensation method using a lock-in amplifier (LIA) is proposed. This method is used due to the outstanding performance in terms of extracting a specific frequency component of interest under extreme noise conditions. This leads to the detection of the amplitude and the phase information of the harmonic component from the GCI output current with a high accuracy. Later, the detected harmonic can be compensated by the simple PI controller. The advantages of the proposed method over conventional methods are as follows.
(1) The LIA can extract the amplitude and the phase of a harmonic with a high accuracy, which results in a more effective harmonic compensation than those obtained with conventional methods. (2) The harmonic detection is performed by using a reference signal with an arbitrary theta, which is independent of the grid theta detected by the PLL, eliminating the concerns of using a grid theta that is polluted by distorted grid conditions, such as grid harmonics, DC offset, etc. (3) The OSG is not required for harmonic compensation, which eliminates the concerns about the asymmetric generation of orthogonal signals and attenuation of harmonic information. harmonic order. Thus, it will reduce the design complexity and less effort will be applied for better performance of the system. This paper is organized as follows. In Section 2, the proposed harmonic compensation method is discussed. In Section 3, controller design considerations for the proposed method are discussed. In Sections 4 and 5, simulation and experimental results are presented to compensate the 3rd, 5th, and 7th harmonics under non-sinusoidal grid conditions. Finally, the conclusion is given in Section 6.

Proposed Lock-In Amplifier (LIA) Harmonic Compensation Method
In this paper, a lock-in amplifier (LIA)-based harmonic compensation method is proposed. The LIA has been used for highly sensitive measurement equipment such as impedance Analyzers (IAs), arbitrary waveform generators (AWGs), Impedance Spectroscopes (ISs), etc. [36][37][38]. The typical block diagram of LIA is shown in Figure 2. To capture the desired harmonic information at a certain frequency, the reference signal and its orthogonal with a unity amplitude and an arbitrarily phase needs to be multiplied to the input signal. This process is called phase sensitive detection (PSD) and it is the heart of LIA. The output of PSD has the following characteristics: (1) Through the PSD, all of the input signals where the frequencies are not the same as the reference signal are rejected and only an input signal with the same frequency as the reference signal is converted to a zero-frequency component, i.e., a DC quantity. (2) The other frequencies present in the input signals are converted into two AC signals, one is at the difference of frequency, and the other is at the sum of frequency due to frequency shifting property of PSD.
Later, the outputs of PSD are passed through the LPFs and an input signal with the same reference frequency signal appears at the output as a zero-frequency component. The above-mentioned principle of LIA will be explained by means of mathematical equations. Figure 3 shows the block diagram of the proposed method. In the proposed method, the fundamental component of the grid current is regulated with a simple PI controller. Meanwhile, the individual harmonic is detected by means of LIA at its own frequency and compensated by the PI controller. The detail process of the harmonic detection by the LIA is presented in the following section.

Detection of Harmonics Using Lock-In Amplifier
In this section, the harmonic detection process using a LIA is detailed by using mathematical derivation. It is assumed that the grid current is distorted and that it has odd harmonic components as shown in Equation (1). I g = I amp sin ω g t + θ g + c 3h sin 3ω g t + 3θ g + c 5h sin 5ω g t + 5θ g + . . . + c nh sin nω g t + nθ g (1) where I g is the grid current, I amp represents the amplitude of the fundamental current, c 3h , c 5h and c nh represents the amplitude of the harmonics in the feedback current, the ω g represents the grid frequency, the grid theta represents the θ g and the "n" represents the order of the odd harmonics. To detect the harmonic components, the reference and its orthogonal signal are needed as shown in Equation (2).
I nh re f = sin kω re f t + kθ re f I nh re f = cos kω re f t + kθ re f (2) where I nh re f and I nh re f are the unity amplitude orthogonal reference signals with a frequency of ω ref (same to the line frequency "60 Hz"), the phase θ ref arbitrarily generated by the DSP, which is independent of the grid theta extracted from the PLL and "k", represents the order of the reference signal, which is selected to be the same as the harmonic order. These reference signals are multiplied by the grid current. This process is called PSD, which can be expressed as follows: I α nh = I g I nh re f = I g sin kω re f t + kθ re f I β nh = I g I nh re f = I g cos kω re f t + kθ re f where I α nh and I β nh represents the output of PSD. Equation (4) shows the frequency shifting trigonometric identity used to simplify Equation (3).
where the product of two sinusoidal having frequencies "ω 1 " and "ω 2 ", represents the output frequencies shifted at ω 1 − ω 2 and ω 1 + ω 2 . Equations (5) and (6) shows the resulting equation by applying Equation (4) into (3): Equations (5) and (6) show the outputs of PSD containing two AC signals. One is at the difference frequency (ω ref − ω g ), and the other is at the sum frequency (ω ref + ω g ). As mentioned earlier, all the signals of which frequencies are not the same as that of the reference signal are rejected by the PSD and only a signal with the same reference frequency is converted to a zero-frequency component, i.e., DC quantity. The other harmonics are shifted to different frequencies, which can be considered as AC ripples. The LPFs are employed to eliminate AC ripples, which will be detailed in the next section.

Filtering AC Ripple
To extract pure DC quantities from the PSD output, a low pass filter (LPF) is employed. The AC ripples are eliminated by the LPF and only the DC quantity remains. The transfer function of an LPF can be expressed as follows: where "n" is the order of the LPF. To obtain accurate DC quantities that contain the amplitude and phase information of a certain harmonic component, the order and the cut-off frequency of the LPF need to be selected carefully.

Low Pass Filter Design Criteria
First of all, the cutoff frequency of the LPF needs to be selected by 1/10 of the AC ripple needs to be eliminated. Here, the 3rd harmonic is the lowest grid current harmonic to be eliminated. In order to extract the amplitude and the phase information of the 3rd harmonic, the reference signal with the same frequency is multiplied to the grid current. At the output of the PSD, the dominant and the lowest frequency AC ripple is 120 Hz. Thus, the cut-off frequency needs to be selected at around 12 Hz to eliminate the 120 Hz AC Ripple. In this research, cut-off frequency has been selected at 20 Hz for the better dynamics of the system. The next step is to select the gain slope of the filter at the stop band. Table 1 shows the attenuation of the filter with different slopes at the stop band. In designing the filter, the selection of the gain slope at the stop band is a trade-off between the attenuation and the dynamics of the system. Figure 4 shows the bode plots of the LPFs with different orders. Here, we have selected a 4th order Butterworth filter with a slope of −80 dB/dec, since it provides an attenuation of 1/1000 (−60 dB) at 120 Hz. An even higher attenuation will increase the computational burden and lead to the slow dynamics of the system. Table 1. Attenuation of the LPF with a different slope at the stop band.

Order
Slope at the Stop Band (dB/dec) −120 dB 0.0001 The transfer function of the Butterworth filter can be represented by Equation (8).
where, n is the order of the filter, and ω c is the cutoff frequency 126 rad/s (20 Hz). It should be noted that the above-designed LPF can be used for all LIAs regardless of the harmonic order since it is designed to eliminate the lowest order of AC ripple.

Reconstruction of the Harmonic
As previously explained, the harmonics are detected through the LIA and regulated by PI controller. The harmonics can be simply reconstructed by using its amplitude and phase information detected by the LIA as expressed in Equation (9).
where n represents the order of the odd harmonics, m nh represents the reconstructed harmonic, A nh is the amplitude of the harmonic component after the harmonic compensator, and θ nh is the phase difference between the harmonic component and the reference signal. After the LPF is applied in Equations (5) and (6), all the AC ripples are removed except the zero frequency or DC quantity, which has the amplitude and phase information of the desired harmonic. The amplitude and phase information of a certain harmonic can be computed as follows: To extract the amplitude information of the nth harmonic, the Pythagorean theorem sin 2 (θ) + cos 2 (θ) = 1 is applied on Equation (10). The amplitude of the nth harmonic can be expressed as Equation (11).
After further simplifying Equation (11), we can get the final amplitude information of the nth harmonic at the reference frequency, which is a half of actual value. To get the right value, the measured value needs to be multiplied by a factor of 2 as shown in Equation (12).
The phase difference between the reference signal and the harmonic can be calculated by using the arctangent function as shown in Equation (13).
After simplifying Equation (13), we can get the phase difference, as shown in Equation (14) θ To extract the amplitude information of the nth harmonic, the Pythagorean theorem ( ) 2 2 sin ( ) cos ( ) 1 θ θ + = is applied on Equation (10). The amplitude of the nth harmonic can be expressed as Equation (11).
After further simplifying Equation (11), we can get the final amplitude information of the nth harmonic at the reference frequency, which is a half of actual value. To get the right value, the measured value needs to be multiplied by a factor of 2 as shown in Equation (12).
The phase difference between the reference signal and the harmonic can be calculated by using the arctangent function as shown in Equation (13).
After simplifying Equation (13), we can get the phase difference, as shown in Equation (14) ( ) Figure 5 shows the PSIM simulation results to extract the amplitude and the phase information of a certain frequency component using the reference signals generated arbitrarily. Figure 5a shows the FFT of the grid current, which contains multiple odd harmonics (3rd, 5th and 7th). Here, the grid current is multiplied with a reference signal at the 3rd harmonic frequency. Figure 5b shows the 3rd harmonic of the grid current and the reference signal generated arbitrarily, which is independent of the grid theta. Figure 5c shows the amplitude and phase information of the 3rd harmonic shifted to zero frequency and the other AC ripples are removed by the LPF. Thus, from Figure 5c we can see that the amplitude and phase of the harmonic at the reference frequency can be obtained with high accuracy due to the outstanding performance of the LIA. kθ re f − nθ g (14) Figure 5 shows the PSIM simulation results to extract the amplitude and the phase information of a certain frequency component using the reference signals generated arbitrarily. Figure 5a shows the FFT of the grid current, which contains multiple odd harmonics (3rd, 5th and 7th). Here, the grid current is multiplied with a reference signal at the 3rd harmonic frequency. Figure 5b shows the 3rd harmonic of the grid current and the reference signal generated arbitrarily, which is independent of the grid theta. Figure 5c shows the amplitude and phase information of the 3rd harmonic shifted to zero frequency and the other AC ripples are removed by the LPF. Thus, from Figure 5c we can see that the amplitude and phase of the harmonic at the reference frequency can be obtained with high accuracy due to the outstanding performance of the LIA.
Once the harmonic information is obtained through the LIA, it is necessary to reconstruct the nth harmonics for the harmonic compensation. Equations (9), (11) and (14) are used for the harmonic reconstruction. Thus, the nth harmonic can be compensated by adding the reconstructed signal to the output of fundamental current controller as shown in Figure 6.

Controller Design Considerations of the Propose Method
In this section, the controller design for a single-phase GCI is discussed. As shown in Figure 6, one fundamental component controller and multiple harmonic compensators need to be designed, where G i (s) is the fundamental current regulator, and HC(s) is the harmonic compensator, which may be composed of many harmonic compensators depending on the requirements.

Design of the Fundamental Current Controller
In the proposed method, the grid current is regulated in the RRF. This is based on the system diagram shown in Figure 3, where the inverter is interfaced with the grid through an LCL passive filter. The LCL filter behavior is the same as that of an L filter when the frequency is below the resonance frequency. Thus, it is possible to neglect the influence of the LCL filter capacitor in designing the current controller for the sake of simplicity. The loop gain for the fundamental current controller is expressed in Equation (15): (15) where G i (s) is the transfer function of the fundamental current controller, and G PWM (s) is the transfer function of the PWM unit in the s-domain, which includes the computation delay, sampler, and zero-order hold unit as shown in Equation (16). In addition, G P (s) is the simplified transfer function of the LCL filter expressed in Equation (17).
The design of the fundamental current controller G i (s) significantly affects the bandwidth and stability margin of the whole system. Ideally, the bandwidth of a closed loop system must be maximized by selecting a higher proportional gain k p to obtain a fast-dynamic response and good disturbance rejection capability. However, a high gain degrades the stability and the noise immunity of the control system. Consequently, the choice of the proportional gain k p is a trade-off between the stability margin and the bandwidth of the system. The PI current controller is designed to achieve a wider bandwidth and a higher phase and gain margins by using the SISOTOOL in MATLAB software (R2015a, MathWorks, USA). The open loop gain bode plot of the current controller is shown in Figure 7a. The parameters k p and k i are chosen to be 5.055 and 96.06, respectively.

Design of the Harmonic Compensator
In the proposed method, harmonic detection is achieved by the LIA. The amplitude and the phase information of the harmonic in the proposed method is a DC quantity. Thus, the harmonic compensation can be performed with a simple PI controller. The open loop gain for the nth harmonic compensation loop can be expressed as in Equation (18).
Energies 2021, 14,597 where G olnh is the open-loop gain for the nth harmonic compensators, "n" shows the order of the low pass filter, and ω c is the cut-off frequency of the LPF filter which has selected 20 Hz. The k p and k i are the PI controller (nth harmonic compensator) proportional and integral parameters, respectively. To achieve effective harmonic compensation, the bandwidth of the PI controller should be less than the cut-off frequency of the LPF. A higher bandwidth selection for the PI controller may cause the harmonic compensation loop to become unstable. The open loop gain bode plot of the nth harmonic compensators are shown in Figure 7b. The PI controller parameters k p and k i for the nth harmonic controllers are chosen to be the same, 1.489 and 12.07, to get the optimal performance. Thus, to ensure stability, the phase margin for nth harmonic compensators is 70.6 degrees at 9.51 Hz.
It should be noted that for the nth harmonic compensator, the above-designed PI controller parameters are chosen to be the same. Thus, we can reduce the controller design complexity and less effort will be applied for better performance of the system. On the contrary, the conventional harmonic compensation methods need to consider the controller design parameters for the nth harmonic compensators. As a result, there is an increase in the controller design complexity and more effort is needed to be applied for better performance of the system.

Simulation Results
To show the superior performance of the proposed method with respect to the conventional methods, PSIM simulations with a 5 kW single phase inverter are conducted under a highly distorted grid voltage condition (THD of the grid voltage is around 5.0%). The amplitude of the 3rd, 5th, and 7th grid harmonics are 1.9%, 2.5%, and 4.0% of the fundamental components, respectively as shown in Figure 8. The unipolar SPWM scheme is used along with 1.0µs dead time given to drive the IGBT. All the system parameters are listed in Table 2.  The performance of the conventional and proposed harmonic compensation methods are presented in Figure 9 along with the FFT results. It can be seen in Figure 9a that the grid current shows higher THD, i.e., 12% with no harmonic compensation and the 3rd, 5th, and 7th harmonics currents are 3.2 A, 1.54 A, and 1.34 A, respectively. Figure 9b shows that the THD of the grid current is reduced from 12% to 2.9% with a reduction of 75% by the conventional PR-based harmonic compensation and 3rd, 5th, and 7th harmonics are 0.41 A, 0.53 A, and 0.64 A, respectively. Figure 9c shows that THD of the grid current is reduced from 12% to 1.6% with a reduction of 87% by the conventional individual multiple frames-based harmonic compensation and 3rd, 5th and 7th harmonics are 0.23 A, 0.25 A, and 0.35 A, respectively. In Figure 9d, the grid current THD is reduced from 12% to 0.8% with a reduction of 93% by the proposed LIA-based harmonic compensation, and 3rd, 5th, and 7th harmonics are 0.02 A, 0.015 A, and 0.013 A, respectively. In Figure 10, the grid current FFT results are compared after employing different harmonic compensations. It can be observed from the simulation results that the harmonic reduction with the proposed LIA method shows an outstanding performance in eliminating the current harmonics as compared to those of other techniques.

Experimental Results
In order to verify the superior performance of the proposed method, a 5 kW singlephase grid-connected inverter has been built as shown in Figure 11. The system is tested under the following conditions: DC link voltage V dc (400 V), grid voltage V g (220 V rms ) with a 2.0% THD, fundamental frequency f g (60 Hz), switching frequency f sw (10 kHz), and the unipolar SPWM scheme is used along with dead time T d (1.0 µs) is given to drive the IGBT. A TMS320F28335 DSP is used to control the inverter and the controllers are implemented by discretizing them with bi-linear transformations. All the system parameters are listed in Table 2. The amplitude of the 3rd, 5th, and 7th grid harmonics are 0.5%, 1.2%, and 2.4% of the fundamental components, respectively, as shown in Figure 12.   Figure 13a,b shows the experimental results of the RRF current controller without a harmonic compensator at 1 kW and 5 kW, respectively. It can be observed from Figure 13a that the 3rd, 5th, and 7th harmonics are 0.25 A, 0.53 A, and 0.58 A, respectively, and that the THD of the output current is 14.9%. In Figure 13b, the magnitude of the 3rd, 5th, and 7th harmonics are 1.75 A, 1.1 A, and 0.8 A, respectively, and the THD of the output current is 7.2%, which exceeds the values suggested by IEEE Std.519 and P1547.  Figure 13c,d shows the experimental results of the RRF controller with the proposed LIA harmonic compensator. It can be observed that the THD of the inverter current is significantly reduced from 14.9% to 6.4% (57% reduction) at 1 kW, and from 7.2% to 2.1% (71% reduction) at 5 kW. The harmonics reduction by the proposed method is as follows: the 3rd harmonic at 1 kW from 0.25 A to 0.02 A (92% reduction), 5th harmonic from 0.50 A to 0.015 A (96% reduction), and 7th harmonic 0.58 to 0.018 A (96% reduction) respectively. Meanwhile, the harmonic reduction by the propose method at 5 kW is as follows; the 3rd harmonic from 1.75 A to 0.15 A (92% reduction), 5th harmonic from 1.1 A to 0.18 A (87% reduction), and 7th harmonic from 0.8 A to 0.17 A (80% reduction), respectively.
As shown in the Table 3, the THD of the inverter current is not able to meet the 5% threshold without the harmonic compensation. However, when the proposed LIA harmonic compensation is applied to eliminate the 3rd, 5th, and 7th harmonics, the inverter current is able to achieve the THD under 5% over the 40% load. It can be confirmed by the experimental results that the THD of the grid current is well reduced by the proposed method under the distorted grid condition.  Table 4 shows a comparison of the proposed harmonic compensation method and the conventional harmonic compensation methods employing the LCL filters in terms of THD, switching frequency, base impedance of the inverter, the ratio of the impedance of the filter with respect to the base impedance of the inverter and less than 5% THD over the 40% load. The size of the filter is compared by the base impedance, which can be calculated Filter Impedance =2π f o L(Total Inductance) 2π(60)(1.8mH ) = 0.678 Ω Ratio of Filter Impedance to Base Impedance = Filter Impedance Base Impedance % = 0.678 Ω 10 Ω × 100 = 6.78% (21) Filter Impedance 0.678 Ratio of Filter Impedance to Base Impedance= % 100 6.78% Base Impedance 10 The filter impedance ratio shown in Equation (21) is the ratio of the filter impedance to the base impedance of the inverter. A higher value of the ratio implies the higher attenuation of the harmonics and hence the improved THD. However, the higher value of the ratio also implies the increased volume and cost of the filter employed.  Table 4, all the filters used in the reference papers have the higher "Ratio of filter impedance to base impedance" as compared to that of the proposed method, which implies the larger size of the filter and even higher attenuation to the harmonics as well. However, they are unable to achieve a 5% THD threshold at less than 40% rated power, even though the filter with higher attenuation is employed. In contrast, the proposed method employs a filter with lower attenuation, i.e., a smaller "Ratio of filter impedance to base impedance", as compared to those of other methods. Therefore, it can be concluded that it is possible to achieve the better THD value with a smaller sized filter with the proposed harmonic compensation method due to the high performance of the proposed harmonic compensation method with LIA.

Conclusions
In this paper, an LIA-based harmonic compensation method for the single phase GCIs is proposed. The LIA is used to extract the amplitude and the phase of a harmonic with the high accuracy from the highly distorted grid feedback current. In addition, for detection of the harmonic, a reference signal with an arbitrary theta is generated, which is independent of the grid theta, detected by the PLL. It eliminates the concerns of using grid theta that is polluted by distorted grid conditions. Moreover, in the proposed LIA harmonic compensation, the LPF used to eliminate the AC ripples and the PI harmonic compensator both are designed the same for the for the nth harmonic order. Thus, it will reduce the design complexity and less effort will be applied for better performance of the system.
Finally, a comparison is done between the proposed and the conventional harmonic compensation methods by employing the LCL filter. It has been concluded that the proposed method employs a filter with a lower attenuation, smaller in size and volume as compared to those of conventional methods. Moreover, the proposed method ensures [39] 8 KHz 2.27 28% the 40% load. The size of the filter is compared by the base impedance, which can be cal-culated according to the power, inverter output RMS voltage (Vo) and output RMS current (Io) and output fundamental frequency (fo) as followings.
Filter Impedance 0.678 Ratio of Filter Impedance to Base Impedance= % 100 6.78% Base Impedance 10 The filter impedance ratio shown in Equation (21) is the ratio of the filter impedance to the base impedance of the inverter. A higher value of the ratio implies the higher atten-uation of the harmonics and hence the improved THD. However, the higher value of the ratio also implies the increased volume and cost of the filter employed.  Table 4, all the filters used in the reference papers have the higher "Ratio of filter impedance to base impedance" as compared to that of the proposed method, which im-plies the larger size of the filter and even higher attenuation to the harmonics as well.
However, they are unable to achieve a 5% THD threshold at less than 40% rated power, even though the filter with higher attenuation is employed. In contrast, the proposed method employs a filter with lower attenuation, i.e., a smaller "Ratio of filter impedance to base impedance", as compared to those of other methods. Therefore, it can be con-cluded that it is possible to achieve the better THD value with a smaller sized filter with the proposed harmonic compensation method due to the high performance of the pro-posed harmonic compensation method with LIA.

Conclusions
In this paper, an LIA-based harmonic compensation method for the single phase GCIs is proposed. The LIA is used to extract the amplitude and the phase of a harmonic with the high accuracy from the highly distorted grid feedback current. In addition, for detection of the harmonic, a reference signal with an arbitrary theta is generated, which is independent of the grid theta, detected by the PLL. It eliminates the concerns of using grid theta that is polluted by distorted grid conditions. Moreover, in the proposed LIA har-monic compensation, the LPF used to eliminate the AC ripples and the PI harmonic com-pensator both are designed the same for the for the nth harmonic order. Thus, it will re-duce the design complexity and less effort will be applied for better performance of the system.
Finally, a comparison is done between the proposed and the conventional harmonic compensation methods by employing the LCL filter. It has been concluded that the pro-posed method employs a filter with a lower attenuation, smaller in size and volume as compared to those of conventional methods. Moreover, the proposed method ensures [40] 20 KHz 10 11.3% the filter with respect to the base impedance of the inverter and less than 5% THD over the 40% load. The size of the filter is compared by the base impedance, which can be cal-culated according to the power, inverter output RMS voltage (Vo) and output RMS current (Io) and output fundamental frequency (fo) as followings.
Filter Impedance 0.678 Ratio of Filter Impedance to Base Impedance= % 100 6.78% Base Impedance 10 The filter impedance ratio shown in Equation (21) is the ratio of the filter impedance to the base impedance of the inverter. A higher value of the ratio implies the higher atten-uation of the harmonics and hence the improved THD. However, the higher value of the ratio also implies the increased volume and cost of the filter employed.  Table 4, all the filters used in the reference papers have the higher "Ratio of filter impedance to base impedance" as compared to that of the proposed method, which im-plies the larger size of the filter and even higher attenuation to the harmonics as well.
However, they are unable to achieve a 5% THD threshold at less than 40% rated power, even though the filter with higher attenuation is employed. In contrast, the proposed method employs a filter with lower attenuation, i.e., a smaller "Ratio of filter impedance to base impedance", as compared to those of other methods. Therefore, it can be con-cluded that it is possible to achieve the better THD value with a smaller sized filter with the proposed harmonic compensation method due to the high performance of the pro-posed harmonic compensation method with LIA.

Conclusions
In this paper, an LIA-based harmonic compensation method for the single phase GCIs is proposed. The LIA is used to extract the amplitude and the phase of a harmonic with the high accuracy from the highly distorted grid feedback current. In addition, for detection of the harmonic, a reference signal with an arbitrary theta is generated, which is independent of the grid theta, detected by the PLL. It eliminates the concerns of using grid theta that is polluted by distorted grid conditions. Moreover, in the proposed LIA har-monic compensation, the LPF used to eliminate the AC ripples and the PI harmonic com-pensator both are designed the same for the for the nth harmonic order. Thus, it will re-duce the design complexity and less effort will be applied for better performance of the system.
Finally, a comparison is done between the proposed and the conventional harmonic compensation methods by employing the LCL filter. It has been concluded that the pro-posed method employs a filter with a lower attenuation, smaller in size and volume as compared to those of conventional methods. Moreover, the proposed method ensures [41] 20 KHz 10 11.3% culated according to the power, inverter output RMS voltage (Vo) and output RMS current (Io) and output fundamental frequency (fo) as followings.
Filter Impedance 0.678 Ratio of Filter Impedance to Base Impedance= % 100 6.78% Base Impedance 10 The filter impedance ratio shown in Equation (21) is the ratio of the filter impedance to the base impedance of the inverter. A higher value of the ratio implies the higher attenuation of the harmonics and hence the improved THD. However, the higher value of the ratio also implies the increased volume and cost of the filter employed.  Table 4, all the filters used in the reference papers have the higher "Ratio of filter impedance to base impedance" as compared to that of the proposed method, which implies the larger size of the filter and even higher attenuation to the harmonics as well. However, they are unable to achieve a 5% THD threshold at less than 40% rated power, even though the filter with higher attenuation is employed. In contrast, the proposed method employs a filter with lower attenuation, i.e., a smaller "Ratio of filter impedance to base impedance", as compared to those of other methods. Therefore, it can be concluded that it is possible to achieve the better THD value with a smaller sized filter with the proposed harmonic compensation method due to the high performance of the proposed harmonic compensation method with LIA.

Conclusions
In this paper, an LIA-based harmonic compensation method for the single phase GCIs is proposed. The LIA is used to extract the amplitude and the phase of a harmonic with the high accuracy from the highly distorted grid feedback current. In addition, for detection of the harmonic, a reference signal with an arbitrary theta is generated, which is independent of the grid theta, detected by the PLL. It eliminates the concerns of using grid theta that is polluted by distorted grid conditions. Moreover, in the proposed LIA harmonic compensation, the LPF used to eliminate the AC ripples and the PI harmonic compensator both are designed the same for the for the nth harmonic order. Thus, it will reduce the design complexity and less effort will be applied for better performance of the system.
Finally, a comparison is done between the proposed and the conventional harmonic compensation methods by employing the LCL filter. It has been concluded that the proposed method employs a filter with a lower attenuation, smaller in size and volume as compared to those of conventional methods. Moreover, the proposed method ensures Proposed 10 KHz 10 6.78% the 40% load. The size of the filter is compared by the base impedance, which can be calculated according to the power, inverter output RMS voltage (Vo) and output RMS current (Io) and output fundamental frequency (fo) as followings.
Filter Impedance 0.678 Ratio of Filter Impedance to Base Impedance= % 100 6.78% Base Impedance 10 The filter impedance ratio shown in Equation (21) is the ratio of the filter impedance to the base impedance of the inverter. A higher value of the ratio implies the higher attenuation of the harmonics and hence the improved THD. However, the higher value of the ratio also implies the increased volume and cost of the filter employed.  Table 4, all the filters used in the reference papers have the higher "Ratio of filter impedance to base impedance" as compared to that of the proposed method, which implies the larger size of the filter and even higher attenuation to the harmonics as well. However, they are unable to achieve a 5% THD threshold at less than 40% rated power, even though the filter with higher attenuation is employed. In contrast, the proposed method employs a filter with lower attenuation, i.e., a smaller "Ratio of filter impedance to base impedance", as compared to those of other methods. Therefore, it can be concluded that it is possible to achieve the better THD value with a smaller sized filter with the proposed harmonic compensation method due to the high performance of the proposed harmonic compensation method with LIA.

Conclusions
In this paper, an LIA-based harmonic compensation method for the single phase GCIs is proposed. The LIA is used to extract the amplitude and the phase of a harmonic with the high accuracy from the highly distorted grid feedback current. In addition, for detection of the harmonic, a reference signal with an arbitrary theta is generated, which is independent of the grid theta, detected by the PLL. It eliminates the concerns of using grid theta that is polluted by distorted grid conditions. Moreover, in the proposed LIA harmonic compensation, the LPF used to eliminate the AC ripples and the PI harmonic compensator both are designed the same for the for the nth harmonic order. Thus, it will reduce the design complexity and less effort will be applied for better performance of the system.
Finally, a comparison is done between the proposed and the conventional harmonic compensation methods by employing the LCL filter. It has been concluded that the proposed method employs a filter with a lower attenuation, smaller in size and volume as compared to those of conventional methods. Moreover, the proposed method ensures The filter impedance ratio shown in Equation (21) is the ratio of the filter impedance to the base impedance of the inverter. A higher value of the ratio implies the higher attenuation of the harmonics and hence the improved THD. However, the higher value of the ratio also implies the increased volume and cost of the filter employed.
In Table 4, all the filters used in the reference papers have the higher "Ratio of filter impedance to base impedance" as compared to that of the proposed method, which implies the larger size of the filter and even higher attenuation to the harmonics as well. However, they are unable to achieve a 5% THD threshold at less than 40% rated power, even though the filter with higher attenuation is employed. In contrast, the proposed method employs a filter with lower attenuation, i.e., a smaller "Ratio of filter impedance to base impedance", as compared to those of other methods. Therefore, it can be concluded that it is possible to achieve the better THD value with a smaller sized filter with the proposed harmonic compensation method due to the high performance of the proposed harmonic compensation method with LIA.

Conclusions
In this paper, an LIA-based harmonic compensation method for the single phase GCIs is proposed. The LIA is used to extract the amplitude and the phase of a harmonic with the high accuracy from the highly distorted grid feedback current. In addition, for detection of the harmonic, a reference signal with an arbitrary theta is generated, which is independent of the grid theta, detected by the PLL. It eliminates the concerns of using grid theta that is polluted by distorted grid conditions. Moreover, in the proposed LIA harmonic compensation, the LPF used to eliminate the AC ripples and the PI harmonic compensator both are designed the same for the for the nth harmonic order. Thus, it will reduce the design complexity and less effort will be applied for better performance of the system.
Finally, a comparison is done between the proposed and the conventional harmonic compensation methods by employing the LCL filter. It has been concluded that the proposed method employs a filter with a lower attenuation, smaller in size and volume as compared to those of conventional methods. Moreover, the proposed method ensures THD less than 5% for a 5 kW GCI over the 40% load with a smaller size filter under the distorted grid conditions due to the high performance LIA harmonic compensation. The outstanding performance of the proposed LIA harmonic compensation method have been verified by simulation and experimental results.