#### Abstract

Photovoltaic (PV) power generation is the main aspect of new energy power generation, and it is an important means to achieve the goal of carbon neutrality. When the PV system is connected to the grid, the nonlinear load of the grid will affect the power quality and consume reactive power. This paper proposes a PV power generation grid-connected system to improve power quality, with an active power filter (APF) function. Through the maximum power point tracking (MPPT) method, PV power generation can operate at the maximum power point and play the function of harmonic and reactive power compensation at the load side. To improve the dynamic performance of the grid-connected PV system and harmonic compensation simultaneously, multistep finite control set model predictive control (FCS-MPC) is adopted for the grid-connected module. The whole system does not need additional equipment, as it plays the role of two devices and effectively reduces the input cost. In this paper, the proposed structure and multistep FCS-MPC are verified in MATLAB/Simulink. The results show that the system injects the maximum power into the power grid at the same time when the load changes and compensates the harmonic generated by the nonlinear load of the power grid so that the total harmonic distortion of the power grid can meet the operation standard, and the system has good dynamic performance and steady-state performance.

#### 1. Introduction

Renewable energy power generation is the primary means to solve the global environmental problems and energy crisis. It includes photovoltaic (PV) power generation, wind power generation, biological power generation, and other new energy power generation methods, which are the inevitable trend of grid-connected power generation [1, 2]. Photovoltaic power generation is becoming more popular because of its convenience, strong reliability, and low use conditions, which can meet the needs of large power grids and ordinary residents. Because of the randomness of photovoltaic power generation system, [3] realizes machine learning to accurately predict the photovoltaic power generation, which ensures the stable operation of power grid. In previous work [4], a support vector machine (GASVM) model based on genetic algorithm is proposed. SVM classifier is used to optimize the historical weather data, which improves the accuracy of prediction. The direct current generated by the PV power generation array is controlled by MPPT to keep the maximum power output, and then the PV grid-connected system supplies the direct current to the grid or load through the inverter [1, 5–8]. Due to the characteristics of converters and the existence of many nonlinear loads in the grid, harmonic pollution is inevitable in the grid-connected system. In this paper, a method of the grid-connected PV power generation and harmonic compensation is proposed. Through the control of the inverter, the active power of the grid is guaranteed, and the power quality is improved [9, 10].

General PV devices meet the needs of the home and industry, and all kinds of loads will inevitably flow harmonics into the grid, which will reduce the power quality of the grid and affect the safe operation of the grid. At present, the main ways of harmonic control include improving the converter topology [11, 12], reducing the generation of harmonics from the harmonic source, and using an active power filter (APF), static var generator, unified power quality conditioner, and other devices to supplement. APF is widely used because it can compensate for reactive power and harmonic current simultaneously [13–15]. However, adding an APF to a grid-connected PV system requires additional costs, increasing the cost of PV utilization. Therefore, it is crucial to find a way to achieve grid connection and improve power quality simultaneously without adding other equipment. This idea was initiated in 1996 by Kim et al. [16]. The structure put forward at that time needed energy storage components, which will increase the cost. Based on the control technology at that time, the development of this technology was limited to a certain extent. However, with the development of control technology and the progress of microprocessor performance, this method began to develop in recent years. Previous work [17] proposes a photovoltaic-active power filter (PV-APF) system used in utility side. It uses fuzzy logic controller to reduce the harmonic content of photovoltaic system, but this control method does not have good dynamic performance.

Concerning the problems that existed in the control method of finite control set model predictive control (FCS-MPC), many scholars in related fields have proposed different methods [11]. Studies [18] have considered an MPC method with time-delay compensation. The reference current is predicted by Lagrange interpolation. In the future, multiple prediction periods will be calculated. Due to the irregular and rapid variation of harmonics, the prediction corresponding to the predicted reference value has a large error at the change. Previous work [19] has pointed out that FCS-MPC was applied to an APF to compensate for the harmonic current and reactive power.

