Digital signal filtering method, apparatus, device, and storage medium
By calculating the ratio of sampling time to period time, and using Fast Fourier Transform and Inverse Fourier Transform to update the spectral values and split the data sequence, the problems of FIR/IIR filter distortion and coarse filtering granularity are solved, realizing a digital signal filtering method that achieves fine filtering and signal integrity.
Patent Information
- Application Number
- CN202510204292.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2045-02-24
AI Technical Summary
In existing technologies, FIR or IIR filters are prone to distortion when filtering signals, and are only applicable to specific frequency ranges. They also have relatively coarse filtering granularity and poor filtering effect.
By acquiring the discrete data sequence of the signal to be processed and the period time of the target suppression frequency, the ratio of sampling time to period time is calculated. The spectrum value is updated using fast Fourier transform and inverse transform to filter out the target suppression frequency. If necessary, the data sequence is split into subsequences for processing to ensure the accuracy and completeness of filtering.
It achieves fine filtering at specific frequency points, reduces signal distortion, improves filtering effect, and ensures waveform integrity and accuracy.
Smart Images

Figure CN120301397B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to a digital signal filtering method and device, equipment and storage medium. BACKGROUND
[0002] In actual application scenarios, in order to better maintain, optimize and troubleshoot the equipment, the user often needs to finely separate the signal containing multiple frequency components, for example, processing the high-frequency signal superimposed on the power frequency signal. The power frequency signal is the basic frequency component in the power system and widely exists in the operation data of various electrical equipment. However, in the actual measurement and analysis process, the user often pays more attention to the high-frequency components superimposed on the power frequency signal. These high-frequency signals may represent the specific operating state, fault characteristics or external interference of the equipment, and thus the high-frequency signal needs to be accurately extracted from the complex mixed signal to realize the separate observation and measurement of the signal.
[0003] In the related art, a FIR (Finite Impulse Response) filter or an IIR (Infinite Impulse Response) filter is used to filter out the power frequency signal. Specifically, a specific impulse response is convolved with the original signal to obtain a filtered waveform. However, the waveform obtained by using the FIR filter or the IIR filter is prone to distortion, and can only be applied to signal filtering in a special frequency spectrum range, the filtering granularity is relatively rough, and the filtering effect is relatively poor. SUMMARY
[0004] Embodiments of the present application provide a digital signal filtering method, device, equipment and storage medium, which solve the problem that the waveform obtained by using the FIR filter or the IIR filter in the related art is prone to distortion, and can only be applied to signal filtering in a special frequency spectrum range, the filtering granularity is relatively rough, and the filtering effect is relatively poor. The embodiments of the present application realize filtering processing for a specific frequency point, refine the filtering granularity, effectively guarantee the removal of the target suppression frequency point, completely restore the waveform, reduce signal distortion, and improve the filtering effect.
[0005] In a first aspect, the embodiments of the present application provide a digital signal filtering method, comprising:
[0006] obtaining a discrete data sequence corresponding to a to-be-processed signal, and obtaining a period time corresponding to a target suppression frequency point;
[0007] calculating a sampling time based on a first length of the discrete data sequence and a sampling rate corresponding to a set analog-to-digital converter, and dividing the sampling time by the period time to obtain a reference quantity value;
[0008] In the case that the reference quantity value is an integer, performing a fast Fourier transform on the discrete data sequence to obtain a target spectrum, updating a spectrum value corresponding to each of the target suppression frequency point and its associated mirror frequency point in the target spectrum to a first target spectrum value corresponding to a nearest frequency point on the right side of the target suppression frequency point;
[0009] Performing an inverse fast Fourier transform on the updated target spectrum to obtain a first target waveform.
[0010] Optionally, the digital signal filtering method further comprises:
[0011] In the case that the reference quantity value is a non-integer, calculating a first data sequence number corresponding to a maximum integer period in the discrete data sequence based on the first length, the sampling rate and the period time, and dividing the discrete data sequence into a first sub-sequence and a second sub-sequence based on the first data sequence number;
[0012] Performing a fast Fourier transform on the first sub-sequence and the second sub-sequence respectively to obtain a first spectrum and a second spectrum;
[0013] Calculating a second target spectrum value based on the period time, the sampling rate, the first length, the first data sequence number, a spectrum value corresponding to each of the target suppression frequency point and its nearest frequency point on the right side, and updating the spectrum value corresponding to each of the target suppression frequency point, the associated mirror frequency point and the nearest frequency point in the first spectrum and the second spectrum to the second target spectrum value;
[0014] Performing an inverse fast Fourier transform on the updated first spectrum and the updated second spectrum respectively to obtain a first waveform and a second waveform, and combining the first waveform and the second waveform to obtain a second target waveform.
[0015] Optionally, the calculating a first data sequence number corresponding to a maximum integer period in the discrete data sequence based on the first length, the sampling rate and the period time comprises:
[0016] Multiplying the sampling rate by the period time to obtain a first calculation result;
[0017] Dividing the first length by the first calculation result to obtain a second calculation result, and performing a floor operation on the second calculation result to obtain a first integer result;
[0018] Multiplying the first integer result by the first calculation result to obtain a third calculation result, and performing a floor operation on the third calculation result to obtain the first data sequence number corresponding to the maximum integer period in the discrete data sequence.
[0019] Optionally, the dividing the discrete data sequence into a first sub-sequence and a second sub-sequence based on the first data index comprises:
[0020] The data sequence from a start data point to a first target data point corresponding to the first data index in the discrete data sequence is determined as the first sub-sequence.
[0021] A second data index is obtained by subtracting the first length from the first data index.
[0022] The data sequence from a second target data point corresponding to the second data index to an end data point in the discrete data sequence is determined as the second sub-sequence.
[0023] Optionally, the obtaining the second target spectrum value based on the period time, the sampling rate, the first length, the first data index, the target suppression frequency point and a most adjacent frequency point right to the target suppression frequency point comprises:
[0024] An amplitude ratio of the target suppression frequency point relative to the most adjacent frequency point right to the target suppression frequency point is obtained based on the period time, the sampling rate, the first length and the first data index.
[0025] A leakage spectrum value is obtained by multiplying the spectrum value corresponding to the target suppression frequency point by the amplitude ratio, and a second target spectrum value is obtained by subtracting the leakage spectrum value from the spectrum value corresponding to the most adjacent frequency point right to the target suppression frequency point.
[0026] Optionally, the obtaining the amplitude ratio of the target suppression frequency point relative to the most adjacent frequency point right to the target suppression frequency point based on the period time, the sampling rate, the first length and the first data index comprises:
[0027] A first calculation result is obtained by multiplying the sampling rate by the period time, a second calculation result is obtained by dividing the first length by the first calculation result, and a first integer result is obtained by rounding down the second calculation result.
[0028] A measurement frequency is obtained by dividing the product of the first integer result and the sampling rate by the first data index, a suppression frequency is obtained by taking an inverse of the period time, a frequency deviation ratio is obtained by dividing the difference between the suppression frequency and the measurement frequency by the measurement frequency.
[0029] The amplitude ratio of the target suppression frequency point relative to the most adjacent frequency point right to the target suppression frequency point is obtained based on the frequency deviation ratio and a set sampling function.
[0030] Optionally, the amplitude ratio of the target suppression frequency point to the nearest frequency point on the right side thereof is calculated based on the frequency offset ratio and a preset sampling function, including:
[0031] The sum of the frequency offset ratio and the preset numerical value is substituted into a preset sampling function to obtain a first intermediate result;
[0032] The frequency spectrum ratio is substituted into a preset sampling function to obtain a second intermediate result;
[0033] The first intermediate result is divided by the second intermediate result to obtain the amplitude ratio of the target suppression frequency point to the nearest frequency point on the right side thereof.
[0034] Optionally, after the updated target spectrum is inversely fast Fourier transformed to obtain a first target waveform, the method further includes:
[0035] The first target waveform is output to a display unit, so that the display unit displays the first target waveform, and the first target waveform is output to an FPGA unit, so that the FPGA unit performs a preset measurement processing and a preset operation processing on the first target waveform.
[0036] In a second aspect, the embodiments of the present application further provide a digital signal filtering device, which comprises:
[0037] An acquisition unit configured to acquire a discrete data sequence corresponding to a to-be-processed signal, and acquire a period time corresponding to a target suppression frequency point;
[0038] A reference numerical value calculation unit configured to calculate a sampling time based on a first length of the discrete data sequence and a preset sampling rate corresponding to an analog-to-digital converter, and divide the sampling time by the period time to obtain a reference numerical value;
[0039] A first spectrum updating unit configured to, in a case where the reference numerical value is an integer, perform fast Fourier transform on the discrete data sequence to obtain a target spectrum, and update a spectrum value corresponding to the target suppression frequency point and a mirror frequency point associated with the target suppression frequency point in the target spectrum to a first target spectrum value corresponding to the nearest frequency point on the right side of the target suppression frequency point;
[0040] A first waveform determination unit configured to inversely fast Fourier transform the updated target spectrum to obtain a first target waveform.
[0041] Optionally, the digital signal filtering device further comprises:
[0042] a second spectrum updating unit, configured to, in a case that the reference quantity value is not an integer, calculate a first data sequence number corresponding to a maximum integer period in the discrete data sequence based on the first length, the sampling rate and the period time, divide the discrete data sequence into a first sub-sequence and a second sub-sequence based on the first data sequence number, and perform fast Fourier transform on the first sub-sequence and the second sub-sequence respectively to obtain a first spectrum and a second spectrum; and calculate a second target spectrum value based on the period time, the sampling rate, the first length, the first data sequence number, a target suppression frequency point and a most adjacent frequency point right to the target suppression frequency point, and update spectrum values corresponding to the target suppression frequency point, an associated mirror frequency point and the most adjacent frequency point in the first spectrum and the second spectrum respectively to the second target spectrum value.
[0043] a second waveform determining unit, configured to perform inverse fast Fourier transform on the updated first spectrum and the updated second spectrum respectively to obtain a first waveform and a second waveform, and combine the first waveform and the second waveform to obtain a second target waveform.
[0044] Optionally, the second spectrum updating unit comprises:
[0045] a sequence number calculating module, configured to multiply the sampling rate and the period time to obtain a first calculation result, divide the first length by the first calculation result to obtain a second calculation result, and take the second calculation result down to an integer to obtain a first integer result, multiply the first integer result and the first calculation result to obtain a third calculation result, and take the third calculation result down to an integer to obtain the first data sequence number corresponding to the maximum integer period in the discrete data sequence.
[0046] Optionally, the second spectrum updating unit comprises:
[0047] a sequence splitting module, configured to determine a data sequence from a start data point to a first target data point corresponding to the first data sequence number in the discrete data sequence as the first sub-sequence, subtract the first length from the first data sequence number to obtain a second data sequence number, and determine a data sequence from a second target data point corresponding to the second data sequence number to an end data point in the discrete data sequence as the second sub-sequence.
[0048] Optionally, the second spectrum updating unit comprises:
[0049] The spectrum value calculation module is configured to calculate an amplitude ratio of the target suppression frequency point relative to the most adjacent frequency point on the right side of the target suppression frequency point based on the cycle time, the sampling rate, the first length, and the first data sequence number; multiply the spectrum value corresponding to the target suppression frequency point by the amplitude ratio to obtain a leakage spectrum value; and subtract the leakage spectrum value from the spectrum value corresponding to the most adjacent frequency point on the right side of the target suppression frequency point to obtain a second target spectrum value.
[0050] Optionally, the spectrum value calculation module is further configured to:
[0051] multiply the sampling rate by the cycle time to obtain a first calculation result, divide the first length by the first calculation result to obtain a second calculation result, and take the second calculation result as an integer to obtain a first integer result;
[0052] divide the product of the first integer result and the sampling rate by the first data sequence number to obtain a measurement frequency, take the cycle time as an inverse to obtain a suppression frequency, divide the difference between the suppression frequency and the measurement frequency by the measurement frequency to obtain a frequency offset ratio;
[0053] calculate the amplitude ratio of the target suppression frequency point relative to the most adjacent frequency point on the right side of the target suppression frequency point based on the frequency offset ratio and a set sampling function.
[0054] Optionally, the spectrum value calculation module is further configured to:
[0055] substitute the sum of the frequency offset ratio and a preset value into the set sampling function to obtain a first intermediate result;
[0056] substitute the spectrum ratio into the set sampling function to obtain a second intermediate result;
[0057] divide the first intermediate result by the second intermediate result to obtain the amplitude ratio of the target suppression frequency point relative to the most adjacent frequency point on the right side of the target suppression frequency point.
[0058] Optionally, the result output unit is further configured to:
[0059] output the first target waveform to the display unit, so that the display unit displays the first target waveform, and output the first target waveform to the FPGA unit, so that the FPGA unit performs preset measurement processing and preset operation processing on the first target waveform.
[0060] In a third aspect, an electronic device is provided. The device includes one or more processors; and a storage configured to store one or more programs, when executed by the one or more processors, cause the one or more processors to implement the digital signal filtering method according to the embodiments of the present application.
[0061] In a fourth aspect, a non-transitory storage medium storing computer executable instructions is provided. When executed by a computer processor, the computer executable instructions configure the computer processor to implement the digital signal filtering method according to the embodiments of the present application.
[0062] In the embodiments of the present application, the discrete data sequence corresponding to the signal to be processed is obtained, and the periodic time corresponding to the target suppression frequency point is obtained. The sampling time is calculated based on the first length of the discrete data sequence and the sampling rate corresponding to the analog-to-digital converter set. The reference quantity value is obtained by dividing the sampling time by the periodic time. In the case that the reference quantity value is an integer, the target spectrum is obtained by performing fast Fourier transform on the discrete data sequence. The spectrum values corresponding to the target suppression frequency point and the associated mirror frequency point in the target spectrum are updated to the first target spectrum values corresponding to the nearest frequency points on the right side of the target suppression frequency point. The first target waveform is obtained by performing inverse fast Fourier transform on the updated target spectrum. In the above scheme, the reference quantity value is obtained by dividing the calculated sampling time by the periodic time, which can effectively determine whether the signal corresponding to the target suppression frequency point is sampled in an integer period, and provide reliable data reference for subsequent filtering operations. In the case that the reference quantity value is an integer, it can be considered that the time domain signal corresponding to the target suppression frequency point is sampled in an integer period, and the target spectrum is obtained by performing fast Fourier transform on the discrete data sequence. The filtering processing in the frequency domain can be realized for a specific frequency point, the filtering granularity is refined, and the spectrum values corresponding to the target suppression frequency point and the associated mirror frequency point in the target spectrum are updated to the first target spectrum values corresponding to the nearest frequency points on the right side of the target suppression frequency point, which can effectively ensure that the target suppression frequency point is removed while the waveform is completely restored, reduce signal distortion, and improve the filtering effect. BRIEF DESCRIPTION OF DRAWINGS
[0063] Figure 1 A flowchart of a digital signal filtering method according to the embodiments of the present application is provided.
[0064] Figure 2 A schematic diagram of filtering out a target suppression frequency point in the frequency domain according to the embodiments of the present application is provided.
[0065] Figure 3 A flowchart of another digital signal filtering method according to the embodiments of the present application is provided.
[0066] Figure 4A flow chart of a specific implementation process for determining a first data sequence number corresponding to a maximum integral period in a discrete data sequence provided by an embodiment of the present application;
[0067] Figure 5 A flow chart of a specific implementation process for dividing a discrete data sequence into a first sub-sequence and a second sub-sequence provided by an embodiment of the present application;
[0068] Figure 6 A schematic diagram of splitting a discrete data sequence into a first sub-sequence and a second sub-sequence provided by an embodiment of the present application;
[0069] Figure 7 A flow chart of a specific implementation process for calculating a second target spectral value provided by an embodiment of the present application;
[0070] Figure 8 A flow chart of a specific implementation process for calculating an amplitude ratio of a target suppression frequency point relative to its rightmost adjacent frequency point provided by an embodiment of the present application;
[0071] Figure 9 Another schematic diagram of filtering a target suppression frequency point in a frequency domain provided by an embodiment of the present application;
[0072] Figure 10 A structural block diagram of a digital signal filtering device provided by an embodiment of the present application;
[0073] Figure 11 A structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0074] The embodiments of the present application will be further described below in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, but not to limit the embodiments of the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the embodiments of the present application are shown in the drawings, but not all the structures.
[0075] The terms "first", "second", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be exchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than that illustrated or described herein, and the objects distinguished by "first", "second", etc. are usually a class, not limited to the number of objects, for example, the first object can be one or more. In addition, the specification and claims "and / or" means at least one of the connected objects, the character " / ", generally indicates that the front and rear associated objects are in an "or" relationship.
[0076] The execution subject of each step of the digital signal filtering method provided in the embodiments of the present application can be a computer device, which refers to any electronic device with data calculation, processing and storage capabilities, such as a terminal device such as a PC (Personal Computer), and can also be a server or the like, which is not limited in the embodiments of the present application.
[0077] The inventors found in the process of separating signals of various frequency components using FIR filters or IIR filters that, since the FIR filters or IIR filters are used to convolve a specific impulse response with an original signal to obtain a filtered waveform, the data at the front end of the filtered waveform is unstable and error data is prone to occur, thereby causing signal distortion in the initial part of the filtered waveform. Secondly, the FIR filters or IIR filters can only remove signals in certain special frequency ranges, for example, signals greater than a certain frequency or smaller than a certain frequency, and cannot be specific to removing signals of one or a few frequency points. Furthermore, when the frequency of a desired signal is close to that of an interference signal, the FIR or IIR filter cannot provide a better filtering effect. Therefore, the present application aims to provide a digital signal filtering method, device, equipment and storage medium, to solve the problems that the waveform obtained by using the FIR filter or IIR filter is prone to distortion, and can only be applied to signal filtering in a special frequency range, the filtering granularity is relatively rough, and the filtering effect is relatively poor.
[0078] Figure 1 A flowchart of a digital signal filtering method provided in the embodiments of the present application is shown in FIG. 1. The digital signal filtering method can be implemented with a processor as an execution subject. As shown in FIG. 1, the digital signal filtering method specifically includes the following steps: Figure 1
[0079] Step S110, obtaining a discrete data sequence corresponding to a to-be-processed signal, and obtaining a period time corresponding to a target suppression frequency point.
[0080] The discrete data sequence can be a digital signal obtained by converting the to-be-processed signal by an analog-to-digital converter, and specifically includes discrete data points in multiple time domains. It should be noted that the period time of the target suppression frequency point can be a period time corresponding to a power frequency signal that needs to be suppressed, which is pre-set by a developer according to the specific needs of an actual application scenario, for example, for a 50Hz power frequency signal, the corresponding period time is 0.02s.
[0081] Step S120, calculating a sampling time based on the first length of the discrete data sequence and the sampling rate corresponding to the analog-to-digital converter, and dividing the sampling time by the period time to obtain a reference quantity value.
[0082] Specifically, the first length represents the number of data points of the discrete data sequence, and the sampling rate of the analog-to-digital converter represents the number of sample data points collected per second by the analog-to-digital converter, so that the relevant formula for calculating the sampling time is as follows:
[0083] t s =L / F s ,
[0084] Where t s is the sampling time, L is the first length, and F s is the sampling rate of the analog-to-digital converter. It can be understood that the sampling time needs to be ensured to be greater than twice the period time corresponding to the target rejection frequency point, so as to effectively collect and remove the time domain signal corresponding to the target rejection frequency point.
[0085] In addition, in order to effectively remove the time domain signal corresponding to the target rejection frequency point, it is necessary to determine whether the frequency point signal is sampled for an integer period, so as to take the corresponding filtering operation. Specifically, by dividing the sampling time by the period time, a reference number value can be obtained, and the relevant formula is as follows:
[0086] num=t s / T1,
[0087] Where num is the reference number value, t s is the sampling time, and T1 is the period time corresponding to the target rejection frequency point. If the reference number value is an integer, it means that the time domain signal corresponding to the target rejection frequency point can be sampled by an integer multiple, and if the reference number value is not an integer, it means that the time domain signal corresponding to the target rejection frequency point cannot be sampled by an integer multiple, so that different filtering processes can be taken according to different judgment results.
[0088] Step S130, in the case where the reference number value is an integer, performing fast Fourier transform on the discrete data sequence to obtain a target spectrum, and updating the spectrum values corresponding to the target rejection frequency point and its associated mirror frequency point in the target spectrum to the first target spectrum values corresponding to the nearest frequency points on the right side of the target rejection frequency point.
[0089] It should be noted that if the reference data value is an integer, it indicates that the time domain signal corresponding to the target suppression frequency point can be sampled by an integer multiple, so that the discrete data sequence can be directly subjected to fast Fourier transform to obtain a target spectrum, and the discrete data sequence is converted to the frequency domain for processing. Although the target spectrum values corresponding to the target suppression frequency point and its associated mirror frequency point can be removed to achieve the purpose of filtering, part of the effective components can be filtered out, resulting in the integrity of the final target waveform being affected. Therefore, the target spectrum values corresponding to the target suppression frequency point and its associated mirror frequency point can be updated to the first target spectrum value of the nearest frequency point located to the right of the target suppression frequency point, so that the target suppression frequency point can be removed while ensuring the integrity of the final target waveform. Specifically, Figure 2 The schematic diagram provided by the embodiment of the present application for filtering out the target suppression frequency point in the frequency domain is shown in Figure 2 F1 is the target suppression frequency point, and F2 is the nearest frequency point located to the right of the target suppression frequency point. By updating the spectrum value corresponding to the target suppression frequency point F1 to the first target spectrum value of the nearest frequency point F2, the purpose of filtering out the target suppression frequency point is achieved. It should be noted that the updating process of the spectrum value corresponding to the associated mirror frequency point is not shown in Figure 2 .
[0090] In step S140, the updated target spectrum is subjected to inverse fast Fourier transform to obtain a first target waveform.
[0091] It can be understood that in the embodiment, the discrete data sequence corresponding to the signal to be processed is converted to the frequency domain for filtering processing by fast Fourier transform, and is restored to the time domain by inverse fast Fourier transform, which can reduce the distortion of the target waveform and remove individual or several discrete individual frequency points without affecting the signals of the nearby frequency points.
[0092] Optionally, after the updated target spectrum is subjected to inverse fast Fourier transform to obtain the first target waveform, the method further includes:
[0093] The first target waveform is output to a display unit to enable the display unit to display the first target waveform, and the first target waveform is output to an FPGA unit to enable the FPGA unit to perform a preset measurement processing and a preset operation processing on the first target waveform.
[0094] It should be noted that the display unit can display the first target waveform to show the waveform after the target suppression frequency point is filtered out to the user, and the FPGA unit can perform the preset measurement processing and the preset operation processing on the first target waveform. The preset measurement processing can be frequency measurement, amplitude measurement, phase measurement, etc., and the preset operation processing can be smoothing processing, enhancement processing, etc., which are not limited herein.
[0095] The above, by acquiring the discrete data sequence corresponding to the signal to be processed, and acquiring the period time corresponding to the target suppression frequency point, the sampling time is calculated based on the first length of the discrete data sequence and the sampling rate corresponding to the set analog-to-digital converter, the reference quantity value is obtained by dividing the sampling time by the period time, in the case of the reference quantity value being an integer, the target spectrum is obtained by performing fast Fourier transform on the discrete data sequence, the spectrum values corresponding to the target suppression frequency point and its associated mirror frequency point in the target spectrum are updated to the first target spectrum values corresponding to the nearest frequency points on the right side of the target suppression frequency point, and the first target waveform is obtained by performing inverse fast Fourier transform on the updated target spectrum. In the above scheme, the reference quantity value is obtained by dividing the calculated sampling time by the period time, which can effectively determine whether the signal corresponding to the target suppression frequency point is sampled in an integer period, and provide reliable data reference for subsequent filtering operation. In the case of the reference quantity value being an integer, it can be considered that the signal corresponding to the target suppression frequency point is sampled in an integer period, and the target spectrum is obtained by performing fast Fourier transform on the discrete data sequence, which can realize filtering processing in the frequency domain for specific frequency points, refine the filtering granularity, and update the spectrum values corresponding to the target suppression frequency point and its associated mirror frequency point in the target spectrum to the first target spectrum values corresponding to the nearest frequency points on the right side of the target suppression frequency point, which can effectively ensure that the target suppression frequency point is removed while the waveform is completely restored, reduce signal distortion, and improve filtering effect.
[0096] Figure 3 Another flowchart of the digital signal filtering method provided by the embodiment of the present application is shown as Figure 3 The digital signal filtering method specifically includes the following steps:
[0097] Step S210, acquiring the discrete data sequence corresponding to the signal to be processed, and acquiring the period time corresponding to the target suppression frequency point.
[0098] Step S220, calculating the sampling time based on the first length of the discrete data sequence and the sampling rate corresponding to the set analog-to-digital converter, and obtaining the reference quantity value by dividing the sampling time by the period time.
[0099] Step S230, in the case of the reference quantity value being an integer, performing fast Fourier transform on the discrete data sequence to obtain the target spectrum, and updating the spectrum values corresponding to the target suppression frequency point and its associated mirror frequency point in the target spectrum to the first target spectrum values corresponding to the nearest frequency points on the right side of the target suppression frequency point.
[0100] Step S240, performing inverse fast Fourier transform on the updated target spectrum to obtain the first target waveform.
[0101] Step S250, in the case where the reference quantity value is a non-integer, based on the first length, the sampling rate and the cycle time, a first data sequence number corresponding to a maximum integer cycle in the discrete data sequence is calculated, and the discrete data sequence is divided into a first sub-sequence and a second sub-sequence based on the first data sequence number.
[0102] If the reference quantity value is a non-integer, it means that the time domain signal corresponding to the target suppression frequency point cannot be sampled by an integer multiple, and the discrete data sequence needs to be split into two sub-sequences for separate processing to ensure that the target suppression frequency point can be completely filtered out. By combining the first length, the sampling rate and the cycle time, the first data sequence number corresponding to the maximum integer cycle in the discrete data sequence can be calculated and determined, thereby effectively splitting the discrete data sequence.
[0103] In an optional embodiment, a specific implementation process for calculating the first data sequence number corresponding to the maximum integer cycle in the discrete data sequence based on the first length, the sampling rate and the cycle time is described. Please refer to Figure 4 , which is a flowchart of a specific implementation process for determining the first data sequence number corresponding to the maximum integer cycle in the discrete data sequence according to an embodiment of the present application, as shown in Figure 4 , the specific implementation steps for calculating the first data sequence number corresponding to the maximum integer cycle in the discrete data sequence based on the first length, the sampling rate and the cycle time are as follows:
[0104] Step S251, multiply the sampling rate by the cycle time to obtain a first calculation result.
[0105] Step S252, divide the first length by the first calculation result to obtain a second calculation result, and take the second calculation result down to an integer to obtain a first integer result.
[0106] Step S253, multiply the first integer result by the first calculation result to obtain a third calculation result, and take the third calculation result down to an integer to obtain the first data sequence number corresponding to the maximum integer cycle in the discrete data sequence.
[0107] It should be noted that in combination with the related description of steps S251-S253, the related formula for calculating the first data sequence number corresponding to the maximum integer cycle in the discrete data sequence is as follows:
[0108]
[0109] Wherein, numsimple is the first data sequence number, F s is the sampling rate corresponding to the analog-to-digital converter, T1 is the cycle time corresponding to the target suppression frequency point, L is the first length of the discrete data sequence, is a down rounding function.
[0110] In an optional embodiment, a specific implementation process of dividing the discrete data sequence into the first sub-sequence and the second sub-sequence based on the first data index is described, please refer to Figure 5 which is a flow chart of a specific implementation process of dividing the discrete data sequence into the first sub-sequence and the second sub-sequence provided by the embodiment of the application, as shown in Figure 5 the specific implementation steps of dividing the discrete data sequence into the first sub-sequence and the second sub-sequence based on the first data index are as follows:
[0111] Step S254, determining the data sequence from the starting data point to the first target data point corresponding to the first data index in the discrete data sequence as the first sub-sequence.
[0112] Step S255, obtaining the second data index by subtracting the first data index from the first length;
[0113] Step S256, determining the data sequence from the second target data point corresponding to the second data index to the ending data point in the discrete data sequence as the second sub-sequence.
[0114] It should be noted that the related formula for determining the first sub-sequence and the second sub-sequence is as follows:
[0115] Data_adc1=Data_adc[:numsimple],
[0116] Data_adc2=Data_adc[L-numsimple:],
[0117] wherein, Data_adc1 is the first sub-sequence, Data_adc2 is the second sub-sequence, Data_adc is the discrete data sequence, L is the first length, numsimple is the first data index, :numsimple indicates from the starting data point to the first target data point, and it can be understood that the first length L and the first data index numsimple can obtain the second data index, L-numsimple: indicates from the second target data point to the ending data point. Specifically, Figure 6 a schematic diagram of dividing the discrete data sequence into the first sub-sequence and the second sub-sequence provided by the embodiment of the application, as shown in Figure 6 based on the first data index, the discrete data sequence 101 can be divided into the first sub-sequence 102 and the second sub-sequence 103.
[0118] Step S260, respectively performing fast Fourier transform on the first sub-sequence and the second sub-sequence to obtain the first frequency spectrum and the second frequency spectrum.
[0119] The first subsequence and the second subsequence are subjected to fast Fourier transform, so that the first subsequence and the second subsequence are converted into the frequency domain for processing.
[0120] In step S270, the second target spectrum value is calculated based on the period time, the sampling rate, the first length, the first data sequence number, the target suppression frequency point and the spectrum value corresponding to the nearest frequency point on the right side of the target suppression frequency point, and the spectrum values corresponding to the target suppression frequency point, the associated mirror frequency point and the nearest frequency point on the right side of the target suppression frequency point in the first spectrum and the second spectrum are updated to the second target spectrum value.
[0121] In an optional embodiment, a specific implementation process for calculating the second target spectrum value based on the period time, the sampling rate, the first length, the first data sequence number, the target suppression frequency point and the spectrum value corresponding to the nearest frequency point on the right side of the target suppression frequency point is described. Figure 7 The specific implementation process for calculating the second target spectrum value provided by the embodiment of the application is a flowchart as shown in Figure 7 The specific implementation steps for calculating the second target spectrum value based on the period time, the sampling rate, the first length, the first data sequence number, the target suppression frequency point and the spectrum value corresponding to the nearest frequency point on the right side of the target suppression frequency point are as follows:
[0122] In step S271, the amplitude ratio of the target suppression frequency point to the nearest frequency point on the right side of the target suppression frequency point is calculated based on the period time, the sampling rate, the first length and the first data sequence number.
[0123] In a specific embodiment, Figure 8 The specific implementation process for calculating the amplitude ratio of the target suppression frequency point to the nearest frequency point on the right side of the target suppression frequency point provided by the embodiment of the application is a flowchart as shown in Figure 8 The specific implementation process for calculating the amplitude ratio of the target suppression frequency point to the nearest frequency point on the right side of the target suppression frequency point provided by the embodiment of the application is a flowchart as shown in
[0124] In step S2711, the sampling rate is multiplied by the period time to obtain a first calculation result, the first length is divided by the first calculation result to obtain a second calculation result, and the second calculation result is rounded down to obtain a first integer result.
[0125] In step S2712, the product of the first integer result and the sampling rate is divided by the first data sequence number to obtain a measurement frequency, the period time is taken as an inverse to obtain a suppression frequency, and the difference between the suppression frequency and the measurement frequency is divided by the measurement frequency to obtain a frequency offset ratio.
[0126] Specifically, the calculation formula of the suppression frequency is as follows:
[0127]
[0128] F1 is the suppression frequency, and T1 is the period time of the target suppression frequency point.
[0129] The calculation formula of the measurement frequency is as follows:
[0130]
[0131] Wherein, F m is the measurement frequency, F s is the sampling rate corresponding to the analog-to-digital converter, T1 is the period time corresponding to the target suppression frequency point, L is the first length of the discrete data sequence, numsimple is the first data serial number corresponding to the maximum integral period in the discrete data sequence, is the floor function. It should be noted that the measurement frequency is obtained by converting the discrete data sequence into the frequency domain through fast Fourier transform, and there is a deviation from the theoretical suppression frequency.
[0132] The calculation formula of the frequency deviation ratio is as follows:
[0133]
[0134] Wherein, k is the frequency deviation ratio, F1 is the suppression frequency, F m is the measurement frequency.
[0135] Step S2713, based on the frequency deviation ratio and the set sampling function, the amplitude ratio of the target suppression frequency point to the nearest frequency point on the right is calculated.
[0136] Specifically, the sampling function can use the sinc() function, and the specific calculation process of calculating the amplitude ratio based on the frequency deviation ratio and the set sampling function is as follows:
[0137] The sum of the frequency deviation ratio and the preset value is substituted into the set sampling function to obtain a first intermediate result, the frequency spectrum ratio is substituted into the set sampling function to obtain a second intermediate result, and the first intermediate result is divided by the second intermediate result to obtain the amplitude ratio of the target suppression frequency point to the nearest frequency point on the right.
[0138] Correspondingly, the calculation formula of the amplitude ratio is as follows:
[0139]
[0140] Wherein, k amp is the amplitude ratio, and k is the frequency deviation ratio.
[0141] Step S272, the spectrum value corresponding to the target suppression frequency point is multiplied by the amplitude ratio to obtain a leakage spectrum value, and the spectrum value corresponding to the nearest frequency point on the right of the target suppression frequency point is subtracted from the leakage spectrum value to obtain a second target spectrum value.
[0142] It should be noted that since the reference quantity value is not an integer, the time domain signal of the target suppression frequency point may not be completely sampled, and the energy corresponding to the target suppression frequency point may leak to the nearest frequency point, so by calculating the leakage spectrum value, the component of the spectrum value corresponding to the target suppression frequency point leaking to the nearest frequency point can be obtained, which needs to be removed to restore the real spectrum value of the nearest frequency point, otherwise the target waveform obtained subsequently will be distorted.
[0143] Specifically, Figure 9 Another schematic diagram for filtering out the target suppression frequency point in the frequency domain provided by the embodiment of the present application is shown in FIG. 3. Figure 9 As shown in FIG. 3, F1 is the target suppression frequency point, F2 is the nearest frequency point located on the right side of the target suppression frequency point, and the spectrum value corresponding to the target suppression frequency point F1 is multiplied by the amplitude ratio k amp to obtain the leakage spectrum value Δ, and the amplitude value corresponding to the nearest frequency point F2 minus the leakage spectrum value Δ can obtain the second target spectrum value. By updating the spectrum value corresponding to the target suppression frequency point F1 to the second target spectrum value of the nearest frequency point F2, the purpose of filtering out the target suppression frequency point F1 is achieved. It should be noted that the updating process of the spectrum value corresponding to the associated image frequency point is not shown in Figure 9 .
[0144] Step S280, respectively, inverse fast Fourier transform the updated first spectrum and the second spectrum to obtain the first waveform and the second waveform, and combine the first waveform and the second waveform to obtain the second target waveform.
[0145] In one embodiment, the related formula for combining the first waveform and the second waveform is as follows:
[0146] Data_highfir[]=Data_highfir1[:]+Data_highfir2[2*numsimple-L:],
[0147] wherein Data_highfir[] is the second target waveform, Data_highfir1[] is the first waveform, and Data_highfir2[] is the second waveform. It should be noted that in order to restore the second target waveform with a length of L, Data_highfir1[:] represents extracting all data points of the first waveform, and Data_highfir2[2*numsimple-L:] represents extracting all data points from the middle data point with data number 2*numsimple-L to the end data point of the second waveform.
[0148] In another embodiment, the first waveform and the second waveform can also be combined with weighting to obtain the second target waveform with a first length, which is not limited herein.
[0149] Optionally, after the first waveform and the second waveform are combined to obtain the second target waveform, the method further comprises:
[0150] outputting the second target waveform to a display unit, so that the display unit displays the second target waveform, and outputting the second target waveform to an FPGA unit, so that the FPGA unit performs a preset measurement processing and a preset operation processing on the second target waveform.
[0151] It should be noted that the display unit can display the second target waveform to show the user the waveform after filtering out the target suppression frequency point, and the FPGA unit can perform the preset measurement processing and the preset operation processing on the second target waveform. The preset measurement processing can be frequency measurement, amplitude measurement, phase measurement, etc., and the preset operation processing can be smoothing processing, enhancement processing, etc., which are not limited herein.
[0152] In the above, in the case where the reference quantity value is not an integer, it can be considered that the time domain signal corresponding to the target suppression frequency point is not sampled in an integer period, and the discrete data sequence needs to be cut off at the front and back according to an integer period of the target suppression frequency point, and after being processed in the frequency domain respectively, the leakage amount of the target suppression frequency point is removed at the nearest frequency point, and the frequency spectrum value corresponding to the target suppression frequency point is updated to the second target frequency spectrum value corresponding to the nearest frequency point, so that the target suppression frequency point is removed while ensuring that there is no spectrum leakage, the waveform is completely restored, and signal distortion is reduced.
[0153] Figure 10 A structural block diagram of a digital signal filtering device provided by an embodiment of the present application is provided. The device is configured to execute the digital signal filtering method provided by the above-mentioned embodiment, and has function modules and beneficial effects corresponding to the execution method. As shown in the figure, the digital signal filtering device specifically comprises: Figure 10
[0154] The acquisition unit 201 is configured to acquire a discrete data sequence corresponding to a to-be-processed signal, and acquire a period time corresponding to a target suppression frequency point.
[0155] The reference quantity value calculation unit 202 is configured to calculate a sampling time based on a first length of the discrete data sequence and a sampling rate corresponding to the set analog-to-digital converter, and divide the sampling time by the period time to obtain a reference quantity value.
[0156] The first frequency spectrum updating unit 203 is configured to, in the case where the reference quantity value is an integer, perform fast Fourier transform on the discrete data sequence to obtain a target frequency spectrum, and update the frequency spectrum values corresponding to the target suppression frequency point and its associated mirror frequency point in the target frequency spectrum to first target frequency spectrum values corresponding to the nearest frequency points on the right side of the target suppression frequency point.
[0157] The first waveform determination unit 204 is configured to perform inverse fast Fourier transform on the updated target spectrum to obtain a first target waveform.
[0158] The above scheme, by dividing the calculated sampling time by the period time to obtain the reference quantity value, can effectively determine whether the signal corresponding to the target suppression frequency point is sampled in an integer period, providing reliable data reference for subsequent filtering operations. In the case of an integer reference quantity value, it can be considered that the signal corresponding to the target suppression frequency point is sampled in an integer period, and the fast Fourier transform is performed on the discrete data sequence to obtain the target spectrum, which can realize filtering processing in the frequency domain for specific frequency points, refine the filtering granularity, and update the spectrum values corresponding to the target suppression frequency point and its associated mirror frequency point in the target spectrum to the first target spectrum values corresponding to the nearest frequency points on the right side of the target suppression frequency point, which can effectively ensure that the target suppression frequency point is removed while the waveform is completely restored, reduce signal distortion, and improve filtering effect.
[0159] In one possible embodiment, the method further comprises:
[0160] The second spectrum updating unit is configured to, in the case of a non-integer reference quantity value, calculate a first data sequence number corresponding to the maximum integer period in the discrete data sequence based on the first length, the sampling rate, and the period time, divide the discrete data sequence into a first sub-sequence and a second sub-sequence based on the first data sequence number, perform fast Fourier transform on the first sub-sequence and the second sub-sequence respectively to obtain a first spectrum and a second spectrum, and calculate a second target spectrum value based on the period time, the sampling rate, the first length, the first data sequence number, the spectrum values corresponding to the target suppression frequency point and its nearest frequency points on the right side, and update the spectrum values corresponding to the target suppression frequency point, the associated mirror frequency point, and the nearest frequency point in the first spectrum and the second spectrum to the second target spectrum value.
[0161] The second waveform determination unit is configured to perform inverse fast Fourier transform on the updated first spectrum and the updated second spectrum respectively to obtain a first waveform and a second waveform, and combine the first waveform and the second waveform to obtain a second target waveform.
[0162] In a possible embodiment, the second spectrum updating unit comprises:
[0163] The sequence calculation module is configured to multiply the sampling rate by the period time to obtain a first calculation result; divide the first length by the first calculation result to obtain a second calculation result, and take the second calculation result down to obtain a first integer result; multiply the first integer result by the first calculation result to obtain a third calculation result, and take the third calculation result down to obtain a first data sequence number corresponding to a maximum integral period in the discrete data sequence.
[0164] In a possible embodiment, the second spectrum updating unit comprises:
[0165] The sequence splitting module is configured to determine, as a first sub-sequence, a data sequence from a start-end data point to a first target data point corresponding to the first data sequence number in the discrete data sequence; subtract the first length from the first data sequence number to obtain a second data sequence number; and determine, as a second sub-sequence, a data sequence from a second target data point corresponding to the second data sequence number to an end-end data point in the discrete data sequence.
[0166] In a possible embodiment, the second spectrum updating unit comprises:
[0167] The spectrum value calculation module is configured to calculate, based on the period time, the sampling rate, the first length, and the first data sequence number, an amplitude ratio of the target suppression frequency point relative to a most adjacent frequency point on the right side of the target suppression frequency point; multiply a spectrum value corresponding to the target suppression frequency point by the amplitude ratio to obtain a leakage spectrum value; and subtract the leakage spectrum value from a spectrum value corresponding to the most adjacent frequency point on the right side of the target suppression frequency point to obtain a second target spectrum value.
[0168] In a possible embodiment, the spectrum value calculation module is further configured to:
[0169] multiply the sampling rate by the period time to obtain a first calculation result, divide the first length by the first calculation result to obtain a second calculation result, and take the second calculation result down to obtain a first integer result;
[0170] divide a product of the first integer result and the sampling rate by the first data sequence number to obtain a measurement frequency, take an inverse of the period time to obtain a suppression frequency, and divide a difference between the suppression frequency and the measurement frequency by the measurement frequency to obtain a frequency offset ratio;
[0171] calculate, based on the frequency offset ratio and a set sampling function, an amplitude ratio of the target suppression frequency point relative to the most adjacent frequency point on the right side of the target suppression frequency point.
[0172] In a possible embodiment, the spectrum value calculation module is further configured to:
[0173] The sum of the frequency offset ratio and the preset value is substituted into the set sampling function to obtain a first intermediate result;
[0174] The spectrum ratio is substituted into the set sampling function to obtain a second intermediate result;
[0175] The first intermediate result is divided by the second intermediate result to obtain an amplitude ratio of the target suppression frequency point relative to the most adjacent frequency point on the right side thereof.
[0176] In one possible embodiment, the device further includes a result output unit configured to:
[0177] The first target waveform is output to the display unit to enable the display unit to display the first target waveform, and the first target waveform is output to the FPGA unit to enable the FPGA unit to perform preset measurement processing and preset operation processing on the first target waveform.
[0178] Figure 11 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown in FIG. 1. Figure 11 As shown in FIG. 1, the device includes a processor 301, a memory 302, an input device 303, and an output device 304; the number of processors 301 in the device can be one or more, Figure 11 for example, one processor 301; the processor 301, the memory 302, the input device 303, and the output device 304 in the device can be connected through a bus or other means, Figure 11The bus connection is taken as an example. The memory 302 is configured as a computer readable storage medium, and can be configured to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the digital signal filtering method in the embodiments of the present application. The processor 301 performs various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 302, that is, implements the digital signal filtering method described above. The input device 303 can be configured to receive input digital or character information, and generate key signal input related to user settings and function control of the device. The output device 304 can include a display device such as a display screen. Specifically, the electronic device can be an oscilloscope, which can include an analog conditioning unit, an analog-to-digital converter, an FPGA unit, a processor unit, a first storage unit, a second storage unit and a display device. The analog conditioning unit can be used to receive a to-be-processed signal and transmit it to the analog-to-digital converter. The analog-to-digital converter can convert the to-be-processed signal into a discrete data sequence and transmit the discrete data sequence to the FPGA unit. The FPGA unit can store the discrete data sequence to the first storage unit and transmit the discrete data sequence to the processor unit. The processor unit can perform filtering processing on the discrete data sequence and transmit the obtained waveform result to the display device and the FPGA unit. The display device can display the waveform result, and the FPGA unit can perform measurement processing and operation processing on the waveform result.
[0179] The electronic device provided in the above can be used to execute the digital signal filtering method provided in any of the above embodiments, and has the corresponding functions and advantages.
[0180] The embodiments of the present application also provide a non-volatile storage medium containing computer executable instructions, which are configured to execute a digital signal filtering method described in the above embodiments when executed by a computer processor, wherein the digital signal filtering method comprises: obtaining a discrete data sequence corresponding to a to-be-processed signal, and obtaining a period time corresponding to a target suppression frequency point; calculating a sampling time based on a first length of the discrete data sequence and a set sampling rate corresponding to an analog-to-digital converter, dividing the sampling time by the period time to obtain a reference quantity value; in the case that the reference quantity value is an integer, performing fast Fourier transform on the discrete data sequence to obtain a target spectrum, updating the spectrum values corresponding to the target suppression frequency point and its associated mirror frequency point in the target spectrum to first target spectrum values corresponding to the nearest frequency points on the right side of the target suppression frequency point; and performing inverse fast Fourier transform on the updated target spectrum to obtain a first target waveform.
[0181] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include an installation medium, e.g., a CD-ROM, floppy disks, or tape device; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; or a non-volatile memory such as a magnetic medium, e.g., a hard drive; optical storage, e.g., a CD; flash memory, etc. The storage medium can also include other types of storage medium. Additionally, the storage medium can be located in a first computer in which the programs are executed, or the storage medium can be located in a second different computer, which connects to the first computer over a network. The second computer can provide program instructions to the first computer for execution. The term "storage medium" can include one or both of removable and non-removable storage devices including, but not limited to, Magnetic disks, Optical disks, and Tape. The term "storage medium" should be taken to include a single medium or multiple media that store the same or different versions of the same or different programs. The term "computer readable medium" includes the storage medium.
[0182] Of course, the storage medium provided by the embodiments of the present application includes computer executable instructions, and the computer executable instructions are not limited to the digital signal filtering method as above, but can also perform the related operations in the digital signal filtering method provided by any of the embodiments of the present application.
[0183] It is worth noting that in the embodiments of the above digital signal filtering device, each unit and module included is only divided according to the function logic, but is not limited to the above division, as long as the corresponding function can be realized; in addition, the specific name of each functional unit is only for the convenience of mutual differentiation, and does not configure as a limitation to the protection scope of the embodiments of the present application.
[0184] It should be noted that the numbering of each step in the present scheme is only used to describe the overall design framework of the present scheme, and does not indicate the necessary sequence relationship between the steps. As long as the overall implementation process conforms to the overall design framework of the present scheme, it belongs to the protection scope of the present scheme, and the sequence in the description is not an exclusive limitation to the specific implementation process of the present scheme. Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memories. The memory can include non-persistent memory in a computer readable medium, random access memory (RAM) and / or non-volatile memory such as read-only memory (ROM) or flash memory. The memory is an example of a computer readable medium.
[0185] It is also to be noted that the terms "comprising", "including", and any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises a... " does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0186] Note that the above merely describes preferred embodiments of the present application and the applied technical principles. Those skilled in the art will understand that the present application is not limited to the specific embodiments described herein, and that various obvious changes, reconfigurations, and substitutions can be made without departing from the scope of the present application. Therefore, although the present application has been described in detail through the above embodiments, the present application is not limited to the above embodiments, and can include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the appended claims.
Claims
1. A method of filtering a digital signal, characterized by, The method comprises the following steps: acquiring a discrete data sequence corresponding to a signal to be processed, and acquiring a period time corresponding to a target suppression frequency point; calculating a sampling time based on a first length of the discrete data sequence and a sampling rate corresponding to an analog-to-digital converter set by the method, dividing the sampling time by the period time to obtain a reference quantity value; in the case that the reference quantity value is an integer, performing fast Fourier transform on the discrete data sequence to obtain a target frequency spectrum, updating a spectrum value corresponding to the target suppression frequency point and an associated mirror frequency point in the target frequency spectrum to a first target spectrum value corresponding to a nearest frequency point on the right side of the target suppression frequency point; performing inverse fast Fourier transform on the updated target frequency spectrum to obtain a first target waveform; in the case that the reference quantity value is not an integer, calculating a first data sequence number corresponding to a maximum integer period in the discrete data sequence based on the first length, the sampling rate and the period time, dividing the discrete data sequence into a first sub-sequence and a second sub-sequence based on the first data sequence number; respectively performing fast Fourier transform on the first sub-sequence and the second sub-sequence to obtain a first frequency spectrum and a second frequency spectrum; multiplying the sampling rate by the period time to obtain a first calculation result, dividing the first length by the first calculation result to obtain a second calculation result, and taking the second calculation result to an integer to obtain a first integer result; dividing a product of the first integer result and the sampling rate by the first data sequence number to obtain a measurement frequency, taking an inverse of the period time to obtain a suppression frequency, and dividing a difference between the suppression frequency and the measurement frequency by the measurement frequency to obtain a frequency deviation ratio; calculating an amplitude ratio of the target suppression frequency point relative to a nearest frequency point on the right side of the target suppression frequency point based on the frequency deviation ratio and a sampling function set by the method; multiplying a spectrum value corresponding to the target suppression frequency point by the amplitude ratio to obtain a leakage spectrum value, and subtracting the leakage spectrum value from a spectrum value corresponding to the nearest frequency point on the right side of the target suppression frequency point to obtain a second target spectrum value; updating spectrum values corresponding to the target suppression frequency point, the associated mirror frequency point and the nearest frequency point in the first frequency spectrum and the second frequency spectrum to the second target spectrum value; respectively performing inverse fast Fourier transform on the updated first frequency spectrum and the updated second frequency spectrum to obtain a first waveform and a second waveform, and combining the first waveform and the second waveform to obtain a second target waveform.
2. The method of claim 1, wherein, The method for calculating the first data sequence number corresponding to the maximum integer period in the discrete data sequence based on the first length, the sampling rate and the period time comprises the following steps: multiplying the sampling rate by the period time to obtain a first calculation result; dividing the first length by the first calculation result to obtain a second calculation result, and taking the second calculation result to an integer to obtain a first integer result; multiplying the first integer result by the first calculation result to obtain a third calculation result, and taking the third calculation result to an integer to obtain the first data sequence number corresponding to the maximum integer period in the discrete data sequence.
3. The method for filtering a digital signal according to claim 1, wherein, The dividing the discrete data sequence into the first sub-sequence and the second sub-sequence based on the first data number comprises: determining a data sequence from a start data point to a first target data point corresponding to the first data number in the discrete data sequence as the first sub-sequence; subtracting the first length from the first data number to obtain a second data number; determining a data sequence from a second target data point corresponding to the second data number to an end data point in the discrete data sequence as the second sub-sequence.
4. The method for filtering a digital signal according to claim 1, wherein, The calculating the amplitude ratio of the target suppression frequency point relative to the nearest frequency point on the right side thereof based on the frequency offset ratio and the set sampling function comprises: substituting the sum of the frequency offset ratio and a preset value into the set sampling function to obtain a first intermediate result; substituting the frequency offset ratio into the set sampling function to obtain a second intermediate result; dividing the first intermediate result by the second intermediate result to obtain the amplitude ratio of the target suppression frequency point relative to the nearest frequency point on the right side thereof.
5. The method for filtering a digital signal according to claim 1, wherein, After the inverse fast Fourier transform of the updated target spectrum is performed to obtain the first target waveform, the method further comprises: outputting the first target waveform to a display unit to enable the display unit to display the first target waveform, and outputting the first target waveform to an FPGA unit to enable the FPGA unit to perform a preset measurement processing and a preset operation processing on the first target waveform.
6. A digital signal filtering apparatus, characterized by comprising: The method comprises: an acquisition unit configured to acquire a discrete data sequence corresponding to a signal to be processed, and acquire a period time corresponding to a target suppression frequency point; a reference quantity value calculation unit configured to calculate a sampling time based on a first length of the discrete data sequence and a sampling rate corresponding to an analog-to-digital converter, and divide the sampling time by the period time to obtain a reference quantity value; a first spectrum updating unit configured to, in a case where the reference quantity value is an integer, perform a fast Fourier transform on the discrete data sequence to obtain a target spectrum, and update spectrum values corresponding to the target suppression frequency point and an associated mirror frequency point in the target spectrum to first target spectrum values corresponding to the nearest frequency point on the right side of the target suppression frequency point; a first waveform determination unit configured to perform an inverse fast Fourier transform on the updated target spectrum to obtain a first target waveform; a second spectrum updating unit configured to, in a case where the reference quantity value is a non-integer, calculate a first data number corresponding to a maximum integral period in the discrete data sequence based on the first length, the sampling rate and the period time, divide the discrete data sequence into a first sub-sequence and a second sub-sequence based on the first data number, perform a fast Fourier transform on the first sub-sequence and the second sub-sequence to obtain a first spectrum and a second spectrum, and calculate second target spectrum values based on the period time, the sampling rate, the first length, the first data number, spectrum values corresponding to the target suppression frequency point, the associated mirror frequency point and the nearest frequency point, and update the spectrum values corresponding to the target suppression frequency point, the associated mirror frequency point and the nearest frequency point in the first spectrum and the second spectrum to the second target spectrum values. The second waveform determination unit is configured to perform inverse fast Fourier transform on the updated first spectrum and the updated second spectrum respectively to obtain a first waveform and a second waveform, and combine the first waveform and the second waveform to obtain a second target waveform. The second spectrum updating unit comprises a spectrum value calculation module configured to calculate an amplitude ratio of the target suppression frequency point to the nearest frequency point on the right of the target suppression frequency point based on the period time, the sampling rate, the first length and the first data sequence number, multiply the spectrum value corresponding to the target suppression frequency point by the amplitude ratio to obtain a leakage spectrum value, and subtract the leakage spectrum value from the spectrum value corresponding to the nearest frequency point on the right of the target suppression frequency point to obtain a second target spectrum value. The spectrum value calculation module is further configured to: multiply the sampling rate by the period time to obtain a first calculation result, divide the first length by the first calculation result to obtain a second calculation result, and take the second calculation result as an integer to obtain a first integer result; divide the product of the first integer result and the sampling rate by the first data sequence number to obtain a measurement frequency, take the inverse of the period time to obtain a suppression frequency, and divide the difference between the suppression frequency and the measurement frequency by the measurement frequency to obtain a frequency offset ratio; calculate the amplitude ratio of the target suppression frequency point to the nearest frequency point on the right of the target suppression frequency point based on the frequency offset ratio and a set sampling function.
7. An electronic device, the device comprising: one or more processors; a storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors are configured to implement the digital signal filtering method of any one of claims 1-5.
8. A non-volatile storage medium storing computer executable instructions which, when executed by a computer processor, are configured to perform the digital signal filtering method of any one of claims 1-5.
Citation Information
Patent Citations
Hydroelectric generating set state monitoring waveform signal digital filtering method based on frequency domain characteristics
CN114548163A