Software algorithm based 50hz or 60hz noise filtering method for adc

CN121356579BActive Publication Date: 2026-09-15SHENZHEN SPARK ELECTRIC CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511902502.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-12-17
Publication Date
2026-09-15
Estimated Expiration
2045-12-17

AI Technical Summary

Technical Problem

但在降噪过程中,硬件滤波需要在店里上增加额外的RC无源滤波器、有源陷波电路等硬件设施,电路的体积以及额外成本都会增加;软件滤波是通过数字算法对模数转换器(ADC)采集的数据进行降噪处理,但是在降噪过程中使用的数字算法的参数是固定的,一方面,固定的参数在复杂环境中,会出现抑制不彻底或过度滤波的情况,自适应能力差;另一方面,针对于波动能力差的数据或波动能力强的数据,固定的参数会导致降噪后,波动能力差的数据出现数据冗余或波动能力强的数据精度不足,无法平衡降噪精度于数据量之间的关系的问题

Benefits of technology

[0016] Compared with existing technologies, the advantages of this invention lie in its use of an improved Goertzel algorithm to obtain spectral parameters, calculate a three-level decimation factor based on these parameters, and sample data. This enables dynamic adjustment of the decimation factor based on the environment, thereby reducing redundant data while ensuring data integrity. Forward and reverse compensation are applied to the sampled data based on the sample data, and finally, noise suppression using a two-dimensional window is performed based on signal bandwidth and abrupt frequency changes. This removes power frequency noise in complex environments while minimizing signal distortion and increasing data accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121356579B_ABST
    Figure CN121356579B_ABST
Patent Text Reader

Abstract

The application discloses an ADC 50Hz or 60Hz noise filtering method based on a software algorithm, and comprises the following steps: initialization configuration, collecting original data; preprocessing and obtaining detection data; using an improved Goertzel algorithm to obtain a frequency spectrum parameter; calculating a three-stage extraction factor, and sampling data output by the ADC to obtain sample data; after forward and reverse compensation of the sample data, performing double-dimension window pulse noise suppression on the pulse noise; calculating a transmission quality index, adjusting the size of a filtering window according to the transmission quality index; using an improved comb algorithm to perform amplitude calibration on a filtering result and output a standard signal after noise reduction processing. On the one hand, the noise reduction processing scheme does not need to additionally increase a filtering circuit, and the circuit volume and hardware cost are reduced; on the other hand, the parameters in the application can be adaptively adjusted according to the frequency spectrum parameter, thereby increasing the adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and more specifically, to a method for ADC 50Hz or 60Hz noise filtering based on software algorithms. Background Technology

[0002] Monitoring the production process is essential, and the analog-to-digital converter (ADC), as the core equipment for digitizing analog signals, directly affects the accuracy of subsequent data processing and system control. However, ADCs are highly susceptible to electromagnetic interference during data acquisition, with 50Hz or 60Hz power frequency noise being the primary influencing factor. Therefore, noise reduction processing is necessary before using ADC data.

[0003] Existing technologies for data denoising include hardware filtering and software filtering. However, hardware filtering requires additional hardware such as RC passive filters and active notch filters, increasing circuit size and cost. Software filtering uses digital algorithms to denoise data acquired by analog-to-digital converters (ADCs), but the parameters of these algorithms are fixed. On one hand, fixed parameters can lead to incomplete suppression or over-filtering in complex environments, resulting in poor adaptability. On the other hand, for data with poor or high volatility, fixed parameters can cause data redundancy in the poorly volatile data or insufficient accuracy in the highly volatile data after denoising, failing to balance denoising accuracy with data volume.

[0004] Therefore, the existing technology has defects and urgently needs improvement. Summary of the Invention

