Harmonic Detection for Shunt Active Power Filter Using ADALINE Neural Network

: This paper presents an efﬁcient harmonic detection for real-time generation of the reference current fed to a shunt active power ﬁlter using the ADALINE neural network. This proposed method is a single layer with 101 nodes generating the coefﬁcients referred to as weights of the reference current model. It effectively overcomes the drawback of the current technology, which is instantaneous power theory (PQ). The proposed method was implemented on the TMS320F28335 DSP board and tested against MATLAB with Simulink as a hardware-in-loop (HIL) structure. This method gives a good performance by producing a precise reference current in a short period with uncomplicated calculation. It also efﬁciently can eliminate individual harmonic current. The achieved percentage of total harmonic distortion (%THD) in the current is reduced following the IEEE standard, while the power factor can be maintained to unity.


Introduction
Today's electrical technology employs a great number of power converters, which impose a stringent demand on power quality. It has been known that two major factors curtailing the power quality are current and voltage harmonics, and reactive power. To maintain the power quality up to industrial standards, one may choose to compensate either of the two or both. As non-linear loads are common in industry, they introduce a large amount of current distortion drawn from the source. In effect, the source voltages distort to a certain extent. Such current harmonic distortion further increases reactive power, hence decreases power factor [1]. A good practical approach to mitigate this problem is to use a shunt active power filter (SAPF) with a voltage source inverter (VSI). A strong point of this type of filter is that it does not cause a resonant problem, and has a low power loss [2,3]. SAPF is a tool for injecting the compensated current into the point of common coupling (PCC) to reduce the total harmonic distortion (THD) under the standard of IEEE std. 519-1992 [4].
For an APF to effectively operate, the detailed harmonics to be compensated must be known. The process to obtain this is referred to as harmonic detection. Many harmonic detection methods have been proposed such as Kalman filter [5], discrete Fourier transform (DFT) [6], instantaneous power theory (PQ) [7], sliding window Fourier analysis (SWFA) [8], the a-b-c reference frame [9], the synchronous detection (SD) [10], the synchronous reference frame (SRF) theory or the d-q axis (DQ) [11], the synchronous detection with Fourier (SDF) method [12], and the d-q axis with Fourier (DQF) method [13]. References [13][14][15][16][17][18][19] studied the advantages and drawbacks of various harmonic current detection methods. It has been found that the methods of PQ, DQ, SD, the a-b-c reference frame, and SRF are not accurate enough for harmonic detection when the power system is not ideal. This is because it uses a filter for separating the harmonic quantity from the fundamental quantity.
is not ideal. This is because it uses a filter for separating the harmonic quantity from the fundamental quantity. It is also extremely difficult to apply for detecting the individual harmonic currents in combination with hybrid power filters. The SD method poorly identifies the harmonic and reactive quantities when the system is unbalanced. The a-b-c reference frame and SWFA methods give poor reactive quantification, both balanced and unbalanced systems. The SWFA and DQF methods, although accurate, are very complicated for harmonic current components calculations. In addition, there are some electric power loads that generate the DC quantity in the power system [20,21]. Also, nowadays, the renewable energy systems are connected to the main power grid distribution system, resulting in the DC quantity being generated in the power system. This causes problems for transformer and circuit breaker operations [22][23][24][25]. Therefore, SAPF is also essential to have the ability to reduce the DC quantity generated in the power system as well. The method mentioned above for detecting harmonic currents cannot work with good performance under an electrical system with a DC quantity occurs. A neural network (NN) has a learning and training property that can quickly and accurately estimate the harmonic current components [26][27][28][29][30][31][32][33][34][35][36]. The NN can be designed to counteract the drawback of the traditional detection methods with good performance. It can detect the individual harmonic current, the DC quantity, and the reactive quantity using a simple equation. It is also very flexible in its application. The NN can be designed to counteract the drawback of the traditional identification methods with good performance. Hence, this paper selects NN as a methodology to detect harmonic current components.
This paper proposes the use of the ADALINE neural network to generate 101 weighting factors of the reference current model. The computed reference current is fed to an APF, which in turn generates compensated currents injected into the three-phase system. Doing it this way, the reference current obtained is highly accurate. Hence, this current harmonic compensation is effective. The advantage of ADALINE is that it can cope with a quickly changing state of the system. As a result, it quickly and accurately separates the individual harmonic. It can be used as an efficient tool to detect the some harmonic for hybrid power filter (HPF) and a DC component as well. Figure 1 represents the proposed filtering system that is connected to a three-phase power system. The PI controller is applied for the current loop and DC bus voltage loop controls.  This paper has the following parts: Section 2 presents the analysis and the calculation to find the reference current which consists of the harmonic current and the reactive Energies 2021, 14, 4351 3 of 21 component using the learning and training weight from the ADALINE neural network, then presents the individual harmonic detection method. Section 3 presents the simulation with the hardware-in-loop (HIL) technique, while the simulation results with the discussion are presented in Section 4. The last section concludes and analyzes the simulation results presented in the previous section.

