 Research
 Open Access
 Published:
A low computation detection method of signal nonlinear distortion based on digital quadrature detection principle
EURASIP Journal on Advances in Signal Processing volume 2023, Article number: 63 (2023)
Abstract
This paper presents a digital low computation detection method for signal nonlinear distortion. After presetting ADC sampling rate and completing data sampling, the low sampling rate data extracted from the sampling data complete the autocorrelation analysis to correct and calculate the accurate fundamental frequency. According to the relationship between the fundamental frequency and the sampling rate, the complete periodic segment data of the signal cutting out from the sampling data carry out the digital quadrature detection operation to obtain the value of each harmonic component and nonlinear distortion. Experiments show that the calculation of this method is less than that of FFT spectrum analysis method when measuring the THD lower than 15 order. When calculating the 15order THD at 1024 points, the calculation time is reduced by 44.26%. Moreover, the digital quadrature detection method has high measurement accuracy with less than 0.6% error of detecting 5order THD.
1 Introduction
Nonlinear distortion refers to the distortion caused by the new frequency component superimposed on the output signal after an AC signal passes through a nonlinear system. These new frequency components are mainly the harmonic components of the original input signal, so they are also called nonlinear harmonic distortion. Harmonic distortion widely exists in power grid, battery technology, instrumentation detection, nonlinear materials, and other technical fields, which is commonly used to weigh the quality and stability of related technologies or materials. Therefore, the accurate detection of nonlinear harmonic distortion is particularly important [1,2,3].
Harmonic analysis is one of the main methods to detect the nonlinear harmonic distortion of signal. This method mainly uses DFT or FFT to separate each order of harmonics, extract harmonic components, and calculate harmonic distortion [4]. In actual measurement, the measured signal is usually asynchronous or aperiodic sampling, so it is difficult to accurately match the harmonic peak frequency with the sampling frequency, which results in fence effect and loss of spectrum information. The commonly used improvement method is to increase the sampling rate to reduce the interval between the harmonic frequency of the measured signal and the sampling frequency. The Nuttall window interpolation FFT algorithm can make harmonic frequency and component detection more accurate [5]. DFT or FFT operation must add window function. Multiplication in time domain and convolution in frequency domain will cause spectrum leakage distortion of the signal, and many side lobes next to the main spectral line will cause interference between spectral lines. The common solution is to expand the width of time domain and narrow the frequency domain, which can reduce energy leakage and improve the accuracy of harmonic detection.
Increasing the sampling rate, expanding the time domain width, windowing interpolation, and some other methods will lead to a significant increase in the amount of sampling data and computation, which have higher computational power requirements for the operation processor. Meanwhile, that is also the main reason that many low performance processors cannot widely use DFT and FFT. In the relevant experiments and research, we try to accurately measure the fundamental frequency of harmonic signal to intercept the sampled signal completely and then perform FFT operation, which can effectively avoid the detection error caused by fence effect and spectrum leakage. Firstly, we chose the zerocrossing detection method to detect the fundamental frequency of the harmonic signal. However, we find that different levels of harmonic components of the harmonic signal will cause uncertainty in the number of zerocrossing points in the signal cycle, so that the detected frequency may be an integral multiple of the fundamental frequency. Since the harmonic signal is a periodic signal, we decided to quickly estimate the fundamental frequency of the sampled signal by using autocorrelation analysis to resample the signal, which has certain errors. By correcting the zerocrossing detection frequency with the fundamental frequency estimated by autocorrelation, the fundamental frequency of harmonic signal under different conditions can be accurately obtained. The higher harmonic components of most nonlinear distortion detection signals can be ignored that result in a lot of meaningless calculation work when using DFT or FFT. Therefore, inspired by the basic theory of DFT, we choose the digital orthogonal detection method to calculate only the necessary loworder harmonics, instead of meaningless highorder harmonic analysis, which greatly improves the calculation efficiency of the system and ensures the detection accuracy of nonlinear distortion under the same conditions.
2 Method and simulation
2.1 Autocorrelation frequency analysis correction
Zerocrossing detection is ordinarily used to measure the frequency of periodic signals, which converts the measured signals into pulse signals that can be directly read by the processor through the threshold set by the circuit. MCU counts the edge of the pulse signal as \(n\), and accurately time the start to the end points of \(n\) edges as \(t\) in the meantime; then, the frequency of the signal is \(f_{0} = \left( {n  1} \right)/2t\). However, due to the highorder harmonic signal component of the measured signal, phase difference, or voltage offset of the measured signal, the actual number of zero crossings of the signal is more than that of the fundamental signal and is usually an integer multiple relationship. As shown in Fig. 1, there are six zero crossings in a fundamental wave period, and the frequency of zero crossing detection is three times that of the fundamental wave. In the process of zero crossing detection, this frequency multiple will be different due to the influence of signal voltage offset or harmonic component value and phase.
The frequency obtained by zero crossing detection must be greater than or equal to the fundamental frequency of the measured signal, so the detection system can preset the sampling rate as \(f_{s} = mf_{0} \left( {m \ge 32} \right)\) and the sampling time width as \(t_{{\text{s}}} = N{/}f_{{\text{s}}} \left( {N \ge 4m} \right)\), where \(m\) is the number of periodic sampling points and \(N\) is the total number of sampling points. The sampled data are stored in \({\text{ADC}}\_{\text{data}}\left[ N \right]\) and used for autocorrelation frequency analysis and nonlinear distortion calculation.
The autocorrelation frequency analysis adopts the convolution algorithm, which needs to resample \(N^{\prime }\) points data from the \(N\) points sampling data for calculation and ensure the resampling frequency \(f_{{{\text{ex}}}}\) not less than \(4f_{0}\); resampling shall not be less than 3 cycles. The data extraction method is shown in Eq. (1).
Literature [6, 7] proposes that in frequency analysis, the convolution object is discrete data of finite length, and the estimated frequency can be obtained by autocorrelation method in time domain. The calculation formula of autocorrelation convolution is:
By changing the position of the autocorrelation function cyclically, the result after convolution with the original signal is used as the basis for determining the similarity between the autocorrelation function and the original signal. The discrete convolution calculation of the estimated frequency autocorrelation is shown in Eq. (3), where \(n\) is the data length and \({\text{pos}}\) is the moving position of the autocorrelation function.
The autocorrelation convolution result is stored in the array \({\text{conv}}\left[ n \right]\), where the data with the maximum peak value and the footmark closest to 0 are the starting point of the autocorrelation function signal where the original signal has moved for a complete period, and the time of the starting point is the estimated fundamental wave period of the original signal. The simulation results are shown in Fig. 2. Finally, the measured frequency is:
In Fig. 2, the fundamental frequency of the signal estimated by the autocorrelation convolution method in the simulation is \(f_{{{\text{es}}}} = {\text{round}}\left( {1/0.002214s} \right) = 444.44\;{\text{Hz}}\). There are 4 zeros in each cycle. For example, the zero crossing detection frequency is \(2702\;{\text{Hz}}\), and the corrected signal frequency is \(f_{{{\text{co}}}} = 450.33\;{\text{Hz}}\).
2.2 Digital quadrature detection analysis method
In the signal processing of the electronic system, the received real signal can be expressed as
In the equation, \(\tilde{S}\left( t \right)\) is the complex envelope of the signal, which can be expressed as
That is, the complex envelope of the signal is composed of the inphase component \(I\left( t \right)\) and the quadrature component \(Q\left( t \right)\). The analog quadrature detection method is to obtain the inphase and quadrature components of the signal after mixing and filtering of two analog quadrature local oscillator signals [8, 9].
In this study, each harmonic signal of the measured signal is treated as a complex signal to complete the quadrature detection calculation. After filtering, the inphase and quadrature components are analyzed to calculate the amplitude of the harmonic signal as shown in Eq. (5).
In the method, the harmonic signal with different frequency from the detection signal in the original signal will be integrated and filtered, and the inphase component and the quadrature component with the same frequency as the detection signal will be left. Suppose that the harmonic component signal of a certain frequency in the original signal is \(h\left( t \right) = A\sin \left( {\omega t + \varphi } \right)\), the reference sine function is \(s\left( t \right) = \sin \omega t\), the reference cosine function is \(c\left( t \right) = \cos \omega t\). The derivation is shown in Eqs. (6–7).
The amplitude calculation of the corresponding frequency harmonic signal is not affected by the signal sampling starting point or phase, and the result is
Digital quadrature detection is to perform quadrature detection and convolution filtering on the discrete signal of ADC sampling. First, the whole period signal can be intercepted from the sampling data \({\text{ADC}}\_{\text{data}}\left[ N \right]\) according to the sampling rate \(f_{s}\) and the calculated fundamental frequency \(f_{{{\text{me}}}}\) of the signal, and the intercepting length is \(L = f_{{\text{s}}} {/}f_{{{\text{me}}}}\).
And then extract the data corresponding to the length of the sampled signal from the prestored reference function according to the whole period length \(L\) to calculate the hth harmonic component, as shown in Eq. (8). The reference sine function is prestored as \({\text{Sin}} \_{\text{dat}}\left[ M \right]\); the reference cosine function is prestored as \({\text{Cos}} \_{\text{dat}}\left[ M \right]\).
where h is the harmonic order; \({\text{Amp}}_{{\text{h}}}\) is the harmonic amplitude. The simulation results of the harmonic components lower than the 9th order calculated by the digital quadrature detection method are shown in Fig. 3.
2.3 Calculation quantity analysis
Usually, the number of times for real multiplication and complex addition is used to represent the computation of a machine. The computation of digital quadrature detection method mainly includes autocorrelation analysis and digital quadrature detection calculation. Autocorrelation is the convolution analysis of the resampling data of the sampled signal, and its computation is related to the sampling and resampling frequency. The computation of digital quadrature detection calculation is related to the length of the intercepted period and the highest order of harmonic analysis. The real multiplication times of digital quadrature detection method are expressed as:
where \(N_{1} = {\text{round}}\left( {\frac{{f_{{{\text{ex}}}} \times N}}{fs}} \right)\) is the number of resampled points from the sampled signal and \(N_{1}^{2}\) is the real multiplication times of autocorrelation analysis. \(N_{2} = {\text{round}}\left( {\frac{{f_{{\text{s}}} }}{{f_{{{\text{me}}}} }}} \right)\) is the length of full period data intercepted from the sampled signal. \(H\) is the highest order of harmonic analysis. \(4 \times N_{2} \times H\) is the real multiplication times of digital quadrature detection calculation.
The complex addition times is expressed as:
where \(\frac{{N_{1} \times \left( {N_{1}  1} \right)}}{2}\) is the complex addition times of autocorrelation analysis and \(2 \times N_{2} \times \left( {2H  1} \right)\) is the complex addition times of digital quadrature detection calculation. The real multiplication times and complex addition times of FFT are shown in Eq. (11).
Given the relevant parameters, the computation of the two methods under different conditions is shown in Table 1. When the order of harmonic analysis is lower than 15, the real multiplication and complex addition times of digital quadrature detection method are lower than those of FFT method.
2.4 Calculation of nonlinear distortion
The total harmonic distortion is used to characterize the nonlinear distortion of the signal [10], and the calculation formula is
3 Experimental setup
To verify the advantages of the signal nonlinear distortion detection method based on the digital orthogonal detection principle in terms of computation cost, flexibility, and accuracy, an experimental device for detecting nonlinear distortion is designed. The device is composed of programcontrolled amplification circuit, bias circuit, zero crossing comparison circuit, MCU core system, and display module, as shown in Fig. 4. The input signal is the harmonic signal generated by the function signal generator, and various parameters such as frequency and harmonic amplitude can be customized. The input signal is preprocessed by the programcontrolled amplifier and the bias circuit before ADC sampling. MCU analyzes the signal peak information and changes the programmed gain coefficient through the DAC output voltage to adjust the signal amplitude within the ADC sampling voltage range.
The zerocrossing comparison circuit converts the gain adjusted signal into a pulse signal. The counter and timer of MCU complete the signal frequency calculation and correct the sampling rate. MCU completes frequency estimation correction and distortion calculation according to Eqs. 1–12 and displays the calculation results on the display module.
4 Results
4.1 Verification of method calculation amount
To verify the optimization of the calculation amount of the digital orthogonal detection method, we select ARM CortexM4 Series MCU as the core processor, on which run the digital quadrature detection method (including autocorrelation frequency convolution calculation) to test the operation time of different points and different harmonic orders distortion. Every time the MCU completes the calculation process once, it will flip the level once at the I/O port. Use an oscilloscope to monitor the pulse width of the port level, as shown in Fig. 5.
The MCU completes the analysis and calculation of the 5–15thorder total harmonic distortion at 128 points, 256 points, 512 points, and 1024 points, respectively. The test results are shown in Table 2.
Table 2 shows that the higher the harmonic order or the more points to be calculated, the longer the calculation time. The calculation time of 5thorder and 15thorder total harmonic distortion is compared with that of FFT harmonic analysis method. The results of comparison of calculation time between two methods in Table 3 show that in the calculation from 128 to 1024 points, the calculation time of the digital quadrature detection method is reduced by 18.96–44.29% compared with calculate the FFT harmonic analysis method in the calculation of the 15thorder total harmonic distortion. If only the 5thorder total harmonic distortion, the operation time of digital quadrature detection method is reduced by more than 73% compared with FFT harmonic analysis method. The lower the requirement of the maximum harmonic order, or the more the number of calculation data points, the higher the reduction rate of the calculation amount of the digital orthogonal detection method. The experimental results of the calculation time are close to the analytical value of the theoretical calculation quantity, and the deviation is mainly reflected in the time of MCU processing some program links, such as cycle operation and judgment.
4.2 Autocorrelation frequency correction verification
Accurate detection of the fundamental frequency of the signal is the basis of the analysis of the nonlinear distortion by digital quadrature detection. After the input signal is amplified by the programcontrolled amplifier, the input zero crossing detection circuit converts it into a pulse signal, as shown in Fig. 6.
The frequency of the pulse signal detected by MCU port is counted according to the zerocrossing point within a certain time but cannot represent the fundamental frequency of the input signal. MCU corrects the frequency of zero crossing detection statistics by autocorrelation method on the sampled data according to Eqs. (1–4) and analyzes the accurate fundamental frequency. The results of measuring the frequency of input signals with different harmonic parameters are shown in Table 4, which shows that the zerocrossing detection and autocorrelation correction methods are accurate in analyzing the fundamental frequency of signals, with an error of less than 0.8%.
4.3 Detection and verification of harmonic component and nonlinear distortion
Since accurate frequency detection, the complete period is extracted from the sampled data, and the magnitude of each harmonic component and nonlinear distortion are calculated by digital orthogonal detection method. To verify the accuracy of the method for harmonic components and nonlinear distortion, the digital orthogonal detection method is compared with the FFT harmonic analysis method. Since the number of points of FFT algorithm must be \(2^{N}\), the sampling rate of the experimental device is adapted in the experiment to minimize the spectrum leakage and fence effect of FFT, so that FFT has a higher harmonic analysis accuracy. For example, the fundamental frequency of the measured signal is 1150 Hz. When performing 256point calculation, the signal sampling rate is set to 294.73 kHz. MCU clock error causes 0.33 kHz error, but when the number of sampling points is 256, the sampled data are also a complete cycle.
The measured signal is a harmonic signal customized by the function signal generator. The digital quadrature detection method is used to calculate the harmonic components of the customized signal, and the results are compared with those of FFT harmonic analysis method. The test results of the 5thorder total harmonic distortion of the customized signal are shown in Table 5. The measurement error of 5thorder total harmonic distortion by digital quadrature detection method is almost the same as that by FFT harmonic analysis method, and the error is less than 0.6%. Comparing the error of the two methods, the floating value is less than ± 0.25%.
The test results of the 10thorder total harmonic distortion of the customized signal are shown in Table 6. The measurement error of 10thorder total harmonic distortion by digital quadrature detection method is almost the same as that by FFT harmonic analysis method, and the error is less than 2%. Comparing the error of the two methods, the floating value is less than ± 0.4%.
The test results of the 15thorder total harmonic distortion of the customized signal are shown in Table 7. The measurement error of the 15thorder total harmonic distortion by digital quadrature detection method is almost the same as that by FFT harmonic analysis method, and the error is less than 5%. Comparing the error of the two methods, the floating value is less than ± 0.7%.
More importantly, the FFT harmonic analysis method is equivalent to the artificial reduction in its analysis error in the sampling rate adaptation and is sufficient to prove the advantages of the digital orthogonal detection method in the analysis accuracy.
5 Conclusion
Signal nonlinear distortion detection is an important means to test signal quality in many industries. In this paper, a digital quadrature detection method with low computation is proposed, and the measuring principle of the method is introduced in detail. Compared with the actual calculation time of the most used FFT harmonic analysis method, it is proved that the calculation amount of the total harmonic distortion of the signal measured by the digital orthogonal detection method is significantly lower than that of the FFT harmonic analysis method. Because the highorder harmonic of the signal has very little influence on the signal, it is usually ignored in the nonlinear distortion analysis. The digital quadrature detection method can omit the calculation of the highorder harmonic signal and is very suitable for low computational power microprocessors. Through experimental comparison, the measurement accuracy of digital quadrature detection method is high, and the measurement error level is almost the same as that of FFT harmonic analysis method.
Another advantage of the digital quadrature detection method in analyzing harmonic components is that the number of calculation points can be flexibly selected, and accurate harmonic components can be obtained if the integrity of signal cycle is guaranteed. However, FFT harmonic analysis method specifies a relatively fixed number of calculation points, and most of them are asynchronous sampling in the process of signal sampling, which leads to the leakage of spectrum analysis. Generally, to reduce the frequency leakage, the time width of signal sampling should be as large as possible, so the number of FFT analysis and calculation points is large, and the calculation amount will increase. Visibly, the digital quadrature detection method is more conducive to the lightweight and low cost of the detection instrument while ensuring the measurement accuracy.
Availability of data and materials
Please contact author for data requests.
Abbreviations
 FFT:

