Discrete-Time Optimal Control of Photovoltaic Grid-Connected Inverter Based on Particle Swarm Optimization

This paper is concerned with the problem of optimal control of photovoltaic grid-connected inverter. Firstly, the discretetime nonlinear mathematical model of single-phase photovoltaic grid-connected inverter in the rotating coordinate system is constructed by the Delta operator, which simplifies the control process and facilitates direct digital realization. Then, a novel optimal control method which is significant to achieve trajectory tracking for photovoltaic grid-connected inverter is developed by constructing a control Lyapunov functional against the difficulty of solving HJB (Hamilton-Jacobi-Bellman) partial differential equations. More importantly, the performance matrix of the controller which is very meaningful to many performance indicators of the system is also optimized via the particle swarm optimization. Finally, two numerical examples are provided to illustrate the effectiveness of the proposed method.


Introduction
Energy is the basic material for survival and development of human, and it is also the blood of the world economy.Along with the development of society and economy and the improving of living standards, the demand for energy is increasingly urgent.In expected future, more than 60% of the worldwide energy will be indirectly consumed by conversion into electrical energy and thus it is urgent to take advantage of the new decentralized energy generation to meet the increasing demand for electricity [1,2].Considering many factors of the energy supply, solar energy is undoubtedly the ideal of sustainable development and green energy.Figure 1 shows a typical single-phase photovoltaic grid-connected system.The control of the system is composed by the boost chopper circuit and single-phase inverter.Boost chopper circuit is mainly to ensure photovoltaic modules running in MPPT (maximum power point tracking) point [3][4][5][6][7].
In order to ensure control accuracy and obtain highquality sine wave of the inverter output current which has the same frequency and phase with the grid voltage, experts and scholars have put forward many methods, such as the traditional PID control, dual-loop control, and hysteresis control.And repetitive control, proportional resonance control, and sliding mode control have also been proposed in recent years.Traditional methods [8][9][10][11] used to control the system are relatively simple and easy to adjust controller parameters, and their stability can be guaranteed and they have mature application, but it is difficult to adjust parameters of the system and eliminate static error and control accuracy is not high.In a word, the overall effect is not satisfactory.As the nonlinear characteristics of electronic devices and photovoltaic modules, it is difficult to obtain improved results by linear approximation using traditional methods to implement the control of the system, and these methods are more suitable for the system which can precisely obtain the steady-state point and always has small perturbations [12].Therefore, it is essential to research nonlinear control methods for grid-connected photovoltaic inverter in order to obtain high-quality grid-connected inverter output current.In [13], it combines the parallel PI with repetitive control which solves the problem of phase lagging, but the improvement is limited and dynamic response can still be improved.In [14], using a Lyapunov functional to design the nonlinear controller for inverters has global stability, and its static and dynamic response get a better improvement, but its implementation is difficult and calculations are very complex.Sliding mode control having strong robustness and stability in a wide margin has been proved in [15,16], but it cannot eliminate the steady-state error and also has oscillation problem.Optimal nonlinear control method using the power converter has been proposed in [17][18][19], and it has proved that the method can operate in a stable way in a wide fluctuating range and has strong robustness.Moreover, [17][18][19][20] also point out that the optimal control is more suitable for trajectory tracking problem, which also proves its stability and effectiveness, and [21,22] also focus on the optimal control and prove that this method has good performance.Photovoltaic grid-connected inverter also can be considered in the current trajectory tracking problem, and using the optimal control can significantly improve performances of the system.However, it is worth noting that optimization problem generally solves the Hamilton-Jacobi-Bellman partial differential equations, which are usually difficult to solve.On the other hand, it is pointed out in [23,24] that constructing a Lyapunov functional in the form of inverse optimality could overcome the shortcomings of optimal control.So far, due to the complexity of mathematical analysis, there has been less work on optimal control of photovoltaic grid-connected inverter.Therefore, this problem needs to be further investigated.
In this paper, the problem of optimal control for photovoltaic grid-connected inverter is addressed.Firstly, the discrete-time nonlinear mathematical model of single-phase photovoltaic grid-connected inverter in the rotating coordinate system is constructed by the Delta operator in Section 2, which simplifies the control process and facilitates direct digital realization.Then, a novel optimal control method for photovoltaic grid-connected inverter is given by constructing a control Lyapunov functional, and the optimization method for the performance matrix of the controller is also proposed in Section 3. Lastly, simulations are given to verify the above proposed method in Section 4.

