Peak filter implementation method, system and equipment for processing data in real time and medium
By using a spike filter implementation method that processes data in real-time in power systems, using fast Fourier transform and signal real-time reconstruction calculation modules, the shortcomings of traditional filters in spike filtering and wide-frequency oscillation suppression are solved, and high-precision signal filtering and oscillation suppression effects are achieved.
Patent Information
- Application Number
- CN202510205260.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-24
- Publication Date
- 2025-06-10
AI Technical Summary
The continuous filter composed of traditional inductor capacitors does not perform well in spike filtering and wide-frequency oscillation suppression technologies, especially when processing small signal systems, its frequency selectivity is poor and it is difficult to meet the needs of wide-frequency oscillation suppression technologies.
Using a spike filter implementation method that processes data in real time, the fast Fourier transform and real-time signal reconstruction calculation module is used to accurately select and reconstruct the target frequency components in the signal to be reconstructed to achieve accurate spike filtering effect.
The filtering effect of an ideal spike filter is realized, and a certain component in the signal is accurately extracted, the reconstruction accuracy of data processing is improved, and the effective suppression of wide-frequency oscillation is ensured in the power system.
Smart Images

Figure CN120123709A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of signal filtering, and particularly relates to a method, system, device and medium for implementing a spike filter for real-time data processing. Background Art
[0002] As the proportion of new energy sources such as wind power and photovoltaic power in the energy structure gradually increases, the power system needs to be able to stably accept and process the power input from the new energy system. To ensure the stable operation of the power system, a series of control technologies for supporting the stable operation of the power grid have emerged. Among them, as an important stable control technology, the broadband oscillation suppression technology requires accurate selection of the frequency components fed back to the control loop.
[0003] In the power system, filters play a crucial role. They are not only responsible for filtering out unnecessary frequency components, but also ensuring the quality and stability of power signals. The traditional continuous filters composed of inductors and capacitors have unsatisfactory effects in implementing spike filtering. Especially when dealing with small-signal systems, their frequency selectivity is poor, making it difficult to meet the requirements of the broadband oscillation suppression technology, resulting in unnecessary oscillation risks in the non-target frequency band for the broadband oscillation suppression technology and restricting the development and application of related technologies. Therefore, it is necessary to design a spike filter with ideal filtering functions to ensure the suppression effect of certain broadband true suppression technologies and further ensure the stable operation of the power system. Summary of the Invention
[0004] In a first aspect, an embodiment of the present application provides a method for implementing a spike filter for real-time data processing, including the following steps: S1. Determine sampling parameters according to accuracy requirements, obtain power grid data in real time according to the sampling parameters, construct a matrix to store the sampled power grid data, and obtain the signal data to be reconstructed; S2. Perform a fast Fourier transform on the signal data to be reconstructed to obtain the amplitudes and phases of the frequency components in the signal data to be reconstructed, and record the time used for the fast Fourier transform; S3. Transmit the amplitudes, phases of the frequency components in the signal data to be reconstructed and the time used for the fast Fourier transform, and record the information transmission time. Calculate the phase correction coefficient based on the transmitted information data and the information transmission time; S4. Reconstruct the collected signal data to be reconstructed in real time according to the amplitudes, phases of the frequency components in the signal data to be reconstructed and the phase correction coefficient.
[0005] Further, the specific steps of step S1 are as follows: S11. Determine the sampling frequency and the number of sampling points according to the accuracy requirements for power grid data processing; S12. Collect power grid data in real time according to the determined sampling frequency until the number of sampling points is satisfied, so as to obtain power grid data of a determined length as the signal data to be reconstructed, and record the sampling time of each signal data to be reconstructed; S13. Construct a 2×N matrix S and initialize it:
[0006] S14. Save the signal data to be reconstructed to the first row of the 2×N matrix S as , and save the sampling time points of the corresponding signal data to be reconstructed to the second row of the 2×N matrix S as :
[0007] where, is the sampling point serial number; is the value of the signal to be reconstructed at the th sampling; is the time of the th sampling, and N is the number of sampling points.
[0008] Further, the specific steps of step S2 are as follows: S21. Detect whether the last column of the 2×N matrix S is assigned; If so, go to step S22; If not, wait for a set time period and return to step S21; S22. Perform a fast Fourier transform on the first row of the 2×N matrix S to obtain a complex vector, and calculate the amplitude vector, phase vector and frequency vector of the complex vector; S23. Construct a spectrum matrix according to the calculated vectors and the symmetry of the spectrum; S24. Detect whether the last column of the spectrum matrix is assigned; If so, go to step S25; If not, wait for a set time period and return to step S24; S25. Record the time used for the fast Fourier transform.
[0009] Further, the specific steps of step S22 are as follows: S221. Perform a fast Fourier calculation on , and the calculated vector is: ; where, is the complex vector obtained by performing a fast Fourier calculation on ; S222. Calculate the amplitude vector of Y through the following formula: ; where is 's amplitude vector; S223. Calculate the phase vector of Y through the following formula: ; where is 's phase vector; S224. Calculate the frequency vector through the following formula: ; where is 's frequency vector.
[0010] Furthermore, the specific steps of step S23 are as follows: S231. Based on the symmetry of the spectrum, construct 's spectrum matrix ; S232. Assign the first amplitude vectors of Y to the first row of the spectrum matrix of , denoted as F(1, N / 2); S233. Assign the first phase vectors of Y to the second row of the spectrum matrix of , denoted as F(2, N / 2); S234. Assign the first frequency vectors of Y to the third row of the spectrum matrix of , denoted as F(3, N / 2); S235. The expression for constructing the spectrum matrix is as follows: .
[0011] Furthermore, the specific steps of step S3 are as follows: S31. Transfer the calculated spectrum matrix , the time used for Fourier transform, and the 2×N matrix S to the real-time reconstruction calculation module, and record the information transfer time ; S32. Determine the target frequency , and find the amplitude and phase corresponding to the frequency identical to the target frequency from the spectrum matrix , denoted as the target amplitude and the target phase ; S33. Extract the first data sampling time point from the second row of the 2×N matrix S and the last data sampling time point , and then combine with the time used for Fourier transform and calculate the time from data acquisition to the completion of fast Fourier transform using the following formula : : ; S34. Calculate the first phase correction coefficient according to the time from data acquisition to the completion of fast Fourier transform using the following formula, and calculate the second phase correction coefficient according to the information transfer time using the following formula : : ; wherein, is the target frequency; S35. Calculate the overall phase correction coefficient according to the first phase correction coefficient and the second phase correction coefficient using the following formula : .
[0012] Furthermore, the specific steps of step S4 are as follows: S41. Obtain the execution frequency of the signal reconstruction module , construct the phase adjustment parameter x, and set the phase adjustment parameter to increase cyclically from 0 to 1 at an interval of the execution frequency ; S42. Input the amplitude of the target frequency , the target phase and the overall phase correction coefficient into the signal reconstruction module; S43. Take the phase adjustment parameter x as a variable, and construct the following signal reconstruction formula according to the amplitude of the target frequency , the target phase and the overall phase correction coefficient :
[0013] wherein, is the signal data for reconstructing the target frequency output by the signal reconstruction module in real time.
[0014] Second, the embodiment of the present application also provides a spike filter implementation system for real-time data processing, including: The signal data acquisition unit to be reconstructed is used to determine sampling parameters according to precision requirements, obtain power grid data in real time according to the sampling parameters, construct a matrix to store the sampled power grid data, and obtain the signal data to be reconstructed; The fast Fourier transform unit is used to perform a fast Fourier transform on the signal data to be reconstructed, obtain the amplitudes and phases of the frequency components in the signal data to be reconstructed, and record the time used for the fast Fourier transform; The phase correction coefficient calculation unit is used to transfer the amplitudes, phases of the frequency components in the signal data to be reconstructed and the time used for the fast Fourier transform, record the information transfer time, and calculate the phase correction coefficient based on the transferred information data and the information transfer time; The signal real-time reconstruction unit is used to perform real-time reconstruction on the acquired signal data to be reconstructed according to the amplitudes, phases of the frequency components in the signal data to be reconstructed and the phase correction coefficient.
[0015] In a third aspect, an embodiment of the present application further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the power grid data spike filtering method based on data real-time processing as described in the first aspect are implemented.
[0016] In a fourth aspect, an embodiment of the present application further provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the power grid data spike filtering method based on data real-time processing as described in the first aspect are implemented.
[0017] As can be seen from the above technical solutions, the present invention has the following advantages: The method, system, device and medium for implementing a spike filter for real-time processing of data provided by the present application perform processing of collecting, storing, calculating and reconstructing power grid signal data, without additional hardware devices, accurately extract a certain component in the signal, achieve the filtering effect of an ideal spike filter, and in the process of data processing, consider the time delay of each link, convert it into a phase delay, and introduce it into the reconstruction calculation, with high reconstruction accuracy. Description of the Drawings
[0018] In order to more clearly illustrate the technical solutions of the present invention, the drawings required to be used in the description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0019] Figure 1 It is a schematic flowchart of an embodiment of the method for implementing a spike filter for real-time processing of data of the present invention.
[0020] Figure 2 Schematic diagram of the spike filter implementation system for real-time processing of data in the present invention.
[0021] Figure 3 Schematic diagram of data acquisition of the ideal spike filter implemented by using simiulink simulation in the present invention.
[0022] Figure 4 Schematic diagram of the FFT calculation module and real-time reconstruction module of the ideal spike filter implemented by using simiulink simulation in the present invention.
[0023] Figure 5 For the present invention Figure 4 Enlarged schematic diagram of part A in the present invention.
[0024] Figure 6 For the present invention Figure 4 Enlarged schematic diagram of the real-time reconstruction module 5 in the present invention.
[0025] Figure 7 Schematic diagram of the trigger signal waveform output by the second trigger module in the simiulink simulation of the present invention.
[0026] Figure 8 For the present invention Figure 7 Enlarged diagram of the waveform at 0.4001 s in the present invention.
[0027] Figure 9 Effect diagram of extracting the target frequency component by the ideal spike filter in the simiulink simulation of the present invention.
[0028] Figure 10 Effect diagram of reconstructing the single-frequency component signal by the offline spike filter in the simiulink simulation of the present invention.
[0029] Specific description of the reference numerals: 1. First trigger module; 2. Sampling time recording module; 3. Second trigger module; 4. Acquisition signal module; 5. Real-time reconstruction module. Specific embodiments
[0030] In the following, the specific steps of the method for implementing the spike filter for real-time processing of data will be described in detail, and various embodiments of the present disclosure will be described more comprehensively. The present disclosure can have various embodiments, and adjustments and changes can be made therein. However, it should be understood that there is no intention to limit the various embodiments of the present disclosure to the specific embodiments disclosed herein, but the present disclosure should be understood to cover all adjustments, equivalents, and / or alternative solutions that fall within the spirit and scope of the various embodiments of the present disclosure.
[0031] Exemplarily, as the proportion of renewable energy sources such as wind power and photovoltaic power in the energy system is increasing day by day, the power system is facing a major challenge of how to stably accept and process the input of new energy power. To ensure the stable operation of the power system, a series of control technologies for supporting the stable operation of the power grid have emerged. Among them, the broadband oscillation suppression technology has attracted much attention due to its core position. This technology requires accurate selection and feedback of specific frequency components to the control loop.
[0032] In the power system, filters play a crucial role. They are not only responsible for removing redundant frequency components but also related to the quality and stability of power signals. However, the traditional continuous filters composed of inductors and capacitors perform poorly in spike filtering. Especially when dealing with small-signal systems, their frequency selectivity is poor and it is difficult to meet the strict requirements of broadband oscillation suppression technology. This problem may cause unnecessary oscillations in the non-target frequency band for the broadband oscillation suppression technology, thus restricting the in-depth development and wide application of related technologies. Therefore, a spike filter with filtering performance meeting the requirements is needed to ensure that the suppression effect of the broadband oscillation suppression technology can be fully exerted, and thus provide a basis for the stable operation of the power system.
[0033] To address the above problems, this embodiment provides a method for implementing a spike filter for real-time data processing. By combining the fast Fourier transform and the signal real-time reconstruction calculation module, the target frequency components in the signal to be reconstructed can be accurately selected and reconstructed in real time to achieve the effect of an accurate spike filter.
[0034] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0035] Please refer to Figure 1 The following is a flowchart of a method for implementing a spike filter for real-time data processing in a specific embodiment. The method includes the following steps: S1. Determine the sampling parameters according to the accuracy requirements, obtain the grid data in real time according to the sampling parameters, and construct a matrix to store the sampled grid data to obtain the signal data to be reconstructed; S2. Perform a fast Fourier transform on the signal data to be reconstructed to obtain the amplitudes and phases of the frequency components in the signal data to be reconstructed, and record the time used for the fast Fourier transform; S3. Transmit the amplitudes, phases of the frequency components in the signal data to be reconstructed and the time used for the fast Fourier transform, and record the information transmission time. Calculate the phase correction coefficient based on the transmitted information data and the information transmission time; S4. Reconstruct the collected signal data to be reconstructed in real time according to the amplitudes, phases, and phase correction coefficients of the frequency components in the signal data to be reconstructed.
[0036] In this embodiment, first, the frequency components in the signal data to be reconstructed are calculated using the fast Fourier transform to obtain the amplitudes and phases of the target frequency components, and then they are transmitted to the signal real-time reconstruction calculation module; then, the phase correction module in the real-time reconstruction calculation module takes into account the time delay of signal transmission to obtain the corrected phase; finally, the signal reconstruction module in the real-time reconstruction calculation module outputs the reconstructed target frequency component signal in real time.
[0037] Further, as a refinement and extension of the specific implementation manner of the above embodiment, in order to fully illustrate the specific implementation process in this embodiment, another implementation method of the spike filter for real-time data processing is provided. This method includes the following steps: S1. Determine the sampling parameters according to the accuracy requirements, obtain the power grid data in real time according to the sampling parameters, construct a matrix to store the sampled power grid data, and obtain the signal data to be reconstructed; the specific steps of step S1 are as follows: S11. Determine the sampling frequency and the number of sampling points according to the accuracy requirements for power grid data processing; S12. Collect the power grid data in real time according to the determined sampling frequency until the number of sampling points is satisfied, so as to obtain the power grid data of a determined length as the signal data to be reconstructed, and record the sampling time of each signal data to be reconstructed; S13. Construct a 2×N matrix S and initialize it:
[0038] S14. Save the signal data to be reconstructed to the first row of the 2×N matrix S as while saving the sampling time points of the corresponding signal data to be reconstructed to the second row of the 2×N matrix S as :
[0039] where, is the sampling point serial number; is the value of the signal to be reconstructed at the th sampling; is the time of the th sampling, and N is the number of sampling points; It should be noted that through the determination of the sampling parameters and the real-time collection process of the power grid data, an accurate data basis is provided for the subsequent fast Fourier transform and signal reconstruction; S2. Perform a fast Fourier transform on the signal data to be reconstructed to obtain the amplitudes and phases of the frequency components in the signal data to be reconstructed, and record the time taken for the fast Fourier transform; the specific steps of step S2 are as follows: S21. Detect whether the last column of the 2×N matrix S is assigned; If so, proceed to step S22; If not, wait for a set time period and return to step S21; S22. Perform a fast Fourier transform on the first row of the 2×N matrix S to obtain a complex vector, and calculate the amplitude vector, phase vector, and frequency vector of the complex vector; S23. Construct a spectrum matrix based on the calculated vectors and the symmetry of the spectrum ; S24. Detect whether the last column of the spectrum matrix is assigned; If so, proceed to step S25; If not, wait for a set time period and return to step S24; S25. Record the time taken for the fast Fourier transform ; S3. Transmit the amplitudes, phases of the frequency components in the signal data to be reconstructed, and the time taken for the fast Fourier transform, and record the information transmission time, and calculate the phase correction coefficient based on the transmitted information data and the information transmission time; the specific steps of step S3 are as follows: S31. Transmit the calculated spectrum matrix , the time taken for the Fourier transform , and the 2×N matrix S to the real-time reconstruction calculation module, and record the information transmission time ; S32. Determine the target frequency , and find the amplitudes and phases corresponding to the frequency identical to the target frequency from the spectrum matrix , and denote them as the target amplitude and the target phase ; S33. Extract the first data sampling time point and the last data sampling time point from the second row of the 2×N matrix S , and then combine the time taken for the Fourier transform and use the following formula to calculate the time taken from data acquisition to completion of the fast Fourier transform : ; S34. According to the time used from data acquisition to the completion of the fast Fourier transform Calculate the first phase correction coefficient through the following formula , according to the information transfer time Calculate the second phase correction coefficient through the following formula : ; wherein, is the target frequency; S35. According to the first phase correction coefficient and the second phase correction coefficient and use the following formula to calculate the overall phase correction coefficient : ; S4. Reconstruct the acquired signal data to be reconstructed in real time according to the amplitudes, phases and phase correction coefficients of the frequency components in the signal data to be reconstructed; the specific steps of step S4 are as follows: S41. Obtain the execution frequency of the signal reconstruction module , construct the phase adjustment parameter x, and set the phase adjustment parameter to increase cyclically from 0 to 1 at intervals of the execution frequency ; S42. Input the amplitude of the target frequency, the target phase and the overall phase correction coefficient into the signal reconstruction module; S43. Take the phase adjustment parameter x as a variable, and according to the amplitude of the target frequency, the target phase and the overall phase correction coefficient construct the following signal reconstruction formula:
[0040] wherein, is the signal data of the reconstructed target frequency output in real time by the signal reconstruction module.
[0041] In an embodiment of the present invention, based on step S22 and step S23, a possible embodiment will be given below to non-limitingly elaborate on its specific implementation scheme.
[0042] The specific steps of step S22 are as follows: S221. Perform a fast Fourier calculation on , and the calculated vector is: ; wherein, is the result of performing a fast Fourier calculation on Obtained by performing a fast Fourier transform complex vector; S222. Calculate the magnitude vector of Y through the following formula: ; where, is magnitude vector; S223. Calculate the phase vector of Y through the following formula: ; where, is phase vector; S224. Calculate the frequency vector through the following formula: ; where, is frequency vector; The specific steps of step S23 are as follows: S231. Based on the symmetry of the spectrum, construct spectrum matrix ; S232. Assign the first magnitude vectors of Y to the first row of the spectrum matrix as F(1, N / 2); S233. Assign the first phase vectors of Y to the second row of the spectrum matrix as F(2, N / 2); S234. Assign the first frequency vectors of Y to the third row of the spectrum matrix as F(3, N / 2); S235. The expression for constructing the spectrum matrix is as follows: ; It should be noted that in fact, the magnitude, phase, and frequency components obtained by performing a fast Fourier transform on should be pieces, but due to the symmetry of the calculated values, only the first are valid.
[0043] The implementation method of the spike filter for real-time processing of data using the simulation tool Simulink is as follows: Taking the matlabfunction in the Simiulink real-time function module as an example, matlabfunction can perform specific calculations based on the input signal to obtain the output, and maintain the current output before the next calculation. For persistent variables inside, their values can still be retained after the current function module runs. Here, the real-time function module matlabfunction in Simiulink is used to simulate data acquisition and construct the 2×N matrix S for storing the signal data to be reconstructed. As Figure 3 shown, it consists of the first trigger module 1 executed by matlabfunction and the subsystem module of the sampling time recording module 2. The function of this part is to enable the first trigger module 1 to output a trigger signal at a frequency, for example, 1e4 in this example. And the first trigger module 1 here controls it to output only one trigger signal. The pulse width of the trigger signal is the operation step size of Simiulink, which is 1e-6s in this example; while the input of the sampling time recording module 2 is the global time of the simulation, and the output is the time of the first sampled data.
[0044] As Figure 4 shown and Figure 5 , the second trigger module 3 is basically similar to the first trigger module 1 and uses the same enable to achieve common startup; the difference between the two is that the second trigger module 3 has an additional variable for controlling the length of the sampled data, which is set to 10000 in this example, that is =10000. Then the output of the second trigger module 3 is a high-level trigger signal with a pulse width of 1e-6s and a number of 10000 times; assuming the enable time is 0.4s, the output of the second trigger module 3 is as Figure 7 and Figure 8 shown. It can be seen that the second trigger module 3 outputs a high-level signal with a pulse width of 1e-6s at a frequency and issues 10000 trigger signals. And the matlabfunction in the acquisition signal module 4 below the second trigger module 3 has the functions of caching the acquisition signal and FFT calculation. It can assign values to the defined persistent matrix , and when it is executed next time, the previous assignment is still retained. The acquisition signal module 4 receives the 10000 trigger signals sent by the second trigger module 3, then saves the sampled data of 10000 signals and assigns 10000 element values to ; while is assigned values by the corresponding time values output by the global time module clock at each sampling. By Figure 5As shown, when of the matrix , is assigned, it indicates that the data acquisition is completed. At this time, FFT calculation is performed on , and the corresponding , , are calculated. Finally, is assigned. At this time, the acquisition signal module 4 below the second trigger module 3 will output ; As Figure 6 shown, in step S3, the phase correction module in the real-time reconstruction module 5 calculates ; among which the information transfer time is recorded by matlabfunction; the time used for Fourier transform is the time recorded by matlabfunction from generating the 2×N matrix to forming the spectrum matrix ; then Figure 5 in, the time2 output by the acquisition signal module 4 below the second trigger module 3 is ; As Figure 6 shown, the signal reconstruction module in the real-time reconstruction module 5 uses , and obtained from step S3 to calculate the signal according to the following formula and output it in real time by matlabfunction:
[0045] At this time, the effect of selectively reconstructing the target frequency component in the signal without phase shift can be achieved, and the same implementation effect as the ideal spike filter for the target frequency is realized.
[0046] Assume that the test signal is composed of signal 1 (a cosine signal with an amplitude of 10, a frequency of 100 Hz, and an initial phase of 0) and signal 2 (a cosine signal with an amplitude of 10, a frequency of 40 Hz, and an initial phase of 0). Set the target frequency component to be extracted as the signal of 100 Hz. The extraction result is as Figure 9 shown.
[0047] Figure 9 In Figure 10 shown, the red signal is the original test signal, and the blue signal is the signal extracted by the ideal spike filter designed by the present invention. To more intuitively verify the effectiveness of the present invention in extracting the target frequency component, make the original test signal only contain the 100 Hz component. The extraction result is as
[0048] It can be seen that the ideal spike filter designed by the present invention extracts the signal of the 100Hz frequency component in the test signal without phase error, achieving the effect that the ideal spike filter should achieve.
[0049] As Figure 2 shown, the following is an embodiment of a spike filter implementation system for real-time processing of data provided by the present disclosure. This system and the spike filter implementation method for real-time processing of data in the above embodiments belong to the same inventive concept. For the details not described in detail in the embodiment of the spike filter implementation system for real-time processing of data, reference may be made to the embodiments of the spike filter implementation method for real-time processing of data.
[0050] The system includes: A signal data acquisition unit to be reconstructed, configured to determine sampling parameters according to accuracy requirements, obtain power grid data in real time according to the sampling parameters, construct a matrix to store the sampled power grid data, and obtain the signal data to be reconstructed; A fast Fourier transform unit, configured to perform a fast Fourier transform on the signal data to be reconstructed, obtain the amplitudes and phases of the frequency components in the signal data to be reconstructed, and record the time used for the fast Fourier transform; A phase correction coefficient calculation unit, configured to transmit the amplitudes, phases of the frequency components in the signal data to be reconstructed, and the time used for the fast Fourier transform, record the information transmission time, and calculate the phase correction coefficient based on the transmitted information data and the information transmission time; A signal real-time reconstruction unit, configured to perform real-time reconstruction on the acquired signal data to be reconstructed according to the amplitudes, phases of the frequency components in the signal data to be reconstructed, and the phase correction coefficient.
[0051] In this embodiment, by integrating functional modules such as signal data acquisition to be reconstructed, fast Fourier transform, phase correction coefficient calculation, and signal real-time reconstruction, real-time processing of power grid data and suppression of broadband oscillations are achieved.
[0052] The method for implementing a spike filter for real-time data processing provided by the embodiments of the present application can be applied to an electronic device. Those skilled in the art can understand that the structure of the electronic device involved in the embodiments of the present invention does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements. In the embodiments of the present invention, the electronic device includes, but is not limited to, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the embodiments of the present application described herein and / or claimed.
[0053] The electronic device may include a processor, an external memory interface, an internal memory, a universal serial bus (USB) interface, a charging management module, a power management module, a battery, a wireless communication module, an audio module, a speaker, a microphone, a sensor module, a key, a camera, a display screen, and a SIM card interface, etc.
[0054] It can be understood that the structure schematically shown in the embodiments of the present application does not constitute a specific limitation on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0055] The processor may include one or more processing units. For example, the processor may include a central processing unit (CPU), etc., an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0056] Among them, the processor can be the nerve center and command center of the electronic device. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0057] A memory can also be set in the processor for storing instructions and data. In some embodiments, the memory in the processor is a cache memory. This memory can save the instructions or data that the processor has just used or recycled. If the processor needs to use the instruction or data again, it can directly call it from this memory. This avoids repeated accesses, reduces the waiting time of the processor, and thus improves the system efficiency.
[0058] The above-mentioned electronic device implements the method for implementing the spike filter for real-time data processing in this application. By collecting, storing, calculating, and reconstructing the power grid signal data, it accurately extracts a certain component in the signal, achieving the filtering effect of an ideal spike filter. And during the data processing process, considering the time delay of each link, it is converted into a phase delay and introduced into the reconstruction calculation, with relatively high reconstruction accuracy.
[0059] In the storage medium provided in this application, there is a program product capable of implementing the method for implementing the spike filter for real-time data processing.
[0060] The method for implementing the spike filter for real-time data processing includes: determining sampling parameters according to the accuracy requirements, obtaining power grid data in real time according to the sampling parameters, constructing a matrix to store the sampled power grid data to obtain the signal data to be reconstructed; performing a fast Fourier transform on the signal data to be reconstructed to obtain the amplitudes and phases of the frequency components in the signal data to be reconstructed, and recording the time used for the fast Fourier transform; transmitting the amplitudes, phases of the frequency components in the signal data to be reconstructed and the time used for the fast Fourier transform, and recording the information transmission time, calculating the phase correction coefficient based on the transmitted information data and the information transmission time; performing real-time reconstruction on the sampled signal data to be reconstructed according to the amplitudes, phases of the frequency components in the signal data to be reconstructed and the phase correction coefficient.
[0061] In some possible implementation manners, the method for implementing the spike filter for real-time data processing in this disclosure can be implemented in the form of a program product, which includes program code. When the program product runs on a terminal device, the program code is used to cause the terminal device to execute the steps according to various exemplary embodiments of this disclosure described in the "Exemplary Method" section above in this specification.
[0062] The storage medium of the present disclosure may adopt any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0063] The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for implementing a spike filter for real-time data processing, characterized in that: The steps include: S1. Determine sampling parameters according to accuracy requirements, obtain power grid data in real time according to the sampling parameters, construct a matrix to store the sampled power grid data, and obtain signal data to be reconstructed; S2. Perform a fast Fourier transform on the signal data to be reconstructed to obtain the amplitude and phase of each frequency component in the signal data to be reconstructed, and record the time used for the fast Fourier transform; S3. The amplitude, phase and time of the fast Fourier transform of each frequency component in the signal data to be reconstructed are transmitted, and the information transmission time is recorded, and the phase correction coefficient is calculated based on the transmitted information data and the information transmission time; S4. Reconstruct the collected signal data to be reconstructed in real time according to the amplitude, phase and phase correction coefficient of each frequency component in the signal data to be reconstructed.
2. The method for implementing a spike filter for real-time data processing according to claim 1, characterized in that: The specific steps of step S1 are as follows: S11. Determine the sampling frequency and number of sampling points according to the accuracy requirements of power grid data processing; S12. Collecting grid data in real time according to a determined sampling frequency until the number of sampling points is met, thereby obtaining grid data of a determined length as signal data to be reconstructed, and recording the sampling time of each signal data to be reconstructed; S13. Construct a 2×N matrix S and initialize it: S14. Save the signal data to be reconstructed to the first row of the 2×N matrix S as , and the sampling time points corresponding to the signal data to be reconstructed are saved in the second row of the 2×N matrix S as : in, is the sampling point number; For the The value of the signal to be reconstructed of the subsample; For the The sampling time is N, and N is the number of sampling points.
3. The method for implementing a spike filter for real-time data processing according to claim 2, characterized in that: The specific steps of step S2 are as follows: S21. Check whether the last column of the 2×N matrix S is assigned a value; If yes, go to step S22; If not, wait for the set time period and return to step S21; S22. For the first row of the 2×N matrix S Perform fast Fourier transform to obtain a complex vector, and calculate the amplitude vector, phase vector and frequency vector of the complex vector; S23. Constructing a spectrum matrix according to the calculated vectors and the symmetry of the spectrum; S24. Check whether the last column of the spectrum matrix is assigned a value; If yes, go to step S25; If not, wait for the set time period and return to step S24; S25. Record the time used for fast Fourier transform .
4. The method for implementing a spike filter for real-time data processing according to claim 3, characterized in that: The specific steps of step S22 are as follows: S221.Yes Perform fast Fourier calculation and the calculated vector is: ; in, For Fast Fourier Transform calculations The complex vector of ; S222. Calculate the magnitude vector of Y by the following formula: ; in, for The magnitude vector of ; S223. Calculate the phase vector of Y by the following formula: ; in, for The phase vector of S224. Calculate the frequency vector using the following formula: ; in, for The frequency vector of .
5. The method for implementing a spike filter for real-time data processing according to claim 4, characterized in that: The specific steps of step S23 are as follows: S231. Based on the symmetry of the spectrum, construct The spectrum matrix ; S232. Move forward The magnitude vector of Y is assigned to The first row of the spectrum matrix of is taken as F (1, N / 2); S233. Move forward The phase vector of Y is assigned to The second row of the spectrum matrix of is taken as F(2,N / 2); S234. Move forward The frequency vector is assigned to The third row of the spectrum matrix of is taken as F (3, N / 2); S235. Construct spectrum matrix The expression is as follows: 。 6. The method for implementing a spike filter for real-time data processing according to claim 5, characterized in that: The specific steps of step S3 are as follows: S31. Calculate the spectrum matrix , the time used for Fourier transform and 2×N matrix S are passed to the real-time reconstruction calculation module, and the information transmission time is recorded ; S32. Determine the target frequency , from the spectrum matrix Find the target frequency The amplitude and phase corresponding to the same frequency are recorded as the target amplitude and target phase ; S33. From the second row of the 2×N matrix S Extract the first data sampling time point and the last data sampling time point , combined with the time used by the Fourier transform And use the following formula to calculate the time from data acquisition to completion of fast Fourier transform : ; S34. Based on the time from data acquisition to completion of fast Fourier transform The first phase correction coefficient is calculated by the following formula , according to the information transmission time The second phase correction coefficient is calculated by the following formula : ; in, is the target frequency; S35. According to the first phase correction coefficient and the second phase correction factor And use the following formula to calculate the overall phase correction coefficient : 。 7. The method for implementing a spike filter for real-time data processing according to claim 6, characterized in that: The specific steps of step S4 are as follows: S41. Obtain the execution frequency of the signal reconstruction module , construct the phase adjustment parameter x, and set the phase adjustment parameter to perform frequency The interval loop increases from 0 to 1; S42. Set the amplitude of the target frequency , target phase and the overall phase correction coefficient Input signal reconstruction module; S43. Take the phase adjustment parameter x as a variable and adjust the amplitude of the target frequency according to the , target phase and the overall phase correction coefficient Construct the following signal reconstruction formula: in, It is the signal data reconstructed for the target frequency outputted in real time by the signal reconstruction module.
8. A spike filter implementation system for real-time data processing, characterized in that: include: The signal data acquisition unit to be reconstructed is used to determine the sampling parameters according to the accuracy requirements, obtain the power grid data in real time according to the sampling parameters, construct a matrix to store the sampled power grid data, and obtain the signal data to be reconstructed; A fast Fourier transform unit is used to perform a fast Fourier transform on the signal data to be reconstructed, obtain the amplitude and phase of each frequency component in the signal data to be reconstructed, and record the time used for the fast Fourier transform; A phase correction coefficient calculation unit, used to transmit the amplitude, phase and time used for fast Fourier transform of each frequency component in the signal data to be reconstructed, record the information transmission time, and calculate the phase correction coefficient based on the transmitted information data and the information transmission time; The signal real-time reconstruction unit is used to reconstruct the collected signal data to be reconstructed in real time according to the amplitude, phase and phase correction coefficient of each frequency component in the signal data to be reconstructed.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the method for implementing a spike filter for real-time data processing as claimed in any one of claims 1 to 7 are implemented.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for implementing a spike filter for real-time data processing according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Resampling baseband signal reconstruction method and system based on fast Fourier transform
CN120768297A