Harmonic Detection and Power Factor Improvement
Non-linear electrical load causes serious current distortion. Such distortion is represented by harmonic components of the current expressed by the term i h (t) in Equation (1). Fourier series expansion has been effectively used as its representation as indicated by Equation (2) in which the current i(t) composed of its DC, fundamental, and harmonic components.

Instantaneous Reactive Power Theory
The instantaneous reactive power theory (PQ) is a well-known and widely used method of harmonic detection and can detect the harmonic current components, such as identifying harmonic currents, reactive power compensation, and the calculation process better than other methods as mentioned above. Therefore, the researcher has chosen the PQ method to compare with the proposed method. A calculated procedure for a 3-phase 3-wire electrical system is shown in Figure 2. It begins by converting the supply voltage (v Sa , v Sb , v Sc ) and the load current in 3-phase form (i La , i Lb , i Lc ) to the electrical quantity on the αβ axis without zero-sequence using Clarke transform, then calculates to find the instantaneous active power (p L ) and the instantaneous reactive power (q L ). Hence, a high-pass filter is used to separate the harmonic active power from the instantaneous active power for calculating the reference current on the αβ axis (i * Cα , i * Cβ ), then convert this reference current from the αβ quantity to the 3-phase quantity (i * Ca , i * Cb , i * Cc ). From the process of the PQ harmonic detection mentioned above. It can be seen that both the source voltage and the load current were used in the calculation. They are also used in conjunction with high-pass filtering to separate the active power of the fundamental quantity and the harmonic quantity for calculating the reference current which contains both the amount of harmonic current and the reactive power. the harmonic quantity for calculating the reference current which contains both the amount of harmonic current and the reactive power.

ADALINE Neural Network
The form of Equation (4) is similar to the output equation of a neural network, where b is bias, W is the weight matrix, and X is the input matrix. Therefore, adopting the ADA-LINE neural network is conceptually straightforward. This method applies the least mean square (LMS) learning technique which this proposed ADALINE neural network is capable of training and learning in real time [31]. The diagram in Figure 3 represents the structure of the proposed ADALINE neural network for harmonic current detection. This proposed real-time harmonic extraction has the target for learning and training is the load current ( ) of each phase, the input X is the sine and cosine term of the 50 harmonic orders with the 100-weight updating are the coefficient of the sine and cosine terms. Besides, the DC component of the Fourier series as in Equation (2) comes from a bias updating. The update of weight and bias is based on NN supervised training which is used in this learning and training to keep the error value to a minimum. This means that the output ( ) as in Equation (4) is closest to the target ( ).

