Photovoltaic Integrated Shunt Active Power Filter with Simpler ADALINE Algorithm for Current Harmonic Extraction

: This manuscript presents a signiﬁcant work in improving the current harmonics extraction algorithm and indirectly improving the injection current produced by a single-phase Photovoltaic Shunt Active Power Filter (PV SAPF). Improvement to the existing adaptive linear neuron (ADALINE) technique has been carried out, leading to the formation of a simpler ADALINE; it is expected to perform as fast as the current harmonics extraction algorithm. Further analysis on the DC link capacitor control algorithm, called “self-charging with step size error cancellation”, was also done to inspect the performance of the algorithm in a single-phase photovoltaic shunt active power ﬁlter system. Both algorithms, conﬁgured in single-phase PV SAPF, were simulated in MATLAB/Simulink (R2012b). A laboratory prototype was developed, and the algorithms were computed on a TMS320F28335 Digital Signal Processing (DSP) board for hardware implementation purposes. From the acquired results, the simpler ADALINE algorithm has effectively performed with lower total harmonic Distortion (THD) and outstanding compensation. The established algorithm of self-charging with step size error cancellation works well with single-phase PV SAPF and has shown less overshoot, a fast response time, and minimal energy losses.


Introduction
The power quality in a power system is the extensive range of electromagnetic phenomena that describe current and voltage at given locations and times in the system [1]. A supply system has its own frequency that it works on. The integer multiples of this frequency are frequencies where harmonic (sinusoidal voltages or currents) power quality issues arise [2,3]. Typically, the nonlinear load operations of power electronic devices are the cause of current harmonics. Another cause is when the supply network is injected with applications that are added in latter stages. The participation of multiple energy source systems with the inclusion of a photovoltaic (PV) grid-connected system in the power system gives rise to these problems [4,5]. Excessive neutral currents, equipment overheating, energy conversion law [23]. Subsequently, it provides high accuracy and regulated voltage that is clean with the least noise, and fewest ripples and spikes. In its specific operation, the input value of the self-charging algorithm (also known as voltage error) must be obtained from the difference between the instantaneous and desired capacitor voltages. Previously, this voltage error was controlled by such algorithms like proportional-integral (PI) and fuzzy logic techniques. Both techniques were configured to directly process the input value without having a prior understanding of its behavior. Hence, there is no room for such flexibility whether the voltage error changes or notit still has to be controlled and processed. The possibility of failure may occur when the operation of the self-charging algorithm later deals with a varied parameter and nonlinearity. Unfortunately, previous studies on self-charging algorithms for the most part took into account only steady-state operation [24]. No further analysis has been done on dynamic operation [25,26]. An indirect approach incorporated with fuzzy logic control techniques was introduced [27], called "Self-charging with step size error cancellation". This indirect approach produces better performance with low overshoot and undershoot (within 0.5-1 V) and fast response time (about 0.5 s), but it is only applicable for shunt active power filter systems and no further testing was done for PV SAPF, especially under various irradiance levels (dynamic operations).
Therefore, this paper presents a significant work in improving the current harmonics extraction algorithm and indirectly improving the injection current produced by a single-phase PV SAPF. Improvements to the ADALINE technique are carried out to produce what we call the Simpler ADALINE algorithm. It is expected to perform as a fast current harmonics extraction algorithm. Meanwhile, additional analysis was performed to investigate the performance of the self-charging with step size error cancellation algorithm for a single-phase PV SAPF system under dynamic and steady-state operations. The proposed single-phase PV SAPF is covered in Section 2, while Section 3 covers the proposed current harmonics extraction algorithm used in the PV SAPF. This is followed by an elaboration of the established self-charging algorithm in Section 4. Sections 5 and 6 discuss the hardware implementation and simulation work, along with the results. This work is concluded in Section 7.

