Three-Level Active Power Filter Based on Model Predictive Control

Abstract: The model predictive control (MPC) algorithm is used in the harmonic compensation of active power filter (APF), which has a fast dynamic response and does not require a PWM modulation model. However, this method has some shortcomings, such as the mass computing and difficult selections of weight factors. To solve these problems, this paper proposes a single objective function improved MPC algorithm based on sector judgment, which only takes the reference current and feedback current as the objective function, omits the weight coefficient setting process, and reduces the number of rolling optimization from 27 to 7, thus reducing the computing time and control complexity. The improved model predictive control is applied to APF. Finally, the simulations and experiments show that the improved MPC algorithm is accurate and efficient.


Introduction
With the advancement of power electronics technology and the development of manufacturing industry, more and more nonlinear devices are put into use. The input of these nonlinear loads brings a huge harmonic interference and a reactive power impact on the power grid. If not treated, it brings a huge pollution to the power grid, and causes major economic losses and safety accidents. The active power filter has excellent dynamic response, real-time performance, and controllability. It is an ideal device for compensating harmonics and improving power quality [1][2][3][4]. The three-level APF has the advantages of large capacity, more output levels and small filter inductance. It is widely used in medium and low voltage occasions [5][6][7]. At present, the studies on the three-level APF mainly focus on the optimization of control algorithm.
The studies on the optimization of the three-level control algorithm mainly focus on the harmonic current tracking strategy. The mature tracking strategies include the proportional integral control, hysteresis control, proportional resonance control, and model predictive control [8][9][10][11]. The PI control algorithm is not suitable for ac tracking [12]. More precisely, the response speed of hysteresis controller is affected by the loop width, while the loop width of different systems is difficult to adjust, and it is also difficult to balance the selection between switching frequency and tracking effect, which limits the use of this algorithm [13]. In general, in order to take the computational load and compensation performance into consideration, the proportional resonance control algorithm is only used for tracking specific harmonic frequency segments [14]. As a novel current tracking control algorithm, the model prediction has the advantages of fast dynamic response, flexible control and good stability. It has been widely used in the control of power converters [15,16].
The model predictive control mainly samples the device output current at the current time, and substitutes it into the established system mathematical model in order to predict the future device output current information according to the current or past current information [17]. Compared with other control algorithms, the model predictive control has great advantages in nonlinear systems, and can better deal with problems such as multiinput, multi variable, and multi constraint conditions [18]. However, the model prediction includes a rolling optimization process, which requires lot of processing time, thus reducing the dynamic performance of the model predictive control [19]. The weight factor reflects the importance of the objective function. It plays a crucial role in the control effect of the target. Therefore, when controlling the multi-objective function, the desired control effect can be obtained by adjusting the weight factor [20,21]. Although the model prediction can unify multiple constraints by adjusting the weight factor, it is difficult to adjust the weight coefficient in engineering applications. In [22], the model predictive control algorithm is applied to the three-phase four leg APF in order to predict the reference current and compensation current, and therefore perform harmonic compensation. However, this method has many rolling times, and the weight factor should be adjusted, which increases the complexity of the system. The authors in [23] apply model predictive control to the current tracking control of the three-level APF system. Although the values of the required parameters in the system are analyzed, a specific setting method of the parameters does not exist. The authors in [24] first classify different types of the objective function and weight factors, and then adjust the weight factors. This method has an excellent control effect. However, it is complex and it has a large computational load, which limits its use in practical application. Another approach [25] combines the model predictive control algorithm with a neural network algorithm. Compared with the traditional MPC algorithm, this method does not require an accurate mathematical model, and significantly improves the dynamic response ability of the APF system. However, the implementation process of this method is complex, and therefore it is difficult to be used in several application domains. The method in [26] applies the model predictive control algorithm to the T-type three-level neutral point clamped (NPC) inverter. It uses the predictive control for the grid current and capacitor voltage. Although the maximum power output and DC side capacitor voltage are stable, a specific setting method for the weight factor does not exist. The method in [27] introduces the idea of mixed logic dynamic (MLD) modeling into MPC control. Although the accuracy of the prediction model is improved, the modeling of this method is complex and difficult to implement. The authors in [28] select the optimal voltage vector according to the inverter output power and DC side voltage. They then optimize multiple objective functions by a constraint term, omitting the setting process of weighting factors. However, this method has more rolling times and a large computational load.
In this paper, a single objective function improved model predictive control algorithm based on sector judgment is proposed. It only takes the given current and feedback current as the objective function, determines the optimal voltage vector according to the influence of small vector and the change of DC voltage, omits the setting process of weight coefficient, and, finally, reduces the rolling optimization times to 7 times by judging the sector. The complexity of the algorithm is reduced and the dynamic response ability of APF system is improved. Finally, the improved MPC algorithm is applied to NPC three-level APF, and the correctness and feasibility of the algorithm are proved by system simulation and experiments. Considering point O as the zero potential reference point, in order to maintain the balance of two capacitors, that is, the voltage of each capacitor is +Vdc/2, three levels can be output by changing the on and off states of the switch according to the modulation strategy: +Vdc/2, 0, and −Vdc/2.
For the convenience of analysis, the topological phase voltage output +Vdc/2 is defined as P state, output -Vdc/2 is N state and output 0 is O state. The NPC topology line voltage output has five states: +Vdc, +Vdc/2, 0, −Vdc/2, and −Vdc. Table 1 can be obtained by summarizing the three working states of NPC three-level topology.

Mathematical Model of Three-level NPC APF
According to the analysis, the output level function is given by: 1( ) S ，S on S ，S off 0(O) S ，S on S ，S off −1(N) S ，S on S ，S off (1) where: Sx is the output level function, and x has the value a, b, or c.
Block diagram of NPC three-level APF, as shown in Figure 2. Assuming that the grid is symmetrical without distortion and only contains the fundamental component, the three-phase load symmetrically ignores the line parasitic inductance and only considers the AC side output filter inductance. It also ignores the system line and device loss, and only considers the inductance internal resistance. Moreover, the three-phase inductance internal resistances are equal (R = Ra = Rb = Rc), and the DC side capacitances are all equal to C. Considering point O as the zero potential reference point, in order to maintain the balance of two capacitors, that is, the voltage of each capacitor is +V dc /2, three levels can be output by changing the on and off states of the switch according to the modulation strategy: +V dc /2, 0, and −V dc /2.
For the convenience of analysis, the topological phase voltage output +V dc /2 is defined as P state, output −V dc /2 is N state and output 0 is O state. The NPC topology line voltage output has five states: +V dc , +V dc /2, 0, −V dc /2, and −V dc . Table 1 can be obtained by summarizing the three working states of NPC three-level topology. Where: 1 represents the switch on, and 0 represents the switch off.

