## 3 Design of Improved Harmonic Detection Method  
### Hybrid Harmonic Detection Method Based on Bartlett-Hann Window DFT and DWT  
This paper designs an improved method based on DFT and DWT using Bartlett-Hann window function hybrid detection. The detection accuracy is improved, and the high frequency part harmonics are separated and extracted. The harmonic signal is decomposed into high frequency part and low frequency part by wavelet multi-resolution analysis. The steady-state part exists in the low frequency part, and the non-steady-state part exists in the high frequency part. According to the frequency band situation, the high frequency part may be doped with steady-state harmonic components, resulting in deviations in detection accuracy. For the low frequency steady-state part, we use a Bartlett-Hann window with better side lobe properties to implement windowed interpolation DFT processing to obtain low frequency steady-state components. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**Number of Harmonic** & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\
**Content(\%)** & 0.5 & 5 & 0.4 & 3 & 0.6 & 2 & 0.2 & 3 & 0.5 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Some harmonic parameters except the fundamental wave in the power grid. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Number of** & \multicolumn{3}{c}{**Relative Frequency Error (\%)**} & \multicolumn{3}{c}{**Relative Amplitude Error (\%)**} \\
**Harmonic** & **Common DFT** & **Barlett–Hann Window** & **Common DFT** & **Barlett–Hann Window** & **Interpolation DFT** \\ \hline Fundamental & \(-2.34\) & \(-1.86\) & \(-14.52\) & \(-3.43\) \\
2 & \(0.12\) & \(0.098\) & \(254.05\) & \(-1.02\) \\
3 & \(0.9\) & \(-0.73\) & \(-27\) & \(-2.36\) \\
4 & \(0.098\) & \(0.1\) & \(63.75\) & \(2.64\) \\
5 & \(-0.39\) & \(-0.3906\) & \(-36.64\) & \(3.37\) \\
6 & \(0.097\) & \(0.097\) & \(10.83\) & \(-0.83\) \\
7 & \(0.035\) & \(0.034\) & \(-28.5\) & \(-4.28\) \\
8 & \(0.098\) & \(0.098\) & \(38.25\) & \(-2.44\) \\
9 & \(-0.0482\) & \(-0.0484\) & \(-21.67\) & \(-3.67\) \\
10 & \(0.097\) & \(0.0976\) & \(8.4\) & \(-3\) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Comparison of ordinary DFT algorithm and Bartlett–[PERSON] window interpolation DFT algorithm. For the low frequency part, windowed interpolation is used to obtain the spectral information of the steady-state harmonic components. According to reference [17], assuming a harmonic signal \(f(t)\) containing the \(l\) th harmonic, and a uniform sampling frequency \(F_{s}\), and according to the sampling theorem \(f_{s}\geq 2F_{\text{max}}\), a discrete-time signal is obtained as in Equation (9):  
\[f(n)=\sum_{i=1}^{l}V_{i}\sin(\frac{2\pi f_{i}\cdot n}{f_{s}}+\varphi_{i}) \tag{9}\]  
where \(V_{i}\) is the amplitude of the \(i\) th harmonic; \(f_{i}\) is the frequency of the \(i\) th harmonic; \(\varphi_{i}\) is the initial phase angle of the \(i\) th harmonic. Add a Bartlett-Hann window to the discrete-time signal \(f(n)\) to obtain the windowed function \(f_{x}(n)=f(n)x(n)\), where \(x(n)\) is the window function, and do discrete-time Fourier Transform(DTFT) to obtain Equation (10):  
\[F_{x}(i)=\sum_{n=-\infty}^{\infty}f(n)x(n)e^{-2\pi fn}=\sum_{i=1}^{l}\left[ \frac{V_{i}}{2}\right]\left[e^{ipi}\cdot X(\frac{2\pi(f-f_{i})}{f_{s}})-e^{-ip i}\cdot X(\frac{2\pi(f+f_{i})}{f_{s}})\right] \tag{10}\]  
When estimating the \(i\) th harmonic, if the influence of other component leakage on the \(i\) th harmonic is ignored, discretize the formula to obtain Equation (11):  
\[F_{x}(k\Delta f)=\frac{V}{2\text{j}}e^{ipi}X(\frac{2\pi(k\Delta f-f_{i})}{f_{s} }) \tag{11}\]  
where in the discrete frequency interval \(\Delta f=f_{s}/N\), \(N\) is the data truncation length, and \(X()\) is the Bartlett-Hann window spectrum. For the signal frequency \(f_{i}\), \(f_{s}\) is not a multiple of \(f_{i}\), and is an asynchronous sampling.