[0005] In view of the above problems, the purpose of this invention is to provide a software algorithm-based ADC 50Hz or 60Hz noise filtering method to solve the problem that existing data noise reduction processes include hardware filtering and software filtering. However, in the noise reduction process, hardware filtering requires the addition of additional hardware facilities such as RC passive filters and active notch filter circuits, which increases the circuit size and additional cost; software filtering uses digital algorithms to process the data collected by the analog-to-digital converter (ADC), but the parameters of the digital algorithm used in the noise reduction process are fixed. On the one hand, fixed parameters may lead to incomplete suppression or over-filtering in complex environments, resulting in poor adaptability; on the other hand, for data with poor or high volatility, fixed parameters may cause data redundancy in data with poor volatility or insufficient accuracy in data with high volatility after noise reduction, failing to balance the relationship between noise reduction accuracy and data volume.

[0006] This invention provides a software algorithm-based method for ADC noise filtering at 50Hz or 60Hz, comprising: Initialize and configure the initial sampling frequency, FFT window size, and filtering parameters, and use the ADC to acquire raw data; The raw data is preprocessed to obtain detection data; The improved Goertzel algorithm was used to obtain the spectral parameters in the detection data; The three-level extraction factor is calculated based on the spectrum parameters. Based on the determined three-level extraction factor, the data output by the ADC is sampled every preset period to obtain sample data. After performing forward and reverse compensation on the sample data, impulse noise suppression is performed using a two-dimensional window based on the signal bandwidth and abrupt change frequency. Calculate the transmission quality index and adjust the size of the filtering window accordingly. An improved comb algorithm is used to calibrate the amplitude of the filtering results and output a standard signal after noise reduction.

[0007] As a preferred technical solution for ADC 50Hz or 60Hz noise filtering method based on software algorithm, the spectral parameters include: spectral main frequency, signal bandwidth, spectral entropy, and abrupt change frequency. The preprocessing includes: sliding window DC removal and Butterworth low-pass filter to suppress high-frequency interference.

[0008] As a preferred technical solution for ADC 50Hz or 60Hz noise filtering methods based on software algorithms, obtaining the spectral parameters in the detection data includes: The main frequency of the spectrum The calculation method is as follows: ; in: Represents the amplitude of a frequency domain signal. The value after Fourier transform, For frequency variables, the unit is Hz. The square of the amplitude of the frequency domain signal; The signal bandwidth The calculation formula is: ;in: This refers to the upper limit frequency of the bandwidth, measured in Hz. This is the lower limit frequency of the bandwidth, measured in Hz. This is the frequency domain expression of the signal. This is the original sampling frequency; The spectrum entropy The calculation formula is: , ; in: For the number of frequency division points, (a=1,2,...,M) represents the frequency value at the a-th frequency division point. (j=1,2,...,M) represents the frequency value of the j-th frequency division point. The power percentage of the a-th frequency component; The mutation frequency The calculation formula is: ; Where: T is the duration of the analysis window, and N is the number of sampling points within the analysis window. This represents the amplitude difference between adjacent sampling points. To analyze the maximum amplitude of the signal within the window, This is the empirical threshold coefficient.

[0009] As a preferred technical solution for a software algorithm-based ADC 50Hz or 60Hz noise filtering method, the calculation of the three-level decimation factor based on the spectral parameters includes: The first-level decimation factor is calculated based on the dominant frequency of the spectrum. : ; Where: A is the safety factor. The dominant frequency in the spectrum. This is the original sampling frequency; First-level extraction factor A two-stage tandem integrator comb filter structure is used, and its transfer function is: ; in: For the z-transform operator, For delay One sampling point, The delay operator is for one sampling point, and the exponent 2 is used to characterize the filter order; Second-level extraction factor D2: ; in: , as well as These are the decimation factors for three switchable CIC filters; The decimation factor of each CIC sub-level is dynamically adjusted based on the second-level decimation factor D2, and the filter order... Adaptive adjustment based on extraction factor: ; Where: i represents the feedback stage of the CIC filter, the higher the order, the stronger the stopband attenuation, and 16 is the order switching threshold; The value range of the third-level extraction factor D3 is [2,4]; And the first-level extraction factor Second-level extraction factor and the third-level extraction factor The value of must satisfy the total extraction multiple constraint: ; in: This represents the minimum total sampling multiple specified by the Nyquist criterion.