Mathematical Model of Three-Level NPC APF
According to the analysis, the output level function is given by: S x    1(P) S x1 , S x2 on S x3 , S x4 off 0(O) S x2 , S x3 on S x1 , S x4 off −1(N) S x3 , S x4 on S x1 , S x2 off (1) where: S x is the output level function, and x has the value a, b, or c.
Block diagram of NPC three-level APF, as shown in Figure 2. Assuming that the grid is symmetrical without distortion and only contains the fundamental component, the three-phase load symmetrically ignores the line parasitic inductance and only considers the AC side output filter inductance. It also ignores the system line and device loss, and only considers the inductance internal resistance. Moreover, the three-phase inductance internal resistances are equal (R = R a = R b = R c ), and the DC side capacitances are all equal to C. According to these assumptions and to the Kirchhoff voltage law (KVL), the mathematical model of the APF system is expressed as: where: usa, usb, and usc are the three-phase voltage, iCA, iCB, and iCC are the system compensation currents，uAO, uBO, and uCO are the potential voltages between the output point of each phase and the reference point O of the NPC topology, uON is the voltage between the DC side neutral point and grid neutral point. UAO, uBO, and uCO can be expressed as (3).
and therefore: By combining Equations (2)-(4), the difference between the point O potential and the point N potential is given by: The three-level NPC APF output voltage and switching function then meet the following relationships:

Analysis of Neutral Point Potential of NPC APF
Two main reasons exist for the capacitor voltage fluctuation: the various losses in APF system, including the loss of switch tube and line, as well as the load fluctuation and the power grid fluctuation. The load fluctuation and grid fluctuation belong to the external disturbance and cannot be controlled. Therefore, in order to suppress the capacitor According to these assumptions and to the Kirchhoff voltage law (KVL), the mathematical model of the APF system is expressed as: where: u sa , u sb , and u sc are the three-phase voltage, i CA , i CB , and i CC are the system compensation currents, u AO , u BO , and u CO are the potential voltages between the output point of each phase and the reference point O of the NPC topology, u ON is the voltage between the DC side neutral point and grid neutral point. U AO , u BO , and u CO can be expressed as (3).
and therefore: By combining Equations (2)-(4), the difference between the point O potential and the point N potential is given by: The three-level NPC APF output voltage and switching function then meet the following relationships:

Analysis of Neutral Point Potential of NPC APF
Two main reasons exist for the capacitor voltage fluctuation: the various losses in APF system, including the loss of switch tube and line, as well as the load fluctuation and the power grid fluctuation. The load fluctuation and grid fluctuation belong to the external disturbance and cannot be controlled. Therefore, in order to suppress the capacitor voltage fluctuation, maintain the stability of the APF system and achieve a better tracking effect on the harmonic current, the relationship between the NPC topology output voltage vector and neutral point potential fluctuation is analyzed as follows. voltage fluctuation, maintain the stability of the APF system and achieve a better tracking effect on the harmonic current, the relationship between the NPC topology output voltage vector and neutral point potential fluctuation is analyzed as follows. As shown in Figure 3, there are 27 voltage vectors in NPC topology switching state  vector, including 6 medium vectors, 6 large vectors, 12 small vectors, and 3 zero   In order to analyze the influence of vectors on the neutral point potential, the equivalent circuits corresponding to these five vectors are analyzed, (cf. Figure 4). In order to analyze the influence of vectors on the neutral point potential, the equivalent circuits corresponding to these five vectors are analyzed, (cf. Figure 4).
It can be seen from Figure 4a, that the large vector (PNN) acts on the entire bus voltage and does not constitute a loop with the point O. The same applies for the other five large vectors. Therefore, when the large vector acts, it only affects the entire bus voltage on the DC side. When the output voltage vector is a medium vector, one phase is connected to point O, and the other phases are, respectively, connected to the bus voltage in order to form a loop with point O, and therefore affect its potential. However, this effect is uncontrollable. That is, the point O potential cannot be controlled by the medium vectors. The small vectors include positive and negative small vectors. It can be seen from Figure 4c,d that no matter which small vector acts, an electrical connection with point O which constitutes a circuit exists, so the small vectors will affect the neutral point potential balance. When the output state of the switch is a zero vector, it can be seen from Figure 4e that although the three bridge arms are connected to the point O, they do not form a current loop and do not affect the voltage balance. The other two zero vectors of the bridge arms are not connected to the point O, and will not affect the voltage balance. The influences of these four voltage vectors are summarized in Table 2.  In order to analyze the influence of vectors on the neutral point potential, the equivalent circuits corresponding to these five vectors are analyzed, (cf. Figure 4). It can be seen from Figure 4a, that the large vector (PNN) acts on the entire bus voltage and does not constitute a loop with the point O. The same applies for the other five large vectors. Therefore, when the large vector acts, it only affects the entire bus voltage on the DC side. When the output voltage vector is a medium vector, one phase is connected to point O, and the other phases are, respectively, connected to the bus voltage in order to form a loop with point O, and therefore affect its potential. However, this effect is uncontrollable. That is, the point O potential cannot be controlled by the medium vectors. The small vectors include positive and negative small vectors. It can be seen from Figure 4c,d that no matter which small vector acts, an electrical connection with point O which constitutes a circuit exists, so the small vectors will affect the neutral point potential balance. When the output state of the switch is a zero vector, it can be seen from Figure 4e that although the three bridge arms are connected to the point O, they do not form a current loop and do not affect the voltage balance. The other two zero vectors of the bridge arms are not connected to the point O, and will not affect the voltage balance. The influences of these four voltage vectors are summarized in Table 2.  Assuming the neutral current is i o , the load currents are i a , i b , and i c , the output direction of the inverter is positive direction, the corresponding relations among i o , the redundant small vectors, and load currents can be obtained, (cf. Table 3).  Table 3, the mathematical relationship between i o and the APF system output compensation current is expressed as: Electronics 2022, 11, 1291 7 of 26 The relationship between i o and the DC side capacitance is given by: where: V dc1 and V dc2 are the voltage values of capacitors C 1 and C 2 , respectively. By setting the voltage deviation to V O = V dc1 − V dc2 , according to Equations (7) and (8), the following is obtained: where: x = a, b, c.
In summary, the reason of NPC topology DC side neutral point potential fluctuations is that i o is not null. Regardless of the magnitude and direction of i o , as long as a current flow exists between the neutral point O and the load circuit, the current will affect the point O voltage. Under the action of different vectors, different currents have different effects on the capacitance voltage. However, only the small vectors really affect the capacitance voltage and can be controlled in the system. Therefore, the small vectors can be used to solve the problem of neutral point fluctuation. Figure 5 presents the overall control structure block diagram of the three-level APF system, including the harmonic current detection unit and model predictive control unit. The harmonic current control unit uses the i p -i q harmonic current detection method in order to obtain the three-phase harmonic reference current i * fa , i * fb , and i * fc . The model predictive control samples the compensation current, capacitor voltage, and grid voltage, and predicts the compensation current and reference current in the future. It also selects the optimal switching vector output combined with the current capacitor voltage error.  Due to the limited switching state of the main circuit, MPC predicts the output of each switching state using the prediction model. By calculating the function values of all the switching states, the switch state corresponding to the minimum function is selected and applied to the next cycle. The detailed process is as follows. The output prediction model of the system is first developed according to the switching state of the APF and the system control variable x. The value function is then established. At time , the output ( ) is calculated using the system prediction model in order to calculate the predicted output ( ) corresponding to n different switching states. Afterwards, the value function of the n switching states can be calculated using the output value ( ) and predicted output value ( ). Finally, the optimal switching state ( ) corresponding to the minimum function value is obtained, and the switching state is output. The diagram of the system is illustrated in Figure 6. Due to the limited switching state of the main circuit, MPC predicts the output of each switching state using the prediction model. By calculating the function values of all the switching states, the switch state corresponding to the minimum function is selected and applied to the next cycle. The detailed process is as follows. The output prediction model f mpc of the system is first developed according to the switching state S sta of the APF and the system control variable x. The value function f val is then established. At time t k , the output x(t k ) is calculated using the system prediction model f mpc in order to calculate the predicted output x mpc i (t k+1 ) corresponding to n different switching states. Afterwards, the value function of the n switching states can be calculated using the output value x ref (t k+1 ) and predicted output value x mpc i (t k+1 ). Finally, the optimal switching state S sta (t k ) corresponding to the minimum function value is obtained, and the switching state is output. The diagram of the system is illustrated in Figure 6. APF and the system control variable x. The value function is then established. At time , the output ( ) is calculated using the system prediction model in order to calculate the predicted output ( ) corresponding to n different switching states. Afterwards, the value function of the n switching states can be calculated using the output value ( ) and predicted output value ( ). Finally, the optimal switching state ( ) corresponding to the minimum function value is obtained, and the switching state is output. The diagram of the system is illustrated in Figure 6.

