A Three-Phase Four-Leg Inverter-Based Active Power Filter for Unbalanced Current Compensation Using a Petri Probabilistic Fuzzy Neural Network

A three-phase four-leg inverter-based shunt active power filter (APF) is proposed to compensate three-phase unbalanced currents under unbalanced load conditions in grid-connected operation in this study. Since a DC-link capacitor is required on the DC side of the APF to release or absorb the instantaneous apparent power, the regulation control of the DC-link voltage of the APF is important especially under load variation. In order to improve the regulation control of the DC-link voltage of the shunt APF under variation of three-phase unbalanced load and to compensate the three-phase unbalanced currents effectively, a novel Petri probabilistic fuzzy neural network (PPFNN) controller is proposed to replace the traditional proportional-integral (PI) controller in this study. Furthermore, the network structure and online learning algorithms of the proposed PPFNN are represented in detail. Finally, the effectiveness of the three-phase four-leg inverter-based shunt APF with the proposed PPFNN controller for the regulation of the DC-link voltage and compensation of the three-phase unbalanced current has been demonstrated by some experimental results.


Introduction
The power pollution in power systems, which results from rectifiers, arc furnaces, nonlinear loads and switching power supplies, has been gained wide attention in recent years [1,2]. Moreover, owing to the increasing usage of power electronic equipment, the power quality in the distribution system is seriously deteriorated. Not only the voltage and current could not be operated within reasonable values, but the resulting non-sinusoidal currents could also cause voltage distortion on the load side. On the other hand, the deterioration of the power quality can be compensated effectively by using power electronic technologies [3,4]. The active power filter (APF) is one of the powerful tools used to compensate the load harmonics, unbalanced load currents and reactive power and has recently been widely adopted to improve the power quality [5][6][7]. APFs can be classified into series, shunt and hybrid APFs three categories [8,9]. A series APF is connected with the power grid in series and is effective to generate harmonic voltages to compensate load harmonic voltages [10]. Furthermore, the series APF is usually employed to protect sensitive loads in polluted grid scenarios. A series APF for the compensation of harmonics and reactive power generated by the non-linear loads was proposed in [11]. In [12], at the point of common coupling, a series APF based on a single-phase matrix converter was adopted to protect sensitive loads from the effects of voltage disturbances. However, the complexity of installation in practical applications limits the use of the series APF [13]. In addition, controller to replace the traditional proportional-integral (PI) controller in the shunt APF. Furthermore, a backpropagation (BP) based online training algorithm is derived to train the connective weights and parameters of the membership functions of the proposed PPFNN online. In addition, the proposed PPFNN controller to control the DC-link voltage of the three-phase four-leg inverter-based shunt APF is implemented by a control platform using the Texas Instruments (TI) digital signal processor (DSP) TMS320F28335. The operating theories of the three-phase four-leg inverter-based shunt APF will be introduced in Section 2. The network structure, online learning algorithms and convergence analysis of the proposed PPFNN will be described in Section 3. Then, the detailed implementation of the intelligent PPFNN controlled shunt APF will be presented in Section 4. Finally, the conclusions can be found in Section 5.

Three-Phase Four-Leg Inverter-Based Shunt APF
The circuit scheme of the three-phase four-leg inverter-based shunt APF in grid-connected operation is shown in Figure 1. The values of the inductor L f and capacitor C f are 3 mH and 3 µF, respectively. The three-phase voltages v sa , v sb , v sc are 180 V and the line to line voltage of the power grid is 220 Vrms. Three resistors R 1 , R 2 , R 3 are designed to be unbalanced and are connected with the power grid of a distribution system. The resulted non-sinusoidal currents could deteriorate the power quality seriously in the distribution system especially for a microgrid system operated in islanding mode [3]. Moreover, the main objective of the three-phase four-leg inverter-based shunt APF is to compensate the three-phase unbalanced currents caused by unbalanced loads R 1 , R 2 , R 3 . The three legs of the inverter-based shunt APF are used to generate the compensated current components i f a , i f b , i f c and make the three-phase currents i sa , i sb , i sc of the power grid be balanced and sinusoidal. The fourth leg is used to suppress the neutral current. The relation of the four leg currents is described as follows: PPFNN controller to control the DC-link voltage of the three-phase four-leg inverter-based shunt APF is implemented by a control platform using the Texas Instruments (TI) digital signal processor (DSP) TMS320F28335. The operating theories of the three-phase four-leg inverter-based shunt APF will be introduced in Section 2. The network structure, online learning algorithms and convergence analysis of the proposed PPFNN will be described in Section 3. Then, the detailed implementation of the intelligent PPFNN controlled shunt APF will be presented in Section 4. Finally, the conclusions can be found in Section 5.