[0010] As a preferred technical solution for a software algorithm-based ADC 50Hz or 60Hz noise filtering method, the step of sampling the ADC output data at preset intervals according to the determined three-level decimation factor includes: The sampling rate for sampling the ADC output data is calculated based on the three-level decimation factor. : The sampling rate The calculation formula is: ; in: The original sampling frequency, This is the first-level extraction factor. This is the second-level extraction factor. This is the third-level extraction factor. This is the original sampling frequency.

[0011] As a preferred technical solution for a software algorithm-based ADC 50Hz or 60Hz noise filtering method, the step of performing forward compensation and reverse compensation on the sample data includes: Forward compensation: A 32nd-order adaptive FIR filter is used for passband compensation, and the filter coefficient vector is calculated and updated in real time according to the least mean square algorithm; Reverse compensation: Corrects the stopband attenuation depth. The correction formula for the stopband attenuation depth is: ; in: For target stopband attenuation, For correction factor, This is the current stopband attenuation measurement.

[0012] As a preferred technical solution for ADC 50Hz or 60Hz noise filtering methods based on software algorithms, the step of performing pulse noise suppression using a two-dimensional window based on signal bandwidth and abrupt change frequency includes: The value of the median filter window size N is determined based on the frequency domain window threshold. and time-domain window threshold To be determined, including: Frequency domain window threshold The calculation method is as follows: ; in: For signal bandwidth, To reduce the sampling rate, For spectral entropy; Time-domain window threshold The calculation method is as follows: ; in: mutation frequency, The sampling period after downsampling, in seconds. For spectral entropy; The formula for calculating the size N of the median filter window is: ; Where: SNR is the signal-to-noise ratio of the ADC output data. This is the signal-to-noise ratio reference value corresponding to the current application scenario. Noise weighting coefficient, For the frequency domain window threshold, This is the threshold value for the time-domain window.

[0013] As a preferred technical solution for ADC 50Hz or 60Hz noise filtering methods based on software algorithms, the transmission quality index The calculation formula is: ; Where α and β are the weighting coefficients for packet loss rate and transmission delay, respectively. For packet loss rate, This is for transmission delay.

[0014] As a preferred technical solution for ADC 50Hz or 60Hz noise filtering methods based on software algorithms, the size of the filtering window is adjusted according to the transmission quality index. Adjustments are made, including: ; Where: E is the window length. This is the transmission quality index.

[0015] As a preferred technical solution for ADC 50Hz or 60Hz noise filtering based on software algorithms, the improved comb algorithm is used to perform amplitude calibration on the filtering result and output a standard signal after noise reduction. The formula for amplitude calibration of the filtering result by the improved comb algorithm is as follows: ; Where: x(n) is the current sampled value, x(nE) represents the sampled value of the input signal at the Eth sampled point before the current time n, x(n-2E) represents the sampled value of the input signal at the 2Eth sampled point before the current time n, E is the window length, and y(n) is the filtered output.

[0016] Compared with existing technologies, the advantages of this invention lie in its use of an improved Goertzel algorithm to obtain spectral parameters, calculate a three-level decimation factor based on these parameters, and sample data. This enables dynamic adjustment of the decimation factor based on the environment, thereby reducing redundant data while ensuring data integrity. Forward and reverse compensation are applied to the sampled data based on the sample data, and finally, noise suppression using a two-dimensional window is performed based on signal bandwidth and abrupt frequency changes. This removes power frequency noise in complex environments while minimizing signal distortion and increasing data accuracy.

[0017] Furthermore, the technical solution of the present invention does not require the addition of an extra filter circuit, which reduces the circuit size and hardware cost. At the same time, the values ​​of each parameter can be adaptively adjusted according to the spectrum parameters, increasing the adaptability of data acquisition in complex environments. Attached Figure Description

