Joint Control Strategy of Microgrid Inverter Based on Optimal Control and Residual Dynamic Compensation

With the continuous development of microgrid, the inverter under traditional PID control is difficult to meet the power quality requirements of microgrid. In order to improve the anti-interference ability and transient response speed of the output voltage of Isolated AC microgrid inverter, a dynamic compensation control structure combining linear quadratic optimal control and disturbance residual generator is proposed in this paper. Firstly, the quadratic optimal controller is established based on the inverter model. Secondly, the residual generator is established to observe the residual value of the disturbed system. Then, the dynamic compensation controller is designed according to the superposition principle, and a control signal opposite to the influence caused by the disturbance is output at the output of the controller. The disturbance signals can cancel each other without knowing the specific disturbance form. Finally, the experiments of load switching, three-phase imbalance and nonlinear load are designed on MATLAB/Simulink simulation software to verify the effectiveness of the control strategy proposed in this paper.


INTRODUCTION
Since entering the 21st century, the development of power resources in the national market has made a qualitative leap, from the traditional power to the power market with modern power electronic technology. Distributed generation, energy storage devices, loads and various control systems are combined into micro grids. These micro grids can not only be connected with the large grid, but also operate independently. This not only puts forward the requirements of flexibility, controllability and strong elasticity for microgrid itself, but also brings great challenges to its safety and reliability.
Since the 1990s, the International Electrotechnical Commission (IEC) has established a number of national standards for bus voltage deviation, fluctuation and flicker, three-phase voltage imbalance and harmonic disturbance, which provides a development opportunity for power quality control. When the micro grid is connected to the grid, the large grid can stabilize its voltage and frequency, and has strong anti-interference ability. When the microgrid operates in island mode, its AC bus voltage is supported by many micro sources, which are mainly controlled by two-way AC/DC and DC/DC converters. At this time, due to the uncertainty of distributed micro source output, load switching and the characteristics of low inertia of microgrid system, its bus voltage is easy to be affected. Therefore, maintaining the voltage stability of isolated bus through reasonable control of AC/DC converter has gradually become one of the key problems [1].
In industrial practice, PID control is most widely used, and there are many design methods, but its closed-loop stability is still a very important problem. In addition, the stability region of PID control object is difficult to determine online, which limits the control performance [2]. Especially in the case of various disturbances, it is difficult to obtain ideal dynamic characteristics. In serious cases, the system will collapse. Reference [3] proposes a new voltage control strategy based on internal model robustness and compound control for hybrid microgrid, which improves the robustness and anti-interference ability of the whole microgrid. On the basis of droop control, references [4] and [5] adopt frequency division droop control method to mainly suppress the power quality problem of PCC terminal voltage after the inverter output voltage passes through a section of line. In reference [6], a multi resonant controller is used in the original primary control, and a compensator composed of multiple resonant voltage regulators is added on the basis of the original secondary control. However, the above methods can only eliminate fixed frequency harmonics and double frequency negative sequence voltage. Reference [7] proposed a voltage control method based on nonlinear disturbance observer, which can effectively suppress the fluctuation of bus voltage, but the inverter has the relationship of dq axis coupling, which will make the system very complex.
In order to solve the transient response speed and anti-interference ability of output voltage of AC microgrid inverter and improve the robustness of output voltage, the main research contents of this paper are as follows.
 After modeling the microgrid inverter, combined with state feedback, integral control and linear quadratic optimal control algorithm, a controller based on LQR is designed to improve the transient response speed of the inverter.
 After analyzing the output voltage fluctuation of the inverter, a dynamic compensation structure based on the disturbance residual generator is proposed. The structure is based on the robust double coprime decomposition and Euler parameterization theory. It can quickly extract and compensate the disturbance signal without additional voltage and current sensors, and enhance the anti-interference performance of the output voltage of the inverter.
Load switching, three-phase unbalanced load and harmonic load experiments are designed in MATLAB / Simulink to verify the correctness and effectiveness of the proposed control.

Mathematical model of three-phase inverter
The state space equation of three-phase inverter circuit can be obtained by selecting load voltage uod, uoq, inductance current iLd and iLq as state variables, inverter bridge output voltage uid and uiq as input and load current iod and ioq as disturbance input d: Where, ω is the fundamental angular frequency.