Single-Phase Photovoltatic Grid-Connected Inverter Model
2.1.Transformation to Rotating Frame of Single Phase.Many parameters of power converters are AC variables which make the analysis of the system and the controller designer complex and cumbersome.Therefore, the introduction of the rotating coordinate system has an important value to simplify the variables. −  rotating coordinate transformation is commonly used in the analysis and controller design of three-phase inverter.Shortcutting creating models of inverters and converters and all time-varying state variables of the topology have become constants, so that the analysis and design of the controller changes become even simpler [25].Since  −  transformation requires at least two orthogonal phases, it is not useful for the single-phase inverter directly [26].To construct a  −  rotating coordinate system of single-phase inverter, a virtual signal corresponding to the original signal is built to generate two orthogonal phase signals.
Assume the actual steady-state variable is where   is the peak value of the variable,  is the fundamental frequency, and  is the initial phase of the sine variable.In ideal condition, the corresponding virtual orthogonal variable is Transformation matrix from two-phase stationary coordinate to two-phase rotating coordinate can be obtained by using The variable in the − rotating coordinate system can be expressed as Figure 2 illustrates the entire building process from a stationary coordinate system to a rotating coordinate system.The time-varying variables of single-phase photovoltaic gridconnected inverter are mainly inverter output current and grid voltage.So the transformation of current and voltage are constructed in Figure 2, where   represents the actual grid voltage and   represents the corresponding virtual orthogonal grid voltage;   represents the actual inverter output current and   represents the corresponding virtual orthogonal inverter output current;   represents the grid voltage and   represents the inverter output current;   represents the grid voltage in  axis and   represents the grid voltage in  axis;   represents the inverter output current in  axis and   represents the inverter output current in  axis.Figure 2 clearly shows that the time-varying variables of the inverter become constant variables, so that the analysis and design of the controller are simplified subsequently.

The Mathematical Model of Single-Phase Grid-Connected
Inverter.Figure 1 shows a typical single-phase photovoltaic grid-connected inverter structure.From it, the mathematical model can be obtained as follows: where and  dc is DC bus voltage,  is capacitor of DC bus,   is gridconnected filtering inductance,   is equivalent resistance of grid-connected filtering inductance,   and   are grid voltage in  axis and  axis, respectively,   and   are inverter output current in  axis and  axis, respectively, and   and   are the duty in  axis and  axis, respectively.
Thanks to the low-cost microprocessor which is the main tool to implement the control method and requires the discrete samples for the signal processing normally, it is necessary to construct discrete-time model of the inverter which can realize the control strategy directly.Traditional shift operator is the main method to discretize continuous systems.When the sampling frequency of the discrete-time system increases, the traditional method is difficult to avoid the shortcomings of the following [27].With the sampling frequency increasing, parameters of the discrete model are not inequivalent to the parameters of the corresponding continuous system, and when the relative degree of continuous system is greater than 1, some zero-polo will tend to the unit circle or go outside of the unit circle; on the other hand, the increasing sampling frequency will lead to the oscillation of the limit cycle and instability of the system.Therefore, when the sampling period is small, the traditional shift operator to realize discretization of systems will result in all poles locating on the boundary of stability for sampling systems and the stability will deteriotate.Control expert, Goodwin, proposes that Delta operator (incremental difference operator, often called  operator) is a better method to discretize continuous systems [28,29], and this method can make it close to the original continuous model in the fast sampling case and maintains the original kinetic properties.In this paper,  operator is used to achieve the discrete-time mathematical model of the system.
operator (incremental difference operator) is defined as where  is sampling period of the system.When  = 0, the system is continuous; when  ̸ = 0, the system is discrete.In order to design a discrete controller for digital implementation directly, the state space model can be obtained by the  operator as follows: where  is period of sample time.Obviously, the system matrix is with a nonlinear term.In Section 3, optimal control will be developed to deal with the output tracking problem of a general nonlinear system including (7).