[0018] Figure 1 A flowchart of a software algorithm-based ADC 50Hz or 60Hz noise filtering method provided by the present invention is shown. Detailed Implementation

[0019] To better understand the above-mentioned objectives, features, and advantages of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0020] Many specific details are set forth in the following description in order to provide a full understanding of the invention. However, the invention may also be practiced in other ways different from those described herein, and therefore the scope of protection of the invention is not limited to the specific embodiments disclosed below.

[0021] like Figure 1 As shown, this invention discloses a software algorithm-based method for ADC 50Hz or 60Hz noise filtering, comprising: Step S1: Initialize and configure the initial sampling frequency, FFT window size, and filtering parameters, and use the ADC to acquire raw data; Step S2: Preprocess the raw data to obtain detection data; Step S3: Use the improved Goertzel algorithm to obtain the spectral parameters in the detection data; Step S4: Calculate the three-level decimation factor based on the spectrum parameters. Based on the determined three-level decimation factor, sample the data output by the ADC every preset period to obtain sample data. Step S5: After performing positive and negative compensation on the sample data, pulse noise suppression is performed on the pulse noise using a two-dimensional window based on the signal bandwidth and abrupt change frequency. Step S6: Calculate the transmission quality index and adjust the size of the filtering window based on the transmission quality index; Step S7: Use an improved comb algorithm to calibrate the amplitude of the filtering result and output the standard signal after noise reduction.

[0022] Furthermore, the preprocessing includes: sliding window DC removal and Butterworth low-pass filter to suppress high-frequency interference; Spectral parameters include: dominant frequency, signal bandwidth, spectral entropy, and abrupt change frequency.

[0023] It is understandable that initializing the initial sampling frequency, FFT window size, and filtering parameters is necessary for initial data acquisition and to provide a data foundation for subsequent calculations of spectral parameters, third-level decimation factors, and other parameters. The initial values ​​are determined based on actual conditions, ensuring that the obtained data represents the original data. The preset period is selected based on the actual noise variation; the more frequent the noise variation, the shorter the preset period. In this embodiment, the preset period is 30 seconds. In implementation, initializing the filtering parameters includes: setting the initial order of the first and third sub-filters of the cascaded integrator-comb filter to order 2, and the initial order of the second sub-filter to order 3; initializing the initial coefficients of the 32nd-order adaptive FIR filter, the initial range of the median filter window, the step size factor of the LNS algorithm, and the stopband attenuation correction coefficient. Initializing the FFT window size includes: setting the FFT window size to 512 points and the window overlap to 50%. The initial sampling frequency is configured to 100kHz.

[0024] Furthermore, the spectral parameters in the detection data are obtained, including: Spectrum main frequency The calculation method is as follows: ;in: Represents the amplitude of a frequency domain signal The value after Fourier transform For frequency variables, the unit is Hz. It is the square of the amplitude of the frequency domain signal.

[0025] signal bandwidth The calculation formula is: ;in: This refers to the upper limit frequency of the bandwidth, measured in Hz. This is the lower limit frequency of the bandwidth, measured in Hz. This is the frequency domain expression of the signal. This is the original sampling frequency. In implementation, the frequency domain expression of the signal... according to The data is obtained in V / Hz or A / Hz.

[0026] Spectral entropy The calculation formula is: , ; In implementation, the number of frequency division points The value is half the number of FFT points. Here is the frequency value at the a-th frequency division point, in Hz. This represents the frequency value at the j-th frequency division point, in Hz. Let be the power percentage of the a-th frequency component. It is a base-2 logarithm to ensure that the entropy value is in bits. Spectral entropy is used to evaluate the dispersion of frequency components in a signal. Complex spectra require higher sampling redundancy.

