A Fast Time-Domain Current Harmonic Extraction Algorithm for Power Quality Improvement Using Three-Phase Active Power Filter

Harmonic current estimation is the key aspect of Active Power Filter (APF) control algorithms to generate a reference current for harmonic compensation. This paper proposes a novel structure for harmonic current estimation scheme based on Trigonometric Orthogonal Principle (TOP) and Self Tuning Filter (STF). The key advantages of the proposed method are its simplicity, low computational burden and faster execution time in comparison to the conventional harmonic current estimation approaches. The TOP method provides a simple and fast approach to extract the reference current, while STF provides a simplified structure to generate the required synchronization signal that eliminates the need of a Phase Locked Loop (PLL) algorithm for synchronization. As a result, it exhibits less complexity in implementation and less consumption of microcontroller‘s resources; thus, the proposed method can be implemented using a low-cost microcontroller. It is shown in the paper that the proposed method provides 10 times gain in processing speed as compared to the conventional DQ method. The proposed approach is analyzed in detail, and its effectiveness and superior performance are verified using simulation and experimental results.


I. INTRODUCTION
Advancements of power electronics have significantly increased the use of power converters in domestic, commercial and industrial applications for efficient energy utilization. However, it pollutes the power system with harmonics by drawing non-sinusoidal current and reactive power from the source. This non-linear behavior causes significant power losses, which not only degrade the efficiency and performance of the power system but also introduce other problems like overheating of equipment, malfunctioning of sensitive devices and a resonance problem [1]- [4]. Active power filters (APF) are being developed as a best solution to perform harmonics and reactive-power compensation in power systems [5], [6]. Different structures and topologies The associate editor coordinating the review of this manuscript and approving it for publication was Alexander Micallef . using passive and active power filters have been proposed in the literature, but shunt APF (SAPF) is considered the most effective tool for harmonic mitigation and addressing other power-quality issues [7]- [10].
The control structure of a three-phase SAPF as shown in Fig. 1 generates the estimated reference current that must be generated by the power filter to mitigate harmonics and reactive power in order to get a distortion-free source current and unity power factor. The control strategy consists of three main subsystems: reference-current estimation, Inner current control (switching) and outer DC-side voltage control. Among these subsystems, the current-harmonics generation algorithm is considered to be most critical [11]- [14]. As reference-current extraction is the first algorithm in APF control, fast and accurate current-harmonics extraction is of prime importance for the effective performance of the current control loop [15], [16]. The processing of the accurate 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/ reference signal enables SAPF to perform the harmonic and reactive-power compensation effectively. It maybe noted that the reference current extraction is independent to the topologies (two level, multi-level) employed [17].
Initially, analog filters such as a band-pass filter and a low-pass filter have been used for current-harmonic extraction, but the output of these filters is not precise because they introduce phase and magnitude errors [18]. Nowadays, the harmonic-current extraction is generally achieved in one of two domains, either in the time domain or in the frequency domain. Frequency-domain methods are based on the Discrete Fourier transform (DFT) or its upgraded form the Fast Fourier transform (FFT) [19], [20]. Though these methods are accurate, the delay they bring into the system make them unfeasible for fluctuating loads. Besides, their disadvantage of slow response and spectral leakage are also not negligible. In addition, Fourier-based harmonicextraction methods are more complicated in implementation. It requires careful consideration of the anti-aliasing filter, large memory requirements and computation power, careful application of a windowing function, and proper synchronization between fundamental frequency and sampling [21]. Time-domain methods are preferable to frequency-domain methods because of their simple and faster implementation [13]. Time-domain based approach, like Instantaneous Reactive Power Theory (IRPT) [17], [22] and Synchronous Reference Frame (SRF) [13], [23], [24], are still prevalent method despite introduction of novel approaches for reference-current generation. These well-tested methods are simple in implementation, reduce controller complexity and are suitable for practical implementation. Despite their simpler implementation and fast response, they requires a synchronization reference-phase signal, usually obtained from a PLL. PLL-based methods involve a comprehensive implementation; if the source voltage is distorted or unbalanced, the PLL requires additional filters to tackle the distortion, which increases the implementation complexity [25], [26]. This has a direct impact on the processing time when a low-cost microcontroller is used. Moreover, tuning of the proportional integral (PI) controller used in the PLL is an another challenge that needs to be taken into account [27]. As an another approach, IRPT based algorithm does not require PLL for synchronization, however this method requires extra voltage processing operation. Moreover, this method involves active and reactive power calculation which also increases the burden on the microcontroller by increasing the processing time of the controller. Harmonic extraction based on fuzzy control [28], adaptive [29], neural-network [30],multiple adaptivefeed-forward cancellation (MAFC) algorithm [31] and PLL-based algorithms [32] also provide a good performance, with a better dynamic response than Fourier, but the complexity in implementation is still a concern.
Recently harmonic extraction utilizing trigonometric orthogonal function has been proposed in literature [33]. As reported in [33], this method can bring great benefits in terms of higher processing speed for single-phase application. However, it still requires a phase lock loop which complicates the synchronization algorithm. The authors in [34] utilized the trigonometric orthogonal functions for generalized analysis of harmonic signals with non-sufficient description on application and examples.
As a result of the research work in this paper, PLL can be replaced with an adaptive filter known as Self Tuning Filter (STF). STF is able to provide a clean unitary synchronization signal irrespective of disturbances in the grid voltages [35], [36]. It is later verified in the paper, that STF can achieve the objective with fast execution time as compared to PLL. This paper solves the above-mentioned problems of the conventional methods via proposing a time-domain harmonics extraction approach which is the combination of trigonometric orthogonality principle (TOP) and STF technique. The proposed method (TOP) provides simpler digital implementation with lower computational burden for reference current estimation. In addition, the proposed method excludes PLL from the APF control algorithm. Instead it utilizes a simple structure of the STF for extracting fundamental component of the grid voltage, thus eliminating the complexity associated with implementation of PLL as well as isolating the APF from grid-voltage disturbances. Consequently, the proposed combination of TOP and STF forms a simple and low-computational-burden harmonic-extraction scheme which can be easily implemented in a low-cost microcontroller. Thus, a high-performance and low-cost system can be obtained.
The rest of the paper is arranged as follows: Section II discusses the operating principle of the proposed algorithm and Section III presents the generation of the synchronous phase signal. The simulation results are discussed in Section IV. The experimental results are presented in Section V and the conclusions of the paper form Section VI.