Traditional MPC
Model predictive control (MPC) belongs to optimal control in essence. It can predict the future output information of the system according to the current and past sampling information of the system. The switching states of the converter are limited, for example, there are 27 switching states in NPC three-level topology. Therefore, the traditional model is also called finite control set model prediction.
The model predictive control consists of the predictive model, rolling optimization and feedback correction. The overall control block diagram is shown in Figure 7. Establishing a systematic prediction model is the first step of MPC, that is, building a prediction model of future information according to the previous and current information, and then rolling optimization. Through rolling optimization, the size of the value function corresponding to all the cases can be judged, and the switch state output corresponding to the minimum value function can be selected. In the process of rolling optimization, the initial positioning link of the current information to the optimization process includes a feedback  Figure 6. APF MPC block diagram.

Traditional MPC
Model predictive control (MPC) belongs to optimal control in essence. It can predict the future output information of the system according to the current and past sampling information of the system. The switching states of the converter are limited, for example, there are 27 switching states in NPC three-level topology. Therefore, the traditional model is also called finite control set model prediction.
The model predictive control consists of the predictive model, rolling optimization and feedback correction. The overall control block diagram is shown in Figure 7. Establishing a systematic prediction model is the first step of MPC, that is, building a prediction model of future information according to the previous and current information, and then rolling optimization. Through rolling optimization, the size of the value function corresponding to all the cases can be judged, and the switch state output corresponding to the minimum value function can be selected. In the process of rolling optimization, the initial positioning link of the current information to the optimization process includes a feedback correction. Therefore, an additional feedback correction link does not exist in practical applications.  In order to reduce the control complexity and improve the real-time performance, the Clarke transform is performed on the APF mathematical model of the traditional MPC in order to obtain the following: where: = By applying the Clarke transformation on the pair of Equation (6), the following is obtained: In order to reduce the control complexity and improve the real-time performance, the Clarke transform is performed on the APF mathematical model of the traditional MPC in order to obtain the following: where: By applying the Clarke transformation on the pair of Equation (6), the following is obtained: Equation (10) is then discretized to obtain: where: i α (k) and i β (k) are the actual compensation currents of APF at time k, i α (k + 1) and i β (k + 1) represents the predicted compensation currents at k+1 time, and T s represents the sampling period of the system. Using Equations (10), (12), and (13), the following can be obtained: where u αβ (k) is the APF output voltage at time k, and e αβ (k) is the APF grid voltage at time k.
In order to maintain a good current tracking effect and take into account the balance of medium electric potential, Equation (9) is discretized: where: V o (k + 1) and V o (k) are the deviation prediction value and deviation sampling value of capacitor C 1 and capacitor C 2 at k + 1 time and k time, respectively. Equation (16) can be obtained from Equations (9) and (15): According to the objective function of the NPC three-level APF system, the square error function is selected as the value function model: Considering the current tracking effect as the objective function, while taking into account the balance of neutral point potential, the value function can be expressed as: Considering the weights of g 1 and g 2 , the final expression of the value function is given by: where: λ 1 and λ 2 are weight coefficients. The current prediction value given in Equation (19) can be obtained by Lagrange interpolation: For the sake of accuracy and computational complexity, n = 2 is selected, and then: The problem of setting the weight coefficient of the objective function can be solved by outputting the optimal small vector to equalize the DC side voltage, and omitting the DC side capacitor voltage error objective function in the cost function.
The realization of DC sides capacitor voltage stability is the premise of maintaining neutral points potential balances. The diagram of the DC sides capacitor voltage stabilizing control is illustrated in Figure 8. Where e a , e b , and e c are the grid voltage, i a , i b , and i c are the three-phase grid current. Firstly, the active current and reactive current components i p and i q in p-q coordinate system are obtained by Clarke transformation and Park transformation. Then, the fundamental component in the p-q coordinate system can be obtained by filtering the high-order harmonic component through the low-pass filter LPF. The difference between the DC side total voltage reference value and the DC side total voltage feedback can be processed by the PI controller to obtain the active power reference current ∆i p . The active current component ∆i p is superimposed with the active fundamental current component in the p-q coordinate system to obtain the final active fundamental current component. The three-phase fundamental current components i af , i bf , and i cf are obtained from the final active fundamental component and reactive fundamental component through the inverse transformation of Clarke and Park. Finally, by subtracting the three-phase fundamental current from the three-phase total current, the three-phase harmonic components i ah , i bh , and i ch can be obtained. The improved model predictive control algorithm can control the voltage of two capacitors on the DC side, by outputting a specific small vector. This method can omit the DC side capacitor voltage error value function, so as to solve the problem of setting the weight coefficient of the objective function. The specific form of the improved value function is given by: Compared with the traditional model prediction value function, this function only needs to consider an objective function of current tracking error, which reduces the computational load and does not introduce a weight coefficient. Therefore, there is no problem of weight coefficient setting.