[0027] The formula for calculating mutation frequency is: ; It should be noted that T is the analysis window duration, in seconds (s). The value of the analysis window duration T is calculated from the number of sampling points N within the window and the sampling period. N is the number of sampling points within the window. The amplitude difference between adjacent sampling points is expressed in V or A. This represents the maximum amplitude of the signal within the window (unit: V or A). This refers to the empirical threshold coefficient. The value is determined through industrial scenario testing to avoid misjudging minor fluctuations as sudden changes. In this embodiment of the invention, the empirical threshold coefficient... The value is 0.3. The mutation frequency is used to limit the maximum size of the median filter window, avoiding over-smoothing of abrupt signals during noise reduction.

[0028] Furthermore, the third-level decimation factor is calculated based on the spectral parameters, including: The first-level decimation factor is calculated based on the dominant frequency of the spectrum. : ; Where: A is the safety factor. The dominant frequency in the spectrum. This is the original sampling frequency; First-level extraction factor A two-stage tandem integrator comb filter structure is used, and its transfer function is: ; in: For the z-transform operator, For delay One sampling point, The delay operator is for 1 sampling point, and the exponent 2 is used to characterize the filter order.

[0029] In implementation, the value of the safety factor A is selected according to the actual situation, as long as the redundancy requirements of the Nyquist criterion are met and the sampling rate after extraction is ≥2.5 times the main frequency. In this embodiment of the invention, the value of the safety factor A is 0.4. This is a floor function used to convert the calculation result into an integer so that it can be matched with the hardware sampling logic. These are the maximum and minimum value functions, used to limit... The value should be between 2 and 64 times to avoid excessive data volume and increased transmission pressure due to excessive extraction, or signal distortion due to excessive extraction.

[0030] Calculate the second-level decimation factor D2 based on the signal bandwidth: ; in: , as well as These are the decimation factors for three switchable CIC filters; The decimation factor for each CIC sub-level is selected by the system and dynamically adjusted based on the second-level decimation factor D2, and the filter order... Adaptive adjustment based on extraction factor: ; Where: i represents the feedback stage of the CIC filter. The higher the order, the stronger the stopband attenuation. 16 is the order switching threshold, unit: none. The order switching threshold is determined by testing. When the decimation factor is greater than 16, a higher order is required to enhance the anti-aliasing capability. The value range of the third-level decimation factor D3 is [2,4]. The value range of the third-level decimation factor D3 is determined based on the sampling rate of the ADC output data sampled by the third-level decimation factor and the total decimation multiple constraint. In this embodiment of the invention, the sampling rate of the ADC output data calculated by the third-level decimation factor is 1024 to 8192 times, so the value range of the third-level decimation factor D3 is [2,4].

[0031] And the first-level extraction factor Second-level extraction factor Third-level extraction factor The value of must satisfy the total extraction multiple constraint: ; in: This indicates the minimum total sampling factor specified by the Nyquist criterion, which means that the original sampling rate must be at least twice the signal bandwidth, and this condition must still be met after downsampling.

[0032] In detail, this invention calculates the first-level decimation factor based on the dominant frequency of the spectrum. This limits the decimation factor based on the signal bandwidth, ensuring the sampling rate meets the Nyquist criterion. Second-level decimation factor. It supports multiple switchable CIC filter combinations, enabling adjustment of the sampling rate according to different customer scenarios, thus increasing the environmental adaptability of the sampling rate. Third-level decimation factor. Final fine-tuning will be conducted based on the actual situation. This will be achieved by setting a triple extraction factor. , as well as ,accomplish coarse adjustment Fine-tuning and The finely tuned downsampling structure can achieve large-scale sampling of 1024 to 8192 times, compressing the high-sampling-rate original data to a low frequency, thereby significantly reducing the amount of computation and bandwidth requirements while ensuring that the obtained data can represent the original data.

