## 4 Direct Predictive Torque Control Algorithm for SRM
### The DPTC Algorithm
Therefore, it is only necessary to find the scheme that minimizes the copper loss in the torque allocation set to determine the optimal commutation operation. Since the copper loss is proportional to the root mean square (RMS) of the phase current, the cost function is constructed as  
\[J=\sum_{p=1}^{3}i_{p}(k+1)^{2} \tag{25}\]  
where the phase current \(i_{p}(k+1)\) is estimated using the LUT \(i_{p}(T_{p},\theta_{p})\). To ensure that the proposed DPTC algorithm can be applied safely, the constraint on the current needs to be defined. Therefore, the cost function is rewritten as  
\[J=\sum_{p=1}^{3}i_{p}(k+1)^{2}+I_{m}(k+1) \tag{26}\]  
where the function \(I_{m}(k+1)\) is defined as (27) to ensure that the phase current does not exceed the maximum admitted current \(i_{\text{max}}\). \[I_{m}(k+1)=\left\{ \begin{array}{cc}\infty&i_{p}(k+1)\geq i_{\text{max}}\\ 0&i_{p}(k+1)<i_{\text{max}}\end{array} \right. \tag{27}\]  
Therefore, by minimizing the cost function (26), the optimal torque allocation scheme can be determined to improve both torque ripple and copper loss. It is worth noting that since the cost function is only related to the phase current, the proposed DPTC method avoids the work of setting weighting parameters compared to the traditional MPTC method. However, in the actual application of the algorithm, because the execution of the algorithm requires a certain time cost, there is usually a problem of time delay. If this delay problem is ignored, the control effect will be affected. In this paper, the problem is solved by the method of delay compensation. The cost function (26) is rewritten as  
\[J=\sum_{p=1}^{3}i_{p}(k+2)^{2}+I_{m}(k+2) \tag{28}\]  
To demonstrate the optimization process of the proposed DPTC algorithm, the flowchart shown in Figure 5 is given. The execution process of the proposed algorithm can be described as:  
Step 1: Obtain the total torque command \(T_{ref}\) from the speed controller. Step 2: \(\theta(k)\) and \(i_{p}(k)\) are sampled at the beginning of period \(k\), and the phase flux linkage \(\varphi_{p}(k)\) is estimated. Figure 5: Flowchart of the proposed DPTC algorithm. Step 3: Calculate the expected flux linkage \(\varphi(k+1)\) at the end of this control period (namely as \(k+1\)) by the duty cycle calculated previously. Then, the corresponding phase current \(i(k+1)\) can be estimated. Step 4: The flux linkage boundaries \(\varphi_{in,max}(k+2)\) and \(\varphi_{ou,min}(k+2)\) at the end of period \(k+1\) are predicted by setting the duty cycle in (10) to \(1\) and \(-1\), respectively. Then, the corresponding torque boundaries \(T_{in,max}(k+2)\) and \(T_{ou,min}(k+2)\) are estimated. Step 5: Assuming that the flux linkage in the \(k+1\) control period is constant, predict the torque value \(T^{\prime}_{p}(k+2)\) and calculate the commutation factor \(\delta\) using (18). Step 6: Partition the commutation into two cases with \(\delta\) and modify the torque boundary. Then, the torque allocation set is obtained by formulas (21) and (24). Step 7: Evaluate the torque allocation scheme using the cost function (28). Step 8: Determine the optimal torque allocation scheme that minimizes the cost function.