Single Objective Function Improved Model Predictive Control Strategy Based on Sector Judgment
Inspired by the three-level SVPWM vector control, the sector judgment is introduced into the model predictive control. Figure 9 presents the three-level NPC voltage vector diagram. The improved model predictive control algorithm can control the voltage of two capacitors on the DC side, by outputting a specific small vector. This method can omit the DC side capacitor voltage error value function, so as to solve the problem of setting the weight coefficient of the objective function. The specific form of the improved value function is given by: Compared with the traditional model prediction value function, this function only needs to consider an objective function of current tracking error, which reduces the computational load and does not introduce a weight coefficient. Therefore, there is no problem of weight coefficient setting.

Single Objective Function Improved Model Predictive Control Strategy Based on Sector Judgment
Inspired by the three-level SVPWM vector control, the sector judgment is introduced into the model predictive control. Figure 9 presents the three-level NPC voltage vector diagram.

Single Objective Function Improved Model Predictive Control Strategy Based on Sector Judgment
Inspired by the three-level SVPWM vector control, the sector judgment is introduced into the model predictive control. Figure 9 presents the three-level NPC voltage vector diagram. It can be seen that the linear and β coordinate axes divide the large hexagon into six regions, quadrilateral areas of I, II, III, IV, V, and VI, while each quadrilateral contains 8 vectors. It is first assumed that the projection of the reference voltage vector V ref on the α and β axes is V α and V β . The six quadrangles are divided according to three lines and voltage vector V ref . Specific regional divisions are shown in Table 4. Table 4. Regional divisions.

Region of
The quadrilateral region of the reference voltage vector can be determined by assessing the mathematical relationship of the projection of the reference voltage vector on the α and β axes. Therefore, the mathematical model of the reference voltage is developed: In order to achieve a better current tracking effect of the system, it is necessary to predict that the output current is equal to the predicted harmonic given current: By simultaneously using Equations (23) and (24), the following can be obtained: where: u α = V α and u β = V β . After this evaluation, the region of the reference voltage vector can be determined. In addition, 8 vectors exist in each region, and there are 2 small vectors among the 8 vectors. Consequently, a redundant vector can be removed. Therefore, the proposed model predictive control algorithm has only 7 rolling optimized vectors, which greatly reduces the rolling times and system calculation, compared with the traditional prediction model.

Flow and Analysis of Improved Model Predictive Control
The control flowchart is shown in Figure 10. Based on the traditional model predictive control, firstly, each parameter is sampled, the system parameters are initialized, u α and u β are calculated, the position of the reference voltage vector is then judged according to the size of u α and u β , and, finally, its quadrilateral region is determined. Afterwards, the seven voltage vectors in this area are subject to rolling optimization. The compensation current is predicted and the value functions containing only current tracking error, are calculated. After seven rolling optimizations, the switching state corresponding to the value function that minimizes the current tracking error is output. Finally, the output voltage vector is judged. In the case of a small vector, a small vector output that is conducive to the capacitor voltage balance on the DC side is selected. Otherwise, it is directly output. Consequently, the optimal switching state output of single objective function improved model predictive control based on sector judgment is completed.

System Simulation and Result Analysis
The feasibility and efficiency of the proposed algorithm are verified by developing the simulation model of the NPC three-level APF. The model predictive control is written using the S-function module of MATLAB / Simulink. The two model predictions are simulated and compared. Table 5 presents the system simulation parameters.

System Simulation and Result Analysis
The feasibility and efficiency of the proposed algorithm are verified by developing the simulation model of the NPC three-level APF. The model predictive control is written using the S-function module of MATLAB/Simulink. The two model predictions are simulated and compared. Table 5 presents the system simulation parameters. Table 5. Specific parameters of APF simulation model.

Simulation Parameters Value
Effective value of grid Phase voltage/V 220 Grid frequency/Hz 50 Sampling frequency/kHz 20 Figure 11 shows the current waveform of A-phase power grid before compensation. It can be seen that when APF is not working, the current waveform is saddle shaped and the waveform distortion is serious because it contains a large number of high-order harmonics. Figure 12 shows the FFT analysis diagram of A-phase grid current before compensation. It can be seen that THD is 27.08%, which is much higher than the national standard of 5%, which seriously reduces the power quality of the grid.   Figure 10, it can be seen that the current waveform after compensation changes from saddle shape to sinusoidal shape, and the sinusoidal degree is high. Its THD is 4.51% and less than 5%, which meets the national standard and realizes harmonic compensation.   Figure 10, it can be seen that the current waveform after compensation changes from saddle shape to sinusoidal shape, and the sinusoidal degree is high. Its THD is 4.51% and less than 5%, which meets the national standard and realizes harmonic compensation.  Figure 10, it can be seen that the current waveform after compensation changes from saddle shape to sinusoidal shape, and the sinusoidal degree is high. Its THD is 4.51% and less than 5%, which meets the national standard and realizes harmonic compensation.   Figure 10, it can be seen that the current waveform after compensation changes from saddle shape to sinusoidal shape, and the sinusoidal degree is high. Its THD is 4.51% and less than 5%, which meets the national standard and realizes harmonic compensation.    Figure 15 is the reference current tracking effect diagram under traditional model predictive control. Under the traditional model predictive control, the feedback current can better track the reference current, but there are some deviations in the peak and trough. Figure 16 presents the error diagram of reference current and feedback current, the error range fluctuates within ±2.5 A, and the maximum error occurs at the peak and trough positions.  Figure 15 is the reference current tracking effect diagram under traditional model predictive control. Under the traditional model predictive control, the feedback current can better track the reference current, but there are some deviations in the peak and trough. Figure 16 presents the error diagram of reference current and feedback current, the error range fluctuates within ±2.5 A, and the maximum error occurs at the peak and trough positions.             In order to observe the MPC the selection of switching state vector, the switching state flag is set to observe the process of finding the optimal switching vector during rolling optimization. Figure 19 is a value diagram of the switching states flag of the traditional model predictive control algorithm. The value of flag is between 1 and 27, which verifies that the rolling optimization times of the traditional model predictive control algorithm is 27. In order to observe the MPC the selection of switching state vector, the switching state flag is set to observe the process of finding the optimal switching vector during rolling optimization. Figure 19 is a value diagram of the switching states flag of the traditional model predictive control algorithm. The value of flag is between 1 and 27, which verifies that the rolling optimization times of the traditional model predictive control algorithm is 27.

Single Objective Function Improved Model Predictive Control Based on Sector Judgment
On the basis of keeping the previously mentioned simulation parameters unchanged, this section uses the single objective function improved model predictive control algorithm based on sector judgment to simulate the APF system. Figures 20 and 21 present the current waveform and THD diagram of APF system after adding the improved model prediction algorithm. It can be seen that the sinusoidal degree of the current waveform is high. It can be deduced using the Fourier analysis that the THD is only 1.35%, and the APF system achieves an excellent compensation effect.

Single Objective Function Improved Model Predictive Control Based on Sector Judgment
On the basis of keeping the previously mentioned simulation parameters unchanged, this section uses the single objective function improved model predictive control algorithm based on sector judgment to simulate the APF system. Figures 20 and 21 present the current waveform and THD diagram of APF system after adding the improved model prediction algorithm. It can be seen that the sinusoidal degree of the current waveform is high. It can be deduced using the Fourier analysis that the THD is only 1.35%, and the APF system achieves an excellent compensation effect.