In recent research, a nonlinear control system based on the Lyapunov stability theory is designed for a three-level NPC inverter in [20], which ensures the grid connection of a PV system and the improvement of power quality. The new system consists of a DC and bus voltage controller, a capacitor voltage controller, and an AC side controller. The instantaneous reactive power theory is used to extract harmonics. This controller’s design is computationally complex and depends on the precise mathematical model. In [21], a grid-connected PV system used as a passive power filter is studied, and the direct power control method is applied to this kind of system. When the harmonic compensation is carried out, the reference value changes rapidly, and the dynamic response of the proposed control method is slow, which affects the compensation effect in some cases. In [22], an indirect current control strategy is proposed. In the current loop control, the hysteresis controller is used to gate and extract the signal. This control method has low precision.

In this paper, a strategy of joint use of a PV system and APF is proposed. First, the harmonic and reactive power of the microgrid load current of distributed PV system nodes is detected by the instantaneous reactive power method (*i*_{p}–*i*_{q}) as part of the command current, and the other part of the command current is the reference current of the grid-connected inverter. In this paper, the multistep FCS-MPC is used to reduce the error caused by the prediction delay of the system. The grid-connected system of the PV system combined with an APF is studied, which improves the utilization rate of light energy, improves the power quality of the power grid system, and reduces the cost of the PV power generation system.

#### 2. PV System Combined with APF System (PV + APF)

The PV + APF system proposed in this paper is shown in Figure 1. The DC generated by the PV system passes through MPPT and the DC/DC plant to make it work at the maximum power point. Stable DC voltage is generated by the PV system and connected to the power grid through a three-phase inverter. For the current inner loop, a multistep FCS-MPC algorithm is used to control the PV + APF system to realize system functions [14, 19].

##### 2.1. Mathematical Model of the PV + APF System

For the PV grid-connected inverter part, assuming the voltage balance of a three-phase power grid, according to Kirchhoff voltage law, the following can be obtained:

In equation (1), the output voltage of the inverter is *u*_{an} = *u*_{aN}−*u*_{nN}, PCC is the common node, *L* is the filter inductor, and *R* is the equivalent resistance of the line and the filter inductor. *i*_{a}, *i*_{b}, and *i*_{c} are the three-phase grid current, and *e*_{a}, *e*_{b}, and *e*_{c} are the grid voltage. From equation (1), the three-phase voltage, current, and inverter output can be written in the vector form.wherewhere **u** is the output voltage vector of the inverter, **i** is the grid current vector, and **e** is the grid voltage vector.

##### 2.2. MPPT

In this paper, the variable compensation disturbance observation method is used to realize the maximum power point tracking of PV power generation. This method can obtain the maximum power point voltage reference value of PV cells under certain external environments. The difference between the reference value and the actual output of PV cells is used as part of the reference value of the grid-connected active current after passing through the PI controller.where *u*_{ref} is the working voltage corresponding to the maximum power point under the disturbance observation method, *u*_{dc} is the DC voltage, and *k*_{p} and *k*_{i} are the proportional and integral coefficients of the DC side voltage controller.

In this paper, variable step maximum power tracking is adopted, and the threshold values of power variation and voltage variation are introduced to make the voltage disturbance zero when the system tracks near the maximum power point to ensure that the system has no oscillation in steady-state operation. When the external environment changes, a larger compensation disturbance is adopted to accelerate the dynamic response of the system. The flowchart of the variable step disturbance observation method is shown in Figure 2, and the reference value of the DC bus voltage in each sampling period is shown in the following equation:

When *λ* is fixed, and the actual working condition is far from the maximum power point, the voltage disturbance step becomes larger. When it is close to the maximum power point, the disturbance step decreases. When d*P* and d*u* reach the set threshold, the disturbance step is zero; that is, there is no power fluctuation in the steady state.

#### 3. Calculation of Reference Current

##### 3.1. Calculation of Harmonic Reference Current

Since the theory of instantaneous reactive power of a three-phase circuit was put forward in the 1980s, it has been successfully applied in many aspects. Based on this theory, the real-time detection method of harmonic and reactive current for APF can be obtained. This paper uses *i*_{p}-*i*_{q} method based on instantaneous reactive power theory as shown in Figure 3 [23].

