## 3 Measurement Improvement by Time Aggregation  
### Calculation of the Ideal Aggregation Time to Find the Common RMS Value  
In the examples of the previous section, the interactions between tones (interharmonic or not synchronized with the acquisition window) were studied. These interactions are due to the spectral leakage produced by the lack of synchronism, giving rise to variations in the amplitudes of the DFT calculated in each window, and can be large in the case of proximity between tones. This can happen when signals, such as the output of electronic converters, are measured using IEC standards. Therefore, it is necessary to correct and stabilize these amplitude variations to make them as close as possible to the desired and correct common RMS value.  
The effects of time aggregation on the processing of frequency groupings were studied next, to demonstrate how to overcome that problem. First, it was proven that the aggregation of the RMS values found in successive windows, for two proximate tones, permits obtaining the correct RMS value of the components of these tones that interact in the same spectral bar.  
Let \(\overline{x}\) be the harmonic component and \(\overline{y}\) the leakage received by \(\overline{x}\). The RMS value of the resulting vector would ideally be equal to \(\sqrt{x^{2}\ +\ y^{2}}\), as if the angle between the two vectors was 90\({}^{\circ}\). However, the actual phase angle between the two tones is unknown, and the procedure is to divide the time into \(m\) short windows and to average the squares of the vectors of each window, making, therefore, a time aggregation of these values, as can be seen in Equation (1).  
The relative positions of the vectors are \(\overline{x}_{i}\) and \(\overline{y}_{i}\), with a phase angle \(\varphi_{i}\), which varies as the successive \(m\) short time windows.  
\[\sqrt{\frac{\sum_{i=0}^{m-1}\left(\overline{x}_{i}+\overline{y}_{i}\right)^{ 2}}{m}}=\sqrt{\frac{m\cdot(x^{2}+\ y^{2})\ +\ 2\cdot x\cdot y\cdot\sum_{i=0}^{m-1}\cos(\varphi_{i})}{m}}= \sqrt{(x^{2}+y^{2})+\frac{2\cdot x\cdot y\cdot\sum_{i=0}^{m-1}\cos(\varphi_{ i})}{m}}. \tag{1}\]  
The second term in Equation (1), which depends on the successive positions of the vectors (\(\varphi_{i}\)), explains the fluctuations of the values, and therefore, it should be as low as possible. This can be achieved in two ways:  
* The term \(\sum\limits_{i=1}^{m}\cos(\varphi_{i})\) decreases if the total aggregation time coincides with the ideal period _Tw_ (or a multiple), divided into \(m=\textit{Tw/tw}=p\) short windows. In that case, an integer number \(n\) of complete phase turns of the leakage (related to the other tone) is obtained. As a result, \(\varphi_{i}\) increases an average of (\(n\):360/\(p\)) degrees in each evaluated window, so that the resulting angle is given by Equation (2): \[\varphi_{i}\ =\ \beta\ +\ i\cdot(n\cdot 360/p),\] (2)where \(n\):360 is the total angle rotated by the leakage vector until it is again, in the same relative position with the other harmonic vector and \(\beta\) is the initial phase angle. Then: \[\sum_{i=0}^{m-1}\cos(p_{i})=\sum_{i=0}^{p-1}\cos(\beta+i\cdot n\cdot 360/p)\ =\ 0.\] (3) This way, for analysis periods equal to or multiples of the ideal _Tw_, divided into short windows _tw_, on which the DFT is performed, the common RMS values can be obtained for all the spectral components contained in that _Tw_ period.
* Increasing the number of evaluated windows, \(m\). As vectors are added, in a quantity not multiple of \(p\) windows, the RMS value obtained differs from the common or correct, but to a lesser extent as the number of aggregated windows, \(m\), becomes greater.  
Since the actual components are unknown in real cases, the number \(m\) of aggregated windows is increased to reduce the second term in Equation (1). Next, the cases described in the previous section will be analyzed again, but now applying this solution.