## 4 Description of the Developed Method
### Harmonics Selection  
The method shown below aims to identify, among all the values obtained after applying a DFT to the input signal, the values that are real and those that result from leakage and picket-fence effects. The algorithm for performing the identification is based on [15], with some equations from [15] being modified. The modifications made are detailed below. The rms value of the harmonic subgroup for the fundamental harmonic, at 50 Hz, is calculated in (18).  
\[G_{\text{sg,1}}^{2}=\sum_{i=-2}^{2}C_{\text{11}+i}^{2} \tag{18}\]  
where \(C_{\text{11}}\) is the effective value of the spectral component corresponding to 50 Hz. It is the same value as \(K_{\text{11}}\) in Figure 1. They are equivalent, maintaining the nomenclature \"\(C_{x}\)\" to preserve similarity with the standard. Compared to [15], two additional spectral components are added to the calculation of the effective value of the harmonic subgroup, as shown in Figure 5.  
By adding these two bands, part of the energy dispersed by the spectral leakage and the picket-fence effect are included in the 50 Hz harmonic subgroup, preventing them from affecting the calculation of adjacent harmonic subgroups. Hence, they are included in Equation (18). The rms value of the harmonic subgroups other than the fundamental is computed following (19):  
\[G_{\text{sg,n}}^{2}=\sum_{i=-1}^{1}C_{k+i}^{2} \tag{19}\]  
where \(n\) indicates the order number of the harmonic for which the harmonic subgroup is being calculated, \(n>1\).  
The rms value of the first interharmonic subgroup, corresponding to the group between 5 and 50 Hz (subharmonics), using the developed Equation (20):  
\[C_{\text{sg,1}}^{2}=\sum_{i=4}^{8}C_{k+i}^{2} \tag{20}\]  
Rms value of the second interharmonic subgroup (21):  
\[C_{\text{sg,2}}^{2}=\sum_{i=3}^{8}C_{k+i}^{2} \tag{21}\]  
Rms value of the remaining interharmonic subgroups is calculated according to Equation (22).  
\[C_{\text{ig,n}}^{2}=\sum_{i=2}^{8}C_{k+i}^{2} \tag{22}\]  
Figure 5: Description of the state of the harmonic subgroups with the new method.  
The minimum value of the first harmonic subgroup (_MVFHS_) is defined as:  
\[MVFHS=K_{LS}*G_{sg,1}=0.003\sqrt{\left(\sum_{i=-2}^{2}C_{11+i}^{2}\right)} \tag{23}\]  
The constant \(K_{LS}\) relates the sensitivity and error of the data-acquisition system to the results obtained in the DFT. After observing the datasheets of numerous sensors, the authors have determined that the value of \(K_{LS}\) = 0.003 effectively enables distinguishing the results that a sensing system could not acquire. In the next stage, all values in the DFT output vector that are less than the _MVFHS_ value are removed, as shown in Figure 6a.  
For the next stage of the method, the minimum value of the interharmonic subgroups (_MVIS_) is defined as:  
\[MVIS_{n}=K_{RS}*C_{ig,n}=0.1*C_{ig,n} \tag{24}\]  
The value of \(K_{RS}\) corresponds to a constant value, similar to \(K_{LS}\), as a design parameter that determines the minimum value a spectral component must have to be employed in the calculation of the interharmonic subgroup. All spectral component values lower than the _MVIS_ of that interharmonic subgroup will be removed from the DFT output as they are considered products of peak fence and/or leakage effects. Empirically, a value of \(K_{RS}\) = 0.1 has been found to provide optimal results in most cases.  
Figure 6: Spectral components filtering process flowchart: (**a**) first part of the algorithm (**b**) second part of the algorithm.  
Figure 6 represents how the method works with the DFT output to define the spectral components considered correct. Figure 6a shows that the application of the algorithm makes the first selection among the spectral components based on _MVFHS_. Figure 6b shows the second selection of the spectral components based on _MVIS_. Note that the equations related to every subprocess have been included in its corresponding block.