In the figure,

This method needs to use sine signal sin*ωt* and cosine signal cos*ωt* which are in phase with *A*-phase grid voltage *e*_{a}. They are obtained by phase locked loop (PLL) and sine-cosine signal-generating circuit.

##### 3.2. Calculation of Grid-Connected Reference Current

The maximum power point voltage reference value of PV cells in a certain external environment can be obtained using the variable step disturbance observation method. The difference between the reference value and the actual output value of PV cells passes through the PI controller, which is a part of the given value of the grid-connected active current, and the amplitude of this part of the command current is zero in the *d−q* coordinate system.where *u*_{ref} is the reference voltage of the grid-connected inverter on the DC side, *u*_{dc} is the current voltage of the grid-connected inverter on the DC side, and *k*_{p} and *k*_{i} are the proportional coefficient and integral coefficient of PI controller.

#### 4. Predictive Control of the Inverter System

To compensate for the power grid harmonic pollution caused by the nonlinear load, the control schematic diagram is shown in Figure 4. The PV + APF system proposed in this paper uses light as the inverter and compensates for harmonics. At night or in the absence of light, it is used as an APF to compensate for the harmonics of the power grid. This paper does not discuss its use as an APF alone [24].

##### 4.1. Model of Predictive Control

Equation (2) is the dynamic current equation of grid connection, which can be transformed into an *α-β* coordinate system to obtain

Equation (8) performs differential discretization to obtain

*T*_{s} is the sampling period, which can be obtained from equation (9).

In equation (10), *u*_{α} and *u*_{β} are the output of the converter. In the three-phase two-level inverter structure, as shown in Figure 5, there are eight groups of vectors.

##### 4.2. FCS-MPC

The FCS-MPC of the current will have an error in the sinusoidal signal tracking, and the higher the frequency, the greater the error. Therefore, it is convenient and intuitive for the APF to track the reference predictive signal in an *α-β* coordinate system after the output of the predictive model. As shown in Figure 6, in the *α-β* coordinate system, *V*_{x} is eight voltage vectors and *J*_{min} is the voltage vector with the smallest objective function. Taking the tracking principle of an FCS-MPC algorithm at a certain sampling time, the objective function is calculated by synthesizing the switching frequency and tracking error, and the optimal target is derived to obtain the combined state of the switching signal and directly control the APF output.

##### 4.3. The Establishment of Objective Function

In the third section, the *i*_{p}-*i*_{q} method based on the instantaneous reactive power theory is used to detect the harmonics generated by the nonlinear load, which are *i*_{ah}, *i*_{bh}, and *i*_{ch}, and the reference current of the grid-connected inverter is and . In order to reduce the tracking error, the detected harmonics are transformed into an *α-β* coordinate system:

In the harmonic detection, there is a delay from the PLL to the harmonic reference current; that is, the output of the APF follows the reference current of the previous time. When establishing the objective function, the following current is the predicted value of the next time. In this process, the delay will produce certain errors. In this paper, to reduce the delay caused by the detection link, the Lagrange interpolation prediction method is used to predict the reference current. Equation (11) is the reference current value at the next time after interpolation. In order to reduce the amount of calculation, this paper uses the second-order interpolation prediction; that is, *n* = 2.

Through equations (9), (12), and (13), the objective function can be established:

In equation (14), the first two terms are the tracking of the predicted current to the harmonic reference current in the *α-β* coordinate system. *h*_{lim}(*i*) imposes the current constraint, while *s*^{2}(*i*) penalizes the switching effort which can be controlled by the associated weighting factor . Their terms are defined as follows:

For the three-phase two-level inverter, there are seven possible different switching vectors, which can be substituted into equation (10) to obtain the predicted value of the next time, and then the objective function *J* corresponding to the vector can be obtained. At each sampling point, all the vectors are cycled to obtain the switch vector that makes *J* minimum. This switch vector is the optimal vector. The optimal output can be obtained by using the switch combination corresponding to the optimal vector to control the inverter.

##### 4.4. Multistep FCS-MPC