Single-Phase Photovoltaic Shunt Active Power Filter
A block diagram is shown in Figure 1 to represent operation of the PV SAPF connected at a point of common coupling of the grid source which supplies power to a nonlinear load. The nonlinear load operation contains load current IL, which comprises harmonic component IH, within the source current IS. An injection current Iinj is generated after the SAPF is connected; this compensates for the harmonic current, leaving only the fundamental component I1, as shown below.
With existence of PV, the injection current Iinj will comprise a combination of the capacitor charging current Idc, inverter current Iinv, and PV current IPV. The nonlinear load operation contains load current I L , which comprises harmonic component I H , within the source current I S . An injection current I inj is generated after the SAPF is connected; this compensates for the harmonic current, leaving only the fundamental component I 1 , as shown below. With existence of PV, the injection current I inj will comprise a combination of the capacitor charging current I dc , inverter current I inv , and PV current I PV .
I inj = I inv + I PV ± I dc (2) For the injection of appropriate current to be accomplished by the SAPF, each current parameter in Equation (2) must be controlled. Hence, we take into consideration the three algorithms. First, the current harmonics extraction algorithm is used to control the inverter current I inv ; second, the maximum power point tracking (MPPT) algorithm is used to control the PV current I PV ; third and finally, the DC voltage control algorithm is used to control the capacitor charging current I dc . For the capacitor charging current I dc , there is possibility it is supplied from the grid or the capacitor with both directions. Its value and sign depend on the voltage of the DC link capacitor as when the voltage is overshot, its sign will be positive (discharging) in order to reduce the voltage, and when the voltage is undershot, its sign will be negative (charging) for voltage to increase. The capacitor charging current I dc is equal to zero when the desired voltage is on point. Figure 2 shows the overall circuit of the single-phase PV SAPF which contains a PV array, DC/DC boost converter, full bridge inverter, DC link capacitor, and its controller. The controller consists of algorithms such as DC link capacitor voltage control, current harmonics extraction, MPPT, current control, and synchronizer. However, as mentioned earlier, this paper focuses on the current harmonics extraction and DC link capacitor voltage control algorithms in order to control the inverter current I inv and the capacitor charging current I dc , respectively. The Adaptive Perturb and Observe (P&O)-Fuzzy algorithm is implemented as the MPPT algorithm [28], due to the fact that it can perform with fast response time and high accuracy. Proportional-integral (PI) was used as the current control algorithm for controlling the steady-state error of the reference current signal [29]. For this particular research work, the unified ADALINE-based fundamental voltage extraction algorithm is used as the synchronizer [30].
For the injection of appropriate current to be accomplished by the SAPF, each current parameter in Equation (2) must be controlled. Hence, we take into consideration the three algorithms. First, the current harmonics extraction algorithm is used to control the inverter current Iinv; second, the maximum power point tracking (MPPT) algorithm is used to control the PV current IPV; third and finally, the DC voltage control algorithm is used to control the capacitor charging current Idc. For the capacitor charging current Idc, there is possibility it is supplied from the grid or the capacitor with both directions. Its value and sign depend on the voltage of the DC link capacitor as when the voltage is overshot, its sign will be positive (discharging) in order to reduce the voltage, and when the voltage is undershot, its sign will be negative (charging) for voltage to increase. The capacitor charging current Idc is equal to zero when the desired voltage is on point. Figure 2 shows the overall circuit of the single-phase PV SAPF which contains a PV array, DC/DC boost converter, full bridge inverter, DC link capacitor, and its controller. The controller consists of algorithms such as DC link capacitor voltage control, current harmonics extraction, MPPT, current control, and synchronizer. However, as mentioned earlier, this paper focuses on the current harmonics extraction and DC link capacitor voltage control algorithms in order to control the inverter current Iinv and the capacitor charging current Idc, respectively. The Adaptive Perturb and Observe (P&O)-Fuzzy algorithm is implemented as the MPPT algorithm [28], due to the fact that it can perform with fast response time and high accuracy. Proportional-integral (PI) was used as the current control algorithm for controlling the steady-state error of the reference current signal [29]. For this particular research work, the unified ADALINE-based fundamental voltage extraction algorithm is used as the synchronizer [30].

Simpler ADALINE-Based Current Harmonics Extraction
In basic principle, the normal ADALINE algorithm estimates harmonic components based on the principle of sine and cosine components that exist in the electrical system for current harmonics extraction. The harmonic components and fundamental component for each sample k and sampling period ts in digital operation with assigned fundamental frequency ω can be depicted by the nonlinear load current IL [18,31,32], or where the order of the harmonic to N maximum is given by n, and amplitudes of the sine and cosine components are given by Wan and Wbn. By rearranging Equation (3) in vector form, the following equations holds: ..... 21 11 = is the weight matrix and X describes the cosine and sine vector as To train T W to be equivalent to the value of nonlinear load current IL, the algorithm is used. The Widrow-Hoff (W-H) method is used because of its updating algorithm that is the main feature of this extraction algorithm [18]. Weight is used as the learning factor in the Widrow-Hoff (W-H) method. However, to reduce complexity of the normal ADALINE, the Modified W-H ADALINE has been proposed. This only uses the first order of the harmonic component as opposed to the n-many harmonic components in the normal Windrow-Hoff ADALINE, as depicted in Figure 3a [18]. It is independent of number of harmonic orders due to the need to only update the two weights of the fundamental component. However, a learning rate α is introduced as a by-product because of the large average square error e produced in this method [18]. Therefore, the weight updating equation becomes , and α is the learning rate. The harmonics current IH can be produced as below [19]:

