## 2 Mathematical Model of PMSM  
The equations describing voltages in the three phase windings of PMSM can be written in matrix form. If symmetrical three-phase winding on the stator is supposed, then it can be assumed that their resistances are identical: \(R_{a}=R_{b}=R_{c}=R_{s}\). In the mathematical model, the saturation and temperature effects are also neglected [55]. \[ \begin{bmatrix}v_{a}\\ v_{b}\\ v_{c}\end{bmatrix} =R_{s} \begin{bmatrix}i_{a}\\ i_{b}\\ i_{c}\end{bmatrix} +\frac{d}{dt} \begin{bmatrix}\psi_{a}\\ \psi_{b}\\ \psi_{c}\end{bmatrix}  \tag{1}\]  
where \(v_{a},v_{b},v_{c}\) are the three phase stator voltages, \(R_{s}\) is the stator resistance, \(i_{a}\), \(i_{b}\), \(i_{c}\) are the three phase stator currents, and \(\psi_{a}\), \(\psi_{b}\), \(\psi_{c}\) are the three phase stator flux linkages, given as:  
\[ \begin{bmatrix}\psi_{a}\\ \psi_{b}\\ \psi_{c}\end{bmatrix} = \begin{bmatrix}L_{aa}&L_{ab}&L_{ac}\\ L_{ba}&L_{bb}&L_{bc}\\ L_{ca}&L_{cb}&L_{cc}\end{bmatrix}\begin{bmatrix}i_{a}\\ i_{b}\\ i_{c}\end{bmatrix} +\psi_{pm} \begin{bmatrix}\cos(\theta_{e})\\ \cos(\theta_{e}-\frac{2\pi}{3})\\ \cos(\theta_{e}+\frac{2\pi}{3})\end{bmatrix}  \tag{2}\]  
where \(L_{aa}\), \(L_{bb}\), \(L_{cc}\) are stator phase self-inductances, \(L_{ab}=L_{ba}\), \(L_{bc}=L_{cb}\), \(L_{ca}=L_{ac}\) are mutual inductances between respective stator phases, \(\psi_{pm}\) is the permanent magnet flux linkage, and \(\theta_{e}\) is the electrical rotor position. By means of Clarke and Park transformation, three phase voltage (1) and flux equations (2) can be transformed to the rotational reference frame \(dq\):  
\[ \begin{bmatrix}v_{d}\\ v_{q}\end{bmatrix} =R_{s} \begin{bmatrix}i_{d}\\ i_{q}\end{bmatrix} +\frac{d}{dt} \begin{bmatrix}\psi_{d}\\ \psi_{q}\end{bmatrix} +\omega_{e} \begin{bmatrix}-\psi_{q}\\ \psi_{d}\end{bmatrix}  \tag{3}\]  
where \(v_{d}\) and \(v_{q}\) are the \(dq\) axis voltages, \(i_{d}\) and \(i_{q}\) are the \(dq\) axis currents, \(\omega_{e}\) is the electrical angular velocity, and \(\psi_{d}\), \(\psi_{q}\) are the \(dq\) axis flux linkages, defined as:  
\[ \begin{bmatrix}\psi_{d}\\ \psi_{q}\end{bmatrix} = \begin{bmatrix}L_{d}&0\\ 0&L_{q}\end{bmatrix}\begin{bmatrix}i_{d}\\ i_{q}\end{bmatrix} +\psi_{pm} \begin{bmatrix}1\\ 0\end{bmatrix}  \tag{4}\]  
where \(L_{d}\) and \(L_{q}\) are the \(dq\) axis inductances. Substituting (4) into (5), the voltage equations of the PMSM in \(dq\) coordinates lead to the following form:  
\[ \begin{bmatrix}v_{d}\\ v_{q}\end{bmatrix} =R_{s} \begin{bmatrix}i_{d}\\ i_{q}\end{bmatrix} + \begin{bmatrix}L_{d}&0\\ 0&L_{q}\end{bmatrix} \frac{d}{dt} \begin{bmatrix}i_{d}\\ i_{q}\end{bmatrix} +\omega_{e} \begin{bmatrix}-L_{q}\\ L_{d}\end{bmatrix}\begin{bmatrix}i_{q}\\ i_{d}\end{bmatrix} +\omega_{e}\psi_{pm} \begin{bmatrix}0\\ 1\end{bmatrix}  \tag{5}\]  
The mathematical model of PMSM in rotational reference frame \(dq\) is very popular for FOC structures, because both controllable quantities, current and voltage, are DC values, as is evident from Figure 1. In addition, it allows employing simple controllers to force the machine currents to the required states. Figure 1: Transformation from stationary to rotational reference frame. The other important quantity of the machine is the electromagnetic torque. The electromagnetic torque of the PMSM machine in rotational reference frame \(dq\) is defined as:  
\[T_{e}=\frac{3}{2}p\big{[}\psi_{pm}i_{q}+\big{(}L_{d}-L_{q}\big{)}i_{d}i_{q}\big{]} \tag{6}\]  
where \(p\) is the number of pole pairs. The first term in Equation (6) represents a synchronous torque produced by the permanent magnet flux, and the second term is a reluctance torque dependent on the rotor saliency. Both terms reflect an essential aspect of the torque production in the PMSM machine. By sublimation of electromagnetic torque and load torque, the mechanical equation of PMSM can be presented as:  
\[T_{e}-T_{L}=J\frac{d\omega_{m}}{dt} \tag{7}\]  
where \(T_{L}\) is the load torque, \(J\) is the moment of inertia, and \(\omega_{m}\) is the mechanical angular velocity.