Single Objective Function Improved Model Predictive Control Based on Sector Judgment
On the basis of keeping the previously mentioned simulation parameters unchanged, this section uses the single objective function improved model predictive control algorithm based on sector judgment to simulate the APF system. Figures 20 and 21 present the current waveform and THD diagram of APF system after adding the improved model prediction algorithm. It can be seen that the sinusoidal degree of the current waveform is high. It can be deduced using the Fourier analysis that the THD is only 1.35%, and the APF system achieves an excellent compensation effect.   Figure 22 presents the effect diagram of the harmonic current tracking, while Figure  23 shows the error result diagram of the reference current and feedback current. It can be seen that the APF output current and reference current mainly coincide, and the tracking effect is efficient. The error between the reference current and feedback current is ±0.7 A,

Single Objective Function Improved Model Predictive Control Based on Sector Judgment
On the basis of keeping the previously mentioned simulation parameters unchanged, this section uses the single objective function improved model predictive control algorithm based on sector judgment to simulate the APF system. Figures 20 and 21 present the current waveform and THD diagram of APF system after adding the improved model prediction algorithm. It can be seen that the sinusoidal degree of the current waveform is high. It can be deduced using the Fourier analysis that the THD is only 1.35%, and the APF system achieves an excellent compensation effect.   Figure 22 presents the effect diagram of the harmonic current tracking, while Figure  23 shows the error result diagram of the reference current and feedback current. It can be seen that the APF output current and reference current mainly coincide, and the tracking effect is efficient. The error between the reference current and feedback current is ±0.7 A,  Figure 22 presents the effect diagram of the harmonic current tracking, while Figure 23 shows the error result diagram of the reference current and feedback current. It can be seen that the APF output current and reference current mainly coincide, and the tracking effect is efficient. The error between the reference current and feedback current is ±0.7 A, which is smaller than that of the traditional MPC algorithm.   Figure 24 shows the overall voltage waveform of the DC side capacitor, which can be stable around 800 V with a small fluctuation. Figure 25 illustrates the fluctuation diagram of the neutral point potential, with a fluctuation range of ±0.37 V, performing a good voltage stabilizing effect.   Figure 26 presents the value of the switch state flag, which value ranges between 1 and 7. In order to further observe the sector judgment, flag1 is defined as the sector judgment flag. Figure 27 shows the result values of flag1. It can be seen that the value of flag1 ranges between 1 and 6, which verifies the efficiency of the method of judging the sector position by the voltage vectors.   Figure 24 shows the overall voltage waveform of the DC side capacitor, which can be stable around 800 V with a small fluctuation. Figure 25 illustrates the fluctuation diagram of the neutral point potential, with a fluctuation range of ±0.37 V, performing a good voltage stabilizing effect.     Figure 24 shows the overall voltage waveform of the DC side capacitor, which can be stable around 800 V with a small fluctuation. Figure 25 illustrates the fluctuation diagram of the neutral point potential, with a fluctuation range of ±0.37 V, performing a good voltage stabilizing effect.   Figure 24 shows the overall voltage waveform of the DC side capacitor, which can be stable around 800 V with a small fluctuation. Figure 25 illustrates the fluctuation diagram of the neutral point potential, with a fluctuation range of ±0.37 V, performing a good voltage stabilizing effect.      Figure 24 shows the overall voltage waveform of the DC side capacitor, which can be stable around 800 V with a small fluctuation. Figure 25 illustrates the fluctuation diagram of the neutral point potential, with a fluctuation range of ±0.37 V, performing a good voltage stabilizing effect.     Figure 26 presents the value of the switch state flag, which value ranges between 1 and 7. In order to further observe the sector judgment, flag1 is defined as the sector judgment flag. Figure 27 shows the result values of flag1. It can be seen that the value of flag1 ranges between 1 and 6, which verifies the efficiency of the method of judging the sector position by the voltage vectors.  In this section, the two MPC algorithms are simulated. Compared with the traditional MPC, the improved model prediction algorithm can judge the output voltage vector and select the switching state conducive to the neutral point potential balance of the capacitor on the DC side for output, so as to realize the voltage sharing control of the capacitor. Using the improved model prediction algorithm, the overall capacitor voltage is closer to 800 V, the neutral point potential fluctuation is smaller, and the harmonic current tracking effect is better. According to the diagram of the switch state flag, the rolling times are reduced from 27 to 7, which reduces the rolling optimization times. In conclusion, the control effect of the improved model prediction algorithm is significantly enhanced.

System Performance Simulation and Analysis
In practical applications, the operating conditions are often complex. A better compensation effect can be achieved only when the APF system has a good adaptability. Therefore, it is crucial to analyze the dynamic response capacity of the APF system. In order to study the dynamic performance of APF system based on improved model predictive control based on sector judgment, it is simulated and analyzed under different working conditions.

System Simulation Analysis under Sudden Load Change
Based on the simulation model presented in Section 4.2, a same nonlinear load is input at 0.2 s and cut off at 0.4 s. Figure 28 shows the three-phase power grid current waveforms when the load suddenly changes. At 0.2 s, the current amplitude suddenly increases due to the load increase, which results in large spikes. However, the APF system can quickly compensate it and then eliminate the spikes. Figure 29 shows the THD diagram of the A-phase current before load mutation, while Figure 30 presents the THD diagram of the A-phase after load mutation. It can be seen that the THD content is 3.41%, which is higher than 1.94%. However, it is still less than 5%, which indicates that the system has a good dynamic compensation performance.  In this section, the two MPC algorithms are simulated. Compared with the traditional MPC, the improved model prediction algorithm can judge the output voltage vector and select the switching state conducive to the neutral point potential balance of the capacitor on the DC side for output, so as to realize the voltage sharing control of the capacitor. Using the improved model prediction algorithm, the overall capacitor voltage is closer to 800 V, the neutral point potential fluctuation is smaller, and the harmonic current tracking effect is better. According to the diagram of the switch state flag, the rolling times are reduced from 27 to 7, which reduces the rolling optimization times. In conclusion, the control effect of the improved model prediction algorithm is significantly enhanced.

System Performance Simulation and Analysis
In practical applications, the operating conditions are often complex. A better compensation effect can be achieved only when the APF system has a good adaptability. Therefore, it is crucial to analyze the dynamic response capacity of the APF system. In order to study the dynamic performance of APF system based on improved model predictive control based on sector judgment, it is simulated and analyzed under different working conditions.