Controller Design
3.1.Mathematical Preliminaries of Optimal Control.From (7), the system can be considered as a nonlinear discrete-time affine system naturally.Therefore, optimal control commonly used in the discrete-time affine system can be used in the system.To understand the optimal control better, a brief discussion will be given in this section.Now, consider a typical nonlinear discrete-time affine system [30][31][32][33] as follows: Along with the associated meaningful cost functional [34], where   ∈ R  is the state of the system at time  ∈ N + = {0, 1, 2, . ..};   ∈ R  is the input of the control; (  ) : R  → R  , (  ) : R  → R × , and ℎ(  ) : R  → R  are smooth mappings; (0) = 0 and (  ) ̸ = 0 for all   ̸ = 0;  : R  → R + ;  : R  → R + is a positive semidefinite function (a function () is a positive semidefinite function if, for all vectors, () ≥ 0; namely, there exist some vectors  for which () = 0 and for all others , () > 0 [35]) and  : R  → R × is a real symmetric positive definite weighting matrix.In the section, we assume that all the states are measurable and available.
And ( 9) can be transformed into where (0) = 0 is required as the boundary condition.Therefore, (  ) becomes a Lyapunov functional.
Based on Bellman's optimality principle, the cost functional (  ) becomes invariant and satisfies the discretetime Hamiltonian for the infinite horizon optimization case [34,36], and it becomes In order to obtain the control law of the system, ( 11) is transformed into The necessary condition to the optimal control law is Combing ( 12) and ( 13), the determination of optimal control is corresponding to calculating the gradient of the right side of (12); then Taking the derivative of ( 8) and substituting it into (14) yield Then the optimal control law can be obtained by which can be rewritten as Substituting ( 17) into (11) gives Due to (if  =   , then which can be expressed as It is not simple to solve the HJB partial differential formulation (20) for (  ).To overcome this awkward problem, inverse optimal control is proposed [37].
The discrete-time inverse optimal control problem can be established as follows.
Lemma 1 (see [37]).Define the control law of the inverse optimal control which is globally stabilizing if the following two points are satisfied: (1) it achieves (global) stability when   = 0 for system (8); (2) (  ) is a positive definite function (radial unbounded) and the following formulation is established: Since inverse optimal control is always used to get the minimum or maximum (  ), a twice differentiable positive definite function can be proposed under meeting the requirements of Lemma 3.1 in [23].Then, where  =   ,  is a positive definite symmetric matrix, and  is an additional gain matrix to modify the convergence rate of the tracking error.Substituting (23) into (21), it follows that Then  *  can be formulated as

System Analysis.
The control objective of single-phase grid-connected inverter generally is the output current.Now, it is hoped to feed energy to the grid with unity power factor in most cases, and in smart microgrid the inverter is required to compensate the reactive power according to the load conditions.Based on the above discussion, it is easy to know that the variables to be controlled are the DC bus voltage and reactive power feeding to the grid.The reactive power feeding to the grid can be defined as follows [38]: where   () is the grid voltage,   () is the inverter output current,  pv () and  pv () are the voltage and current of the photovoltaic models, and  is the efficiency of the grid-connected device which is set to 1 in order to compute briefly.The static stable value using the reference for the reactive power can be expressed as where  ss  () is active power feeding to the grid and  ss is static stable power factor.
Therefore, the tracking errors of the state variables are defined as where  dc is DC bus voltage in real-time state,  ss dc is DC bus voltage in static-steady state,   dc is difference of the DC bus voltage,   is reactive power feeding to the grid in real-time state,  ss  is reactive power feeding to the grid in static-steady state, and    is difference of the reactive power.
Combining the discrete-time state space model of singlephase photovoltaic grid-connected inverter with the above system analysis, the steady-state operating point for reference can be formulated as The current feeding to the grid and the DC bus voltage of steady-state operation point can be obtained by (29).

Optimal Controller.
In order to simplify the controller design, the discrete-time state space model of single-phase photovoltaic grid-connected inverter should be expressed as a general nonlinear discrete-time affine system.Therefore, we define a synthesis vector composed by the DC bus voltage and the current feeding to the grid which is written as , and its corresponding steady-state vector is written as . Now, the model can be expressed as where The tracking error of the state variables can be expressed as Similarly, Combining (30), (32), and (33), we can get Generally, the composition of control variables is steadystate part and dynamic part.Therefore, we assume   =  ss  +  *  , and (34) can be expressed as In order to make the formula match with the nonlinear discrete-time affine system, we assume that Combining (35) and (36) yields Now, the steady-state part of the control variable can be obtained by (37).In addition, (38) is a typical nonlinear discrete-time affine system, so we can use the conclusion of Section 3.1.The dynamic part of the control variable can be formulated as The controller design is completed at this point.