[0033] Furthermore, based on the determined three-level decimation factor, the ADC output data is sampled every preset period, including: The sampling rate for sampling the ADC output data is calculated based on the three-level decimation factor. : Sampling rate The calculation formula is: ; in: This is the first-level extraction factor. This is the second-level extraction factor. This is the third-level extraction factor. This is the original sampling frequency.

[0034] Furthermore, positive and negative compensation are applied to the sample data, including: Forward compensation: A 32nd-order adaptive FIR filter is used for passband compensation, and the filter coefficient vector is calculated and updated in real time according to the least mean square algorithm; In practice, the filter coefficient vector is calculated as follows: Where: n is the number of iterations, and each processing of a frame of signal is considered one iteration; Step size factor, representing the update rate of the control coefficients. The specific value is determined based on the actual situation. In this embodiment of the invention, the step size factor... The value is 0.01; This is the error term, measured in V or A, used to represent the deviation between the ideal passband and the actual passband. ,in It is an ideal passband response (i.e., a flat frequency response). This is the measured value of the current passband response; The input signal vector is a 32-dimensional vector, with units of V or A.

[0035] Reverse compensation: Corrects the stopband attenuation depth. The correction formula for the stopband attenuation depth is: ; in: Target stopband attenuation, in dB. For correction factor, This is the current stopband attenuation measurement.

[0036] Those skilled in the art will understand that stopband depth is used to characterize the filter's ability to suppress out-of-band noise; a larger stopband depth results in better suppression. The target stopband attenuation is determined based on the actual situation during ADC noise reduction and the required suppression capability for out-of-band noise. In this embodiment of the invention, the target stopband attenuation... The value is 85dB. Correction factor. The purpose is to control the adjustment speed of the stopband attenuation, avoid over-adjustment, and correct the coefficient. The value of is determined according to the actual situation. In this embodiment of the invention, the correction coefficient is... The value is 0.05.

[0037] In detail, on the one hand, the present invention uses a 32nd-order adaptive FIR filter + LMS algorithm to positively compensate for the passband attenuation of the filter, thereby ensuring the stability of the amplitude of the effective signal; on the other hand, the present invention uses reverse compensation to dynamically optimize the stopband attenuation depth, avoiding the problem of insufficient suppression capability of traditional fixed step size schemes for 50Hz / 60Hz power frequency noise, and avoiding residual noise affecting subsequent data processing.

[0038] Impulse noise suppression using a two-dimensional window based on signal bandwidth and abrupt change frequency includes: The value of the median filter window size N is determined based on the frequency domain window threshold. and time-domain window threshold To be determined, including: Frequency domain window threshold The calculation method is as follows: ; in: For signal bandwidth, To reduce the sampling rate, This is the spectral entropy.

[0039] Time-domain window threshold The calculation method is as follows: ; in: Mutation frequency, The sampling period after downsampling is expressed in seconds. This is used to characterize the time interval between adjacent sampling points after downsampling. This is the spectral entropy.

[0040] The formula for calculating the size N of the median filter window is: ; Where: SNR is the signal-to-noise ratio of the ADC output data. This is the signal-to-noise ratio reference value corresponding to the current application scenario. Noise weighting coefficient, For the frequency domain window threshold, The threshold value for the time-domain window; In practice, the application scenario is an industrial setting, and the corresponding signal-to-noise ratio reference value is... The value is taken as the average signal-to-noise ratio of 30dB. is the noise weighting coefficient. The value is configured according to the system, and the weighting coefficient is... The value of can be chosen to satisfy the actual need for a larger window to enhance the filtering effect as the noise becomes stronger. In this embodiment of the invention, the noise weighting coefficient is... The value is 0.15. and These are the lower and upper limits for the window size, respectively, to prevent filtering from failing due to the window being too small or real-time performance from degrading due to the window being too large. and The value of is selected according to the actual situation. In this embodiment of the invention, The value of is 3. The value is 21.