II. OPERATION PRINCIPLE OF PROPOSED ALGORITHM
The basic principle of an SAPF is shown in Fig.1, where the source current can be expressed as a combination of the load current and the filter current.
The non-linear load current composes of harmonic components and a fundamental component and is given by the Fourier series as: where ω indicates the frequency (100πrad/s) of the fundamental component. The first and second terms of (3) are active and reactive components of the fundamental load current respectively, while the third term represents the harmonics of the load current. The function of the APF is to provide the reactive content and harmonics content of the load current, such that the source only needs to supply the active component.
Hence, the source current becomes purely sinusoidal and in phase with the source voltage. The current drawn by the nonlinear load is composed of sinusoids at different multiple integrals of the fundamental frequency, and these frequency components are orthogonal to each other. Extraction of the fundamental component is obtained by eliminating the superimposed harmonics. One simple approach is to apply the trigonometric orthogonality principle, which states that the integral of the product of two orthogonal functions (y1, y2) is equal to zero. Mathematically, the integral of the product of two trigonometric functions in [−π, π] is zero if the functions are orthogonal to each other.
Considering two sinusoidal functions and integration of their inner product in [−π, π], The product above results in an odd function which is symmetric on [−π, π] thus sin(ωt) and cos(ωt) are orthogonal to each other and their integral product results in zero.
Also, sin(nωt) is orthogonal with sin(kωt + ϕ) and cos(kωt) as long as n = k and both are integers. Fig.2 illustrates the orthogonality principle shown by two sinusoidal functions with different frequencies. Similarly, load current is also composed of current components with different frequencies referred to as harmonic components. Therefore, by applying this principle, any component of the load current can be extracted. Usually, the active current of the fundamental component is extracted and then it is subtracted from the load current to generate the reference current. Thus the obtained reference current, which includes the harmonic and reactive current components, acts as a reference current for the APF. In order to extract the fundamental component, i L (t) is multiplied by sin (ωt), Taking the integral of both sides, According to the orthogonal principle, the 2nd term of (8) on the right hand side is equal to zero, so Again the 2nd term of (9) is also equal to zero, so π −π i L (t)·sin(ωt)d(ωt) = πI 1 cos φ 1 Similarly multiply (3) by cos(ωt) on both sides,and get  Consolidate (10) and (11), we can get the fundamental component of the load current i L , I 1 cos φ 1 sin(ωt)+I 1 sin φ 1 cos(ωt) = I 1 sin(ωt +φ 1 ) According to the harmonic current detection principle based on orthogonal theorem, instantaneous fundamental current can be written as; where For harmonic and reactive power compensation, the second term of (13), B 1 cos(ωt) can be ignored, thus the fundamental component can be extracted from the load current to get the reference signal. Then this fundamental component is subtracted from load current to get the reference signal as given by Harmonic current detection method based on orthogonal theorem is shown in Fig. 3. The implementation of mean value at [−π, π] is equivalent to use a low-pass filter (LPF) for eliminating AC components. However, LPF tends to make the response of the system sluggish hence an average filter is suggested. This can also be evaluated using the step response of LPF and average filter which is presented in Fig. 4. The cutoff frequency of butterworth LPF influences the dynamic