Simpler ADALINE-Based Current Harmonics Extraction
In basic principle, the normal ADALINE algorithm estimates harmonic components based on the principle of sine and cosine components that exist in the electrical system for current harmonics extraction. The harmonic components and fundamental component for each sample k and sampling period t s in digital operation with assigned fundamental frequency ω can be depicted by the nonlinear load current I L [18,31,32], or where the order of the harmonic to N maximum is given by n, and amplitudes of the sine and cosine components are given by W an and W bn . By rearranging Equation (3) in vector form, the following equations holds: where W T = [w 11 w 21 . . . . . . w an w bn ] is the weight matrix and X describes the cosine and sine vector as X T = [sin(kωt s ) cos(kωt s ) . . . . . . sin(nkωt s ) cos(nkωt s )]. To train W T to be equivalent to the value of nonlinear load current I L , the algorithm is used. The Widrow-Hoff (W-H) method is used because of its updating algorithm that is the main feature of this extraction algorithm [18]. Weight is used as the learning factor in the Widrow-Hoff (W-H) method. However, to reduce complexity of the normal ADALINE, the Modified W-H ADALINE has been proposed. This only uses the first order of the harmonic component as opposed to the n-many harmonic components in the normal Windrow-Hoff ADALINE, as depicted in Figure 3a [18]. It is independent of number of harmonic orders due to the need to only update the two weights of the fundamental component. However, a learning rate α is introduced as a by-product because of the large average square error e produced in this method [18]. Therefore, the weight updating equation becomes where W T = [w 11 w 21 ], Y = sin(kωt s ) cos(kωt s ) , and α is the learning rate. The harmonics current I H can be produced as below [19]: where W sin(kωt s ) represents the fundamental sine component multiplied by its weight factor W.
To reimburse harmonic distortion, the inverter current I inv is used; this is inversely proportional to the harmonic current I H . Although it is capable of reducing THD below 5%, The Modified W-H ADALINE algorithm still has disadvantages that may lead to the current harmonics extraction being slowed. Extracting current harmonics has basic requirements that it has to fulfil and the unnecessary characteristics that it has do not represent them. Hence, it can be further simplified and improved. The first simplification is made by discarding the periodic signal cosine component. According to the symmetrical theory of AC power systems, the odd function of periodic signals is of the sine component only. This is because odd functions are inversely symmetrical about the y axis. In Equation (3), when W bn is made equal to zero (W bn = 0), odd functions are of the sine components only. The sum of elements is automatically removed when the cosine component is removed. As a result, the average square error e is removed in large magnitudes, making this the second improvement.  (6) where W sin(kωts) represents the fundamental sine component multiplied by its weight factor W. To reimburse harmonic distortion, the inverter current Iinv is used; this is inversely proportional to the harmonic current IH. Although it is capable of reducing THD below 5%, The Modified W-H ADALINE algorithm still has disadvantages that may lead to the current harmonics extraction being slowed. Extracting current harmonics has basic requirements that it has to fulfil and the unnecessary characteristics that it has do not represent them. Hence, it can be further simplified and improved. The first simplification is made by discarding the periodic signal cosine component. According to the symmetrical theory of AC power systems, the odd function of periodic signals is of the sine component only. This is because odd functions are inversely symmetrical about the y axis. In Equation (3), when Wbn is made equal to zero (Wbn = 0), odd functions are of the sine components only. The sum of elements is automatically removed when the cosine component is removed. As a result, the average square error e is removed in large magnitudes, making this the second improvement.  Changing the learning factor of the updating algorithm is the third improvement. The functionality of SAPF is not clearly shown by the weight factor W in Equation (5). Before it is multiplied by the sine component, this learning factor represents the active fundamental current peak value. In simpler terms, it is renamed as the fundamental active current If, or The last improvement is made by replacing the average square error e, as shown in Figure 3a, with the negative inverter current −Iinv as further elaborated below.
A better representation can be seen where the negative inverter current −Iinv is the actual value used later (by removing its negative sign) for the amount of current to be injected by the SAPF. A new updating technique called the Fundamental Active Current (FAC) updating technique is formed by the average square error to the negative inverter current and weight learning factor to the fundamental active current If, or Changing the learning factor of the updating algorithm is the third improvement. The functionality of SAPF is not clearly shown by the weight factor W in Equation (5). Before it is multiplied by the sine component, this learning factor represents the active fundamental current peak value. In simpler terms, it is renamed as the fundamental active current I f , or The last improvement is made by replacing the average square error e, as shown in Figure 3a, with the negative inverter current −I inv as further elaborated below.
A better representation can be seen where the negative inverter current −I inv is the actual value used later (by removing its negative sign) for the amount of current to be injected by the SAPF. A new updating technique called the Fundamental Active Current (FAC) updating technique is formed by the average square error to the negative inverter current and weight learning factor to the fundamental active current I f , or By referring to Figure 3b and Equation (10), the active current is generated, depicted by I f sin(kωt s ). It is generated by multiplying I f with the unity sine function.

Self-Charging with Step Size Error Cancellation Algorithm
In principle, the DC link capacitor voltage should be maintained at the desired set point so that the injection current I inj is properly generated for compensating harmonics. Therefore, the charging capacitor current I dc is an important factor to be controlled as such change to it may affect the performance of the DC link capacitor. Interestingly, I dc may also affect the performance of the PV array in supplying I PV , besides the existing role carried out by the MPPT algorithm. Considering an analysis of the circuit's connection between the DC link capacitor and the inverter as shown in Figure 1, the effective amount of I PV injected to the grid depends on the condition of I dc . Therefore, a new parameter named the capacitor-PV current I CPV is introduced, by combining I PV and I dc as follows: Any change to I dc may affect the delivery of I PV , which has to be used for keeping the DC link capacitor voltage at a certain level, rather than to be used for injection. Therefore, it is critical to control I dc , not only to ensure that the voltage of the DC link capacitor is maintained at its desired value, but also to ensure a fast and optimum supply of I PV .
As mentioned, the self-charging algorithm is implemented to control I dc . The charging capacitor current I dc is determined by the energy conversion law mathematical equation in relation to the DC link capacitor. The DC link capacitor voltage always fluctuates from the desired voltage value during the charging process. The energy stored in the DC link capacitor is forced to change as a result. Hence, the self-charging equations [27] are where the DC link capacitor value is given by C, V dc1 is the desired DC link capacitor voltage, V dc2 is the instantaneous DC link capacitor voltage, and the period of the supply frequency is given by T.
The difference between V dc1 and V dc2 can be represented as voltage error e, or The change in e gives the impacts in determination of I dc , and, thus, it should be controlled accordingly. To realize control of e, the PI technique has been implemented [19]; with rapid growth of artificial intelligence techniques, especially Fuzzy Logic Control (FLC) [19], better control of voltage error e can be achieved, as shown in Figure 4. However, from the figure it is noticeable that the e is controlled directly, where the FLC has to perform and act accordingly based on whatever its value (including zero). Thus, the capability of the self-charging algorithm is still limited, especially for dynamic operation.
By referring to Figure 3b and Equation (10), the active current is generated, depicted by If sin(kωts). It is generated by multiplying If with the unity sine function.