Three-Phase Four-Leg Inverter-Based Shunt APF
The circuit scheme of the three-phase four-leg inverter-based shunt APF in grid-connected operation is shown in Figure 1. The values of the inductor Lf and capacitor Cf are 3 mH and 3 μF, respectively. The three-phase voltages vsa, vsb, vsc are 180 V and the line to line voltage of the power grid is 220 Vrms. Three resistors R1, R2, R3 are designed to be unbalanced and are connected with the power grid of a distribution system. The resulted non-sinusoidal currents could deteriorate the power quality seriously in the distribution system especially for a microgrid system operated in islanding mode [3]. Moreover, the main objective of the three-phase four-leg inverter-based shunt APF is to compensate the three-phase unbalanced currents caused by unbalanced loads R1, R2, R3. The three legs of the inverter-based shunt APF are used to generate the compensated current components fc fb fa and make the three-phase currents of the power grid be balanced and sinusoidal. The fourth leg is used to suppress the neutral current. The relation of the four leg currents is described as follows: (1) And fn sn i i − = is the neutral current of the power grid. Furthermore, the control scheme of the shunt APF is shown in Figure 2. First, the three-phase voltages of the power grid are detected to obtain the synchronous angle e θ via the phase locked loop (PLL) unit. Then, the threephase load currents are detected and transferred to 0 dq synchronous reference frame as follows:  And i sn = −i f n is the neutral current of the power grid. Furthermore, the control scheme of the shunt APF is shown in Figure 2. First, the three-phase voltages v sa , v sb , v sc of the power grid are detected to obtain the synchronous angle θ e via the phase locked loop (PLL) unit. Then, the three-phase load currents i La , i Lb , i Lc are detected and transferred to dq 0 synchronous reference frame as follows: where i Ld , i Lq , and i L0 are the d, q and zero axis currents, respectively. Then, the dc components are extracted via two low pass filters which the transfer functions are designed as follows: where the gain k = 1, damping ratio ξ = 0.7, and angular cut-off frequency ω = 20π rad/s. The dc components are subtracted by i Ld , and i Lq , to generate dq-axis current harmonic components i Ld and i Lq . In addition, the DC-link voltage V dc of the shunt APF is detected and compared with the DC-link voltage command V * dc . The DC-link voltage error is then sent to a PI, PFNN or PPFNN controller, and the control current i es is produced to maintain the constant DC-link voltage V dc of the shunt APF. The control current i es is added to the q-axis current harmonic component i Lq to obtain the q-axis current command i * Lq , and name the d-axis current harmonic component i Ld and zero axis current i L0 to equal to the d-axis current command i * Ld and zero axis current command i * L0 , respectively. The compensated current outputs i fa , i fb , i fc of the inverter-based shunt APF are also detected and transferred to dq0 synchronous reference frame to obtain the i fd , i fq , and i f0 currents, respectively. The three currents i fd , i fq , i f0 are compared with the current commands i * Ld , i * Lq , i * L0 , respectively and three voltage components v d , v q , v 0 can be calculated by using three respective PI controller. The three control commands v coma , v comb , v comc are obtained through dq0/abc coordinate transformation as follows:  where iLd, iLq, and iL0 are the d, q and zero axis currents, respectively. Then, the dc components are extracted via two low pass filters which the transfer functions are designed as follows: where the gain k = 1, damping ratio ξ = 0.7, and angular cut-off frequency ω = 20π rad/s. The dc components are subtracted by iLd, and iLq, to generate dq-axis current harmonic components ̃ and ̃ . In addition, the DC-link voltage Vdc of the shunt APF is detected and compared with the DC-link voltage command * . The DC-link voltage error is then sent to a PI, PFNN or PPFNN controller, and the control current ies is produced to maintain the constant DC-link voltage Vdc of the shunt APF. The control current ies is added to the q-axis current harmonic component ̃ to obtain the q-axis current command * , and name the d-axis current harmonic component ̃ and zero axis current The fourth control command will be computed as follows: Finally, the pulse width modulation (PWM) switching signals are generated for maintaining the constant DC-link voltage V dc and compensating the three-phase unbalanced currents in the three-phase four-leg inverter-based shunt APF.

PPFNN Controller
If the three-phase unbalanced load changes suddenly, the DC-link voltage of the shunt APF will fluctuate seriously and the compensation performance and stability of the system will be affected. Though the traditional PI control has the advantages of simple structure and easy implementation, it is not robust in dealing with the system uncertainties, which includes parameter variations, modeling errors and external disturbances, in practical applications [31]. In other words, since the traditional PI controllers are not robust in dealing with the system uncertainties, the parameters of the PI controllers are not suitable for different operating conditions. Thus, in order to improve the regulation control of the DC-link voltage of the shunt APF under unbalanced load change and to compensate the three-phase unbalanced currents effectively, the online trained PPFNN is proposed to replace traditional PI controller in the shunt APF. Since the proposed PPFNN is mainly developed based on PN, PNN and fuzzy logic control, the proposed PPFNN possesses the analytical, graphical and mathematical modeling capabilities of PN, the superior model performance and adaptability of PNN and the advantages of fuzzy logic control to handle uncertain information and to approximate nonlinear systems. Hence, the PPFNN is proposed in this study to improve the control performance of the DC-link voltage of the shunt APF. The network structure, online learning algorithms and convergence analysis of the proposed PPFNN are described as follows.