[0041] In detail, the transmission quality index is calculated, and the size of the filtering window is adjusted according to the transmission quality index, including: Transmission Quality Index The calculation formula is: ; Where α and β are the weighting coefficients for packet loss rate and transmission delay, respectively. For packet loss rate, For transmission delay; In implementation, the weighting coefficients α for packet loss rate and β for transmission delay are determined by the system based on the actual impact of packet loss rate and transmission delay on data integrity. Considering that actual packet loss has a greater impact on data integrity, their weights are higher. In this embodiment of the invention, the weighting coefficient α for packet loss rate is 0.6, and the weighting coefficient β for transmission delay is 0.4. 10% represents the maximum acceptable packet loss rate during data transmission, and 100 represents the maximum acceptable transmission delay during data transmission, in milliseconds (ms).

[0042] According to the transmission quality index Size of the filter window Adjustments are made, including: ; Where: E is the window length. This is the transmission quality index.

[0043] Furthermore, an improved comb algorithm is used to calibrate the amplitude of the filtering result and output a standard signal after noise reduction. The formula for amplitude calibration of the filtering result using the improved comb algorithm is as follows: ; Where: x(n) is the current sample value, x(nE) represents the sample value of the input signal at the Eth sample point before the current time n, x(n-2E) represents the sample value of the input signal at the 2Eth sample point before the current time n, E is the window length, and y(n) is the filtered output.

[0044] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0045] Alternatively, if the integrated units of this invention are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this invention, or the parts that contribute to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, RAM, magnetic disks, or optical disks.

Claims

1. A software algorithm-based method for ADC noise filtering at 50Hz or 60Hz, characterized in that, include: Initialize and configure the initial sampling frequency, FFT window size, and filtering parameters, and use the ADC to acquire raw data; The raw data is preprocessed to obtain detection data; The improved Goertzel algorithm was used to obtain the spectral parameters in the detection data; The three-level extraction factor is calculated based on the spectrum parameters. Based on the determined three-level extraction factor, the data output by the ADC is sampled every preset period to obtain sample data. After performing forward and reverse compensation on the sample data, impulse noise suppression is performed using a two-dimensional window based on the signal bandwidth and abrupt change frequency. Calculate the transmission quality index and adjust the size of the filtering window accordingly. An improved comb algorithm is used to calibrate the amplitude of the filtering result and output a standard signal after noise reduction. The spectral parameters include: dominant frequency, signal bandwidth, spectral entropy, and abrupt change frequency; The preprocessing includes: sliding window DC removal and Butterworth low-pass filter to suppress high-frequency interference; The improved comb algorithm is used to calibrate the amplitude of the filtering result and output a standard signal after noise reduction. The formula for amplitude calibration of the filtering result using the improved comb algorithm is as follows: ; Where: x(n) is the current sampled value, x(nE) represents the sampled value of the input signal at the Eth sampled point before the current time n, x(n-2E) represents the sampled value of the input signal at the 2Eth sampled point before the current time n, E is the window length, and y(n) is the filtered output.

2. The ADC 50Hz or 60Hz noise filtering method based on software algorithm according to claim 1, characterized in that, Obtaining the spectral parameters from the detection data includes: The main frequency of the spectrum The calculation method is as follows: ; in: Represents the amplitude of a frequency domain signal. The value after Fourier transform, For frequency variables, the unit is Hz. The square of the amplitude of the frequency domain signal; The signal bandwidth The calculation formula is: ;in: This refers to the upper limit frequency of the bandwidth, measured in Hz. This is the lower limit frequency of the bandwidth, measured in Hz. This is the frequency domain expression of the signal. This is the original sampling frequency; The spectrum entropy The calculation formula is: , ; in: For the number of frequency division points, (a=1,2,...,M) represents the frequency value at the a-th frequency division point. (j=1,2,...,M) represents the frequency value of the j-th frequency division point. The power percentage of the a-th frequency component; The mutation frequency The calculation formula is: ; Where: T is the duration of the analysis window, and N is the number of sampling points within the analysis window. This represents the amplitude difference between adjacent sampling points. To analyze the maximum amplitude of the signal within the window, This is the empirical threshold coefficient.