Optimization of the Performance Matrix.
Many performance indicators have relation with the choice of positive definite weighting matrix in the inverse optimal control; therefore it is very meaningful and important to optimize the definite weighting matrix of the optimal controller.In this paper, particle swarm algorithm is used to optimize the definite weighting matrix.Particle swarm optimization (PSO) is one of the intelligent optimization algorithms.In particle swarm, each particle can move at different speeds in the search space, and it is able to remember the optimal position which has been visited.In addition, all groups can share all optimal locations of the individual particles.Each particle and group can mediate the movement speed and direction according to a certain strategy and their best position, and the search space tends to be the optimal position for solving ultimately [39].Each particle can be updated according to the following formula in the solution space of their own position and velocity: where () is the inertia weight;  start is the initial inertia weight;  end is the inertia weight of the iteration to the maximum number of times;  is the number for the current iteration;  max is the maximum number of iterations;  = 1, 2, . . ., ;  = 1, 2, . . ., ; the entire group has  particles, and each particle is a vector with -dimension;   is the position of particle;   is the velocity of particle;   is extreme value of individual;   is extreme value for the group;  1 and  2 are nonnegative constants, called acceleration factor;  1 and  2 are random intervals number distributed in [0, 1].By optimizing, the fitness function for particle is defined as follows: in which  is number of state variables to be controlled which is equal to the dimension of the search space;  is the size of population.

Simulation Results
The performances of the proposed nonlinear optimal controller are illustrated by simulation using MATLAB.The principle of simulation setup based on the experimental schematic Figure 1 is described by Figure 3.
In order to verify that the controller has strong robustness and weak dependence on the parameters of the system, two simulations will be given.In the two simulations, the parameters of particle swarm are set as follows: iteration  max is 1000, particle  is 100,  1 and  2 are 2,  start is 0.9, and  end is 0.4.
(1) The First Simulation.The control design parameters and values of the first simulation are given in Table 1.
The objection function evaluation by PSO is shown in Figure 4.
Optimized performance matrix is  tracking state values and blue indicates its reference value.Since grid is equivalent to infinite load in the system, its  axis reference current is set to 0. In order to ensure the unity power factor, the  axis current reference value is also set to 0 apparently.Thus, the dynamic current tracking response curve of  axis and  axis is shown in Figures 6 and 7, similarly.
(2) The Second Simulation.The control design parameters and values of the second simulation are given in Table 2.
The objection function evaluation by PSO is shown in Figure 8.  Optimized performance matrix can be obtained like simulation 1, so it is not necessary to repeat it here.
Dynamic tracking of the DC bus voltage response curve is shown in Figure 9, wherein the red means the dynamic tracking state values and blue indicates its reference value.Since grid is equivalent to infinite load, its  axis reference current is set to 0. In order to ensure the unity power factor, the  axis current reference value is also set to 0 apparently.Thus, the dynamic current tracking response curve of  axis and  axis is shown in Figures 10 and 11, similarly.
From Figures 5, 6, 7, 9, 10, and 11, it is obvious that the inverse optimal controller can realize zero steady-state error and has good dynamic and steady response characteristics.Comparing the results of simulation 1 and simulation 2, it is easy to prove that the controller has strong robustness to the changing parameters of the system.In a word, the designed controller has less dependence on the system parameters and has good performance.

Conclusion
In order to achieve the active and reactive power independently and use the low-cost microcontroller to implement    the control strategy directly, a discrete-time model of singlephase photovoltaic grid-connected inverter in the rotating coordinate system has been constructed in this paper.Since the bandwidth of the controller is required not to be very high and it has good tracking performance of the optimal control, this paper has proposed an optimal controller for the single-phase inverter.Against the difficulty of solving the HJB partial differential equations, a Lyapunov function has been constructed to solve the problem perfectly.In addition, the performance matrix has been optimized by the particle swarm optimization.The simulation results have shown that the proposed method is better to eliminate static error of the system, has good response characteristic, and has good robustness and following performance.The future researches are to study the optimal control for the whole systems with the preboost conversion portion and study the coordinate control of the active and reactive power.

Figure 9 :
Figure 9: The response curve of DC bus voltage.

Figure 10 :
Figure 10: The response curve of  axis current.

Figure 11 :
Figure 11: The response curve of  axis current.

Table 1 :
Characteristics of the controlled system.

Table 2 :
Characteristics of the controlled system.