III. SYNCHRONIZATION PHASE SIGNAL
In order to get the synchronization reference-phase signal from the source voltage, an STF based approach is adopted as shown in Fig. 5. In a practical implementation, the source voltage contains distorted components and is not purely sinusoidal or maybe unbalanced. A self-tuning filter is used to remove those unwanted components in order to get the desired clean synchronization signal. The distorted source voltage is transformed into the stationary references (alphabeta) which include fundamental and distorted components given by where v sα(fund) and v sβ(fund) are the fundamental components and v sα(dis) and v sβ(dis) are the distorted components of the source voltage in the alpha-beta domain. In order to extract the fundamental component, the source voltage is passed through the STF filter and written as: where U xy and V xy are the instantaneous signals before and after integration, while ω is the angular frequency. On taking the Laplace transform of (18), we get By introducing an additional parameter K in T (s), the transfer function will have zero phase delay and unity magnitude at the cut-off frequency ω = ω c . Rearranging (19), we obtain the transfer function of the STF as: This additional parameter now affects the filtering performance of the STF. Fig. 6 shows the filtering characteristics of the STF for different values of K. As sown in Fig. 6, the selectivity of the filter at ω c is dependent on the parameter K . Reducing K increases the selectivity but increases the dynamics of the STF. To further illustrate this, the dynamics of the magnitude estimation (v S(fund_mag) ) from the STF when grid voltage falls to 320V peak is shown in Fig. 7. Higher value of K results in faster dynamic response while lower value provides a sluggish behaviour in magnitude estimation, which is an integral part of unitary vector generation. Thus, K must be carefully selected to achieve a good compromise between these two features. The value of K is tuned to 100 at the fixed cut-off frequency of f c = 50 Hz in order to get effective performance of the STF. If the input is replaced by v sαβ and the output signal by v sαβ(fund) and written in complex form with corresponding real and imaginary parts, (20) can be simplified as: Equating real and imaginary parts, the following expressions can be obtained: (23) Solving (22) and (23) The generalized structure in (24) and (25) can be used to construct the STF for any two orthogonal signals formed by the abc−αβ transformation. The result of (24) and (25) The magnitude of the fundamental component of the source voltage can be obtained by using the following calculation: From (26) and (27), the required synchronization signal for current-harmonic extraction can be obtained as follows: The synchronizing signal is obtained by processing the source voltage directly. Hence, the obtained synchronization signal will be able to track the changes of angular position of the operating power system. This means that the synchronization signal is in phase with the source voltage. Hence, STF can be a suitable replacement for the PLL, which has been a preferred choice for APF application.

