*3.2. Implemented Algorithm*

The currents in the IRFOC are always in a dynamic state. The current at the *k* + 1 instant cannot be sensed at present. Therefore, an approach algorithm that takes advantage of the historic current and voltage is proposed.

The historic data of the current, voltage, and field-oriented angle, e.g., *i*(*k* − *n*), *i*(*k* − *n* + 1) ... *i*(*k* − 1), *i*(*k*), as shown in Figure 4, can be recorded in the random-access memory (RAM) of the DSP or MCU. According to (14), the current at the instant *k* − *n* + 1 can be predicted with the current *i*(*k* − *n*) and *v*(*k* − *n* + 1). That is

$$\begin{cases} \begin{array}{l} i\_{qs}^\*(k-n+1) = \frac{C' \times A - D' \times E'}{A^2 + F' \times E'}\\ i\_{ds}^\*(k-n+1) = \frac{C' \times F' + D' \times A}{A^2 + F' \times E'} \end{array} \end{cases} \tag{18}$$

where *C* = *<sup>δ</sup>Ls Ts iqs*(*<sup>k</sup>* <sup>−</sup> *<sup>n</sup>*) + *vqs*(*<sup>k</sup>* <sup>−</sup> *<sup>n</sup>* <sup>+</sup> <sup>1</sup>), *<sup>D</sup>* <sup>=</sup> *Ls Ts ids*(*k* − *n*) + *vds*(*k* − *n* + 1), *E* = *ωe*(*k* − *n*)*Ls*, *F* = *ωe*(*k* − *n*)*δLs*, *i* ∗ *qs*(*k* − *n* + 1) and *i* ∗ *ds*(*k* − *n* + 1) are the predicted currents at the instant *k* − *n*.

**Figure 4.** Proposed implemented algorithm diagram.

The accuracy of the predicted current at the next instant can be improved with the data at the previous instants. The current and voltage are always in a dynamic state because the period of the current and voltage sample is very short and the closed-loop control period is usually the same as the sample period. Therefore, the predicted current is not stable enough to tune *θcom*. By using the saved data, a filter for the predicted current can be used to improve the stability of the predicted and feedback current as

$$i\_{qds}^{\*} = \frac{i\_{qds}^{\*}(k-4) + i\_{qds}^{\*}(k-3) + i\_{qds}^{\*}(k-2) + i\_{qds}^{\*}(k-1)}{4} \tag{19}$$

$$i\_{qds} = \frac{i\_{qds}(k-4) + i\_{qds}(k-3) + i\_{qds}(k-2) + i\_{qds}(k-1)}{4} \tag{20}$$

where *i* ∗ *qds* = *i* ∗ *qs* − *ji*<sup>∗</sup> *ds* and *i qds* = *iqs* − *jids* are the predicted current and the actual feedback current, respectively. Then, according to Equations (16) and (17), the cost function can be calculated. Finally, *θcom* can be tuned using the PI regulator in Figure 3.

#### **4. Simulation Results**