The single-step FCS-MPC can select the optimal switch combination in a sampling period, but the optimal switch combination at the current sampling time has some conservation problems because it is only the optimal solution at *k* + 1 time. The processor has a certain delay in the actual process, and the optimal solution at the current time cannot be obtained for two or more cycles. Even though the calculation of the single-step prediction is low, and the structure is simple, the optimal situation at time stamp *k* + 2 and *k* + 3 is not considered. This method ignores the optimal control information that the suboptimal switch may contain; that is, the suboptimal switch at the current time may be beneficial to the selection of the optimal vector at the next time. In the case of measurement error or parameter mismatch, the conservatism of one-step prediction will affect the control effect. In the subsequent several cycles, eight switch vectors cannot select the appropriate state. This problem will make the inverter output unable to follow the reference value, thus making the control result more erroneous [25].

To solve the conservatism problem of one-step prediction, a multistep prediction method is proposed in this paper. The inverter output is also predicted in the next cycle. The multistep FCS-MPC combines the optimal state and suboptimal state at the current moment as the candidate vector to obtain the optimal state at the next moment to determine the switch combination that needs to act on the inverter. If the Euler forward difference is continued for equation (10), the following equation can be obtained:

In equation (16), *i*_{α}(*k* + 1) and *i*_{β}(*k* + 1) are the predicted currents in the *α-β* coordinate system at time *k* + 1; *e*_{α}(*k* + 1) and *e*_{β}(*k* + 1) are the grid currents at time *k* + 1, and *e*(*k* + 1) = *e*(*k*) in a very small sampling period; *u*_{α}(*k* + 1) and *u*_{β}(*k* + 1) are the outputs of the inverter, which are obtained by cycling all switch vectors in the multistep prediction method.

In Section 4.2, the optimal vector and the suboptimal vector can be obtained. Substituting them into equation (9), the corresponding optimal predictive current (*k* + 1) and suboptimal predictive current (*k* + 1) can be obtained. Substituting them into equation (16), all the switching vectors are cycled again and the switching vector of the first step is selected under the minimum objective function of the second step to control the inverter through the objective function of the following equation:where

The control algorithm of multistep FCS-MPC in each sampling period is shown in Figure 7.

The principle is as follows:(a)At time *k*, according to the current value, the reference current at the next time is obtained by Lagrange interpolation.(b)The objective function is constructed, eight groups of switch combinations are cycled, and the switch combinations which make the objective function minimum and the second smallest are selected. The two groups of switch states which make the objective function minimum are calculated. The optimal current prediction values (*k* + 1) and (*k* + 1) are obtained, and the corresponding switching states are recorded.(c)Using the two groups of predicted values corresponding to the objective function at *k* + 1 obtained in the second part, 8 groups of vectors are recycled again to display the switch state corresponding to the minimum objective function at *k* + 2. The same method is also applied to the current prediction equation (16) to obtain two objective functions at *k* + 2.(d)The objective function at time *k* + 1 and the smaller one at time *k* + 2 is selected as the final prediction results, and the corresponding switch state at time *k* + 1 is taken as the application state at time *k* + 1 and applied to the APF.

From the above analysis, the advantage of the multistep FCS-MPC proposed in this paper over the traditional model prediction algorithm is that it seeks the optimal solution at the current time and in the subsequent multiple cycles by solving the objective function through multiple rolling optimization algorithms to solve the conservative problem of the traditional algorithm. Due to the increase of computation, the processor’s performance is sacrificed in exchange for the optimal switch combination. The better the processor performance, the more obvious the control performance.

#### 5. Simulation and Results Analysis

To verify the harmonic compensation effect of multistep FCS-MPC on the PV + APF system control, the simulation model as shown in Figure 1 is built in MATLAB/Simulink Toolbox, and the parameters of this paper are shown in Table 1. In this paper, the PV power generation module and inverter grid and harmonic compensation need to be controlled, and the nonlinear load need to be set as an uncontrollable diode rectifier bridge. To verify the dynamic performance of the control method, the illumination intensity changes from 700 W/m^{2} to 1000 W/m^{2} in 1.5 s; the reference voltage changes from 550 V to 800 V in 0.25 s; the setting load fluctuates in 0.35 s; and the load changes from 5 Ω to 2.5 Ω.