IV. SIMULATION RESULTS
To validate the efficacy of the proposed approach, simulations are carried out in MATLAB Simulink environment. Firstly, the proposed synchronization signal generation (STF) and the proposed current harmonic extraction algorithm (TOP) are individually tested, and then a whole APF system including the combination of TOP and STF will be tested and analyzed. The load consists of a three-phase rectifier with a resistor and inductor on DC-side to generate the distorted current. This sort of non-linear load distorts the current with harmonics of order 6k ± 1. Table 1 provides the parameters used in the simulation study.

A. SYNCHRONIZATION SIGNAL GENERATION
The proposed TOP method requires unitary synchronization signal, which can be obtained either from a PLL or using the STF based approach as described in Section III. In PLL, the unitary sync signal is generated from the estimated phase, while in STF based method, the unitary signal is obtained by normalizing the filtered signal with the grid voltage magnitude. Both approaches provide distortion free synchronization signal with the THD below 1%. However, STF based method has advantage over the PLL in terms of implementation and resource consumption which is verified in experimental section. Fig. 8 represents the synchronization phase signal generated using the STF-based procedure in distorted  grid condition. It can be seen from Fig. 8 that, even in abnormal grid scenario the obtained synchronization phase signal contains a pure fundamental component (THD = 0.1%) of the source voltage. Another test is conducted for evaluating STF performance, where the grid voltage undergoes phase jump (+30 • ) at t = 0.08s, amplitude change (283 V ) at t = 0.2s and frequency jump (2Hz) at t = 0.32s. In all these three disturbances, the STF is able to generate accurate unitary synchronization signal. This is illustrated through simulation results shown in Fig. 9. This synchronization signal is used as a phase reference for the proposed current harmonicextraction algorithm (TOP) which eliminates the use of a PLL. The operation of STF only relies on grid voltage and has no dependency on the operation of TOP or APF system.

B. STEADY-STATE AND DYNAMIC ANALYSIS
In this section, the dynamic and the steady-state response of the proposed TOP method in generating the fundamental component of the load current is analyzed and compared with the two well-known SRF and Fourier-transform techniques.
To check the transient response, an additional switch is employed which is triggered at 0.1 s to provide a step change to the load. Fig. 10 (a) and Fig. 10 (b) represent the grid voltage, which is sinusoidal, and the load current, which is distorted and contains harmonics. To make a fair comparison, an Average Filter, as explained in Section II, with window size of 20 ms is used for both TOP and SRF methods. This  filter can eliminate the effect of the DC component in the measured current, which translates to sinusoidal at 50 Hz. As shown in Fig. 10 (d), Fourier-transform based method exhibits the transient response of at least one complete fundamental cycle. Fig. 10 (c) and 10 (e) represent the fundamental component extraction by the SRF and the proposed algorithm respectively. The SRF and the proposed method show the same steady-state and dynamic performance, which takes only half a cycle to settle down during the load variation.
From the simulation results in Fig. 10, although the proposed TOP and SRF methods exhibit the same dynamic response during the load variation, from an implementation point of view, the proposed method is superior due to its less number of calculations involved. This has direct impact on processing time of microcontrollers and is beneficial in industrial applications where low-cost microcontrollers are preferable. Table 2 presents the number of mathematical calculations involved in the three tested methods. Among these, Fourier transform requires a large number of mathematical calculations. Additionally, Fourier requires large memory compared to any other approach. It can be seen that TOP provides an efficient implementation and can be considered as a suitable alternative for a low-cost implementation.

C. COMPENSATION PERFORMANCE ANALYSIS
In this section, the operation of the whole APF system, including the proposed TOP method for harmonics extraction and STF for synchronization, is tested and analyzed. Fig. 11   FIGURE 11. Overall compensation result of three-phase APF with TOP algorithm.  represents the compensation performance of a three-phase APF during the steady-state and at load variations. It can be seen that during a load change, the system using the proposed approach requires half of the fundamental cycle to reach the steady-state mode, which meets the simulation results in Fig. 10 (d). The THD of source current before and after compensation are depicted in Fig. 12 and Fig. 13 respectively. THD is below 5% after compensation, thus fulfilling the restriction set by IEEE-standard 519-2014. This verifies the VOLUME 8, 2020 successful operation of the whole APF system including both proposed TOP and STF for synchronization.

