# Sensorless HSPMSM Control of an Improved SMC and EKF Based on Immune PSO
## 3 Design of the Speed Controller Based on Improved SMC
### Design of Traditional-Speed SMC  
The mathematical model of the HSPMSM in the d-q coordinate system is as follows [37]:  
\[\left\{ \begin{array}{l}u_{d}=Ri_{d}+L_{s}di_{d}/dt-p_{n}\omega_{e}L_{s}i_{q} \\ u_{q}=Ri_{q}+L_{s}di_{q}/dt+p_{n}\omega_{e}L_{s}i_{d}+p_{n}\omega_{e}\varphi_{ f}\\ Jd\omega_{e}/dt=1.5p_{n}\varphi_{f}i_{q}-T_{L}\end{array} \right. \tag{11}\] \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Arithmetic** & **Iterations** & **Value** & **Iterations** &
\begin{tabular}{c} **Optimal Fitness** \\ **Value** \\ \end{tabular} \\ \hline PI-PSO & 12 & 71.2878320918268 & 48 & 26.7295406097632 \\ \hline SMC-PSO & 12 & 29.1013543176795 & 47 & 26.8191574261835 \\ \hline SMC-w-PSO & 12 & 31.2474590327885 & 45 & 25.9442102638115 \\ \hline SMC-w-IPSO & 12 & 25.3497159998008 & 46 & 17.3148124002699 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Performance analysis of multiple optimization strategies. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Arithmetic** & **Iterations** & **Value** & **Iterations** &
\begin{tabular}{c} **Optimal Fitness** \\ **Value** \\ \end{tabular} \\ \hline PI-PSO & 17 & 67.0864712052134 & 29 & 52.057357828006 \\ \hline SMC-PSO & 6 & 29.1013543176795 & 47 & 26.8191574261835 \\ \hline SMC-w-PSO & 4 & 26.6556819783912 & 4 & 26.6556819783912 \\ \hline SMC-w-IPSO & 17 & 24.272268595533 & 49 & 17.0101770076945 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Performance analysis of multiple optimization strategies. Figure 2: Convergence curve of the algorithm fitness function. where \(i_{d}\), \(i_{q}\), and \(U_{d}\), \(U_{q}\) are the current components and voltage components in the \(d\)-\(q\) coordinate system, respectively, \(p_{n}\) is the polar logarithm, and the other characters are used as in Equation (1). The HSPMSM uses rotor magnetic field orientation control with \(i_{d}\) = 0, defines \(x_{1}\) = \(\omega_{ref}\) - \(\omega_{e}\), \(x_{2}\) = \(\dot{x_{1}}\) = \(-\dot{\omega_{e}}\) as the system state variables and uses \(u\) = \(\dot{i_{q}}\), \(D\) = \(3p_{n}\varphi_{f}/2J\) to obtain the system state equation as:  
\[\left[ \begin{array}{c}\dot{x_{1}}\\ \dot{x_{2}}\end{array} \right]=\left[ \begin{array}{cc}0&1\\ 0&0\end{array} \right]\left[ \begin{array}{c}x_{1}\\ x_{2}\end{array} \right]+\left[ \begin{array}{c}0\\ -D\end{array} \right]u \tag{12}\]  
The SMSs--the LSMS, GSMS, and ISMS--are used to design the normal SMC, global SMC, and integral SMC for control. Because the GSMC is robust in both converging and sliding modes, it has better robustness than the normal SMC. The integral SMC, which is obtained by introducing an integral term in the SMS, can suppress the steady-state error of the system and enhance the robustness of the system. In this paper, three types of SMSs are applied separately for convergence law improvement. An optimal controller is selected by Lyapunov stability proof and characteristic analysis for subsequent simulation verification [27]. The linear SMS function is defined as:  
\[s=cx_{1}+x_{2} \tag{13}\]  
where \(c\) indicates the parameter to be designed, and \(c\) > 0. To ensure that the HSPMSM has favorable dynamic quality, the exponential convergence law method is normally adopted, where the exponential convergence law function is Formula (14), and the obtained controller expression is Formula (15):  
\[\dot{s}=-\varepsilon\text{sgn}(s)-qs \tag{14}\]  
\[u=\left[cx_{2}+\varepsilon\text{sgn}(s)+qs\right]/D \tag{15}\]  
The global SMC function is defined as:  
\[s_{1}=x_{2}+c_{1}x_{1}-h(0)\exp(-\lambda t) \tag{16}\]  
where \(h(0)=x_{2}(0)+c_{1}x_{1}(0),c_{1}>0,\lambda>0\). The SMC using the global SMS and exponential convergence law is as follows:  
\[u_{1}=\left[c_{1}x_{2}+\lambda h(0)\exp(-\lambda t)+\varepsilon\text{sgn}(s_ {1})+qs_{1}\right]/D \tag{17}\]  
The integral SMS function is defined as:  
\[s_{2}=x_{2}+c_{2}x_{1}+c_{3}\int_{0}^{t}x_{1}dt \tag{18}\]  
where \(c_{2}>0,c_{3}>0\).