Self-Charging with Step Size Error Cancellation Algorithm
In principle, the DC link capacitor voltage should be maintained at the desired set point so that the injection current Iinj is properly generated for compensating harmonics. Therefore, the charging capacitor current Idc is an important factor to be controlled as such change to it may affect the performance of the DC link capacitor. Interestingly, Idc may also affect the performance of the PV array in supplying IPV, besides the existing role carried out by the MPPT algorithm. Considering an analysis of the circuit's connection between the DC link capacitor and the inverter as shown in Figure  1, the effective amount of IPV injected to the grid depends on the condition of Idc. Therefore, a new parameter named the capacitor-PV current ICPV is introduced, by combining IPV and Idc as follows: Any change to Idc may affect the delivery of IPV, which has to be used for keeping the DC link capacitor voltage at a certain level, rather than to be used for injection. Therefore, it is critical to control Idc, not only to ensure that the voltage of the DC link capacitor is maintained at its desired value, but also to ensure a fast and optimum supply of IPV.
As mentioned, the self-charging algorithm is implemented to control Idc. The charging capacitor current Idc is determined by the energy conversion law mathematical equation in relation to the DC link capacitor. The DC link capacitor voltage always fluctuates from the desired voltage value during the charging process. The energy stored in the DC link capacitor is forced to change as a result. Hence, the self-charging equations [27] are where the DC link capacitor value is given by C, Vdc1 is the desired DC link capacitor voltage, Vdc2 is the instantaneous DC link capacitor voltage, and the period of the supply frequency is given by T. The difference between Vdc1 and Vdc2 can be represented as voltage error e, or The change in e gives the impacts in determination of Idc, and, thus, it should be controlled accordingly. To realize control of e, the PI technique has been implemented [19]; with rapid growth of artificial intelligence techniques, especially Fuzzy Logic Control (FLC) [19], better control of voltage error e can be achieved, as shown in Figure 4. However, from the figure it is noticeable that the e is controlled directly, where the FLC has to perform and act accordingly based on whatever its value (including zero). Thus, the capability of the self-charging algorithm is still limited, especially for dynamic operation.   Therefore, to address dynamic operations, modifications and improvements have been made to the direct control approach by arranging it to be an indirect approach, as shown in Figure 5. This indirect control in the self-charging algorithm introduced a new parameter which was named step size error ∆e. It is now part of the existing voltage error e to form a new voltage error e new [27], or The new voltage error e new provides an appropriate value to minimize such drastic changes due to change of the capacitor's voltage. Thus, the charging current I dc [27] becomes The self-charging algorithm is supposed to be able to react smoothly. This is done by giving the algorithm adaptability to abort any change of the voltage error e with respect to overshoot and undershoot. There will be no unnecessary task to perform since the algorithm provides another route to mitigate the voltage error. Even though this approach is considered stable with good undershoot and overshoot, and with fast response time, this approach was only tested with normal shunt active power filter and no further testing and analysis was done for the single-phase PV SAPF system. The FLC membership functions are shown in Figure 6. Therefore, to address dynamic operations, modifications and improvements have been made to the direct control approach by arranging it to be an indirect approach, as shown in Figure 5. This indirect control in the self-charging algorithm introduced a new parameter which was named step size error ∆e. It is now part of the existing voltage error e to form a new voltage error enew [27], or The new voltage error enew provides an appropriate value to minimize such drastic changes due to change of the capacitor's voltage. Thus, the charging current Idc [27] becomes The self-charging algorithm is supposed to be able to react smoothly. This is done by giving the algorithm adaptability to abort any change of the voltage error e with respect to overshoot and undershoot. There will be no unnecessary task to perform since the algorithm provides another route to mitigate the voltage error. Even though this approach is considered stable with good undershoot and overshoot, and with fast response time, this approach was only tested with normal shunt active power filter and no further testing and analysis was done for the single-phase PV SAPF system. The FLC membership functions are shown in Figure 6.   Step size error, ∆e  Therefore, to address dynamic operations, modifications and improvements have been made to the direct control approach by arranging it to be an indirect approach, as shown in Figure 5. This indirect control in the self-charging algorithm introduced a new parameter which was named step size error ∆e. It is now part of the existing voltage error e to form a new voltage error enew [27], or The new voltage error enew provides an appropriate value to minimize such drastic changes due to change of the capacitor's voltage. Thus, the charging current Idc [27] becomes The self-charging algorithm is supposed to be able to react smoothly. This is done by giving the algorithm adaptability to abort any change of the voltage error e with respect to overshoot and undershoot. There will be no unnecessary task to perform since the algorithm provides another route to mitigate the voltage error. Even though this approach is considered stable with good undershoot and overshoot, and with fast response time, this approach was only tested with normal shunt active power filter and no further testing and analysis was done for the single-phase PV SAPF system. The FLC membership functions are shown in Figure 6.   Step size error, ∆e