Network Structure
The network structure of the proposed PPFNN shown in Figure 3 has six layers including the input layer (layer 1), the membership layer (layer 2), the Petri layer (layer 3), the probabilistic layer (layer 4), the rule layer (layer 5) and the output layer (layer 6). Moreover, there are two inputs and one output. The signal propagation of each layer is described in the following: Finally, the pulse width modulation (PWM) switching signals , , , , , , , are generated for maintaining the constant DC-link voltage Vdc and compensating the three-phase unbalanced currents in the three-phase four-leg inverter-based shunt APF.

PPFNN Controller
If the three-phase unbalanced load changes suddenly, the DC-link voltage of the shunt APF will fluctuate seriously and the compensation performance and stability of the system will be affected. Though the traditional PI control has the advantages of simple structure and easy implementation, it is not robust in dealing with the system uncertainties, which includes parameter variations, modeling errors and external disturbances, in practical applications [31]. In other words, since the traditional PI controllers are not robust in dealing with the system uncertainties, the parameters of the PI controllers are not suitable for different operating conditions. Thus, in order to improve the regulation control of the DC-link voltage of the shunt APF under unbalanced load change and to compensate the three-phase unbalanced currents effectively, the online trained PPFNN is proposed to replace traditional PI controller in the shunt APF. Since the proposed PPFNN is mainly developed based on PN, PNN and fuzzy logic control, the proposed PPFNN possesses the analytical, graphical and mathematical modeling capabilities of PN, the superior model performance and adaptability of PNN and the advantages of fuzzy logic control to handle uncertain information and to approximate nonlinear systems. Hence, the PPFNN is proposed in this study to improve the control performance of the DC-link voltage of the shunt APF. The network structure, online learning algorithms and convergence analysis of the proposed PPFNN are described as follows.

Network Structure
The network structure of the proposed PPFNN shown in Figure 3 has six layers including the input layer (layer 1), the membership layer (layer 2), the Petri layer (layer 3), the probabilistic layer (layer 4), the rule layer (layer 5) and the output layer (layer 6). Moreover, there are two inputs and one output. The signal propagation of each layer is described in the following:   The input and the output of the node in this layer are represented as: x n (N) = e n (N), n = 1, 2, where x n represents the nth input to the input layer; N represents the Nth iteration. In this study, the inputs of the proposed PPFNN are e 1 (N) = e and e 2 (N) = .
e, which are the DC-link voltage error of the shunt APF and its derivative, respectively.

Membership layer:
The Gaussian function is adopted as the membership function in this layer, and is described in the following: where m j and σ j are the mean and standard deviation of the membership functions, respectively; µ j (net j ) is the output of the membership layer.
Petri layer: In the Petri layer, the transition is in enable state when the token is produced in input place. Then, the transition is fired or unfired by the following equations [32]: where t p is the transition; d th is threshold value and is varied by the function V = e + . e /2 [32]; α and β are positive constants and set to be 0.15 and 4, respectively, by empirical rules. The token can be removed from its input place to output place when the transition is fired. That is to say, the token will stay in input place when the transition is unfired. Hence, the relationship of the input and output of the Petri layer is presented as follows: Probabilistic layer: The receptive field function is also a Gaussian function in the probabilistic layer, and is described as follows: where m k and σ k are the mean and standard deviation of the Gaussian function, respectively; P k (µ p ) is the output of the probabilistic layer. Rule layer: Each node corresponds to a rule in the knowledge base in this layer. The node itself performs the t-norm operation (product operation) in the Mamdani inference to obtain the inference set according to the rules shown in (15). Moreover, the probabilistic information is processed considering the group of fuzzy grade being independent variables as shown in Equation (16) by using the Bayes' theorem [21]. Therefore, the node input and the node output are represented as: where µ I l and P I l are the input of rule layer; w jl is the connective weight between the membership layer and the rule layer which is set to be 1; w kl is the connective weight between the probabilistic layer and the rule layer which is also set to be 1; µ O l is the output of the rule layer. Layer 6 (output layer): In output layer, the node is denoted with ∑, which performs the summation operation. Hence, the output of this layer is given as follows: where w l is the connective weight between the rule layer and the output layer; y(N) equals the control current i es shown in Figure 2 for the regulation control of the DC-link voltage in the shunt APF.