System Simulation Analysis under Sudden Load Change
Based on the simulation model presented in Section 4.2, a same nonlinear load is input at 0.2 s and cut off at 0.4 s. Figure 28 shows the three-phase power grid current waveforms when the load suddenly changes. At 0.2 s, the current amplitude suddenly increases due to the load increase, which results in large spikes. However, the APF system can quickly compensate it and then eliminate the spikes. Figure 29 shows the THD diagram of the A-phase current before load mutation, while Figure 30 presents the THD diagram of the A-phase after load mutation. It can be seen that the THD content is 3.41%, which is higher than 1.94%. However, it is still less than 5%, which indicates that the system has a good dynamic compensation performance. In this section, the two MPC algorithms are simulated. Compared with the traditional MPC, the improved model prediction algorithm can judge the output voltage vector and select the switching state conducive to the neutral point potential balance of the capacitor on the DC side for output, so as to realize the voltage sharing control of the capacitor. Using the improved model prediction algorithm, the overall capacitor voltage is closer to 800 V, the neutral point potential fluctuation is smaller, and the harmonic current tracking effect is better. According to the diagram of the switch state flag, the rolling times are reduced from 27 to 7, which reduces the rolling optimization times. In conclusion, the control effect of the improved model prediction algorithm is significantly enhanced.

System Performance Simulation and Analysis
In practical applications, the operating conditions are often complex. A better compensation effect can be achieved only when the APF system has a good adaptability. Therefore, it is crucial to analyze the dynamic response capacity of the APF system. In order to study the dynamic performance of APF system based on improved model predictive control based on sector judgment, it is simulated and analyzed under different working conditions.

System Simulation Analysis under Sudden Load Change
Based on the simulation model presented in Section 4.2, a same nonlinear load is input at 0.2 s and cut off at 0.4 s. Figure 28 shows the three-phase power grid current waveforms when the load suddenly changes. At 0.2 s, the current amplitude suddenly increases due to the load increase, which results in large spikes. However, the APF system can quickly compensate it and then eliminate the spikes. Figure 29 shows the THD diagram of the A-phase current before load mutation, while Figure 30 presents the THD diagram of the A-phase after load mutation. It can be seen that the THD content is 3.41%, which is higher than 1.94%. However, it is still less than 5%, which indicates that the system has a good dynamic compensation performance. Electronics 2022, 10, x FOR PEER REVIEW 19 of 28                  Compared with the simulation waveform of traditional MPC algorithm, the algorithm based on improved model predictive control has better control effect on DC side capacitor voltage and neutral point potential voltage, and it can better maintain the stability of the DC side voltage and reduce the voltage fluctuation range.

System Simulation Analysis under Unbalanced Load
This section studies the compensation effect of the APF under load imbalance, where a 10 Ω unbalanced resistance is connected to the A-phase circuit in order to simulate the system. Figure 35 shows the waveform diagram of the power grid current under unbalanced load. It can be seen that the current distortion is significant, the amplitude of the Bphase and C-phase current is high, the amplitude of the A-phase is low, and the power grid current is unbalanced. Figure 36 presents the THD diagram of the A-phase current before compensation, while Figures 37 and 38 show the waveform diagram of the threephase grid current and A-phase current THD diagram after compensation.   Compared with the simulation waveform of traditional MPC algorithm, the algorithm based on improved model predictive control has better control effect on DC side capacitor voltage and neutral point potential voltage, and it can better maintain the stability of the DC side voltage and reduce the voltage fluctuation range.

System Simulation Analysis under Unbalanced Load
This section studies the compensation effect of the APF under load imbalance, where a 10 Ω unbalanced resistance is connected to the A-phase circuit in order to simulate the system. Figure 35 shows the waveform diagram of the power grid current under unbalanced load. It can be seen that the current distortion is significant, the amplitude of the Bphase and C-phase current is high, the amplitude of the A-phase is low, and the power grid current is unbalanced. Figure 36 presents the THD diagram of the A-phase current before compensation, while Figures 37 and 38 show the waveform diagram of the threephase grid current and A-phase current THD diagram after compensation.   Compared with the simulation waveform of traditional MPC algorithm, the algorithm based on improved model predictive control has better control effect on DC side capacitor voltage and neutral point potential voltage, and it can better maintain the stability of the DC side voltage and reduce the voltage fluctuation range.

System Simulation Analysis under Unbalanced Load
This section studies the compensation effect of the APF under load imbalance, where a 10 Ω unbalanced resistance is connected to the A-phase circuit in order to simulate the system. Figure 35 shows the waveform diagram of the power grid current under unbalanced load. It can be seen that the current distortion is significant, the amplitude of the Bphase and C-phase current is high, the amplitude of the A-phase is low, and the power grid current is unbalanced. Figure 36 presents the THD diagram of the A-phase current before compensation, while Figures 37 and 38 show the waveform diagram of the threephase grid current and A-phase current THD diagram after compensation. Compared with the simulation waveform of traditional MPC algorithm, the algorithm based on improved model predictive control has better control effect on DC side capacitor voltage and neutral point potential voltage, and it can better maintain the stability of the DC side voltage and reduce the voltage fluctuation range.

System Simulation Analysis under Unbalanced Load
This section studies the compensation effect of the APF under load imbalance, where a 10 Ω unbalanced resistance is connected to the A-phase circuit in order to simulate the system. Figure 35 shows the waveform diagram of the power grid current under unbalanced load. It can be seen that the current distortion is significant, the amplitude of the B-phase and C-phase current is high, the amplitude of the A-phase is low, and the power grid current is unbalanced. Figure 36 presents the THD diagram of the A-phase current before compensation, while Figures 37 and 38 show the waveform diagram of the three-phase grid current and A-phase current THD diagram after compensation.
As can be seen from Figures 36 and 38 that under the action of the improved MPC control algorithm based on sector judgment, the grid current THD after compensation is reduced from 27.54% to 2.19%, performing an excellent compensation effect. It can be seen from Figure 37 that the APF system can make up the unbalanced three-phase current into a balanced state and it has a strong ability to suppress the three-phase imbalance. Electronics 2022, 10, x FOR PEER REVIEW 21 of 28    As can be seen from Figures 36 and 38 that under the action of the improved MPC control algorithm based on sector judgment, the grid current THD after compensation is reduced from 27.54% to 2.19%, performing an excellent compensation effect. It can be seen from Figure 37 that the APF system can make up the unbalanced three-phase current into a balanced state and it has a strong ability to suppress the three-phase imbalance.

Experiment and Result Analysis
Based on the simulation, the following experiments are performed in order to verify the feasibility and correctness of the proposed control algorithm in the APF system. The experimental parameters are shown in Table 6.    As can be seen from Figures 36 and 38 that under the action of the improved MPC control algorithm based on sector judgment, the grid current THD after compensation is reduced from 27.54% to 2.19%, performing an excellent compensation effect. It can be seen from Figure 37 that the APF system can make up the unbalanced three-phase current into a balanced state and it has a strong ability to suppress the three-phase imbalance.

Experiment and Result Analysis
Based on the simulation, the following experiments are performed in order to verify the feasibility and correctness of the proposed control algorithm in the APF system. The experimental parameters are shown in Table 6.    As can be seen from Figures 36 and 38 that under the action of the improved MPC control algorithm based on sector judgment, the grid current THD after compensation is reduced from 27.54% to 2.19%, performing an excellent compensation effect. It can be seen from Figure 37 that the APF system can make up the unbalanced three-phase current into a balanced state and it has a strong ability to suppress the three-phase imbalance.