Simulation Results
Matlab-Simulink was used to carry out the simulation works. The proposed single-phase PV SAPF was designed and connected with the test bed made up of a nonlinear load and supply grid source. The nonlinear load was developed using an H-bridge rectifier (240 mH inductor and 20 Ω resistor connected in series). Matlab-Simulink was used to implement all the algorithms in Figure 2 together with the proposed single-phase PV SAPF including both proposed algorithms. The simulation work was carried out under dynamic operations to evaluate both algorithms, which covers penetration of PV through off-on operation and change of irradiance from low to high. The PV irradiances were set at about 200 W/m 2 (low irradiance), 600 W/m 2 (medium irradiance), and 1000 W/m 2 (high irradiance). For comprehensive evaluation, performance of the Simpler ADALINE algorithm in reducing THD level was evaluated with the Modified W-H ADALINE algorithm, by fixing the self-charging with step size error cancellation algorithm. In addition, the performance of the self-charging with step size error cancellation algorithm was compared with that of the Direct Fuzzy-based Self-charging algorithm by fixing the simpler ADALINE algorithm. Among the major parameters which were evaluated, besides THD, were overshoot, undershoot, response time, and energy losses. The simulation sampling time was set at about 6.67 µs, while the learning rate of 0.0001 was configured for both proposed and existing algorithms of current harmonics extraction. The duty cycle to boost up the PV voltage to 400 V dc was set to 0.46. The PV module used was a SHARP NT-180UI (Sharp Electronics Corporation, Huntington Beach, CA, USA) its characteristics are as shown in Table 1. Table 2 shows the main parameters and components used in this work. The configuration of the proposed PV SAPF is based on a voltage source inverter (VSI) which is considered as a conventional inductor-based converter.
According to Middlebrook's extra element theorem [33], to avoid instability, the input impedance of the converter should be much higher than the output impedance of the filter. For the PV SAPF configuration, the switching frequency was set at high frequency-around 20 kHz. The inductive element inside the PV SAPF increases the input impedance for the high switching frequency; therefore, Middlebrook's condition is verified and the filter does not affect the stability of the proposed PV SAPF. The simulation outcomes of PV SAPF with different irradiances (including without PV) using both Simpler ADALINE and Modified W-H ADALINE current harmonics extraction algorithms are shown in Figure 7. It covers source current I s , injection current I inj , voltage V s , and load current I L for the nonlinear load. Figure 8 shows the simulation results of harmonic spectra for different irradiances (including without PV) for the Simpler ADALINE algorithm. The simulation results of harmonic spectra for the Modified W-H ADALINE algorithm are shown in Figure 9. From Figures 7-9  Both algorithms give THD values below the 5% benchmark as per the IEEE Standard 519-2014 [1]. According to the findings, there is a slight increase in the THD values when the irradiance of the PV is increased, which subsequently increases the PV source current IPV. The source current Is is decreased with the increase of IPV where the load is depending more on power from the PV. Another point to take note of from the findings is during the operation of the normal SAPF, when PV is in the off condition and there should be no additional active power flow to the grid. Only when the PV is in the on condition will additional active power flow to the grid, affecting the injection and source currents. In addition, according to the previous works on SAPF, operation of the normal SAPF compensates only the reactive component, which means it only has the effect of removing harmonics from the grid [34,35]. Therefore, it is confirmed that PV is the main source of producing active power. In comparing both algorithms, Simpler ADALINE clearly shows much better performance over the Modified W-H ADALINE. The significant reduction of THD values shows that the performance of the SAPF is better with the algorithm that is proposed, with or without PV connectivity. Meanwhile, the power factor is improved from 0.89 to almost unity, which directly confirms the effectiveness of the proposed current harmonics extraction algorithm to perform power correction, too. Both algorithms give THD values below the 5% benchmark as per the IEEE Standard 519-2014 [1]. According to the findings, there is a slight increase in the THD values when the irradiance of the PV is increased, which subsequently increases the PV source current I PV . The source current I s is decreased with the increase of I PV where the load is depending more on power from the PV. Another point to take note of from the findings is during the operation of the normal SAPF, when PV is in the off condition and there should be no additional active power flow to the grid. Only when the PV is in the on condition will additional active power flow to the grid, affecting the injection and source currents. In addition, according to the previous works on SAPF, operation of the normal SAPF compensates only the reactive component, which means it only has the effect of removing harmonics from the grid [34,35]. Therefore, it is confirmed that PV is the main source of producing active power. In comparing both algorithms, Simpler ADALINE clearly shows much better performance over the Modified W-H ADALINE. The significant reduction of THD values shows that the performance of the SAPF is better with the algorithm that is proposed, with or without PV connectivity. Meanwhile, the power factor is improved from 0.89 to almost unity, which directly confirms the effectiveness of the proposed current harmonics extraction algorithm to perform power correction, too.
In regard to the evaluation of DC link capacitor voltage control, dynamic operation of off-on between PV and SAPF was implemented. This is done by considering the level of irradiance to be set at 600 W/m 2 , as it is considered as medium irradiance in the Malaysia climate [36]. The performances of both DC link capacitor voltage control algorithms and both harmonic extraction algorithms during off-on operation between PV and SAPF are shown in Figure 10. Consideration is given to evaluate both current harmonics extraction algorithms which were simulated together with the DC link capacitor voltage control algorithm. The self-charging with step size error cancellation algorithm performs at a much lower overshoot (0.5 V) and fast response time (0.1 s), as compared to the direct control where it has high overshoot (4.5 V) with slow response time (1.5 s). Meanwhile, both current harmonics extraction algorithms respond well during off-on dynamic operation, but Simpler ADALINE performs with a much better response time of only 15 ms, as opposed to the Modified W-H ADALINE algorithm which needs 40 ms to respond. In regard to the evaluation of DC link capacitor voltage control, dynamic operation of off-on between PV and SAPF was implemented. This is done by considering the level of irradiance to be set at 600 W/m 2 , as it is considered as medium irradiance in the Malaysia climate [36]. The performances of both DC link capacitor voltage control algorithms and both harmonic extraction algorithms during off-on operation between PV and SAPF are shown in Figure 10. Consideration is given to evaluate both current harmonics extraction algorithms which were simulated together with the DC link capacitor voltage control algorithm. The self-charging with step size error cancellation algorithm performs at a much lower overshoot (0.5 V) and fast response time (0.1 s), as compared to the direct control where it has high overshoot (4.5 V) with slow response time (1.5 s). Meanwhile, both current harmonics extraction algorithms respond well during off-on dynamic operation, but Simpler ADALINE performs with a much better response time of only 15 ms, as opposed to the Modified W-H ADALINE algorithm which needs 40 ms to respond. In regard to the evaluation of DC link capacitor voltage control, dynamic operation of off-on between PV and SAPF was implemented. This is done by considering the level of irradiance to be set at 600 W/m 2 , as it is considered as medium irradiance in the Malaysia climate [36]. The performances of both DC link capacitor voltage control algorithms and both harmonic extraction algorithms during off-on operation between PV and SAPF are shown in Figure 10. Consideration is given to evaluate both current harmonics extraction algorithms which were simulated together with the DC link capacitor voltage control algorithm. The self-charging with step size error cancellation algorithm performs at a much lower overshoot (0.5 V) and fast response time (0.1 s), as compared to the direct control where it has high overshoot (4.5 V) with slow response time (1.5 s). Meanwhile, both current harmonics extraction algorithms respond well during off-on dynamic operation, but Simpler ADALINE performs with a much better response time of only 15 ms, as opposed to the Modified W-H ADALINE algorithm which needs 40 ms to respond. Another dynamic operation focuses on the change of irradiance from low to high levels. Figure  11 shows the obtained results. The self-charging with step size error cancellation algorithm produces much better regulated DC link capacitor voltage with a low overshoot of 1 V and fast response time of 0.2 s compared to the direct control approach with an overshoot and response time of 4 V and 1.6 s, respectively. This is almost similar to the case during off-on dynamic operation. At the same time, the Simpler ADALINE also has a response time of about 15 ms, performing faster than the Modified W-H ADALINE with 40 ms. Further analyses to be explored are energy losses during dynamic operations of off-on between PV and SAPF and change of irradiance. Good DC link capacitor voltage control should result in minimal energy losses to the SAPF, especially during integration of PV and SAPF. Another dynamic operation focuses on the change of irradiance from low to high levels. Figure  11 shows the obtained results. The self-charging with step size error cancellation algorithm produces much better regulated DC link capacitor voltage with a low overshoot of 1 V and fast response time of 0.2 s compared to the direct control approach with an overshoot and response time of 4 V and 1.6 s, respectively. This is almost similar to the case during off-on dynamic operation. At the same time, the Simpler ADALINE also has a response time of about 15 ms, performing faster than the Modified W-H ADALINE with 40 ms. Further analyses to be explored are energy losses during dynamic operations of off-on between PV and SAPF and change of irradiance. Good DC link capacitor voltage control should result in minimal energy losses to the SAPF, especially during integration of PV and SAPF. Another dynamic operation focuses on the change of irradiance from low to high levels. Figure 11 shows the obtained results. The self-charging with step size error cancellation algorithm produces much better regulated DC link capacitor voltage with a low overshoot of 1 V and fast response time of 0.2 s compared to the direct control approach with an overshoot and response time of 4 V and 1.6 s, respectively. This is almost similar to the case during off-on dynamic operation. At the same time, the Simpler ADALINE also has a response time of about 15 ms, performing faster than the Modified W-H ADALINE with 40 ms. Further analyses to be explored are energy losses during dynamic operations of off-on between PV and SAPF and change of irradiance. Good DC link capacitor voltage control should result in minimal energy losses to the SAPF, especially during integration of PV and SAPF.
where Pdc is the steady-state power of the DC link capacitor that should be obtained after change, t1 is the starting time of change, and t2 is the end time of change before achieving steady state. However, considering that the change is linear, the calculation of energy can be performed as follows: By referring to Figures 12 and 13, operation of self-charging with step size error cancellation causes lower energy losses as compared to the direct control approach. For off-on operation, the proposed self-charging algorithm only causes energy losses of 36 J, whereas the direct control causes loses up to 540 J. Meanwhile for change of irradiance, the self-charging with step size error cancellation algorithm only causes losses of 112 J; for the direct control, it is 896 J. The results obtained clearly show the capability of the self-charging with step size error cancellation algorithm to significantly minimize the energy losses of the DC link capacitor. Table 3 presents THDs obtained from the simulation results of both current harmonics extraction algorithms with different irradiances and Table 4 shows overall performances of both DC link capacitor control algorithms for both dynamic operations.  Figures 12 and 13 show clearly the energy losses resulting from operation on the DC link capacitor in dynamic operations. During the period of dynamic operation, energy losses on the DC link capacitor E loss-Cdc can be calculated as below: where P dc is the steady-state power of the DC link capacitor that should be obtained after change, t 1 is the starting time of change, and t 2 is the end time of change before achieving steady state. However, considering that the change is linear, the calculation of energy can be performed as follows: By referring to Figures 12 and 13, operation of self-charging with step size error cancellation causes lower energy losses as compared to the direct control approach. For off-on operation, the proposed self-charging algorithm only causes energy losses of 36 J, whereas the direct control causes loses up to 540 J. Meanwhile for change of irradiance, the self-charging with step size error cancellation algorithm only causes losses of 112 J; for the direct control, it is 896 J. The results obtained clearly show the capability of the self-charging with step size error cancellation algorithm to significantly minimize the energy losses of the DC link capacitor. Table 3 presents THDs obtained from the simulation results of both current harmonics extraction algorithms with different irradiances and Table 4 shows overall performances of both DC link capacitor control algorithms for both dynamic operations.