ADALINE Neural Network
The form of Equation (4) is similar to the output equation of a neural network, where b is bias, W is the weight matrix, and X is the input matrix. Therefore, adopting the ADALINE neural network is conceptually straightforward. This method applies the least mean square (LMS) learning technique which this proposed ADALINE neural network is capable of training and learning in real time [31]. The diagram in Figure 3 represents the structure of the proposed ADALINE neural network for harmonic current detection. This proposed real-time harmonic extraction has the target for learning and training is the load current i L (t) of each phase, the input X is the sine and cosine term of the 50 harmonic orders with the 100-weight updating are the coefficient of the sine and cosine terms. Besides, the DC component of the Fourier series as in Equation (2) comes from a bias updating. The update of weight and bias is based on NN supervised training which is used in this learning and training to keep the error value to a minimum. This means that the output i(t) as in Equation (4) is closest to the target i L (t).  Consider a sinusoidal voltage supply represented by: When the supply feeds a non-linear load such as a power converter, the current contains harmonic components expressed by: The instantaneous power can simply derive as shown by Equations (9) and (10).
As a result, the average power and the fundamental active current are expressed by Equations (11)-(13), respectively.
For a balanced three-phase system, the instantaneous fundamental active currents can be expressed by Equations (14)-(16) for phases a, b, and c, respectively.  (14) [ ] When the supply feeds a non-linear load such as a power converter, the current contains harmonic components expressed by: The instantaneous power can simply derive as shown by Equations (9) and (10).
As a result, the average power and the fundamental active current are expressed by Equations (11)-(13), respectively.
For a balanced three-phase system, the instantaneous fundamental active currents can be expressed by Equations (14)-(16) for phases a, b, and c, respectively.
When the voltage source supplies the current to a non-linear load, the DC component of some load, the active current and reactive current will occur in each harmonic order as shown in Equation (17), where, i 1p , i 1q , i hp and i hq are the fundamental active current, Energies 2021, 14, 4351 6 of 21 the fundamental reactive current, the harmonic active current, and the harmonic reactive current in each order, respectively.
The purpose of SAPF is to compensate for harmonic currents and reactive power into PCC of electrical power systems. This is so that the source current has a shape close to the sinusoidal waveform and the phase angle is in phase with the voltage phase angle of each phase. Hence, it is necessary to find a reference current composed of a DC component, harmonic currents, and reactive currents at fundamental frequencies. These components are used as the reference quantity for the current control for switching VSI to inject the compensated current into the system at the PCC. The source current is shown in Equation (18) with a shape close to the sinusoidal waveform and the phase angle in phase with the phase angle of the source voltage in each phase. The source current is an active current at fundamental frequency calculated from Equation (19), so the required reference current will be obtained from Equation (20). The calculated process is shown in Figure 4. Figure 5a shows the whole reference current calculation as proposed previously. It also shows that the amplitude of the active current (I Pk ) in each phase is the combination of the amplitude of the fundamental active current (I 1Pk ) and the amplitude of the DC bus active current (I Cdc ). This active current occurs from the process of controlling the DC bus voltage equal to the reference voltage. When the voltage source supplies the current to a non-linear load, the DC component of some load, the active current and reactive current will occur in each harmonic order as shown in Equation (17), where, , , and are the fundamental active current, the fundamental reactive current, the harmonic active current, and the harmonic reactive current in each order, respectively.
The purpose of SAPF is to compensate for harmonic currents and reactive power into PCC of electrical power systems. This is so that the source current has a shape close to the sinusoidal waveform and the phase angle is in phase with the voltage phase angle of each phase. Hence, it is necessary to find a reference current composed of a DC component, harmonic currents, and reactive currents at fundamental frequencies. These components are used as the reference quantity for the current control for switching VSI to inject the compensated current into the system at the PCC. The source current is shown in Equation (18) with a shape close to the sinusoidal waveform and the phase angle in phase with the phase angle of the source voltage in each phase. The source current is an active current at fundamental frequency calculated from Equation (19), so the required reference current will be obtained from Equation (20). The calculated process is shown in Figure 4.  Figure 5a shows the whole reference current calculation as proposed previously. It also shows that the amplitude of the active current ( ) in each phase is the combination of the amplitude of the fundamental active current ( ) and the amplitude of the DC bus active current ( ). This active current occurs from the process of controlling the DC bus voltage equal to the reference voltage.
The elimination of the individual harmonic (IH) which is detected by the ADALINE neural network can be easily achieved as shown in Figure 3 The individual harmonic component of each order can be separated by the learning and training process of the network as represented by Equation (3). Each harmonic is separated from the load current which is used as a target in a real-time learning and training process with the maximum harmonic at order 50. The separation can be achieved by Equation (21). The elimination of the individual harmonic (IH) which is detected by the ADALINE neural network can be easily achieved as shown in Figure 3 The individual harmonic component of each order can be separated by the learning and training process of the network as represented by Equation (3). Each harmonic is separated from the load current which is used as a target in a real-time learning and training process with the maximum harmonic at order 50. The separation can be achieved by Equation (21).
For example, the reference current of the individual harmonic current detection process, i * CI H , is achieved by the compensation of the fundamental reactive current i 1q and the harmonic current order 2nd (i h2 ) to order 5th (i h5 ) as shown in Equation (22). Figure 5b shows the reference current calculation for the individual harmonic elimination process.