Online Learning Algorithms
In order to describe the online learning algorithms of the proposed PPFNN, first the error function E is defined as: The parameter learning can be achieved by the online tuning of the connective weights between the rule layer and the output layer, and the mean and standard deviation of the membership functions using the BP algorithm to minimize the error function. The online learning algorithms are described as follows: The error term to be propagated is computed as: By using the chain rule, the connective weight w l is updated by the amount: where η 1 is the learning rate. Thus, the connective weight w l is updated as follows: The error term to be propagated is given as follows: Layer 2: In this layer, the error term needs to be computed and propagated as follows: Then, by using of the chain rule, the update rules of the mean m j and standard deviation σ j of the membership functions are calculated as follows: where η 2 and η 3 are the learning rates of the mean and standard deviation respectively. In general, the values of the learning rates η 1 , η 2 , η 3 are usually set to be between 0 and 1. By empirical rules, larger values of the learning rates η 1 , η 2 , η 3 could result in divergent control responses. On the other hand, smaller values of the learning rates η 1 , η 2 , η 3 could result in slow convergence of the control performance. Thus, the varied learning rates based on the analysis of a discrete-type Lyapunov function [33,34], which can guarantee the convergence of the regulation control of the DC-link voltage at a reasonable rate, are derived in this study. Then, the mean and standard deviation of the membership functions are updated as follows: Owing to the uncertainties of the dynamic three-phase four-leg inverter-based shunt APF, the exact calculation of the Jacobian of the shunt APF, ∂V dc /∂y(N), is difficult to determine. Thus, the delta adaptation law in the following is adopted in order to increase the online learning rate of the network parameters [24]:

Convergence Analysis
In order to train the proposed PPFNN effectively, the varied learning rates [33,34] are derived in this study. The purpose of the convergence analysis is to derive specific learning rate coefficients for network parameters to assure the convergence of the intelligent regulation control of the DC-link voltage by the analysis of a discrete-type Lyapunov function.
Considering the error function in (19) as a discrete-type Lyapunov function, the variation of the Lyapunov function can be given as: Then, the linearized model [34] of the error equation can be represented via (21), (25) and (26) by: where ∆w l , ∆w j and ∆σ j represent the change of connect weight in the output layer, and the change of the mean and the standard deviation of the Gaussian function in the membership layer, respectively. If the learning rate parameters of the proposed PPFNN are designed as: where ε is a positive constant, then Equation (31) can be rewritten as: According to Equations (19) and (35), the convergence of the proposed PPFNN control can be guaranteed. Hence, the intelligent regulation control of the DC-link voltage of the shunt APF will converge to the DC-link voltage command gradually.