inverter Establishment of optimal controller
In modern control theory, state feedback can comprehensively reflect the internal characteristics of the system, and good dynamic performance can be obtained through pole assignment. An integral controller can be added to eliminate the steady-state error. In addition, it is not necessary to use proportional integral controller instead of integral controller, because it will introduce a new zero point into the system and affect the dynamic response of the system [8]. Thus, the structure of the system can be obtained, as shown in Figure 1   In Figure 1, k1 and k2 are the state current and voltage feedback parameters, k3 is the integral parameter, e is the difference between the given voltage and the actual output voltage, and uo * is the given input of the inverter circuit.
The optimal controller is usually solved by Riccati equation to obtain the optimal control input ui * . By selecting appropriate values of the error weighting matrix Q and the weighting matrix R of the control signal, the values of the optimal control parameters k1, k2 and k3 can be solved. The solution of ui * is shown in equation (2).
x ，e d and e q are the difference between the given voltage and the actual voltage of axis d and q respectively. It is difficult to directly solve u i * through equation (2), and it is easier to obtain the optimal control input by redefining the state variables.Let, The system control block diagram after redefining the state variable is shown in Figure 1 (b), and the performance index of the new system can be expressed as: The resulting system control structure is shown in Figure 2. The LQR controller can effectively improve the transient response speed and steady-state accuracy of the system. However, considering that there are various disturbances in the operation of the system, the dynamic compensation structure is added on the basis of the original controller, so that the system can reduce the output voltage fluctuation of the inverter without identifying the specific disturbance form, Improve the anti-interference ability and reliability of inverter.

Disturbance analysis
In general, the ideal single-phase output voltage of the inverter can be expressed as: Where u1 is the amplitude of the fundamental voltage, θ1 is the initial phase angle. Disturbances are divided into two categories [9]:  The amplitude U1 of fundamental voltage changes, including voltage sag, overvoltage, undervoltage, fluctuation and flicker;  Additive disturbance, including harmonics, three-phase imbalance, impulse voltage, etc. The bridge arm current of three-phase inverter is transformed into the expression in dq coordinate system, as shown in equation (6).
According to equation (6), when the output voltage fluctuates, the output currents iod and ioq of the inverter are equivalent to the disturbance input. When the circuit performs load switching, the expression of output current of dq axis is: Where iod1 and ioq1 are the amplitude of the fundamental current, Ipd and Ipq are the amplitude of fluctuating current, 1 (t-tp) is the step function, and tp is the load switching time. According to equation (7), the switching load of inverter shows step disturbance in dq coordinate system.
When the load connected to the inverter is three-phase unbalanced load, the phase voltage can be decomposed into positive, negative and zero sequence voltages according to the symmetrical component method. After ignoring the harmonic component, the output expression of three-phase current in dq coordinate system is: Where, ioo is zero sequence current, and Im + 、 Im -、 Im 0 are output positive, negative and zero sequence current amplitudes respectively. θ + 、θ -、θ 0 are the initial phase angles of positive, negative and zero sequence current respectively.
It can be seen from equation (8) that the unbalanced voltage on dq axis is the superposition of DC component and 2 times of power frequency AC negative sequence component.
When the inverter has nonlinear load, the output voltage of the whole inverter can be expressed as the sum of the fundamental voltage and harmonic voltage. Among them, the positive sequence harmonic voltage will appear in the dq axis in the form of 6k+1 (k is a positive integer) harmonic, the negative sequence harmonic voltage will appear in the dq axis in the form of 6k-1 harmonic, and the zero sequence harmonic voltage is zero.

Dynamic compensation theory
If for a true rational transfer function G(s), the controllability is observable, and the external controller K(s) remains stable, as shown in   [10]: The control loop of the controlled object G(s) and a control signal u1 provided by the existing controller K(s) are given. If the control loop is internally stable, all internally stable controllers can be parameterized as follows: Where u1 is the output of the original controller, u is the output of the actual controller, Qc is the transfer function matrix of the compensation signal, and r is the residual signal.
Therefore, when the system composed of the control object Gp(s) and the controller K(s) is stable, the system can still remain stable when the compensation controller Qc(s) is added. The residual generator models are the original control object, observes the local original information and makes a difference with the actual output information to obtain the corresponding residual signal r(s). Without additional load sensors, it can not only reduce the equipment investment and communication cost, but also respond to the current state of the system in real time. When the disturbance d(s) is zero, the model in the residual generator corresponds to the actual control object, and the output residual signal r(s) is zero. When the disturbance d(s) comes, the residual generator can quickly detect the residual signal and output the compensation signal to the control end through Qc(s), which is superimposed with the output signal of the original controller to realize the dynamic suppression of the disturbance.
According to the above theoretical analysis, the residual is generated by the difference between the observer output and the actual value, and its structure can be expressed as equation (10).
Where L is the observer gain matrix, x is the reconstructed state vector and ŷ is the reconstructed output. With the continuous increase of L, the response will gradually accelerate, but unnecessary noise and other signal disturbances will also be introduced. Therefore, the poles of the observer are usually 2-5 times of the real part of the system poles.
The dynamic compensation structure based on the residual generator is shown in Figure 4, According to the structure of Figure 4, the disturbance caused by the outside can be extracted by the residual generator without knowing the specific disturbance type in advance. If you want the output not to be affected by the disturbance, you only need to meet the following requirements:

Voltage dynamic compensation
According to the inverter and the above compensation theory，letx e = x -x ，by making a difference between equations (1) and (10), the calculation expression of inverter residual generator shown in equation (12)  Where d is the disturbance input of the equivalent residual generator. r is the residual value output by the residual generator. The residual generator of equation (10) is equivalent to the calculated output of equation (12), so the residual value of inverter output can be obtained without actually measuring the size of d. Since the dq axis of the inverter is structurally symmetrical, the dynamic compensation structure taking the d axis as an example is shown in Figure 5. In Figure 5, uod * is the input reference voltage of axis d, uod is the output voltage of axis d, iLd is the inductance current, Io is the disturbance input, rd is the output residual signal of axis d residual generator, Qc is the transfer function of voltage compensation signal, urd is the voltage compensation output, uid is the controller output. As can be seen from Figure 5, k1 and k2 are the state feedback part of the optimal controller, -k3/s is the integral control part of the controller, uid is the output control signal of the controller, when there is no disturbance Current Io, the output of the residual generator is 0, and the output compensation voltage signal of Qc is 0. When there is disturbance Current Io, the residual generator can immediately detect the disturbance and output the residual signal and compensate through Qc. However, due to the feedback branch of inductive current between the inverter and the controller, some control objects form an inner loop feedback with k2, so that the compensation signal of Qc is fed back to the input of the control signal through k2 to form a secondary disturbance. At this time, the disturbance should be fully compensated, must meet: According to equation (12), it can be solved that the disturbance action is the input and the residual is the output transfer function Grd. The solution of Qc in equation (13) can be simplified as:

Secondary compensation
It can be seen from equation (14) that the unpacking of Qc includes a part of LQR controller. In order to make the compensation controller operate independently and not affected by the optimal controller, a compensation controller H is designed to offset the secondary disturbance signal before it is affected by the optimal controller. The compensation structure is shown in Figure 6.  Based on the above theoretical analysis and derivation, a complete inverter dynamic compensation architecture based on linear quadratic optimal control and the parameters to be solved are obtained, which is extended to the dual axis control structure, as shown in Figure 7.

Q'c solution of voltage dynamic compensation
According to the above theoretical derivation and model matching theory [11], the model matching structure of inverter dynamic compensation controller is obtained, as shown in Figure 8. Where Gyd is the transfer function matrix of the disturbance directly acting on the system, Grd is the transfer function matrix of the residual generator, and Gp is the compensation signal ur output by Q'c as the transfer function matrix of the system input.
According to the superposition principle of linear system, when the disturbance action is used for the control object, it will produce a disturbance output yp,d, and the compensation system will also produce a compensation output yp,q. when yp,d+yp,q=0, the effect of any disturbance on the system can be offset theoretically. The solution process of Q'c is shown in equation (15).

xd=[iLd iLq uod uoq] T is the state quantity and d=[iod ioq] T is the disturbance current input.
Grd input is d and output is r. The state space expression is shown in equation (15). According to the system dimension, it can be obtained that the gain matrix of the observer is a 4 × 2, so let the observer gain matrix be:

xp=[iLd iLq uod uoq] T is the state quantity and ur=[urd urq] T is the compensation voltage input.
According to equation (15), the transfer function matrix of the compensation controller Q'c can be solved through matrix operation, and the simplest expression matrix element expression can be obtained after simplification According to the results of the above formula, the numerator order is greater than the denominator order. According to the linear system control principle, the denominator must be compensated to make the denominator order greater than or equal to the numerator, so as to obtain the simplest matrix expression of Q'c. r r r r r Where, ird、irq are d-axis and q-axis secondary compensation outputs respectively, and urd、urq are d-axis and q-axis voltage compensation outputs respectively.

Inverter
Load Switching

Three-Phase Unbalanced Load
Non-Linear Load Figure 9. Experimental topology In order to verify the compensation effect of the inverter dynamic compensation architecture based on linear quadratic control designed in this paper, different kinds of experiments are designed, and MATLAB / Simulink simulation is used to verify the rationality of the compensation architecture. Parameter settings are shown in Table 1.