Experiment and Result Analysis
Based on the simulation, the following experiments are performed in order to verify the feasibility and correctness of the proposed control algorithm in the APF system. The experimental parameters are shown in Table 6.    As can be seen from Figures 36 and 38 that under the action of the improved MPC control algorithm based on sector judgment, the grid current THD after compensation is reduced from 27.54% to 2.19%, performing an excellent compensation effect. It can be seen from Figure 37 that the APF system can make up the unbalanced three-phase current into a balanced state and it has a strong ability to suppress the three-phase imbalance.

Experiment and Result Analysis
Based on the simulation, the following experiments are performed in order to verify the feasibility and correctness of the proposed control algorithm in the APF system. The experimental parameters are shown in Table 6.

Experiment and Result Analysis
Based on the simulation, the following experiments are performed in order to verify the feasibility and correctness of the proposed control algorithm in the APF system. The experimental parameters are shown in Table 6. According to these system parameters, an experimental platform is built. It mainly includes a topology unit, main control unit, sampling unit, and driving unit. The topology unit is composed of a NPC three-level topology and a filter inductance. The main control unit is composed of DSP and FPGA to complete the data operation and drive the signal output, respectively. The sampling unit is mainly responsible for sampling grid voltage and current, DC side capacitor voltage and APF system output current. The driving unit is responsible for amplifying the PWM wave output by the controller in order to drive the power switching devices. The experimental system platform is shown in Figure 39. Table 6. Key parameters of the system.

System Parameter Parameter Value
Voltage of capacitor C 1 , C 2 400 V The capacitor C 1 , C 2 1000 µF The sampling frequency f s 20 kHz The grid frequency f 50 Hz The inductor L A , L B , L C 10 mH The balanced grid phase voltages U A , U B , U C 220 V The balanced resistance load R 40 Ω The unbalanced resistance load R 20 Ω 20 Ω According to these system parameters, an experimental platform is built. It mainly includes a topology unit, main control unit, sampling unit, and driving unit. The topology unit is composed of a NPC three-level topology and a filter inductance. The main control unit is composed of DSP and FPGA to complete the data operation and drive the signal output, respectively. The sampling unit is mainly responsible for sampling grid voltage and current, DC side capacitor voltage and APF system output current. The driving unit is responsible for amplifying the PWM wave output by the controller in order to drive the power switching devices. The experimental system platform is shown in Figure 39.

DC Capacitor Voltage Waveform
The waveform of the capacitor voltage is presented in Figure 40. The APF device detects the change of capacitor voltage by the Hall voltage sensor. The experimental waveform shows that the DC side voltage is stable at 800 V during operation. The results show that the capacitor voltage can remain stable with a small fluctuation, which meets the requirements of voltage stability. Therefore, the correctness of the proposed voltage stabilizing algorithm is proved.

DC Capacitor Voltage Waveform
The waveform of the capacitor voltage is presented in Figure 40. The APF device detects the change of capacitor voltage by the Hall voltage sensor. The experimental waveform shows that the DC side voltage is stable at 800 V during operation. The results show that the capacitor voltage can remain stable with a small fluctuation, which meets the requirements of voltage stability. Therefore, the correctness of the proposed voltage stabilizing algorithm is proved.

Harmonic Current Extraction and Tracking Waveform
Figure 41 channel A shows the harmonic current waveform in the A-phase load current, while Figure 41 channel B presents the compensation current waveform by the APF system. The diagram shows that the harmonic current wave is coherent with the simulation waveform. The variation trend of the harmonic current and output current is mainly the same, which indicates that the system can better perform the extraction and tracking of harmonic current. This demonstrates that the proposed improved MPC algorithm has a high current tracking performance.  Figure 41 channel A shows the harmonic current waveform in the A-phase load current, while Figure 41 channel B presents the compensation current waveform by the APF system. The diagram shows that the harmonic current wave is coherent with the simulation waveform. The variation trend of the harmonic current and output current is mainly the same, which indicates that the system can better perform the extraction and tracking of harmonic current. This demonstrates that the proposed improved MPC algorithm has a high current tracking performance. Figure 40. Waveforms of capacitance voltage at DC side. Figure 41 channel A shows the harmonic current waveform in the A-phase load current, while Figure 41 channel B presents the compensation current waveform by the APF system. The diagram shows that the harmonic current wave is coherent with the simulation waveform. The variation trend of the harmonic current and output current is mainly the same, which indicates that the system can better perform the extraction and tracking of harmonic current. This demonstrates that the proposed improved MPC algorithm has a high current tracking performance.

Algorithm Time-Consuming Comparison
In the experiment, mark points are set at the beginning and end of the algorithm program, and the running time of the algorithm program segment is obtained by the timer, so as to compare the time consumption between the traditional MPC and the proposed improved MPC.
The program running time measured by this method when using the traditional MPC algorithm for compensation is 59.2 μs, while the running time of the MPC algorithm program section is 39 μs, as shown in Figure 42. When the improved MPC strategy is used for harmonic compensation, the running time of the whole program is 38.4 μs. Figure 43 shows that the running time of the improved MPC algorithm is 18 μs.

Algorithm Time-Consuming Comparison
In the experiment, mark points are set at the beginning and end of the algorithm program, and the running time of the algorithm program segment is obtained by the timer, so as to compare the time consumption between the traditional MPC and the proposed improved MPC.
The program running time measured by this method when using the traditional MPC algorithm for compensation is 59.2 µs, while the running time of the MPC algorithm program section is 39 µs, as shown in Figure 42. When the improved MPC strategy is used for harmonic compensation, the running time of the whole program is 38.4 µs. Figure 43 shows that the running time of the improved MPC algorithm is 18 µs.  The traditional algorithm requires 27 comparison operations when selecting the optimal vector each time, while the improved MPC algorithm only requires 7 comparison operations. Therefore, the running time of the MPC algorithm in Figure 43 is shorter than that in Figure 42.  The traditional algorithm requires 27 comparison operations when selecting the optimal vector each time, while the improved MPC algorithm only requires 7 comparison operations. Therefore, the running time of the MPC algorithm in Figure 43 is shorter than that in Figure 42.  Figure 43 is shorter than that in Figure 42.

Experiment of Power Grid Balance and Load Balance
The three-phase gird voltages U A , U B , and U C are 220 V, 220 V, and 220 V, respectively. The resistance is 40 Ω after three-phase rectification. Figure 44a is the waveform of three-phase grid current before compensation, and Figure 44b is the FFT analysis diagram of A-phase current before compensation. Because the load contains nonlinear devices, the grid current is seriously distorted and the sinusoidal degree is low. Taking A-phase as an example, the THD of A-phase grid current is 24.86%, which reduces the power quality of the grid. The traditional algorithm requires 27 comparison operations when selecting the optimal vector each time, while the improved MPC algorithm only requires 7 comparison operations. Therefore, the running time of the MPC algorithm in Figure 43 is shorter than that in Figure 42.