Experimental Results
An experimental prototype was developed as in Figure 14 to evaluate the projected algorithms practically (in real time). A model in Matlab-Simulink was used to develop the single-phase PV SAPF. The operated power rating of the PV SAPF is about 536 W with a DC link capacitor of 4400 µF and output filter inductor of 5 mH. The IGBT IHW15N120R3 with maximum operating current of 15 A and maximum operating voltage of 1200 V was selected. For this experimental purpose, using a variable transformer, the supply source voltage was configured to 100 V ac . Hence, the voltage was put to 200 V dc , which is the desired voltage of the DC link capacitor. To execute all the control strategies for the single-phase PV SAPF, the DSP TMS320F28335 board was programmed and configured. These strategies include the current harmonics extraction, current control, DC link capacitor voltage control, MPPT, and synchronizer. As in the simulation for dynamic operations, the proposed Simpler ADALINE was compared with the established Modified Widrow-Hoff ADALINE algorithm by using the self-charging with step size error cancellation algorithm as the DC link capacitor voltage control algorithm. All the algorithms were evaluated to validate their performance practically in real-time applications. All the measured waveforms were taken by using an oscilloscope Tektronix TBS1000 (Tektronix, Inc., Beaverton, OR, USA) with 4 channels, 150 MHz bandwidth, and 1 GS/s sample rate. The PV simulator Chroma 62100H-600S (Chroma Ate Inc., Kuei-Shan Hsiang, Taoyuan, Taiwan) was the main PV source used for this experiment. It has a voltage range of 0-1.5 kV with output power up to 15 kW.