5.1.
Step disturbance experiment Switch the load with active power of 15kW and reactive power of 8kVar to ensure that other parameters of the line remain unchanged. Through MATLAB / Simulink simulation, the d-axis voltage waveform is obtained, as shown in Figure 10.  It can be seen from Figure 10 that under the double closed-loop PI control, the inverter is stable within 50ms after startup, and the overshoot is obvious. Under the LQR control, the system can be stable without overshoot within 20ms, which significantly improves the transient response speed of the system. After 0.15s of load input, due to the influence of disturbance current, the d-axis voltage is temporarily reduced to 295V, The system voltage under double closed-loop PI control is stabilized again after 500ms, and the system voltage under LQR control is stabilized after 20ms, which greatly improves the transient response speed of the system, but the sag amplitude does not change significantly. After adding the dynamic compensation structure of disturbance residual generator, the voltage sag amplitude of the system is greatly reduced and restored to stability after 20ms. After the load is cut off in 0.25s, the response effect is similar to the input load.
The comparison of three-phase voltage waveforms is shown in Figure 11. When the load is put into operation in 0.15s, when there is only a double closed-loop PI controller, the three-phase voltage amplitude temporarily decreases to 300V and slowly recovers to stability after 500ms. After the load is put into operation, the three-phase voltage under LQR control temporarily decreases to 302V and recovers to stability after 20ms. After adding the dynamic compensation structure of disturbance residual generator, the fluctuation amplitude of three-phase voltage is greatly reduced and can be restored to stability in 20ms. When the load is cut off for 0.25s, the three-phase voltage response effect is similar to that when the load is input. The experiment shows that LQR control can effectively improve the transient response speed of the system, and LQR+Qc control strategy can greatly reduce the amplitude of voltage fluctuation and improve the rapidity and immunity of the inverter system without changing the rapidity of the system. Step disturbance three-phase voltage waveform

Three phase unbalance disturbance
Input unbalanced three-phase load at 0.2s to ensure that other parameters remain unchanged. Through MATLAB / Simulink simulation, the d-axis voltage waveform is obtained, as shown in Figure 12.
It can be seen from Figure 12 that after the unbalanced load is input, the d-axis voltage under LQR control has an obvious double power frequency sinusoidal fluctuation, and the fluctuation amplitude is 323V. After adding the LQR + Qc control structure proposed in this paper, the fluctuation amplitude is reduced to 312V. The three-phase voltage waveform under unbalanced load is shown in Figure 13. Under the influence of unbalanced load, the amplitude of three-phase sinusoidal voltage changes to varying degrees with different three-phase loads. After adding the compensation structure proposed in this paper, the threephase voltage amplitude is basically the same. Figure 14 shows the three-phase voltage unbalance. The three-phase voltage unbalance under LQR control is 4.03%. After adding the compensation structure proposed in this paper, the voltage unbalance is reduced to 0.58%. The simulation results show that the LQR+Qc control structure can effectively suppress the influence of three-phase unbalanced load on the output voltage waveform and improve the reliability and robustness of the output voltage.

Harmonic disturbance
Harmonic disturbance is mainly caused by nonlinear load. Through MATLAB simulation, input nonlinear load at 0.2s, and the d-axis voltage waveform can be obtained, as shown in Figure 15.  It can be seen from Figure 15 that after adding nonlinear load, the d-axis voltage fluctuates obviously under the control of LQR, and the fluctuation amplitude is 323V. After adding the control structure proposed in this paper, the d-axis voltage fluctuation is significantly improved, the amplitude is reduced to 311.5V, and the anti-interference ability is greatly improved. It can be seen from the simulation waveform that the three-phase voltage has obvious distortion. The waveform after adding dynamic compensation structure is shown in Figure 16 (b). The voltage waveform has been significantly improved and is close to the standard three-phase sinusoidal waveform. After that, the voltage is analyzed by using the FFT analysis provided by Matlab / Simulink, and the harmonic analysis diagram shown in Figure 178 is obtained. It can be seen from Figure 17 (a) that under the control of LQR, the distortion rate of the inverter output voltage is 3.25%. After adding the dynamic compensation structure, the output voltage is as shown in Figure 17 (b), and the distortion rate of the output voltage becomes 0.21%. Experiments show that the dynamic compensation structure can effectively suppress the influence of nonlinear load on the output voltage and improve the robustness and reliability of the output voltage.

CONCLUSIONS
Under the background of microgrid, an inverter output voltage control strategy based on optimal control and disturbance residual generator is proposed, which realizes the rapidity of output voltage response and immunity. The specific conclusions are as follows.  Through the state feedback of output voltage and inductance current, the inverter can obtain good dynamic performance. After adding integral control, the steady-state error of the system can be eliminated. The two are combined and solved by LQR, so that the voltage can follow quickly without overshoot when the inverter is started, and the transient response speed of the system is improved.
 When the disturbance occurs, the load current as a disturbance causes the fluctuation of the inverter output voltage. The compensation control strategy proposed in this paper can quickly extract the disturbance and realize compensation without additional voltage and current sensors, which can improve the anti-interference ability of the inverter and enhance the robustness of the inverter system without changing the transient response speed.