## 3 Proposed LQRC and LQRIC for _Lc_-Hapf
### Linear Quadratic Regulator Control (LQRC) for LC-Hapf
#### 3.1.2 LQRC for LC-HAPF  
The objective of optimal control is to find a control system under the given constraint conditions so as to minimize the cost function, \(J\). LQRC, which is an optimal control, has good tracking control ability, and calculates the gain by the cost function, weighting matrices and state-space model. Generally, LQRC takes the minimum value of the cost function (11) in time interval [\(t_{0}\), \(t_{f}\)] [17], where \(t_{0}\) and \(t_{f}\) represent the initial time and final time, respectively. \[J=\int\limits_{t_{0}}^{t_{f}}\left(\mathrm{e}^{T}\mathrm{Q}\mathrm{e}+\mathrm{ u}^{T}\mathrm{R}\mathrm{u}\right)dt \tag{11}\]  
Q is a state weighting matrix, which is defined as a diagonal semi-positive matrix (Q \(\geq\) 0), and measures the importance of each phase state variable for the LQRC. R is an input weighting matrix, which is diagonal positive definite (R \(>\) 0) and measures the importance level of each phase control variable. They are given by (12) and (13). \[\mathrm{Q}= \begin{bmatrix}q_{q1}&0&0\\ 0&q_{q2}&0\\ 0&0&q_{q3}\end{bmatrix}  \tag{12}\]  
\[\mathrm{R}= \begin{bmatrix}r_{q1}&0&0\\ 0&r_{q2}&0\\ 0&0&r_{q3}\end{bmatrix}  \tag{13}\]  
when e and u indicate the error and input, \(q_{qi}\) (\(i\) = 1, 2, 3,... ) represents the weighting value of corresponding e, and \(r_{qi}\) represents the weighting value of corresponding u. The larger value of \(q_{qi}\) means take more effect on corresponding state variable in certain phase, so as \(r_{qi}\). The physical meaning of minimizing the cost function (11) is to minimize the tracking error and control cost (DC-link voltage of the inverter) by minimizing the corresponding terms \(\mathrm{e}^{T}\mathrm{Q}\mathrm{e}\) and \(\mathrm{u}^{T}\mathrm{R}\mathrm{u}\). To solve the optimal control problem for this dynamical system, the Hamiltonian function \(F\) with Lagrange multipliers \(\lambda\) in (14) is constructed. \[F[\mathrm{e},\mathrm{u},\lambda,t]=\frac{1}{2}\left[\mathrm{e}^{T}\mathrm{Q} \mathrm{e}+\mathrm{u}^{T}\mathrm{R}\mathrm{u}\right]+\lambda^{T}[\mathrm{A} \mathrm{e}+\mathrm{B}\mathrm{u}] \tag{14}\]  
Then, (15) is used to calculate the minimum value of \(F\), i.e., the minimum value of the cost function, \(J\). \[\frac{\partial F}{\partial\mathrm{u}}=\mathrm{R}\mathrm{u}+\mathrm{B}^{T} \lambda=0 \tag{15}\]  
As R is positive and symmetrical, by (15), the optimal control variable solution \(\mathrm{u}^{*}\) is calculated by:  
\[\mathrm{u}^{*}=-\mathrm{R}^{-1}\mathrm{B}^{T}\lambda \tag{16}\]  
In order to realize feedback control, the positive-definite transformation matrix, P, is introduced to evaluate the \(\lambda\). \[\lambda=\mathrm{P}\cdot\mathrm{e} \tag{17}\]  
and the matrix P is the solution of Algebraic Riccati equation (ARE):  
\[\mathrm{PA}+\mathrm{A}^{T}\mathrm{P}-\mathrm{P}\mathrm{B}\mathrm{R}^{-1} \mathrm{B}^{T}\mathrm{P}+\mathrm{Q}=0 \tag{18}\]  
From (16) and (17), we have:  
\[\mathrm{u}^{*}=-\mathrm{R}^{-1}\mathrm{B}^{T}\mathrm{P}\cdot\mathrm{e}=\mathrm{ K}\cdot\mathrm{e} \tag{19}\]  
\[\mathrm{K}=\mathrm{R}^{-1}\mathrm{B}^{T}\mathrm{P} \tag{20}\]where K is the gain matrix for LQR optimal control. Every combination of Q and R matrices can obtain a unique solution for K, which can satisfy the minimum cost of (11). From (19) and (20), the controlled system is expressed as:  
\[\frac{d}{dt}\mathbf{e}=\mathrm{A}\mathrm{e}+\mathrm{B}\mathrm{u}=(\mathrm{A}- \mathrm{B}\mathrm{K})\mathrm{e} \tag{21}\]  
and the design of Q and R matrices is based on [PERSON]'s rule [30], which provides the reasonable weighting elements \(q_{qi}\) and \(r_{qi}\) that are shown in below:  
\[\left\{ \begin{array}{l}q_{qi}=\frac{1}{Maximum\ acceptable\ value\ of\ \left[ \overline{\epsilon}_{i}^{2}\right]}\\ r_{qi}=\frac{1}{Maximum\ acceptable\ value\ of\ \left[\overline{\epsilon}_{i}^{2} \right]}\end{array} \right. \tag{22}\]  
The overall design process of LQRC is shown as follows:  
1. Select Q and R matrices based on [PERSON]'s rule;
2. Substitute the A, B, Q and R matrices to (18) and obtain the P matrix;
3.