## 2 Mathematical Modeling of PMSG-WECS
### Permanent Magnet Synchronous Generator Mathematical Modeling  
The PMSG can be conveniently modeled in the \(d\)-\(q\) (or synchronously rotating) reference frame, where the zero components are discarded. The axis along the axis of the rotor is called the direct or the \(d\)-axis, while the axis perpendicular to the \(d\)-axis is known as the quadrature or \(q\)-axis. For a standalone PMSG-WECS, the voltages on the \(d\)-\(q\) axes are considered as the output variables. Based on this concept, the PMSG model can be described in terms of the \(d\)-\(q\) axes voltages by the following group of equations [18; 19]:  
\[\left(L_{d}+L_{ch}\right)\frac{di_{d}}{dt} =-\left(R_{s}+R_{ch}\right)i_{d}+p\left(L_{q}-L_{ch}\right)i_{q} \Omega_{h} \tag{9}\] \[\left(L_{q}+L_{ch}\right)\frac{di_{q}}{dt} =-\left(R_{s}+R_{ch}\right)i_{q}-p\left(L_{d}+L_{ch}\right)i_{q} \Omega_{h}+p\Phi_{m}\Omega_{h}\] \[J_{h}\frac{d\Omega_{h}}{dt} =\frac{T_{m}}{g_{r}}-T_{em}=\frac{T_{m}}{g_{r}}-\left[p\left(L_{d }-L_{q}\right)i_{d}i_{q}+p\Phi_{m}i_{q}\right]=\frac{d_{1}v_{w}^{2}}{g_{r}}+ \frac{d_{2}v_{w}\Omega_{h}}{g_{r}^{2}}\] \[+\frac{d_{3}\Omega_{h}^{2}}{g_{r}^{3}}-p\Phi_{m}i_{q}\]  
where \(R_{s}\) denotes the stator resistance, \(L_{d}\) and \(L_{q}\) represent the stator \(d\)- and \(q\)-_axis_ inductances, respectively, \(i_{d}\) and \(i_{q}\) stand for the \(d\)- and \(q\)-_axis_ stator currents, respectively, \(p\) indicates the number of pole pairs, \(\Phi_{m}\) indicates the maximum value of magnetic flux and \(T_{em}\) represents the electromagnetic torque of the PMSG, resulting from the interaction between the stator and rotor fluxes. Moreover, \(J_{h}\) denotes the moment of inertia of the high-speed shaft (PMSG) and \(R_{ch}\), \(L_{ch}\) indicate the resistance and inductance of the load, respectively. In Equation (9), the non-salient pole type of PMSG has been considered, for which \(L_{d}=L_{q}\). The WECS is inherently a highly nonlinear system. The objective of this work is to maximize the power extraction from the PMSG-WECS, which is accomplished by controlling the shaft speed. For this purpose, the nonlinear PMSG-WECS model can be written in state-space representation as follows:  
\[ \begin{cases}\dot{\mathbf{x}}=f(\mathbf{x})+g(\mathbf{x})u\\ y=h(\mathbf{x})\end{cases} \]  
where  
\[\underbrace{ \begin{bmatrix}\dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\end{bmatrix} }_{\dot{\mathbf{x}}} =\underbrace{ \begin{bmatrix}a_{2}x_{1}+a_{3}x_{2}x_{3}\\ b_{2}x_{2}+b_{3}x_{1}x_{3}+b_{4}x_{3}\\ \frac{1}{J_{h}}\left(\frac{d_{1}v_{w}^{2}}{g_{r}}+\frac{d_{2}v_{w}x_{3}}{g_{ r}^{2}}+\frac{d_{3}x_{3}^{2}}{g_{r}^{3}}-p\Phi_{m}x_{2}\right)\end{bmatrix} }_{f( \mathbf{x})}+\underbrace{ \begin{bmatrix}-\frac{x_{1}}{a_{1}}\\ -\frac{x_{2}}{b_{1}}\\ 0\end{bmatrix} }_{g(\mathbf{x})}\cdot\underbrace{R_{ch}}_{u}\\ y=\underbrace{\Omega_{h}}_{g(\mathbf{x})}\end{cases} \tag{10}\] \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Parameter** & **Value** & **Parameter** & **Value** & **Parameter** & **Value** \\ \hline \(a_{1}\) & \(0.1215\) & \(b_{3}\) & \(-6\) & \(d_{4}\) & \(2.6292\) \\ \(a_{2}\) & \(-27.1471\) & \(b_{4}\) & \(21.6288\) & \(\xi_{1}\) & \(9.9399\) \\ \(a_{3}\) & \(-0.9486\) & \(d_{1}\) & \(3.8422\) & \(\xi_{2}\) & \(-0.13316\) \\ \(b_{1}\) & \(0.1215\) & \(d_{2}\) & \(-0.3603\) & \(\xi_{3}\) & \(-5.059\times 10^{-3}\) \\ \(b_{2}\) & \(-27.1471\) & \(d_{3}\) & \(-0.0958\) & \(\xi_{4}\) & \(2.6292\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Specification of various important parameters. where \(f(\mathbf{x})=[f_{1}\ f_{2}\ f_{3}]^{T},g(\mathbf{x})=[g_{1}\ g_{2}\ g_{3}]^{T}\), \(\mathbf{x}=[x_{1}\ x_{2}\ x_{3}]^{T}=[i_{d}\ i_{q}\ \Omega_{h}]^{T}\in\mathbb{R}^{n}\) represents the state vector, \(f(\mathbf{x})\) and \(g(\mathbf{x})\) stand for the nonlinear smooth vector fields, and \(u\) and \(y\) indicate the control input and output, respectively. Moreover,  
\[\left\{