Experiment of Power Grid Balance and Load Balance
The three-phase gird voltages , , and are 220 V, 220 V, and 220 V, respectively. The resistance is 40 Ω after three-phase rectification. Figure 44a is the waveform of three-phase grid current before compensation, and Figure 44b is the FFT analysis diagram of A-phase current before compensation. Because the load contains nonlinear devices, the grid current is seriously distorted and the sinusoidal degree is low. Taking A-phase as an example, the THD of A-phase grid current is 24.86%, which reduces the power quality of the grid.  Figure 45a shows the current waveform after system compensation using the proposed improved algorithm. The FFT analysis of the A-phase current is shown in Figure   Figure 44. Experimental waveform before compensation: (a) three-phase grid current and (b) A-phase current THD. Figure 45a shows the current waveform after system compensation using the proposed improved algorithm. The FFT analysis of the A-phase current is shown in Figure 45b. It can be seen that the compensated current recovers the sinusoidal shape, and the sinusoidal degree is satisfactory. In the latter, the THD of the A-phase current is 2.86%, which improves the power quality. The experimental waveform is similar to the simulation results. The compensation effect is mainly coherent with the simulation results, and the compensation effect is clear. When the power grid and load are balanced, the system dynamic compensation performance is high, which verifies the efficiency of the single objective function improved model predictive control algorithm. 45b. It can be seen that the compensated current recovers the sinusoidal shape, and the sinusoidal degree is satisfactory. In the latter, the THD of the A-phase current is 2.86%, which improves the power quality. The experimental waveform is similar to the simulation results. The compensation effect is mainly coherent with the simulation results, and the compensation effect is clear. When the power grid and load are balanced, the system dynamic compensation performance is high, which verifies the efficiency of the single objective function improved model predictive control algorithm.  Figure 46a shows the waveform of the three-phase power grid when the system is connected to unbalanced load. It can be seen that the three-phase power grid is asymmetric, and the current amplitudes are not equal. It can be observed from Figure 46b that the current THD of A-phase power grid is 28.32%.  Figure 46a shows the waveform of the three-phase power grid when the system is connected to unbalanced load. It can be seen that the three-phase power grid is asymmetric, and the current amplitudes are not equal. It can be observed from Figure 46b that the current THD of A-phase power grid is 28.32%.  Figure 46a shows the waveform of the three-phase power grid when the system is connected to unbalanced load. It can be seen that the three-phase power grid is asymmetric, and the current amplitudes are not equal. It can be observed from Figure 46b that the current THD of A-phase power grid is 28.32%.

Experiment of Power Grid Balance and Load Imbalance
(a) (b) Figure 46. Experimental waveform before compensation when load is unbalanced: (a) three-phase grid current abd (b) A-phase current THD. Figure 47a presents the current waveform after compensation. It can be seen that the distorted and asymmetric power grid current waveform is compensated into a threephase symmetrical sinusoidal shape. The A-phase current is analyzed by the FFT (cf. Figure 47b)), the THD is 3.80%, which is close to the simulation results. Using the improved MPC strategy, the system compensates the harmonic current, and, also, restrains the three-phase imbalance.  Figure 47a presents the current waveform after compensation. It can be seen that the distorted and asymmetric power grid current waveform is compensated into a three-phase symmetrical sinusoidal shape. The A-phase current is analyzed by the FFT (cf. Figure 47b), the THD is 3.80%, which is close to the simulation results. Using the improved MPC strategy, the system compensates the harmonic current, and, also, restrains the three-phase imbalance.  Figure 48a shows the waveform of the three-phase power grid after compensation in case of sudden load change. It can be observed that the current suddenly increases due to the load increase. A FFT analysis is conducted on the A-phase current of power grid after sudden change, (cf. Figure 48b)), It can be seen that the THD is 4.48%, which still meets the national standard. This indicates that although the load current significantly changes in case of sudden load change, the APF system based on the single objective function improved MPC algorithm can still quickly respond, and perform the rapid tracking of sudden harmonic current with a high dynamic performance.

Conclusions
This paper tackles the NPC three-level active power filter and deeply studies the principle and shortcomings of the traditional MPC algorithm, in order to develop a novel model predictive control current tracking algorithm. Dealing with the problems of many rolling times, high computational load, and difficulty to adjust the weight factor of the multi-objective function, an improved MPC algorithm of single objective function based  Figure 48a shows the waveform of the three-phase power grid after compensation in case of sudden load change. It can be observed that the current suddenly increases due to the load increase. A FFT analysis is conducted on the A-phase current of power grid after sudden change, (cf. Figure 48b), It can be seen that the THD is 4.48%, which still meets the national standard. This indicates that although the load current significantly changes in case of sudden load change, the APF system based on the single objective function improved MPC algorithm can still quickly respond, and perform the rapid tracking of sudden harmonic current with a high dynamic performance.  Figure 48a shows the waveform of the three-phase power grid after compensation in case of sudden load change. It can be observed that the current suddenly increases due to the load increase. A FFT analysis is conducted on the A-phase current of power grid after sudden change, (cf. Figure 48b)), It can be seen that the THD is 4.48%, which still meets the national standard. This indicates that although the load current significantly changes in case of sudden load change, the APF system based on the single objective function improved MPC algorithm can still quickly respond, and perform the rapid tracking of sudden harmonic current with a high dynamic performance.

Conclusions
This paper tackles the NPC three-level active power filter and deeply studies the principle and shortcomings of the traditional MPC algorithm, in order to develop a novel model predictive control current tracking algorithm. Dealing with the problems of many rolling times, high computational load, and difficulty to adjust the weight factor of the

Conclusions
This paper tackles the NPC three-level active power filter and deeply studies the principle and shortcomings of the traditional MPC algorithm, in order to develop a novel model predictive control current tracking algorithm. Dealing with the problems of many rolling times, high computational load, and difficulty to adjust the weight factor of the multi-objective function, an improved MPC algorithm of single objective function based on sector judgment, is proposed. The sector judgment concept is introduced into the model predictive control. By judging the mathematical relationship between the three lines and the voltage reference vector, the location of the area where the reference vector is located is determined, and the number of rolling optimizations is reduced from 27 to 8. After removing the redundant small vector, the rolling number can be reduced to 7, which reduces the complexity of the algorithm and the computational load. The current tracking error, neutral point potential fluctuation on DC side, compensation effect and rolling times of the two MPC algorithms, are compared by simulations and engineering implementations. The obtained results demonstrate that the proposed single objective function improved MPC algorithm based on sector judgment, has a better current tracking effect and voltage stabilizing effect. In addition, it has a good dynamic response ability and compensation performance, which proved that the proposed algorithm is feasible and efficient.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.

Conflicts of Interest:
The authors declare no conflict of interest.