System Parameter and Controller Design
The design of the voltage source inverter is crucial to the performance of the current injection into the PCC in various processes, such as the selection of the reference DC bus voltage ( * ), the inductance design process, [37], and the capacitor design process, [38]. Following the references, this simulation used * = 360 V, = 18 mH, and = 2350 μF. There are two PI controllers required for controlling the current and the DC bus voltage. The controllers design of this article is followed the reference [39]. Table  1 summarizes the controller parameters thus obtained.

System Parameter and Controller Design
The design of the voltage source inverter is crucial to the performance of the current injection into the PCC in various processes, such as the selection of the reference DC bus voltage (V * dc ), the inductance design process, L f [37], and the capacitor design process, C dc [38]. Following the references, this simulation used V * dc = 360 V, L f = 18 mH, and C dc = 2350 µF. There are two PI controllers required for controlling the current and the DC bus voltage. The controllers design of this article is followed the reference [39]. Table 1 summarizes the controller parameters thus obtained.

System Simulation
The simulation to evaluate the performance of the APF system using the proposed method will use the hardware-in-loop (HIL) simulation which is the combination between MATLAB with Simulink of The MathWorks, Natick, MA, USA, and eZdsp TMS320F28335 board of Spectrum Digital Incorporated, Stafford, TX, USA. The eZdsp board will serve all calculation parts, while Simulink will simulate and illustrate the results. The configuration of HIL is shown in Figure 6 and the device configuration of the HIL is shown in Figure 7. The simulation to evaluate the performance of the APF system using the proposed method will use the hardware-in-loop (HIL) simulation which is the combination between MATLAB with Simulink of The MathWorks, Natick, MA, USA, and eZdsp TMS320F28335 board of Spectrum Digital Incorporated, Stafford, TX, USA. The eZdsp board will serve all calculation parts, while Simulink will simulate and illustrate the results. The configuration of HIL is shown in Figure 6 and the device configuration of the HIL is shown in Figure 7.

Results and Discussion
This section presents the simulation results of the purposed method, ADALINE harmonic detection, for the balanced three-phase power system with all harmonic order elimination and and individual harmonic elimination. The result will be compared with the result received from PQ harmonic detection theory with a second-order butter-worth LP filter having its cutoff frequency at 30 Hz. These parameters of the LP filter give the best performance for the considered load. The simulation to evaluate the performance of the APF system using the proposed method will use the hardware-in-loop (HIL) simulation which is the combination between MATLAB with Simulink of The MathWorks, Natick, MA, USA, and eZdsp TMS320F28335 board of Spectrum Digital Incorporated, Stafford, TX, USA. The eZdsp board will serve all calculation parts, while Simulink will simulate and illustrate the results. The configuration of HIL is shown in Figure 6 and the device configuration of the HIL is shown in Figure 7.

Results and Discussion
This section presents the simulation results of the purposed method, ADALINE harmonic detection, for the balanced three-phase power system with all harmonic order elimination and and individual harmonic elimination. The result will be compared with the result received from PQ harmonic detection theory with a second-order butter-worth LP filter having its cutoff frequency at 30 Hz. These parameters of the LP filter give the best performance for the considered load.

Results and Discussion
This section presents the simulation results of the purposed method, ADALINE harmonic detection, for the balanced three-phase power system with all harmonic order elimination and and individual harmonic elimination. The result will be compared with the result received from PQ harmonic detection theory with a second-order butter-worth LP filter having its cutoff frequency at 30 Hz. These parameters of the LP filter give the best performance for the considered load.