Experimental Results
The block diagram of the three-phase four-leg inverter-based shunt APF and the photos of the experimental setups are provided in Figure 4. The block diagram of the DSP-based APF is illustrated in Figure 4a. The control algorithms, including the PLL, the unbalanced currents compensation, and the proposed PPFNN control, are implemented by the control platform using the TI DSP TMS320F28335. The peripheral circuits consist of the feedback and protect circuits. The feedback circuits are composed of two current sensors and a voltage sensor to detect the compensated current components i fa , i fb , i fc , the three-phase load currents i La , i Lb , i Lc and the three-phase voltages v sa , v sb , v sc of the power grid. The over voltage/current and interlock circuits are also implemented in the control platform. Moreover, three unbalanced loads are designed as follows: (1) load 1 consists of R 1 = 80 Ω, R 2 = 40 Ω, R 3 = 100 Ω; (2) load 2 consists of R 1 = 40 Ω, R 2 = 20 Ω, R 3 = 60 Ω; (3) load 3 consists of R 1 = 20 Ω, R 2 = 10 Ω, R 3 = 50 Ω. The DC-link voltage command V * dc of the shunt APF is set to be 450 V. Furthermore, the photos of the experimental setups are shown in Figure 4b. A photo of the three-phase four-leg inverter is provided as Figure 4c. In this study, two three-phase three-leg inverters are adopted to build up one three-phase four-leg inverter. In order to compare the compensation performance of the shunt APF using the proposed PPFNN controller, the experimental results using PI and PFNN controllers are also demonstrated in this study. The optimized parameters of the PI controller are obtained as K p = 1.161, K I = 312.67 according to [35]. In addition, a three-phase unbalanced current ratio U R is defined in the following to compare the compensation performance of the shunt APF: where Max(i sa , i sb , i sc ) is the maximum RMS current of the three-phase currents i sa , i sb , i sc of the power grid; Min(i sa , i sb , i sc ) is the minimum RMS current of the three-phase currents i sa , i sb , i sc ; Average(i sa , i sb , i sc ) is the average RMS current of the three-phase currents i sa , i sb , i sc . The lesser value the three-phase unbalanced current ratio U R is, the more superior compensation performance the shunt APF possesses.
in Figure 4a. The control algorithms, including the PLL, the unbalanced currents compensation, and the proposed PPFNN control, are implemented by the control platform using the TI DSP TMS320F28335. The peripheral circuits consist of the feedback and protect circuits. The feedback circuits are composed of two current sensors and a voltage sensor to detect the compensated current components ifa, ifb, ifc, the three-phase load currents iLa, iLb, iLc and the three-phase voltages vsa, vsb, vsc of the power grid. The over voltage/current and interlock circuits are also implemented in the control platform. Moreover, three unbalanced loads are designed as follows: (1) Figure 4b. A photo of the threephase four-leg inverter is provided as Figure 4c. In this study, two three-phase three-leg inverters are adopted to build up one three-phase four-leg inverter. In order to compare the compensation performance of the shunt APF using the proposed PPFNN controller, the experimental results using PI and PFNN controllers are also demonstrated in this study. The optimized parameters of the PI controller are obtained as Kp = 1.161, KI = 312.67 according to [35]. In addition, a three-phase unbalanced current ratio UR is defined in the following to compare the compensation performance of the shunt APF: where Max(isa, isb, isc) is the maximum RMS current of the three-phase currents isa, isb, isc of the power grid; Min(isa, isb, isc) is the minimum RMS current of the three-phase currents isa, isb, isc; Average(isa, isb, isc) is the average RMS current of the three-phase currents isa, isb, isc. The lesser value the three-phase unbalanced current ratio UR is, the more superior compensation performance the shunt APF possesses.  In order to verify the effectiveness of the three-phase four-leg inverter-based shunt APF under unbalanced load conditions, the experimental results without using the shunt APF and the experimental results using PI, PFNN and the proposed PPFNN controlled shunt APFs at the unbalanced load 1 are provided to demonstrate the compensation performance as shown in Figure  5. The responses of the three-phase currents isa, isb, isc and neutral current isn without using the shunt APF are shown in Figure 5a; the responses of the three-phase currents isa, isb, isc, neutral current isn, DC-link voltage Vdc and phase voltage of the power grid using PI controlled shunt APF are shown in Figure 5b,c; the responses of the three-phase currents isa, isb, isc, neutral current isn, DC-link voltage Vdc and phase voltage of the power grid using PFNN controlled shunt APF are shown in Figure 5d,e; the In order to verify the effectiveness of the three-phase four-leg inverter-based shunt APF under unbalanced load conditions, the experimental results without using the shunt APF and the experimental results using PI, PFNN and the proposed PPFNN controlled shunt APFs at the unbalanced load 1 are provided to demonstrate the compensation performance as shown in Figure 5. The responses of the three-phase currents i sa , i sb , i sc and neutral current i sn without using the shunt APF are shown in Figure 5a; the responses of the three-phase currents i sa , i sb , i sc , neutral current i sn , DC-link voltage V dc and phase voltage of the power grid using PI controlled shunt APF are shown in Figure 5b,c; the responses of the three-phase currents i sa , i sb , i sc , neutral current i sn , DC-link voltage V dc and phase voltage of the power grid using PFNN controlled shunt APF are shown in Figure 5d,e; the responses of the three-phase currents i sa , i sb , i sc , neutral current i sn , DC-link voltage V dc and phase voltage of the power grid using the proposed PPFNN controlled shunt APF are shown in Figure 5f,g. From the experimental results shown in Figure 5a, owing to the unbalanced load 1 connected with the power grid and the absence of the shunt APF, the three-phase currents i sa , i sb , i sc of the power grid are unbalanced with large neutral current i sn . The peak value of the neutral current i sn is 2.79 A. The main objective of the three-phase four-leg inverter-based shunt APF is to generate the compensated current components i fa , i fb , i fc to make the three-phase currents i sa , i sb , i sc of the power grid be balanced, and suppress the neutral current i sn . Hence, from the experimental results using PI controlled APF as shown in Figure 5b,c, the three-phase currents i sa , i sb , i sc of the power grid can be compensated to be balanced and the peak value of the neutral current i sn can be suppressed to be 0.61 A as shown in Figure 5b. The responses of DC-link voltage V dc and phase voltage v sa of the power grid using PI controlled shunt APF are shown in Figure 5c. Moreover, from the experimental results using PFNN controlled APF as shown in Figure 5d,e, the three-phase currents i sa , i sb , i sc of the power grid can be compensated and the peak value of the neutral current i sn can be suppressed to be 0.58 A as shown in Figure 5d. The responses of DC-link voltage V dc and phase voltage v sa of the power grid using PFNN controlled shunt APF are shown in Figure 5e. Furthermore, from the experimental results using the proposed PPFNN controlled APF as shown in Figure 5f,g. The three-phase currents i sa , i sb , i sc of the power grid can be also compensated to be balanced and the peak value of the neutral current i sn can be suppressed to be 0.51 A as shown in Figure 5f. The responses of DC-link voltage V dc and phase voltage v sa of the power grid using the proposed PPFNN controlled shunt APF are shown in Figure 5g. In addition, the experimental results without using the shunt APF and the experimental results using PI, PFNN and the proposed PPFNN controlled shunt APFs at the unbalanced loads 2 and 3 are provided in Figures 6 and 7, respectively. Additionally, the three-phase unbalanced current ratio U R without using the shunt APF and the unbalanced current ratio U R using PI, PFNN and the proposed PPFNN controlled shunt APF at the unbalanced loads 1-3 are provided in Table 1. From Table 1, since the proposed PPFNN controlled shunt APF possesses not only the abilities of the PFNN but also the analytical, graphical and mathematical modeling capabilities of PN, the three-phase unbalanced current ratio U R of the proposed PPFNN controlled shunt APF is better than PI and PFNN controlled shunt APFs.   neutral current isn without using shunt APF; (b) Responses of three-phase currents isa, isb, isc and neutral current isn using PI controlled shunt APF; (c) Responses of DC-link voltage Vdc and phase voltage of power grid vsa using PI controlled shunt APF; (d) Responses of three-phase currents isa, isb, isc and neutral current isn using PFNN controlled shunt APF; (e) Responses of DC-link voltage Vdc and phase voltage of power grid vsa using PFNN controlled shunt APF; (f) Responses of three-phase currents isa, isb, isc and neutral current isn using proposed PPFNN controlled shunt APF; and (g) Responses of DC-link voltage Vdc and phase voltage of power grid vsa using proposed PPFNN controlled shunt APF. To further verify the feasibility and the effectiveness of the proposed PPFNN controlled APF with system uncertainties, a two-phase to ground fault with 0.2 per unit (pu) voltage dip on the power grid is considered at the unbalanced load 3. The experimental results without using the shunt APF and the experimental results using PI, PFNN and the proposed PPFNN controlled shunt APFs at the unbalanced load 3 under abnormal grid voltage are provided in Figure 8. First, the responses of the amplitude of grid voltage with 0.2 pu voltage dip is shown in Figure 8a. Then, the responses of threephase currents isa, isb, isc and neutral current isn without using shunt APF are provided in Figure 8b. The three-phase unbalanced current ratio UR without using the shunt APF is 133.5% and the peak value of the neutral current isn is 9.66 A. Furthermore, the responses of the three-phase currents isa, isb, isc and neutral current isn and DC-link voltage Vdc using PI controlled shunt APF are shown in Figure  8c,d; the responses of the three-phase currents isa, isb, isc and neutral current isn and DC-link voltage Vdc  To further verify the feasibility and the effectiveness of the proposed PPFNN controlled APF with system uncertainties, a two-phase to ground fault with 0.2 per unit (pu) voltage dip on the power grid is considered at the unbalanced load 3. The experimental results without using the shunt APF and the experimental results using PI, PFNN and the proposed PPFNN controlled shunt APFs at the unbalanced load 3 under abnormal grid voltage are provided in Figure 8. First, the responses of the amplitude of grid voltage with 0.2 pu voltage dip is shown in Figure 8a. Then, the responses of three-phase currents i sa , i sb , i sc and neutral current i sn without using shunt APF are provided in Figure 8b. The three-phase unbalanced current ratio U R without using the shunt APF is 133.5% and the peak value of the neutral current i sn is 9.66 A. Furthermore, the responses of the three-phase currents i sa , i sb , i sc and neutral current i sn and DC-link voltage V dc using PI controlled shunt APF are shown in Figure 8c,d; the responses of the three-phase currents i sa , i sb , i sc and neutral current i sn and DC-link voltage V dc using PFNN controlled shunt APF are shown in Figure 8e,f; the responses of the three-phase currents i sa , i sb , i sc and neutral current i sn and DC-link voltage V dc using the proposed PPFNN controlled shunt APF are shown in Figure 8g,h. From the experimental results, the PI, PFNN and the proposed PPFNN controlled shunt APFs can make the three-phase currents i sa , i sb , i sc of the power grid be balanced, and the peak value of the neutral current i sn using PI, PFNN and the proposed PPFNN controlled shunt APF can be suppressed to be 1.41 A, 1.34 A and 1.11 A as shown in Figure 8c,e,g. In addition, the unbalanced current ratio U R using PI, PFNN and the proposed PPFNN controlled shunt APFs at the unbalanced load 3 under abnormal grid voltage are 16.65%, 12.83% and 9.63%, respectively. From the experimental results, though the shunt APF is operated under abnormal grid voltage, the compensation performance of the proposed PPFNN controlled shunt APF is still superior than the PI and PFNN controlled shunt APFs. To further verify the feasibility and the effectiveness of the proposed PPFNN controlled APF with system uncertainties, a two-phase to ground fault with 0.2 per unit (pu) voltage dip on the power grid is considered at the unbalanced load 3. The experimental results without using the shunt APF and the experimental results using PI, PFNN and the proposed PPFNN controlled shunt APFs at the unbalanced load 3 under abnormal grid voltage are provided in Figure 8. First, the responses of the amplitude of grid voltage with 0.2 pu voltage dip is shown in Figure 8a. Then, the responses of threephase currents isa, isb, isc and neutral current isn without using shunt APF are provided in Figure 8b. The three-phase unbalanced current ratio UR without using the shunt APF is 133.5% and the peak value of the neutral current isn is 9.66 A. Furthermore, the responses of the three-phase currents isa, isb, isc and neutral current isn and DC-link voltage Vdc using PI controlled shunt APF are shown in Figure  8c,d; the responses of the three-phase currents isa, isb, isc and neutral current isn and DC-link voltage Vdc using PFNN controlled shunt APF are shown in Figure 8e,f; the responses of the three-phase currents isa, isb, isc and neutral current isn and DC-link voltage Vdc using the proposed PPFNN controlled shunt APF are shown in Figure 8g,h. From the experimental results, the PI, PFNN and the proposed PPFNN controlled shunt APFs can make the three-phase currents isa, isb, isc of the power grid be balanced, and the peak value of the neutral current isn using PI, PFNN and the proposed PPFNN controlled shunt APF can be suppressed to be 1.41 A, 1.34 A and 1.11 A as shown in Figure 8c,e,g. In addition, the unbalanced current ratio UR using PI, PFNN and the proposed PPFNN controlled shunt APFs at the unbalanced load 3 under abnormal grid voltage are 16.65%, 12.83% and 9.63%, respectively. From the experimental results, though the shunt APF is operated under abnormal grid voltage, the compensation performance of the proposed PPFNN controlled shunt APF is still superior than the PI and PFNN controlled shunt APFs. In order to verify the compensation performance and the regulation control of the DC-link voltage of the shunt APF under unbalanced load changing, two scenarios are designed as follows: (1) case 1, the load is changed from load 1 to load 3 at 0.6 s; (2) case 2, the load is changed from load 2 to load 1 at 0.6 s. First, the experimental results of PI, PFNN and the proposed PPFNN controlled shunt APF at case 1 are provided in Figure 9. The responses of the three-phase currents isa, isb, isc and DClink voltage Vdc using PI controlled shunt APF are shown in Figure 9a. The responses of the threephase currents isa, isb, isc using PI controlled shunt APF in 0.54-0.74 s are shown in Figure 9b. The responses of the three-phase currents isa, isb, isc and DC-link voltage Vdc using PFNN controlled shunt APF are shown in Figure 9c. The responses of the three-phase currents isa, isb, isc using PFNN controlled shunt APF in 0.54-0.74 s are shown in Figure 9d. The responses of the three-phase currents isa, isb, isc and DC-link voltage Vdc using the proposed PPFNN controlled shunt APF are shown in Figure 9e. The responses of the three-phase currents isa, isb, isc using the proposed PPFNN controlled shunt APF In order to verify the compensation performance and the regulation control of the DC-link voltage of the shunt APF under unbalanced load changing, two scenarios are designed as follows: (1) case 1, the load is changed from load 1 to load 3 at 0.6 s; (2) case 2, the load is changed from load 2 to load 1 at 0.6 s. First, the experimental results of PI, PFNN and the proposed PPFNN controlled shunt APF at case 1 are provided in Figure 9. The responses of the three-phase currents i sa , i sb , i sc and DC-link voltage V dc using PI controlled shunt APF are shown in Figure 9a. The responses of the three-phase currents i sa , i sb , i sc using PI controlled shunt APF in 0.54-0.74 s are shown in Figure 9b. The responses of the three-phase currents i sa , i sb , i sc and DC-link voltage V dc using PFNN controlled shunt APF are shown in Figure 9c. The responses of the three-phase currents i sa , i sb , i sc using PFNN controlled shunt APF in 0.54-0.74 s are shown in Figure 9d. The responses of the three-phase currents i sa , i sb , i sc and DC-link voltage V dc using the proposed PPFNN controlled shunt APF are shown in Figure 9e. The responses of the three-phase currents i sa , i sb , i sc using the proposed PPFNN controlled shunt APF in 0.54-0.74 s are shown in Figure 9f. From the experimental results, the proposed PPFNN controlled shunt APF can reduce the transient and steady-state error of the DC-link voltage more rapidly as shown in Figure 9e. Comparing with PI and PFNN controllers, since the proposed PPFNN controller owns fast convergence capability with robust, the excellent regulation control of the DC-link voltage and the compensation performance can be obtained by the proposed PPFNN controlled shunt APF. Moreover, the experimental results of PI, PFNN and the proposed PPFNN controlled shunt APF at case 2 are provided in Figure 10. The responses of the three-phase currents i sa , i sb , i sc and DC-link voltage V dc using PI controlled shunt APF are shown in Figure 10a. The responses of the three-phase currents i sa , i sb , i sc using PI controlled shunt APF in 0.54-0.74 s are shown in Figure 10b. The responses of the three-phase currents i sa , i sb , i sc and DC-link voltage V dc using PFNN controlled shunt APF are shown in Figure 10c. The responses of the three-phase currents i sa , i sb , i sc using PFNN controlled shunt APF in 0.54-0.74 s are shown in Figure 10d. The responses of the three-phase currents i sa , i sb , i sc and DC-link voltage V dc using the proposed PPFNN controlled shunt APF are shown in Figure 10e. The responses of the three-phase currents i sa , i sb , i sc using the proposed PPFNN controlled shunt APF in 0.54-0.74 s are shown in Figure 10f. From the experimental results, the transient and steady-state responses of the DC-link voltage are also much improved as shown in Figure 10e due to the powerful adaptive ability of the proposed PPFNN controlled shunt APF. Finally, a numerical performance comparison of the proposed PPFNN with PI and PFNN controllers is provided in Table 2. The response time from the transient state to steady state of the DC-link voltage and the maximum DC-link voltage error from overshoot to undershoot in transient state using PI, PFNN and the proposed PPFNN controllers at cases 1 and 2 are shown in Table 2. From Table 2, the proposed PPFNN controlled shunt APF owns fast response time and less overshoot and undershoot. Therefore, the proposed PPFNN controlled shunt APF possesses excellent compensation and regulation performance.

