# Inner-Loop Controllers for Grid-Forming Converters
## 2 Materials and Methods
### Proposed Inner-Loop Voltage Controller with Current Limiter
#### 2.1.2 Voltage Controller Design  
Considering the single-phase circuit shown in Figure 4, a discrete-time state-space model with a sampling time of \(T_{s}\), including the one-sample delay resulting from the digital implementation for the output voltage controller, is given by (10) and is rewritten in the compact form in (11). \[\left[ \begin{array}{c}i_{Lk+1}\\ v_{ck+1}\\ u_{dk+1}\end{array} \right]=\left[ \begin{array}{ccc}1&-\frac{T_{s}}{L}&\frac {T_{s}}{L}\\ \frac{T_{s}}{C}&1&0\\ -k_{i1}&0&-k_{i2}\end{array} \right]\left[ \begin{array}{c}i_{Lk}\\ v_{ck}\\ u_{dk}\end{array} \right]+\left[ \begin{array}{c}0\\ 0\\ k_{r}\end{array} \right]i_{refk}+\left[ \begin{array}{c}0\\ -\frac{T_{s}}{C}\\ 0\end{array} \right]i_{ak} \tag{10}\]  
\[y_{k}=\left[ \begin{array}{cc}0&1&0\end{array} \right]\left[ \begin{array}{c}i _{Lk}\\ v_{ck}\\ u_{dk}\end{array} \right]\]  
\[\mathbf{x}_{k+1}=\mathbf{G}_{v}\mathbf{x}_{k}+\mathbf{h}_{v}i_{refk}+\mathbf{ f}_{v}i_{ok} \tag{11}\]  
where \(\mathbf{G}_{v}=\mathbf{G}_{i}-\mathbf{h}_{i}\mathbf{k}_{i}\) and \(\mathbf{k}_{i}=\left[ \begin{array}{cc}\mathbf{k}_{i1}&0&\mathbf{k}_{i2}\end{array}  \right]^{T}\). The resonant controller is designed to track the fundamental frequency of the grid voltage, and its discrete-time representation can be expressed by Equation (12). \[x_{ck+1}=\mathbf{R}x_{ck}+\mathbf{T}\epsilon_{k} \tag{12}\] \begin{table}
\begin{tabular}{c c c} \hline \hline
**Parameter** & **Description** & **Value** \\ \hline S & rated power of the inverter & 33 kVA \\ V & rated voltage of the inverter & 220 V\({}_{\text{RMS}}\) \\ L & inductance of the output filter & 0.25 m \\ C & capacitance of the output filter & 100 uF \\ T\({}_{s}\) & sampling rate & 50 uS \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Parameters of the controller design. where \(x_{c}\) is the controller state, \(e_{k}\) is the tracking error, and the matrices \(\mathbf{R}\) and \(\mathbf{T}\) are given by (13) and (14). \[\mathbf{R} =\left[ \begin{array}{cc}0&1\\ -e^{-aT_{s}}&2e^{-2 aT_{s}}\cos(\omega T_{s})\end{array} \right] \tag{13}\] \[\mathbf{T} =\left[ \begin{array}{c}0\\ 1\end{array} \right] \tag{14}\]  
From (11) and (12), the augmented system can be expressed in its compact form as in (15). \[\rho_{k+1}=\mathbf{G}_{a}\rho_{k}+\mathbf{h}_{a}i_{refk}+\mathbf{f}_{1a}i_{ \mathrm{ok}}+\mathbf{f}_{2a}v_{refk} \tag{15}\]  
where  
\[\rho_{k} =\left[ \begin{array}{c}\mathbf{x}_{k}\\ \mathbf{x}_{ck}\end{array} \right] \tag{16}\] \[\mathbf{G}_{a} =\left[ \begin{array}{cc}\mathbf{G}_{v}&\mathbf{0}_{3x2}\\ -\mathbf{T}\mathbf{c}_{v}&\mathbf{R}\end{array} \right]\] (17) \[\mathbf{h}_{a} =\left[ \begin{array}{c}\mathbf{h}_{v}\\ \mathbf{0}_{2x1}\end{array} \right]\] (18) \[\mathbf{f}_{1a} =\left[ \begin{array}{c}\mathbf{f}_{v}\\ \mathbf{0}_{2x1}\end{array} \right]\] (19) \[\mathbf{f}_{2a} =\left[ \begin{array}{c}\mathbf{0}_{3x1}\\ \mathbf{T}\end{array} \right] \tag{20}\]  
The block diagram of the voltage loop controller is presented in Figure 8.  
If the pair (\(\mathbf{G}_{a}\),\(\mathbf{h}_{a}\)) is controllable, then with (21), it is possible to define the closed-loop performance by the adequate selection of the feedback gains. \[i_{refk}=-\Big{[} \begin{array}{cc}\mathbf{k}_{1}&\mathbf{k}_{2}\end{array}  \Big{]}\rho_{k}=-\mathbf{k}_{1}\mathbf{x}_{k}-\mathbf{k}_{2}\mathbf{x}_{ck} \tag{21}\]  
To implement a state feedback controller, the state feedback gains \(\mathbf{k}_{1}\) and \(\mathbf{k}_{2}\) need to be determined. For this, the DLQR can once again be used. The cost function for this regulator is given by Equation (22). \[J=\frac{1}{2}\sum_{k=0}^{\infty}\Big{[}\rho_{k}^{T}\mathbf{Q}\rho_{k}^{T}+i_{ refk}r_{refk}\Big{]} \tag{22}\]  
Figure 8: Block diagram of the voltage loop controller. where \(\mathbf{Q}\) is a positive semidefinite matrix and \(r\) is a positive scalar.