## 3 Solver Optimization
### Sub-Interval Predictive Integration  
The relevant optimization originally introduced in [17] and here explained in detail, involves the use of an integrating method that divides the calculation step time into smaller ones (sub-intervals) for a more precise calculation without decreasing the step time. Since the integrating values are rotating vectors, the increase in precision is significant, especially at high speed. Moreover, the increase in computation complexity can be limited thanks to the appropriate simplification and reference frame selection. The (20) can be directly used for the calculation of the flux in \(k\) using the form given by (21) or as starting point for the prediction at \(k+1\). \[\mathbf{\varphi}_{k}=[T_{k}]^{-1}[M][T_{k}](T_{c}\mathbf{v}_{k}+\mathbf{\varphi}_{k-1}) \tag{21}\]  
Assuming a constant rotational speed during the step \(k\), (21) is transformed in (22). \[\mathbf{\varphi}_{k+1}=[T_{k+1}]^{-1}[M][T_{k+1}](T_{c}\mathbf{v}_{k}+\mathbf{\varphi}_{k}) \tag{22}\]  
In (22), only the available measured values (\(\mathbf{v}_{k}\)) and the approximated rotational matrix referred to the next step \([T_{k+1}]\) are used. As represented in Figure 3, during the interval \(k\), the electrical angle rotates from \(\theta_{k}\) to \(\theta_{k+1}\). Introducing now the virtual sub-division of \(k\), this rotation is then divided in \(m\) sub-intervals. The rotation angle \(\theta_{i}\) for any sub-interval of \(k\)\(i|_{1:m}\) is approximated as (23) by assuming that the rotation in interval \(k\) is the same as the previous one. \[\Delta\theta_{i}=\frac{\Delta\theta_{k}}{m}=\frac{\theta_{k}-\theta_{k-1}}{m} \tag{23}\]  
Figure 3: Discrete time interval sub-division diagram. The constant rotational matrix \([\Delta T_{i}]\) valid for each sub-interval \(i|_{1:m}\) in the step \(k\) is then calculated as (24). \[[\Delta T_{i}]=[T(\Delta\theta_{i})]=\Big{[}T\Big{(}\frac{\Delta\theta_{k}}{m} \Big{)}\Big{]} \tag{24}\]  
Given that the rotation at step \(k\) is described by \([T_{k}]=[T(\theta_{k})]\), the rotation for a generic sub-interval is \([T_{i}]=[T(\theta_{i})]=[T(\theta_{k}+i\cdot\Delta\theta_{i})]\). For the property of the rotation matrix the direct and inverse transformation can be expressed as (25). \[[T_{i}]= [T(\theta_{k}+i\cdot\Delta\theta_{i})]=[T_{k}]([\Delta T_{i}])^{i}\] \[[T_{i}]^{-1}= [T(\theta_{k}+i\cdot\Delta\theta_{i})]^{-1}=[T_{k}]^{-1}([\Delta T _{i}]^{-1})^{i} \tag{25}\] \[\forall i|_{1:m}\text{ of interval }k\text{, in which }\Delta\theta_{i}\text{ in interval }k\text{ is constant}\]  
Using (25) the iterative integration (22) becomes (27). \[\mathbf{\varphi}_{i+1}=[T_{i}]^{-1}[M][T_{i}]\Big{(}\frac{T_{c}}{m} \mathbf{v}_{k}+\mathbf{\varphi}_{i}\Big{)} \tag{26}\] \[\mathbf{\varphi}_{i+1}=[T_{k}]^{-1}([\Delta T_{i}]^{-1})^{i}[M][T_{k} ]([\Delta T_{i}])^{i}\Big{(}\frac{T_{c}}{m}\mathbf{v}_{k}+\mathbf{\varphi}_{i}\Big{)} \tag{27}\]  
Additional simplifications can be applied by grouping the calculations in the same reference frame. So far all the inputs, outputs and states in (27) are kept into their respective reference frames (_natural_ frames). This means that, since the magnetic coupling requires the terms to be into the same reference frame, the stator values are transformed into the rotor reference frame to properly be able to have flux interaction and then transformed back at each sub-interval. To optimize this step, the general idea is then to make the calculations in the rotor reference frame for the \(i|_{1:m}\) iterations and then transform back in the natural frame only the final results. To illustrate this, (27) is presented again as (28), this time with the reference frames shown explicitly in the superscripts.