## 3 Description of Control Schemes
### Integrating EKF with MPC  
The EKF, in reality, is an extension of a simple Kalman filter for nonlinear systems and works on the principle of the least square technique. It is based on successive linearization of the nonlinear state space model at each time instant around the previous estimate called Jacobian which is the linearized version of the nonlinear system. The Jacobians are calculated at each iteration using Equation (17a,b) [26].  
\[\phi^{k}=\left.\frac{\partial f}{\partial x}\right|_{x^{k},\mu^{k}} \tag{17a}\] \[\mathbf{H}^{k}=\left.\frac{\partial h}{\partial x}\right|_{x^{k}} \tag{17b}\]  
Equation (17a) is the linearized version of the system matrix while Equation (17b) represents the linearized version for the output of the PMSM. Linearized function \(\phi^{k}\) and output function \(\mathbf{H}^{k}\) of the nonlinear mathematical model are calculated. In the analysis of EKF, online computation of Jacobian matrices of both functions is necessary to predict the states and covariances [31]. Prediction and updating are the two major steps used for the estimation of the states. Integrating the EKF as an observer with the MPC, the following changes are to be made so that the simulation results can be compared with the proposed MPC-UKF scheme.  
Step 1: Prediction  
\[\mathbf{\bar{x}}^{k}=\mathbf{F}\big{(}\mathbf{\bar{x}}^{k-1}\big{)}\mathbf{\bar {x}}^{k-1}+\mathbf{B}\mathbf{u}^{k-1} \tag{18a}\] \[\mathbf{P}^{k}=\phi^{k-1}\mathbf{P}^{k-1}(\phi^{k-1})^{T}+\mathbf{Q}^{k} \tag{18b}\]  
Equation (18a) estimates the mean of next values for state-space vector \(\mathbf{\bar{x}}^{k}\) in terms of the previous values of the states vector \(\mathbf{\bar{x}}^{k-1}\) and the input vector \(\mathbf{u}^{k-1}\) at instant \(k-1\). The input vector is directly calculated from the stator voltages and converted into \(dq\) transformation framework. Equation (18b) represents the estimation of covariance \(\mathbf{P}^{k}\) in terms of Jacobian of the system matrix \(\phi^{k-1}\), initial assumption of covariance \(\mathbf{P}^{k-1}\), and addition of process noise \(\mathbf{Q}^{k}\) in the system.  
Step 2: Measurement  
\[\mathbf{\bar{x}}^{k}=\mathbf{\bar{x}}^{k-1}+\mathbf{K}^{k}\Big{(}\mathbf{y}^ {k}-\mathbf{H}\mathbf{\bar{x}}^{k-1}\Big{)} \tag{19a}\] \[\mathbf{P}^{k}=\mathbf{P}^{k-1}-\mathbf{K}^{k}\mathbf{H}\mathbf{P}^{k} \tag{19b}\]\[\mathbf{K}^{k}=\mathbf{P}^{k-1}\mathbf{H}^{T}\Big{(}\mathbf{H}\mathbf{P}^{k-1} \mathbf{H}^{T}+\mathbf{R}^{T}\Big{)}^{-1} \tag{19c}\] \[\mathbf{P}^{k}=\Big{(}1-\mathbf{K}^{k}\mathbf{H}^{k-1}\Big{)} \mathbf{P}^{k-1}(1-\mathbf{K}^{k}\mathbf{H}^{k-1})^{-1}+\] \[\mathbf{K}^{k}\mathbf{R}^{k}(\mathbf{K}^{k})^{T} \tag{19d}\]  
Similarly, in the measurement phase, Equation (19a) updates the mean in stepwise process, such as (a) by measuring the direct, measurable states (stator currents) of the system that are in vector \(\mathbf{y}^{k}\), (b) the term \(\mathbf{H}\mathbf{x}^{k-1}\) singles out the estimated states from the mean vector \(\mathbf{\bar{x}}^{k-1}\), and (c) the difference between Equation (19a,b) is multiplied by Kalman Gain \(\mathbf{K}^{k}\), which is calculated using Equation (19c). In Kalman gain, measurement noise \(\mathbf{R}^{T}\) is added. Finally, Equation (19d) updates the covariance. This iterative process repeats itself until the specified number of iterations is achieved in the algorithm [3].