V. EXPERIMENT RESULTS
The aim of the experimental results in this section is to validate the simulation results as well as verifying the lower complexity and processing time of the proposed approach than the conventional methods. In this regard, the focus has been on the harmonic current extraction rather than the operation of whole APF system. A hardware prototype is developed in the laboratory to validate the proposed current harmonic-extraction algorithm as well as compare it with other conventional approaches. The configuration of the hardware setup is the same as shown in Fig. 1, and the overall laboratory setup is shown in Fig. 14. A three-phase variable AC source is used as a supply voltage connected with the APF and the non-linear load. The nonlinear load is a three-phase uncontrolled rectifier. A dSPACE Microlabbox 1102 is used for implementing the proposed algorithm and for controlling the APF. The main parameters used in the experiment are given in the Table 3.
The proposed TOP method is a PLL less system, and its required synchronization phase signals are obtained from the STF based algorithm. The synchronization phase signals, which are shown in Fig. 15, are purely sinusoidal and contain phase information of the grid voltage. The experimental result in Fig. 15 is consistent with the simulation result in Fig. 8. The STF method is as effective as PLL but with reduced computation burden and complexity. Comparing the execution times of a standard PLL and STF (measured and reported by dSPACE 1102), the STF requires only 0.34µs which is 10 time smaller than 3.6µs required by the standard PLL. A similar execution time will also be noted if other micro-   controllers are used in place of dSPACE because of lower computational requirement from the proposed method. Fig. 16 illustrates the extracted fundamental component of the load current using the proposed TOP algorithm. As already shown in Fig. 10 and experimentally verified in Fig. 16, the proposed TOP method can extract the fundamental component with minimum THD and within half cycle during transient same as SRF method. The corresponding harmonic reference currents generated by TOP are shown in Fig. 17 which will used as reference for the controller of APF.   The compensation performance of the APF, utilizing the proposed structure of TOP and STF, is shown in Fig. 18 where the load current, the harmonics current and the source current are presented. The sinusoidal nature of the source current and with the THD below 5% verifies the accuracy of the proposed TOP-STF based harmonic extraction method.
So far, the experimental results have shown the effectiveness of the proposed method, which is equivalent to the conventional SRF method. However, as mentioned throughout the paper and shown in Table 2, the proposed approach exhibits a lower computational burden than SRF. This advantage is verified in this section by experimentally observing the execution time of each algorithm in the control desk of   dSPACE 1102 presented in Fig. 19, Fig. 20 and Fig. 21. As can be seen, the proposed TOP-STF method requires 0.8 µs execution time, while Fourier-transform method exhibits 16 µs and SRF shows 9 µs. The execution times of the three algorithms are plotted and compared in Fig. 22. From  Fig. 22, it can be concluded that the proposed method takes the minimum time for execution which is highly beneficial, especially if the sampling window time is less, for instance, with high sampling frequency. The lower processing times gives enough remaining window time for other control tasks such as the execution of current and voltage control loops. Performance evaluations of the proposed method compared with the conventional SRF and FFT are summarized in Table 4.

VI. CONCLUSION
This paper proposes a new harmonic extraction approach which uses TOP principle. The replacement for a PLL, as used by the conventional methods, was realized with a simple structure comprised of an STF for synchronization. As a result, the proposed TOP method exhibits lower complexity and computational burden. The underlying principle of the TOP and STF are discussed in detail and the performance of the proposed method is compared with conventional techniques. The simulation, analysis and experimental results verify the superiority of the proposed method in terms of its accuracy, dynamics and implementation. The TOP method is at least 10 times faster than the SRF and 20 times than the fourier based method. The proposed harmonics extraction approach would be an interesting alternative for industrial used APFs where low-cost microcontrollers are preferable. The future research will focus on including the selective harmonic compensation capability of the proposed method.