## 2 Mathematical Modeling
### Modeling of Surface Permanent Magnet Synchronous Motor  
The mathematical modeling of the three-phase SPMSM is considered in the rotating reference frame. Due to the non-salient characteristic of the motor drive, we consider that the \(d\)- and \(q\)-axis inductances \(L_{d}\) and \(L_{q}\) of the motor satisfy \(L_{d}=L_{q}=L_{s}\). To ensure model simplicity and real-time implementation feasibility, high-frequency effects such as magnetic saturation, core losses, and temperature variations were neglected. The direct-axis and quadrature-axis currents, \(i_{d}\) and \(i_{q}\), respectively, are obtained from the following equations, as given in Chapter 6 in [1],  
\[\frac{di_{d}}{dt} =-\frac{r_{s}}{L_{s}}i_{d}+\omega_{r}i_{q}+\frac{1}{L_{s}}v_{d}, \tag{4a}\] \[\frac{di_{q}}{dt} =-\frac{r_{s}}{L_{s}}i_{q}-\omega_{r}i_{d}+\frac{1}{L_{s}}v_{q}- \frac{\psi_{m}}{L_{s}}\omega_{r} \tag{4b}\]  
where \(v_{d}\) and \(v_{q}\) are the voltage components in the \(dq\) frame, \(r_{s}\) is the stator resistance, \(\omega_{r}\) is the electrical angular velocity, and \(\psi_{m}\) is the magnetic flux due to permanent magnets.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline \(S_{1}S_{3}S_{5}\) & \(v_{a}\) & \(v_{b}\) & \(v_{e}\) \\ \hline
000 & 0 & 0 & 0 \\
100 & \(2V_{dc}/3\) & \(-V_{dc}/3\) & \(-V_{dc}/3\) \\
110 & \(V_{dc}/3\) & \(V_{dc}/3\) & \(-2V_{dc}/3\) \\
010 & \(-V_{dc}/3\) & \(2V_{dc}/3\) & \(-V_{dc}/3\) \\
011 & \(-2V_{dc}/3\) & \(V_{dc}/3\) & \(V_{dc}/3\) \\
001 & \(-V_{dc}/3\) & \(-V_{dc}/3\) & \(2V_{dc}/3\) \\
101 & \(V_{dc}/3\) & \(-2V_{dc}/3\) & \(V_{dc}/3\) \\
111 & 0 & 0 & 0 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Output voltage vectors of a two-level three-phase inverter.  
Figure 2: Inverter possible switching configuration.  
The voltages \(v_{d}\) and \(v_{q}\) fed to the SPMSM are obtained through the VSI described in the previous section, as shown in Figure 1.  
For a given sampling period \(T_{s}\), we use the explicit forward Euler discretization approach [34] to derive a discrete-time prediction model of the \(dq\) frame currents as  
\[i_{d}(k+1) =i_{d}(k)+T_{s}\bigg{(}-\frac{r_{s}}{L_{s}}i_{d}(k)+\omega_{r}(k)i _{q}(k)+\frac{1}{L_{s}}v_{d}(k)\bigg{)}, \tag{5a}\] \[i_{q}(k+1) =i_{q}(k)+T_{s}\bigg{(}-\frac{r_{s}}{L_{s}}i_{q}(k)-\omega_{r}(k) i_{d}(k)+\frac{1}{L_{s}}v_{q}(k)-\frac{\psi_{m}}{L_{s}}\omega_{r}(k)\bigg{)}. \tag{5b}\]  
This equation describes the updated current values \(i_{d}(k+1)\) and \(i_{q}(k+1)\) at the next time step \(k+1\) in terms of the different signal values and system parameters at the current time step \(k\).  
The motor speed is considered to remain constant over several time steps, as the electromechanical time constant of the motor drive is significantly smaller than the mechanical time constant [35]. This leads to the approximation \(\omega_{r}(k+1)\approx\omega_{r}(k)\). The electromagnetic torque \(T_{e}\) produced by the SPMSM is  
\[T_{e}(k)=\frac{3}{2}p\psi_{m}i_{q}(k) \tag{6}\]  
where \(p\) is the number of pole pairs of the motor. This model provides a fundamental understanding of the motor's operation employed in this paper, enabling effective design and analysis of control systems for SPMSMs.