Conclusions
The development and implementation of the three-phase four-leg inverter-based shunt APF for compensating the three-phase unbalanced currents in grid-connected operation are successfully presented in this study. Moreover, if the unbalanced load changes suddenly, the DC-link voltage of the shunt APF will fluctuate seriously and the compensation performance and even the stability of Figure 10. Experimental results at case 2: (a) Responses of three-phase currents i sa , i sb , i sc and regulation control of DC-link voltage using PI controlled shunt APF; (b) Responses of three-phase currents i sa , i sb , i sc using PI controlled shunt APF in 0.54-0.74 s; (c) Responses of three-phase currents i sa , i sb , i sc and regulation control of DC-link voltage using PFNN controlled shunt APF; (d) Responses of three-phase currents i sa , i sb , i sc using PFNN controlled shunt APF in 0.54-0.74 s; (e) Responses of three-phase currents i sa , i sb , i sc and regulation control of DC-link voltage using proposed PPFNN controlled shunt APF (f) Responses of three-phase currents i sa , i sb , i sc using proposed PPFNN controlled shunt APF in 0.54-0.74 s. The execution time of the "C" program in the TMS320F28335 32-bit floating-point DSP can be obtained by the clock tool of TEXAS INSTRUMENTS Code Composer Studio (CCS) v5 program editing interface. The execution time of the shunt APF using PI, PFNN and proposed PPFNN controllers are compared in Table 3. As the result, the execution time of the shunt APF using the proposed PPFNN is still less than 1 ms which is the sampling interval of the control loop. Therefore, except the extra coding time for the shunt APF using proposed PPFNN controller, there is no extra hardware cost requirement for the implementation of the shunt APF using proposed PPFNN controller.

Conclusions
The development and implementation of the three-phase four-leg inverter-based shunt APF for compensating the three-phase unbalanced currents in grid-connected operation are successfully presented in this study. Moreover, if the unbalanced load changes suddenly, the DC-link voltage of the shunt APF will fluctuate seriously and the compensation performance and even the stability of the system will be affected. Hence, an online trained PPFNN controller is proposed to replace the PI and PFNN controllers to improve the control performance of the DC-link voltage of the shunt APF. Furthermore, the operating theories of the shunt APF and the network structure, online learning algorithms and convergence analysis of the proposed PPFNN have been introduced in detail. In addition, from the experimental results using the proposed PPFNN controlled shunt APF, excellent regulation control of the DC-link voltage and compensation performance can be achieved simultaneously by the proposed PPFNN controlled shunt APF due to the powerful adaptive ability of the PPFNN control. The major contributions of this study are: (i) the successful development of the three-phase four-leg inverter-based shunt APF for compensating the three-phase unbalanced currents by the control platform using the TI DSP TMS320F28335; (ii) the successful development of the proposed intelligent PPFNN control; (iii) the successful implementation of the proposed PPFNN controller for the regulation control of the DC-link voltage and the unbalanced currents compensation of the shunt APF.