Fast Fourier transform
 THD:

Total harmonic distortion
 DFT:

Discrete Fourier transform
 ADC:

Analogtodigital converter
 MCU:

Microcontroller unit
 DAC:

Digitaltoanalog converter
 ARM:

Advanced RISC machines
 DQD:

Digital quadrature detection
References
K. Jonghyeon, K. Julia, A method for detecting the existence of an overdischarged cell in a lithiumion battery pack via measuring total harmonic distortion. Batteries 8(3), 26–26 (2022)
K. Piotr, W. Grzegorz, Problem of total harmonic distortion measurement performed by smart energy meters. Meas. Sci. Rev. 22(1), 1–10 (2022)
R.R. Das et al., Impact of temperature on radio frequency/linearity and harmonic distortion characteristics of Ge multichannel fin shaped fieldeffect transistor. Int. J. RF Microwav. Comput.Aid. Eng. 32(2), e22987 (2021)
R. Ingale, Harmonic analysis using FFT and STFT. Int. J. Sign. Process. Image Process. Pat. Recognit. 7(4), 345–362 (2014)
S. Zhao, C. Wang, X. Bian, Research on harmonic detection based on wavelet threshold and FFT algorithm. Syst. Sci. Control Eng. 6(3), 339–345 (2018)
R.P. Williams, On the formulation of convolution, autocorrelation and cross correlation. Eur. J. Phys. 7(1), 6 (1986)
Tu. YaQing, Y.L. Shen, Phase correction autocorrelationbased frequency estimation method for sinusoidal signal. Sign. Process. 130, 183–189 (2017)
Su. Juan, J. Mingxing, J. Fei, Pound–Drever–Hall laser frequency locking technique based on orthogonal demodulation. Optik 168, 348–354 (2018)
C. Wang, Qu. Yang, Y.P.T. Tang, IQ quadrature demodulation algorithm used in heterodyne detection. Infrared Phys. Technol. 72, 191–194 (2015)
J. Zhang, Nonlinear distortion signal generation and THD measuring device. J. Phys.: Conf. Ser. 1802(2), 022024 (2021)
Acknowledgements
We would like to thank the handing editor and the anonymous reviewers for their valuable comments and suggestions for this paper. This work was supported in part by Guangxi Innovationdriven Development Special Fund Project under Grant No. GuikeAA19254010.
Author Informations
Pengcheng Wang received the B.S. degree in applied electronic technology education from Yunnan Normal University, Kunming, China, in 2013. In 2013, he joined Guilin University of Technology as a junior experimentalist, and in 2018, he served as an experimentalist. His research interests include digital signal processing, embedded systems, and digital image processing.
Xiaoping Huang received the B.S. degree in automation from Hunan Industry University, Zhuzhou, China, in 1996, and the M.S. degree in control science and engineering from Guilin University of Technology, Guilin, China, in 2007. From 1996 to 2010, he was a senior engineer in Guilin Shuguang Rubber Industry Research and Design Institute. From 2011 to 2016, he was an associate professor at the college of mechanical and electrical engineering at Nanning University. From 2017 to Nov.2021, he was a professor at the college of mechanical and electrical engineering at the same University. From Dec.2021 to now, he is a professor at Guilin University of Technology. His research interests include intelligent manufacturing and complex nonlinear systems control.
Funding
This research was funded by Guangxi Innovationdriven Development Special Fund Project under Grant No. GuikeAA19254010.
Author information
Authors and Affiliations
Contributions
PW proposed the method of digital quadrature detection for signal nonlinear distortion detection and completed the theoretical deduction and simulation experiment. PW designed the system experiment device, completed the experiment, and wrote the manuscript. XH verified the feasibility of the theoretical method and reviewed the manuscript. XH will complete the submission and future correspondence as the corresponding author. All authors read and approved the final manuscript.
Corresponding author
Ethics declarations
Declarations
Ethics approval and consent to participate.
Not applicable.
Consent for publication
Not applicable.
Competing interests
We declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Wang, PC., Huang, XP. A low computation detection method of signal nonlinear distortion based on digital quadrature detection principle. EURASIP J. Adv. Signal Process. 2023, 63 (2023). https://doi.org/10.1186/s13634023010150
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s13634023010150
Keywords
 Low calculation
 Autocorrelation
 Frequency detection
 Digital quadrature detection
 Nonlinear distortion