In this paper, multistep FCS-MPC is used to compare the performance of traditional PV and PV + APF systems in the presence of harmonics. The simulation results are as follows. Figure 8 shows the three-phase harmonics detected by the instantaneous reactive power method. When the load changes, the harmonic content also changes.

As shown in Figure 9, under the condition of light and load fluctuation, the performance of the two systems is the same, and the current of the power grid is distorted, which affects the safe operation of the power grid. After 0.35 s load fluctuation, the load current value also changes.

**(a)**

**(b)**

As shown in Figure 10, when the light intensity changes, the grid current changes slightly; when the DC side voltage changes from 550 V to 800 V, the grid current is increased; and when the load value changes, the grid current fluctuates. In the case of harmonic pollution in the power grid, the current waveform of the grid-connected inverter after power injection is distorted, and the current waveform of the PV + APF system for harmonic control is close to the sine wave. It can be concluded that the method proposed in this paper effectively improves the power quality.

**(a)**

**(b)**

As shown in Figure 11, the total harmonic distortion (THD) dynamic change diagram of the grid-connected current shows the grid distortion rate of the system under various parameter changes. (a) PV grid-connected system without an APF: when THD is 0.61% in the whole process, it is not high. Due to the characteristics of the nonlinear load selected in this paper, the 5th, 7th, 11th, and 13th harmonics are dominant in the power grid. (b) PV + APF system performance: it is found that its THD is lower than that of (a). After treatment, THD is 4.8% in 0.2 S, and the distribution of the harmonic number is decentralized. It can also be found from Figure 11 that THD will fluctuate when the light intensity changes and the DC side reference current changes. After reaching stability, THD will also stabilize.

**(a)**

**(b)**

Figure 12 shows the DC side voltage changes of the two systems. (a) PV grid-connected system without an APF: due to the advantages of FCS-MPC, the DC side voltage value can quickly follow the reference value and recover after fluctuation. (b) PV + APF system: harmonic control is carried out while grid connected. When the load fluctuates in 3.5 s, the harmonic reference also fluctuates, making the DC side voltage fluctuate.

**(a)**

**(b)**

Figure 13 shows the output power of the PV system. When the illumination and DC side reference change, the output power will change accordingly (Figure 13(a)). When the load changes, its output power will not be affected. When the load changes, the harmonic content needs to be compensated, and the output power needs to be consumed to achieve the two-terminal power balance (Figure 13(b)). Hence, the fluctuation occurs at 0.35 s, but the balance is quickly achieved under the FCS-MPC algorithm.

**(a)**

**(b)**

#### 6. Conclusions

In this paper, a multistep FCS-MPC PV control system combined with an APF is proposed. The system uses solar energy resources, improves power quality simultaneously, and solves the problem of power quality decline caused by the grid-connected systems and loads. It has broad application prospects in the future microgrid system. The scheme proposed in this paper has the following advantages:(a)From the experimental results, this combined system has little impact on the whole grid when PV power is injected into the grid(b)Using multistep FCS-MPC, the system has good dynamic performance and steady-state performance(c)The combination of an APF with a PV system effectively reduces the power grid’s THD and improves the power grid’s power quality(d)The whole system does not need additional equipment, as it plays the role of two devices and effectively reduces the input cost.(e)It has broad prospects in the application of clean energy

#### Data Availability

No data were used to support this study.

#### Conflicts of Interest

The authors declare no conflicts of interest.

#### Authors’ Contributions

R.Z. contributed to conceptualization and formal analysis and was responsible for resources and supervision; S.H. investigated the study, validated the data, prepared the original draft, and reviewed and edited the manuscript. All authors have read and agreed to the published version of the manuscript.

#### Acknowledgments

This project was supported by Natural Science Foundation of Tibet Autonomous Region (XZ202001ZR0093G) and Key Laboratory of Higher Education of Tibet Autonomous Region: Electrical Engineering Laboratory Support Project (2020D-ZN-01).