Case 1: Odd and Even Harmonic Load
The simulation of the balanced three-phase power system with non-linear load is presented in this case. Within simulated duration between 0 ≤ Time < 0.25 s, the load current (i L ) in each phase consists of the fundamental frequency and harmonics in the 5th order as shown in Equations (23)- (25). Equations (26)- (28) show the increase of the harmonic current load in even order (4th, 8th) and odd order (7th, 11th, 13th) in the duration 0.25 ≤ Time < 0.5 s. Such a load has the phase angle lagging the voltage phase angle equal to π/6. At 0 ≤ Time < 0.25 s.
i La,t2 (t) = i La,t1 (t) + 0.6 sin 4ω 0 t − π 6 + 0.9 sin 7ω 0 t − π 6 +0.3 sin 8ω 0 t − π 6 + 0.4 sin 11ω 0 t − π 6 + 0.3 sin 13ω 0 t − π 6 (26) i Lc,t2 (t) = i Lc,t1 (t) + 0.6 sin 4ω 0 t + 8π 3 − π 6 + 0.9 sin 7ω 0 t + 14π +0.3 sin 13ω 0 t + 26π 3 − π 6 (28) Figure 8 shows the simulation results of the signal of all three-phase for case 1. The PI controller that has K PV = 0.312 and K IV = 6.96 is used to control the DC bus voltage of VSI. This voltage should equal the reference DC voltage (360 volts). It changed a little bit at a time every 0.25 s that the load changed. After injecting the compensated current (i C ) with SAPF using that proposed method, the source current (i S ) of each phase is close to sinusoidal and in-phase with the source voltage make the power factor unity. When the load changed at 0.25 s, the compensated current could adjust according to the change in the load current (i L ). The source current of all three-phase remained near to a sinusoidal waveform and in-phase with the source voltage in a balanced system. All three-phase operate at a 120-degree difference phase angle and the same magnitude. The performance of the proposed method was slightly better than the PQ method. waveform and in-phase with the source voltage in a balanced system. All three-phase operate at a 120-degree difference phase angle and the same magnitude. The performance of the proposed method was slightly better than the PQ method.
The source current spectrum of the system before and after the load changing at a time of 0.25 s is shown in Figure 9. The first interval, 0 ≤ Time < 0.25 s, the spectrum of phase A, B, and C before compensation has fundamental quantity and the harmonic order 5th. After compensation, the spectrum has only a fundamental quantity, as shown in Figure 9a. The second interval, 0.25 ≤ Time < 0.5 s, the source current spectrum of phase A, B, and C before compensation composed of the fundamental quantity and the harmonic quantity at various order (4th, 5th, 7th, 8th, 11th, and 13th), which corresponds to Equations (26)- (28). After compensation, there is only the fundamental component spectrum, as shown in Figure 9b.   The source current spectrum of the system before and after the load changing at a time of 0.25 s is shown in Figure 9. The first interval, 0 ≤ Time < 0.25 s, the spectrum of phase A, B, and C before compensation has fundamental quantity and the harmonic order 5th. After compensation, the spectrum has only a fundamental quantity, as shown in Figure 9a. The second interval, 0.25 ≤ Time < 0.5 s, the source current spectrum of phase A, B, and C before compensation composed of the fundamental quantity and the harmonic quantity at various order (4th, 5th, 7th, 8th, 11th, and 13th), which corresponds to Equations (26)- (28). After compensation, there is only the fundamental component spectrum, as shown in Figure 9b.  Table 2 shows the average performance value of both %THD and power factor (PF) of SAPF operation using ADALINE harmonic detection compared with the PQ method. The ADALINE method gives a slightly better value than the PQ method. In terms of PF improving, both methods yield the same value, PF = 1. Case 2 presents the simulation with a non-linear load in a balanced three-phase power system. In theory, the power converters which has the non-linear load can create the DC component. The example of power converters mentioned above is a transformerless grid-connected system for renewable energy and DC/AC drives, etc. In this case, the load current of each phase consists of the harmonic component and is shown in Equations (29)-(31) at a time between 0 to 0.5 s. At between 0.5 to 1 s, the DC component from the load currents is increasing, as shown in Equations (32)-(34) and the phase angle is lagging  Table 2 shows the average performance value of both %THD and power factor (PF) of SAPF operation using ADALINE harmonic detection compared with the PQ method. The ADALINE method gives a slightly better value than the PQ method. In terms of PF improving, both methods yield the same value, PF = 1. Case 2 presents the simulation with a non-linear load in a balanced three-phase power system. In theory, the power converters which has the non-linear load can create the DC component. The example of power converters mentioned above is a transformerless grid-connected system for renewable energy and DC/AC drives, etc. In this case, the load current of each phase consists of the harmonic component and is shown in Equations (29)-(31) at a time between 0 to 0.5 s. At between 0.5 to 1 s, the DC component from the load currents is increasing, as shown in Equations (32)- (34) and the phase angle is lagging with the voltage phase angle equal to π/6. At 0 ≤ Time < 0.5 s.
i La,t1 (t) = 5 sin ω 0 t − π 6 + 1.2 sin 5ω 0 t − π 6 + 0.9 sin 7ω 0 t − π 6 (29) The simulation results in this case for ADALINE harmonic detection are shown in Figure 10 which starts with the first interval, 0 ≤ Time < 0.5 s, the balanced load current and has the harmonic current order 5th and 7th. The waveform that occurred in the system where the DC bus voltage control (V dc ) can be controlled by the PI controller with K PV = 0.104 and K IV = 2.32 is equal to the referenced voltage 360 volts since Time ≥ 0.2 s. At the interval 0.5 ≤ Time < 1 s, the DC component is added into the current load in phase A and phase C. It affects the DC bus voltage. The voltage is fluctuating between the range of V * dc = ±2 volts, but still maintains an average of 360 volts. At phase A, the load current (i La ) has a DC component increase of 2 amperes at 0.5 s, the compensated current (i Ca ) of phase A which is injected into the PCC has the average equal to 2 amperes as well. At phase C, the load current (i Lc ) has a DC component decrease of 2 amperes at 0.5 s, the compensated current (i Cc ) of phase C has an average value equal to −2 amperes. In phase B, the load current (i Lb ) is not changed at all. Even though the load current at phase A and phase C change at time 0.5 s, the waveform of the source current in all three phases remains close to sinusoidal and balanced. The %THD av is decreasing from 30 to 2.93 and all three-phase have a unity power factor. The PQ harmonic detection method cannot make balanced the source current. Figure 11 shows the spectrum of the source current before and after the compensation of all three phases for the first interval, 0 ≤ Time < 0.5 s. Both ADALINE and PQ for the harmonic detection method, before the compensated current injection, there is the harmonic current at the 5th and 7th order. After injecting the compensated current into PCC, there is only the fundamental component spectrum.
The second interval at 0.5 ≤ Time < 1 s, in case the DC component occurs in the transmission line, after compensation, the ADALINE harmonic detection method can maintain a good performance, it has only the fundamental component. While the PQ method has the magnitude of the fundamental component, the DC component and the 2nd harmonic current equal to 4.35, 0.4, and 0.48 amperes, consecutively at phase A and B, where at phase C has the magnitude of the fundamental component and the 2nd harmonic current equal to 4.35 and 0.48 ampere, respectively, as shown in Figure 12. Therefore, the %THD of the PQ harmonic detection method is worse than the proposed method, which the comparison result of the average performance value in case 2 as shown in Table 3. Both

