# Multi-Phase Stator Current Tracking with Gradual Penalization of Commutations
## 3 Proposal
### Algorithm  
According to the previous ideas, in the proposal, the control action is determined by the region that contains a gap vector with a modified metric. The region is determined by hyper-planes, making it easy to compute online. After this, an extra layer is used to decide whether to implement the computed optimal VV or the previous one in order to offset commutation frequency with tracking accuracy. The following algorithm is a step-by-step description of the method.  
1. Compute the \(r(k+2)\) in \(\alpha-\beta-x-y\) axes using (2).
2. The one-step ahead prediction for stator currents is computed using (5).
3. The weighted gap for the desired reference \(r(k+2)\) is computed using (14).
4. The hyper-quadrant \(Q\), where \(g_{\alpha\beta xy}\) lies, is computed as \[Q=1+s_{\alpha\beta xy}\cdot(8,\ 4,\ 2,\ 1)^{\intercal},\] (17) where \(s_{\alpha\beta xy}\) is a one-by-four vector of signs computed as \[s_{\alpha\beta xy}=\big{(}\text{sgn}(g_{\alpha}),\ \text{sgn}(g_{\beta}),\ \text{sgn}(g_{x}),\ \text{sgn}(g_{y})\big{)},\] (18) where sgn stands for the sign function.
5. Retrieve from Table 2 the three hyper-planes (\(\Pi_{1}\), \(\Pi_{2}\) and \(\Pi_{3}\)) that are active for \(Q\). Compute the vector connecting the VVs as \[n=B\big{(}V_{i}-V_{j}\big{)},\] (19) where \(i\) and \(j\) are the indices or the VV that define the hyper-plane.
6. Compute the position of \(g_{\alpha\beta xy}\) with respect to the active hyper-planes by multiplying the normal vector by \(g_{\alpha\beta xy}\) and applying the sign function as \[s_{j}=\text{sgn}(g_{\alpha\beta xy}^{\intercal}\cdot n_{j}), \tag{20}\]  
where \(n_{j}\) with \(j=1,2,3\) are the vectors orthogonal to planes \(\Pi_{j}\).
7. Obtain the selected VV from the triple \(s_{\Pi}=(s_{1},s_{2},s_{3})\) as \[I_{VV}=1+s_{\Pi}\cdot(4,\ 2,\ 1)^{\intercal},\] (21) The selected VV is computed as \(VV^{sel}=T_{VV}(Q,I_{VV})\), with the values of \(T_{VV}\) provided in Table 3.
8. Compute \(SC(k+1)\) associated with \(VV^{sel}\), as indicated by Equation (13).
9. Compute \(J_{0}\) according to (16) and the permissible cost \(J_{a}=\overline{J}_{0}/J_{ap}\), where \(J_{ap}\) is provided by Figure 2 and \(\overline{J}_{0}\) represents the mean value of \(J_{0}\). Now, if \(J_{0}<J_{a}\), then the previous control action is maintained \(VV^{app}(k+1)=VV^{app}(k)\), else the computed VV is applied: \(VV^{app}(k+1)=VV^{sel}\).
10. Issue \(VV^{app}(k+1)\); wait for the next sampling period and go back to 1.  
\begin{table}
\begin{tabular}{c c c c} \hline \(Q\) & \(\Pi_{1}\) & \(\Pi_{2}\) & \(\Pi_{3}\) \\ \hline
01 & 05-10 & 05-11 & 09-10 \\
02 & 07-11 & 07-10 & 09-11 \\
03 & 05-10 & 05-11 & 09-10 \\
04 & 05-10 & 05-11 & 09-10 \\
05 & 07-10 & 07-08 & 09-10 \\
06 & 07-10 & 07-08 & 10-11 \\
07 & 02-10 & 02-08 & 07-10 \\
08 & 02-10 & 02-08 & 07-10 \\
09 & 03-11 & 03-06 & 05-11 \\
10 & 03-11 & 03-06 & 05-11 \\
11 & 03-06 & 02-03 & 05-06 \\
12 & 03-06 & 03-04 & 05-06 \\
13 & 02-04 & 02-08 & 03-04 \\
14 & 02-04 & 02-08 & 03-04 \\
15 & 02-06 & 02-04 & 03-06 \\
16 & 02-04 & 02-08 & 03-04 \\ \hline \end{tabular}
\end{table}
Table 2: Active hyper-planes for each hyper-quadrant \(Q\).  
\begin{table}
\begin{tabular}{c c c c c c c c} \hline \multicolumn{9}{c}{\(I_{VV}\)} \\ \hline \(Q\) & \(1\) & \(2\) & \(3\) & \(4\) & \(5\) & \(6\) & \(7\) & \(8\) \\ \hline
01 & 05 & 05 & 11 & 11 & 09 & 10 & 09 & 10 \\
02 & 07 & 07 & 10 & 10 & 09 &  
Figure 3 summarises the described algorithm in a flowchart.  
Figure 3: Flowchart of the proposal. The numbers on the left correspond to the steps in the algorithm.  
Figure 2: Allowed zone (AZ) for commuting as a function of the future number of switch changes (SCs).