## 3 Proposed Method
### Supervisor Block  
The Supervisor Block decides whether \(df_{m}\) Estimator Block has to be executed in the next interaction and whether the filter of the Tracking Frequency has to be reset. The Supervisor block (Figure 3) has two inputs and three outputs. The inputs are the output of the \(df_{m}\) Estimator block, \(df_{m}\), and the output of the Tracking Frequency block, \(f_{m}\). The output \(ex\_dfm\) of the Supervisor block indicates if the \(df_{m}\) Estimator block has to be executed in the next iteration. The output _reset_ determines if the Tracking Frequency block has to be reset and, if so, the output \(f_{0}\) indicates the new central frequency of the Tracking Frequency block. To obtain these outputs, the Supervisor block compares the frequency, \(f_{m}\), determined by the Tracking Frequency block, with an estimation of this frequency. This estimation is derived from the distance between frequencies, \(df_{m}\), and the index of the current component used to detect the speed, \(\#f\). If the difference between both is not too large, then the outputs \(ex\_dfm\) and _reset_ are kept. Otherwise, the outputs are updated to the correct values. To decrease the computational cost, this comparison is not made every iteration; instead it is checked every \(IM\) iterations. The block diagram of the supervisor is shown in Figure 7. The inputs are \(df_{m}\) and \(f_{m}\), and the outputs are \(ex\_dfm\), \(f_{0}\), and _reset_. The others are parameters of the algorithm. In the diagram, triangles implement arithmetic operations such as subtraction or multiplication. These triangle blocks also implement comparative operations such as \"greater than\" and \"greater than or equal to.\" When these blocks implement a comparative operation, the output is a Boolean value, \(True(T)\) or \(False(F)\). Trapezoids are multiplexers and they are controlled by a Boolean input that selects one input or the other, depending on the value of the selected input. Blocks with the symbol \(Z^{-1}\) are delayers. This block delays the input sample by one iteration. The Mean block calculates the average value of the last \(L\) samples of \(df_{m}\) according to:  
\[M_{df_{m}}[n]\ =(1/L\ )\sum_{i=0}^{L-1}df_{m}[n-i] \tag{17}\]  
The Counter True block counts how many times the input signal has had the value \(True\) in the last \(L\) samples. If the Boolean value \(True\) is replaced by \(1\) and \(False\) by \(0\), then the output of this block can be calculated according to:  
\[C_{t}=\sum_{i=0}^{L-1}B[n-i] \tag{18}\]  
The blocks AND and OR are blocks that implement the logical operations with these names. The block with the symbol \(|\cdot|\) calculates the absolute value of its input. According to Figure 7, the input \(df_{m}\) is used only when the \(df_{m}\) Estimator block has been executed in the present iteration, in other words, when the output \(ex\_df_{m}\) had the Boolean value \(True\) in the previous iteration. When the \(df_{m}\) Estimator block is not executed, the last value stored by the delayer is used. When \(df_{p}\) is calculated, then the mean value is calculated from the last \(L\) values of \(df_{p}\), and  
Figure 7: Block diagram of the Supervisor. the estimation of the position of \(f_{m}\) is also determined. This estimation, \(f_{me}\) is obtained by multiplying \(df_{p}\) by \(\#f\). The parameter \(\#f\) is the position or index of the frequency peak used to detect the speed. The estimation of \(f_{me}\) is not precise enough to be used to calculate the motor speed. For this reason, the Tracking Frequency block is used to improve precision. When \(f_{me}\) has been calculated, the distance between \(f_{me}\) and \(f_{m}\), named \(df_{a}\), is calculated. This is done with a subtract block and an absolute value block. The maximum allowable distance between both frequencies, \(w\), is obtained by calculating the mean value of \(df_{p}\) from the last \(L\) values, and multiplying this mean value by the parameter \(p\), \(p\) being a value between 0 and 1.