Case 3: Bridge Rectifier Load
This case is the performance evaluation using a bridge rectifier with series RL load as a non-linear load connected to the system. In the first interval, 0 ≤ Time < 0.25 s, the resistance is equal to 90 Ω and the inductance is equal to 0.5 H. In the second interval, 0.25 ≤ Time < 0.5 s, the load change by decrease the resistance to 45 Ω, and the inductance remain the same. Figure 13 shows the simulation result of case 3. The PI controller can perform both the DC bus voltage control and the current control as well as the previous cases. In this case, the PI controller of the DC-Bus voltage Controller uses = 0.312 and = 6.96.
At a time of 0.25 s, the DC bus voltage is changed a little bit because of the changing of the current load but it is still able to be controlled as equal to the reference voltage 360 volts. Based on the simulation for the signal in all three-phase as shown in Figure 13, when the load current ( ) changes in a balanced system, the harmonic detection will recalculate for

Case 3: Bridge Rectifier Load
This case is the performance evaluation using a bridge rectifier with series RL load as a non-linear load connected to the system. In the first interval, 0 ≤ Time < 0.25 s, the resistance is equal to 90 Ω and the inductance is equal to 0.5 H. In the second interval, 0.25 ≤ Time < 0.5 s, the load change by decrease the resistance to 45 Ω, and the inductance remain the same. Figure 13 shows the simulation result of case 3. The PI controller can perform both the DC bus voltage control and the current control as well as the previous cases. In this case, the PI controller of the DC-Bus voltage Controller uses K PV = 0.312 and K IV = 6.96. At a time of 0.25 s, the DC bus voltage is changed a little bit because of the changing of the current load but it is still able to be controlled as equal to the reference voltage 360 volts. Based on the simulation for the signal in all three-phase as shown in Figure 13, when the load current (i L ) changes in a balanced system, the harmonic detection will recalculate for the reference current (i * C ). Therefore the source current (i S ) also changes when the compensated current (i C ) is injected into the system at PCC but still has close to sinusoidal and in-phase with the source voltage (v S ) of each phase in a balanced system.
After compensation, the harmonic spectrums of all three-phase are eliminated from the source current, only the fundamental component is left, as shown in Figure 14. The performances of both the ADALINE method and PQ method for harmonic detection, in this case, are similarly good. The source current of all three-phase nearly sinusoidal with a balanced system and unity PF, as shown in the average performance value in Table 4.
The performance of the system from the simulation with three different loads using PQ theory and the ADALINE neural network are as shown in Tables 2-4. Those results show that the %THD of cases 1 and 3 is slightly less than the %THD from PQ theory. In case 2, the ADALINE neural network gives a better result, when the DC component occurs the reference current ( * ). Therefore the source current ( ) also changes when the compensated current ( ) is injected into the system at PCC but still has close to sinusoidal and in-phase with the source voltage ( ) of each phase in a balanced system. Figure 13. The DC bus voltage, the load current, the compensated current, and the source current for Case 3.
After compensation, the harmonic spectrums of all three-phase are eliminated from the source current, only the fundamental component is left, as shown in Figure 14. The performances of both the ADALINE method and PQ method for harmonic detection, in this case, are similarly good. The source current of all three-phase nearly sinusoidal with a balanced system and unity PF, as shown in the average performance value in Table 4.
The performance of the system from the simulation with three different loads using PQ theory and the ADALINE neural network are as shown in Tables 2-4. Those results show that the %THD of cases 1 and 3 is slightly less than the %THD from PQ theory. In case 2, the ADALINE neural network gives a better result, when the DC component occurs in the transmission line. In terms of the power factor improvement, both methods give a similar performance. They can improve PF to unity.  After compensation, the harmonic spectrums of all three-phase are eliminated from the source current, only the fundamental component is left, as shown in Figure 14. The performances of both the ADALINE method and PQ method for harmonic detection, in this case, are similarly good. The source current of all three-phase nearly sinusoidal with a balanced system and unity PF, as shown in the average performance value in Table 4.
The performance of the system from the simulation with three different loads using PQ theory and the ADALINE neural network are as shown in Tables 2-4. Those results show that the %THD of cases 1 and 3 is slightly less than the %THD from PQ theory. In case 2, the ADALINE neural network gives a better result, when the DC component occurs in the transmission line. In terms of the power factor improvement, both methods give a similar performance. They can improve PF to unity.