Experimental Results
An experimental prototype was developed as in Figure 14 to evaluate the projected algorithms practically (in real time). A model in Matlab-Simulink was used to develop the single-phase PV SAPF. The operated power rating of the PV SAPF is about 536 W with a DC link capacitor of 4400 µF and output filter inductor of 5 mH. The IGBT IHW15N120R3 with maximum operating current of 15 A and maximum operating voltage of 1200 V was selected. For this experimental purpose, using a variable transformer, the supply source voltage was configured to 100 Vac. Hence, the voltage was put to 200 Vdc, which is the desired voltage of the DC link capacitor. To execute all the control strategies for the single-phase PV SAPF, the DSP TMS320F28335 board was programmed and configured. These strategies include the current harmonics extraction, current control, DC link capacitor voltage control, MPPT, and synchronizer. As in the simulation for dynamic operations, the proposed Simpler ADALINE was compared with the established Modified Widrow-Hoff ADALINE algorithm by using the self-charging with step size error cancellation algorithm as the DC link capacitor voltage control algorithm. All the algorithms were evaluated to validate their performance practically in realtime applications. All the measured waveforms were taken by using an oscilloscope Tektronix TBS1000 (Tektronix, Inc., Beaverton, OR, USA) with 4 channels, 150 MHz bandwidth, and 1 GS/s sample rate. The PV simulator Chroma 62100H-600S (Chroma Ate Inc., Kuei-Shan Hsiang, Taoyuan, Taiwan) was the main PV source used for this experiment. It has a voltage range of 0-1.5 kV with output power up to 15 kW. The experimental outcomes obtained by using the Simpler ADALINE algorithm are shown in Figure 15. It includes the source voltage Vs, injection current Iinj, load current IL, and source current Is, for different irradiance levels. The outcomes of harmonic spectra with different irradiances (including without PV) for the Simpler ADALINE algorithm are shown in Figure 16 while Figure 17 shows the results of harmonic spectra for the Modified W-H ADALINE algorithm. Figure 18 shows the experimental results of the self-charging with step size error cancellation algorithm with Simpler ADALINE and Modified Widrow-Hoff ADALINE current harmonics extraction algorithms with offon operation between PV and SAPF. The results of the self-charging with step size error cancellation algorithm with Simpler ADALINE and Modified Widrow-Hoff ADALINE current harmonics extraction algorithm under low to high irradiance operation of PV are shown in Figure 19. Figure 20 shows the energy losses using the self-charging with step size error cancellation DC link capacitor voltage control algorithm for both dynamic operations. The experimental outcomes obtained by using the Simpler ADALINE algorithm are shown in Figure 15. It includes the source voltage V s , injection current I inj , load current I L , and source current I s , for different irradiance levels. The outcomes of harmonic spectra with different irradiances (including without PV) for the Simpler ADALINE algorithm are shown in Figure 16 while Figure 17 shows the results of harmonic spectra for the Modified W-H ADALINE algorithm. Figure 18 shows the experimental results of the self-charging with step size error cancellation algorithm with Simpler ADALINE and Modified Widrow-Hoff ADALINE current harmonics extraction algorithms with off-on operation between PV and SAPF. The results of the self-charging with step size error cancellation algorithm with Simpler ADALINE and Modified Widrow-Hoff ADALINE current harmonics extraction algorithm under low to high irradiance operation of PV are shown in Figure 19. Figure 20 shows the energy losses using the self-charging with step size error cancellation DC link capacitor voltage control algorithm for both dynamic operations.           [15][16][17] show that the THDs obtained are 2.3% for irradiance at 0 W/m 2 , 2.54% at 200 W/m 2 , 2.8% at 600 W/m 2 , and lastly 3.2% at 1000 W/m 2 . The THDs obtained are almost the same as in the simulation work. The proposed current harmonics extraction algorithm is proven to work well to compensate current harmonics to below than 5% THD under any level of PV irradiance. The power factor has been improved from 0.86 to almost unity. This confirms the productiveness of the proposed algorithm to accomplish power factor corrections as well. By referring to Figures 18 and 19, the self-charging with step size error cancellation algorithm performs with low overshoot (0.5 V) for off-on operation between PV and SAPF, and only 1 V for change of irradiance. The self-charging with step size error cancellation algorithm also produces a fast response time within 0.3 s for the off-on operation between PV and SAPF, and within 0.4 s for the change of irradiance. The same also applies to the proposed harmonic extraction algorithm where for both dynamic operations, the Simpler ADALINE algorithm achieved a fast response time of only 20 ms. The established Modified Widrow-Hoff ADALINE algorithm produces a slow response time of about 40 ms-about 20 ms slower than the proposed algorithm. This really shows that the proposed current harmonic extraction algorithm performs well with good THD values under various irradiances and fast response times under various dynamic operations. Referring to Figure 20, under the first dynamic operation which involves off-on operation between the PV and SAPF, the self-charging with step size error cancellation algorithm produces low energy losses of only 54 J. The self-charging with step size error cancellation algorithm produces an energy loss of around 112 J for the second dynamic operation of the adjustment of irradiance between low and high irradiance levels.

