**3. Model-Based Predictive Algorithm and Implementation**

*3.1. Model-Based Predictive Algorithm*

In the discrete model, based on Equations (11) and (12), the d-axis and q-axis currents at the *k* + 1 instant are predicted by

$$\begin{cases} & \left( R\_s + \frac{\delta I\_s}{T\_s} \right) i\_{qs}(k+1) + \omega\_c L\_s i\_{ds}(k+1) = \frac{\delta I\_s}{T\_s} i\_{qs}(k) + \upsilon\_{qs}(k+1) \\ & -\omega\_c \delta L\_s i\_{qs}(k+1) + (R\_s + \frac{\delta I\_s}{T\_s}) i\_{ds}(k+1) = \frac{\delta I\_s}{T\_s} i\_{ds}(k) + \upsilon\_{ds}(k+1) \end{cases} \tag{13}$$

Then,

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

where *A* = *Rs* + *<sup>δ</sup>Ls Ts* , *<sup>C</sup>* <sup>=</sup> *<sup>δ</sup>Ls Ts iqs*(*k*) + *vqs*(*<sup>k</sup>* <sup>+</sup> <sup>1</sup>), *<sup>D</sup>* <sup>=</sup> *<sup>δ</sup>Ls Ts ids*(*k*) + *vds*(*k* + 1), *E* = *ωe*(*k*)*Ls*, and *F* = *ωe*(*k*)*δLs*. The voltages *vds*(*k* + 1) and *vqs*(*k* + 1) are the d-axis and q-axis voltages at *k* + 1 instant, respectively. When the IRFOC is realized in a digital signal processor (DSP) or microcontroller unit (MCU), *vds*(*k* + 1) and *vqs*(*k* + 1) can be obtained by the pulse width modulation (PWM) duty cycle at the *k* instant because the PWM duty cycle calculated at the *k* instant will be active at the *k* + 1 instant. Therefore, *vds*(*k* + 1) and *vqs*(*k* + 1) do not need to be predicted.

Based on (14), the predicted currents, *iqs*(*k* + 1) and *ids*(*k* + 1), at the *k* + 1 instant can be obtained without the rotor field-oriented angle. According to Equations (13) and (14), the stator resistance *Rs* is needed and varies with temperature. However, the variation in the stator resistance can be neglected because it is very small compared with the other parts of Equation (14). Therefore, the stator resistance on the motor plate can be used. The predictive model control diagram is shown in Figure 2. *θcom* in Figure 2 is the compensated angle of the rotor field-oriented error; *θwe* is the rotor field-oriented angle with compensation; *ian*(*k*), *ibn*(*k*), and *icn*(*k*) are the three-phase currents at the *k* instant; *van*(*k* + 1), *vbn*(*k* + 1), and *vcn*(*k* + 1) are the phase voltages at the *k* + 1 instant; *idsf ed*(*k* + 1) and *iqsf ed*(*k* + 1) are the d-axis and q-axis currents based on the feedback current at the *k* + 1 instant.

**Figure 2.** Control diagram of model-based predictive rotor field-oriented angle compensation.

The cost function is *g*(*k* + 1).

$$\log(k+1) = p\_1\lg\_1(k+1) + p\_2\lg\_2(k+1) + \dots + p\_n\lg\_n(k+1)\tag{15}$$

where *p*1, *p*<sup>2</sup> ... *pn* are the weighting coefficients and *p*<sup>1</sup> + *p*<sup>2</sup> + ... + *pn* = 1. The functions *g*1(*k* + 1), *g*2(*k* + 1) ... *gn*(*k* + 1) are the different optimization objective cost functions. Here,

$$\lg\_1(k+1) = i\_{ds}^\*(k+1) - i\_{ds}(k+1) \tag{16}$$

$$g\_2(k+1) = i\_{qs}^\*(k+1) - i\_{qs}(k+1) \tag{17}$$

If the rotor field-oriented angle is accurate, then *g*1(*k* + 1) = 0 and *g*2(*k* + 1) = 0. Therefore, *g*(*k* + 1) = 0. If the *g*(*k* + 1) = 0, then the angle *θwe* will be compensated by *θcom*. The proportional integral (PI) regulator shown in Figure 3 is used to linearly tune the *θcom*. Zero is used as the input of the PI regulator. It means that the rotor field-oriented angle error is none.

**Figure 3.** PI regulator used to tune the *θcom*.