3. The ADC 50Hz or 60Hz noise filtering method based on software algorithm according to claim 2, characterized in that, The calculation of the third-level extraction factor based on the spectral parameters includes: The first-level decimation factor is calculated based on the dominant frequency of the spectrum. : ; Where: A is the safety factor. The dominant frequency in the spectrum. This is the original sampling frequency; First-level extraction factor A two-stage tandem integrator comb filter structure is used, and its transfer function is: ; in: For the z-transform operator, For delay One sampling point, The delay operator is for one sampling point, and the exponent 2 is used to characterize the filter order; Second-level extraction factor : ; in: , as well as These are the extraction factors for the three CIC sub-levels; The decimation factor of each CIC sub-level is dynamically adjusted based on the second-level decimation factor D2, and the filter order... Adaptive adjustment based on extraction factor: ; Where: i represents the feedback stage of the CIC filter, the higher the order, the stronger the stopband attenuation, and 16 is the order switching threshold; The value range of the third-level extraction factor D3 is [2,4]; And the first-level extraction factor Second-level extraction factor and the third-level extraction factor The value of must satisfy the total extraction multiple constraint: ; in: This represents the minimum total sampling multiple specified by the Nyquist criterion.

4. The ADC 50Hz or 60Hz noise filtering method based on software algorithm according to claim 3, characterized in that, The step of sampling the ADC output data at preset intervals according to the determined three-level extraction factor includes: The sampling rate for sampling the ADC output data is calculated based on the three-level decimation factor. : The sampling rate The calculation formula is: ; in: This is the first-level extraction factor. This is the second-level extraction factor. This is the third-level extraction factor. This is the original sampling frequency.

5. The ADC 50Hz or 60Hz noise filtering method based on software algorithm according to claim 1, characterized in that, The positive and negative compensation of the sample data includes: Forward compensation: A 32nd-order adaptive FIR filter is used for passband compensation, and the filter coefficient vector is calculated and updated in real time according to the least mean square algorithm; Reverse compensation: Corrects the stopband attenuation depth. The correction formula for the stopband attenuation depth is: ; in: For target stopband attenuation, For correction factor, This is the current stopband attenuation measurement.

6. The ADC 50Hz or 60Hz noise filtering method based on software algorithm according to claim 5, characterized in that, The two-dimensional window impulse noise suppression based on signal bandwidth and abrupt change frequency includes: The value of the median filter window size N is determined based on the frequency domain window threshold. and time-domain window threshold To be determined, including: Frequency domain window threshold The calculation method is as follows: ; in: For signal bandwidth, To reduce the sampling rate, For spectral entropy; Time-domain window threshold The calculation method is as follows: ; in: Mutation frequency, The sampling period after downsampling, in seconds. For spectral entropy; The formula for calculating the size N of the median filter window is: ; Where: SNR is the signal-to-noise ratio of the ADC output data. This is the signal-to-noise ratio reference value corresponding to the current application scenario. Noise weighting coefficient, For the frequency domain window threshold, The time-domain window threshold, This is the lower limit of the window size. This is the upper limit of the window size.

7. The ADC 50Hz or 60Hz noise filtering method based on software algorithm according to claim 6, characterized in that, The transmission quality index The calculation formula is: ; Where α and β are the weighting coefficients for packet loss rate and transmission delay, respectively. For packet loss rate, This is for transmission delay.

8. The ADC 50Hz or 60Hz noise filtering method based on software algorithm according to claim 7, characterized in that, The size of the filter window is determined based on the transmission quality index. Adjustments are made, including: ; Where: E is the window length. This is the transmission quality index.

Citation Information

Patent Citations

  • Multi-level pulse compensation type active EMI (Electro-Magnetic Interference) filter applied to multi-noise source switching power supply

    CN120638853A

  • Digital linearization circuit

    US20040247042A1