Conclusions
A new algorithm in relation to current harmonics extraction for SAPF integrated with a PV source has been presented in this paper. The new current harmonics extraction algorithm is a simpler and improved version of the established Modified Widrow-Hoff ADALINE algorithm and is called the Simpler ADALINE algorithm. The improvements were made by removing the unnecessary features inside the existing algorithm such as cosine factor and sum of elements and by rearranging the weight factor. The Simpler ADALINE algorithm shows fast and accurate extraction. Analysis of the self-charging with step size error cancellation algorithm's further performance towards a single-phase PV SAPF system has also been presented. Evaluations in terms of dynamic operations have been made to verify the performances of both algorithms. The analysis under steady-state operation has extensively been used in the past. Hence, dynamic operations such as the change of irradiance level and off-on operation between PV and SAPF were investigated. These analyses provide the novelty of this work due to the extensive findings and results for further evaluation.
Demonstration of the projected current harmonics extraction algorithm has been successfully accomplished. A comparative evaluation has also been completed with the established algorithm (Modified W-H ADALINE). As for the DC link capacitor voltage control algorithm, the established self-charging with step size error cancellation was successfully demonstrated and was compared with the established Direct Fuzzy-based Self-charging algorithm. The simulation and experimental works confirm the much better performance of the projected current harmonics extraction algorithm over the established algorithms. The Simpler ADALINE algorithm performs with THD values that are low with fast response time and various irradiance levels during both dynamic operations. The self-charging with step size error cancellation algorithm works well for single-phase PV SAPF and was able to have low overshoot accompanying fast response time in dynamic operations. A vast difference was observed during the two dynamic operations where the projected Simpler ADALINE algorithm and the established self-charging with step size error cancellation algorithm were able to control any effects from the change of irradiance level for the PV source and off and on operations between PV and SAPF.  Phase angle ∆E Energy differential ∆e Step size error e new New voltage error