Some Harmonic Orders Elimination
This topic has presented the methodology for the compensation of some order of harmonic current components and fundamental reactive component in a balanced three-phase power system, which this compensation must implement in a hybrid power filter (HPF). It aims to test the accuracy and the performance of harmonic detection for an individual harmonic current and fundamental reactive component. This processed calculation is shown in Figure 5b. The three-phase bridge rectifier with the 45 Ω resistor in series with the 0.5 H inductor for interval 0 ≤ Time < 0.25 s. Another interval is 0.25 ≤ Time < 0.5 s, the resistor change to 90 Ω at a time of 0.25 s. This non-linear load is used to test the SAPF performance. These non-linear loads have various orders of harmonics current. This case uses the PI controller for DC bus voltage control with K PV = 0.312 and K IV = 6.96.

Case 1: 5th Order Elimination
The signal in Figure 15 shows the simulation result of eliminating the 5th order harmonic current and the fundamental reactive component of all three-phase. The average of %THD is equal to 26.66 for a time between 0 to 0.25 s and 24.92 for a time between 0.25 to 0.5 s. This case tests the performance of the elimination of individual harmonics order, by choosing to eliminate the harmonics current order 5th. Throughout the simulation, the PI controller can control the DC bus voltage (V dc ) equal to the reference voltage (V * dc ) 360 volts. Although the load current will change at a time of 0.25 s. The compensated current (i C ) and the source current (i S ) will adapt to the load changing. After injecting the compensated current (i C ) which consist of the harmonic order 5th and the fundamental reactive component into the system at PCC of each phase, the source current in each phase is closer to sinusoidal with a balanced system and in-phase with the source voltage (v S ). This means that all three phases can improve to unity PF.
The spectrum in Figure 16 shows that the spectrum of the source current (i S ) in all three-phase. Before compensation, the source current or the load current of both intervals have several harmonic orders and the average %THD is 26.66 and 24.92, respectively. After injecting the compensated current (i Ca , i Cb , i Cc ) which consists of the harmonic order 5th, and the fundamental reactive component into the system at PCC of each phase, the harmonic current order 5th of the source current of each phase is eliminated. The source current of both intervals has the average %THD decreases to 18.13 and 16.17, respectively. It also makes the power factor of all three phases to unity, as shown in Table 5. The spectrum in Figure 16 shows that the spectrum of the source current ( ) in all three-phase. Before compensation, the source current or the load current of both intervals have several harmonic orders and the average %THD is 26.66 and 24.92, respectively. After injecting the compensated current ( , , ) which consists of the harmonic order 5th, and the fundamental reactive component into the system at PCC of each phase, the harmonic current order 5th of the source current of each phase is eliminated. The source current of both intervals has the average %THD decreases to 18.13 and 16.17, respectively. It also makes the power factor of all three phases to unity, as shown in Table 5.  The spectrum in Figure 16 shows that the spectrum of the source current ( ) in all three-phase. Before compensation, the source current or the load current of both intervals have several harmonic orders and the average %THD is 26.66 and 24.92, respectively. After injecting the compensated current ( , , ) which consists of the harmonic order 5th, and the fundamental reactive component into the system at PCC of each phase, the harmonic current order 5th of the source current of each phase is eliminated. The source current of both intervals has the average %THD decreases to 18.13 and 16.17, respectively. It also makes the power factor of all three phases to unity, as shown in Table 5.    This case presents the SAPF performance of eliminating the harmonic current order 5, 7, and the fundamental reactive component of the source current. The PI controller still controls the DC bus voltage (V dc ) equal to the reference voltage 360 volts in both intervals. After injecting the compensated current (i C ) into the PCC in each phase, the source current (i S ) is closer to sinusoidal with a balanced system and in-phase with the source voltage (v S ). Although the load current (i L ) of all three phases have changed at a time of 0.25 s, the SAPF still has a good performance, as shown in Figure 17. (a) Figure 17. The DC bus voltage, the load current, the compensated current, and the source current.
Before compensation, the source current spectrum of all three phases has various order as shown in Figure 18a,b. After injecting the compensated current into the system, the source current spectrum orders 5 and 7 are eliminated. This result occurs at both intervals. The performance value in Table 6 shows that the source current has an average %THD decrease from 26.66 to 12.43 and the power factor is unity in the first interval. The performance value in Table 6 shows that the source current has an average of %THD decrease from 26.66 to 12.43 and the power factor is unity in the first interval. In the second interval, the source current has an average of %THD decreasing from 24.92 to 10.00 and the power factor is unity. The individual harmonic detection using the PQ method does not simulate in this case, because it is very complicated to design the bandwidth of the filter for each harmonic order. The filter has an inaccurate calculation and is sensitive when the system changes.

Conclusions
The article has presented the new approach on harmonic current detection that employs a real-time ADALINE neural network. It starts with the comparison studies between the existing technologies that include the PQ methods by HIL. The results indicated that the PQ method is superior in harmonic current detection. However, it was found that the harmonic current detection results contain a considerable number of errors due to the PQ harmonic components calculation needing to use a filter process for the required filtering of the signal for further calculations. Therefore, the limitations of the filter cannot be designed to filter the signal precisely. As a result, the PQ computation process is inaccurate as well. It is necessary to specify the exact operating frequency for designing a filter. Therefore, the PQ