## 3 Control Algorithm
### Rotor Position Observer  
As mentioned previously, to further obtain rotor position information, the electric angular velocity tracking error should be calculated. As can be seen from (10) and (11), when \(\hat{i}_{d}=i_{d}\) and \(\hat{i}_{q}=i_{q}\), \(\hat{\omega}_{e}\) will be equal to \(\omega_{e}\). Therefore, if (11) is subtracted from (10), the existing observed current can be utilized to build the following mathematical model  
\[\frac{\mathrm{d}}{\mathrm{d}t}\left[\begin{array}{c}\Delta i_{d}\\ \Delta i_{q}\end{array}\right]+\left[\begin{array}{cc}R/L_{d}&0\\ 0&R/L_{q}\end{array}\right]\left[\begin{array}{c}\Delta i_{d}\\ \Delta i_{q}\end{array}\right]=\left[\begin{array}{cc}L_{q}/L_{d}&0\\ 0&-L_{d}/L_{q}\end{array}\right]\left[\begin{array}{c}\omega_{e}i_{q}/-\hat {\omega}_{e}\hat{i}_{q}\\ \omega_{e}i_{d}/-\hat{\omega}_{e}\hat{i}_{d}\end{array}\right] \tag{12}\]  
where \(\Delta i_{d}=i_{d}\)-\(\hat{i}_{d}\) and \(\Delta i_{q}=i_{q}\)-\(\hat{i}_{q}\) represent the tracking error of the \(d\)-\(q\)-axes current, respectively. \(\Delta\omega_{e}=\omega_{e}-\hat{\omega}_{e}\), represents the electric angular velocity tracking error. Then, (12) can be transformed into  
\[\left[\begin{array}{cc}L_{d}/L_{q}&0\\ 0&L_{q}/L_{d}\end{array}\right]\frac{\mathrm{d}}{\mathrm{d}t}\left[\begin{array} []{c}\Delta i_{d}\\ \Delta i_{q}\end{array}\right]+\left[\begin{array}{cc}R/L_{q}&0\\ 0&R/L_{d}\end{array}\right]\left[\begin{array}{c}\Delta i_{d}\\ \Delta i_{q}\end{array}\right]+\left[\begin{array}{cc}-\omega_{e}&0\\ 0&\omega_{e}\end{array}\right]\left[\begin{array}{c}i_{q}t-\hat{i}_{q}\\ i_{d}t-\hat{i}_{d}\end{array}\right]=\left[\begin{array}{c}\Delta\omega_{e }\hat{i}_{q}\\ -\Delta\omega_{e}\hat{i}_{d}\end{array}\right] \tag{13}\]  
According to the above analysis, the electric angular velocity tracking error \(\Delta\omega_{e}\) can be directly calculated by the combined action from \(\Delta i_{d}\) and \(\Delta i_{q}\). Thus, (13) should be rewritten as  
\[\Delta\omega_{e}(\hat{i}_{d}+\hat{i}_{q})=\frac{L_{d}}{L_{q}}\frac{\mathrm{d} \Delta i_{d}}{\mathrm{d}t}+(\frac{R}{L_{q}}-\omega_{e})\Delta i_{d}-[\frac{L_{q }}{L_{d}}\frac{\mathrm{d}\Delta i_{q}}{\mathrm{d}t}+(\frac{R}{L_{d}}+\omega_{e} )\Delta i_{q}] \tag{14}\]  
Consequently, a \(d\)-\(q\)-axes current error PI controller mainly associated with the \(\Delta i_{d}\) and \(\Delta i_{q}\) is constructed to obtain the electric angular velocity tracking error \(\Delta\omega_{e}\) as  
\[\int_{0}^{t}\Delta\omega_{e}=(\frac{k_{id}}{s}+k_{pd})\Delta i_{d}-(\frac{k_{ iq}}{s}+k_{pq})\Delta i_{q} \tag{15}\]  
where \(k_{p}\) and \(k_{i}\) represent the proportional and integral coefficients of PI controllers, respectively. Thereafter, the angular velocity of the rotor can be estimated by  
\[\hat{\omega_{e}}=k_{\omega_{e}}\int_{0}^{t}\Delta\omega_{e} \tag{16}\]  
where \(k_{\omega e}\) is the proportionality coefficient of \(\Delta\omega_{e}\). In this way, once the two estimated currents reach the real currents, the rotor speed error will be around zero, and then the estimated rotor speed will be stable.  
Figure 5: A diagram of the current observer of the \(d\)–\(q\)-axes.  
Lastly, the rotor position angle \(\theta\) can be calculated by the integral operation of \(\hat{\omega}_{e}\) as  
\[\theta=\frac{1}{s}\hat{\omega}_{e} \tag{17}\]  
Figure 6 shows the composition of the rotor position observer. It is observed that the position and speed information of the machine can be extracted from two PI controllers associated with the tracking errors of \(d\)-\(q\)-axes current.