Control method of harmonic component calculation system with dynamic sampling
By designing the frequency detection module, the adaptive sampling rate generation module and the frequency feedback module in the harmonic component calculation system, and using the dynamic clock manager to generate the adaptive sampling rate, the problem of the inability to dynamically adjust the phase in the existing technology is solved, and the Real-time sampling and calculation of different fundamental waves meets the needs of harmonic component calculation.
Patent Information
- Application Number
- CN202311534692.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-17
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2043-11-17
AI Technical Summary
The existing PLL clock manager cannot dynamically adjust the phase, resulting in the inability to arbitrarily adjust the real-time sampling and calculation of harmonic components of different fundamental waves.
A dynamic sampling harmonic component calculation system is designed, including a frequency detection module, an adaptive sampling rate generation module, an ADC acquisition module, a frequency feedback module and a harmonic calculation module. The dynamic clock manager generates an adaptive sampling rate to achieve Real-time sampling and calculation of different fundamental waves.
It realizes any adjustable real-time sampling and calculation of different fundamental waves, meets the needs of the harmonic component calculation system, and improves the accuracy and flexibility of the sampling rate.
Smart Images

Figure CN117574030B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of harmonic calculation, and in particular relates to a control method for a dynamically sampled harmonic component calculation system. Background Art
[0002] For systems that need to calculate harmonic components through FFT (Fast Fourier Transform) at sampling points, data acquisition at the previous sampling points is the key to the system implementation. If different fundamental waves are to be sampled and calculated in real time and arbitrarily adjustable, a dynamic sampling rate has to be generated through a dynamic clock manager to meet the requirements of the harmonic component calculation system.
[0003] In Xilinx's FPGA, the clock manager is called Clock Management, or CMT for short. DCM / PLL / MMCM are all included in CMT. DCM was used relatively early in FPGAs, such as Sparten-3 and Virtex-4. Later devices no longer use DCM. In Virtex-4, CMT includes a PLL and two DCMs. The core of DCM is DLL (DelayLocked Loop), which is a digital module that can generate clocks of different phases, frequency division, frequency multiplication, dynamic phase adjustment, etc., but the accuracy is limited. PLL is a phase-locked loop (PLL). PLL can be used for clocks, frequency multiplication, frequency division, phase adjustment, etc., and PLL is an analog circuit. The frequency it generates is more accurate than DCM, and the jitter is also better. However, the existing PLL cannot dynamically adjust the phase, and cannot arbitrarily adjust the real-time sampling and calculation for different fundamental waves. Summary of the invention
[0004] In order to solve the above technical problems, the present invention provides a dynamically sampled harmonic component calculation system and a control method thereof. The technical solution adopted by the present invention is as follows:
[0005] The harmonic component calculation system of dynamic sampling includes a frequency detection module, an adaptive sampling rate generation module, an ADC acquisition module, a frequency feedback module and a harmonic calculation module. The frequency detection module realizes data interaction with the adaptive sampling rate generation module, the adaptive sampling rate generation module realizes data interaction with the ADC acquisition module, the ADC acquisition module realizes data interaction with the frequency feedback module and the harmonic calculation module respectively, and the frequency feedback module realizes data interaction with the frequency detection module.
[0006] The control method of the harmonic component calculation system of dynamic sampling as mentioned above comprises the following steps:
[0007] The frequency detection module acquires the frequency of the input signal and transmits the frequency of the input signal to the adaptive sampling rate generation module. The adaptive sampling rate generation module generates an adaptive sampling rate with a fixed total number of sampling points and a changing integer frequency division ratio according to the frequency of the input signal, and transmits the adaptive sampling rate to the ADC acquisition module. The ADC acquisition module realizes analog voltage signal acquisition and converts it into a digital voltage value, and transmits the obtained digital voltage value to the frequency feedback module. The frequency feedback module obtains the current signal frequency by calculating the moment of the zero crossing point, and the frequency feedback module transmits the obtained current signal frequency to the frequency detection module. The frequency detection module stores the current signal frequency in the register as the previous signal frequency. The frequency detection module compares the previous signal frequency in the register with the frequency of the current input signal. If the frequency of the current input signal is inconsistent with the previous signal frequency, the frequency of the input signal is transmitted to the adaptive sampling rate generation module to be adjusted to the adaptive sampling rate. At the same time, the ADC acquisition module also samples according to the adaptive sampling rate and transmits the digital voltage value to the harmonic calculation module. The harmonic calculation module is implemented by the FFT IP core of Xilinx to calculate the harmonic component.
[0008] Preferably, the method for generating the adaptive sampling rate is:
[0009] FS / f / a=b (1-1)
[0010] Where FS is the fixed sampling rate, f is the frequency of the input signal, a is the number of sampling points in a single signal cycle, and b is the frequency division ratio;
[0011] First, the frequency division ratio b is calculated by formula (1-1). The frequency division ratio b is a decimal. After rounding b off, the integer frequency division ratio b(+) is obtained.
[0012] f*a*b(+)=FS(+) (1-2)
[0013] a=A / T (1-3)
[0014] Where FS(+) is the adaptive sampling rate, f is the frequency of the input signal, A is the total number of sampling points, a is the number of acquisition points in a single signal cycle, T is the number of signal acquisition cycles, and b(+) is the integer division ratio after rounding off;
[0015] The adaptive sampling rate FS(+) is calculated by formula (1-2), and the integer division ratio b(+) is to take a number at intervals of b(+) points for FFT calculation. After calculation by the FFT formula, it is a combination of 2*A real and imaginary parts.
[0016] Preferably, after the adaptive sampling rate FS(+) is obtained, it is clocked by the system clock 10ns inside the FPGA, and the sampling period t (t=1 / FS(+)) is achieved by counting.
[0017] Preferably, the ADC acquisition module performs acquisition according to the total number of sampling points A, the integer division ratio b(+), and the number of signal acquisition cycles T during the acquisition process, and the acquired data is fed back to the frequency feedback module and transmitted to the harmonic calculation module for FFT calculation.
[0018] Beneficial effects of the present invention:
[0019] The present invention designs a frequency detection module, an adaptive sampling rate generation module and a frequency feedback module, generates a dynamic sampling rate through a dynamic clock manager, realizes arbitrarily adjustable real-time sampling and calculation of different fundamental waves, and meets the requirements of the harmonic component calculation system. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a schematic diagram of the structure of a phase-locked loop system in the prior art;
[0021] Figure 2 is a schematic diagram of the principle of a harmonic component calculation system for dynamic sampling according to an embodiment of the present invention;
[0022] Figure 3 is an example diagram of adaptive sampling rate data results obtained according to different frequencies according to an embodiment of the present invention;
[0023] Figure 4 This is an example diagram of a synthesized square wave obtained by arranging data for image display according to an embodiment of the present invention;
[0024] Figure 5 It is an example diagram of square wave harmonics obtained by arranging data for image display according to an embodiment of the present invention. DETAILED DESCRIPTION
[0025] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.
[0026] There are two common methods for implementing phase-locked loops: software implementation and hardware implementation. Figure 1The figure shows a schematic diagram of the structure of a phase-locked loop system in the prior art. A typical phase-locked loop system implemented by hardware is composed of three basic circuits: a phase detector (PD), a voltage-controlled oscillator (VCO), and a loop filter (LF). The hardware implementation of the clock manager relies on a phase-locked chip or switch. Hardware implementation can save software development costs, but the phase-locked structure is fixed and cannot be properly adjusted according to the input frequency of the fundamental signal. It cannot meet the needs of linkage and complex systems.
[0027] There are many methods for implementing a phase-locked loop by software. However, for a system that needs to collect fundamental signals and calculate harmonic components in real time, there is currently no reasonable method to meet the demand for dynamic adjustment of phase during harmonic calculation. Therefore, an embodiment of the present invention proposes a harmonic component calculation system and a control method thereof that realizes dynamic sampling at different sampling rates according to different fundamental waves.
[0028] like Figure 2 FIG. 1 is a schematic diagram of the principle of a harmonic component calculation system for dynamic sampling according to an embodiment of the present invention. The embodiment of the present invention is implemented on an FPGA platform and is designed to meet the requirements of harmonic component and IEC harmonic component calculation.
[0029] The specific requirements for harmonic component calculation are as follows: 1. The input signal for harmonic calculation must be a full-cycle signal, and sampling by incomplete cycles is not allowed. 2. The input harmonic order of harmonic calculation is 2 n , n is a non-zero positive integer. 3. The output result of the harmonic calculation is twice the input signal, and is output in the form of real and imaginary parts.
[0030] Therefore, in order to meet the needs of harmonic component calculation, the present invention designs a harmonic component calculation system for real-time dynamic sampling of fundamental wave signals realized by software control. The specific implementation scheme is as follows:
[0031] The harmonic component calculation system of dynamic sampling includes a frequency detection module, an adaptive sampling rate generation module, an ADC acquisition module, a frequency feedback module and a harmonic calculation module. The frequency detection module realizes data interaction with the adaptive sampling rate generation module, the adaptive sampling rate generation module realizes data interaction with the ADC acquisition module, the ADC acquisition module realizes data interaction with the frequency feedback module and the harmonic calculation module respectively, and the frequency feedback module realizes data interaction with the frequency detection module; the frequency detection module is actually equivalent to a frequency detector realized by a software program module, which is used to compare the frequency of digital quantity signals.
[0032] The control method of the aforementioned dynamic sampling harmonic component calculation system comprises the following steps:
[0033] The frequency detection module acquires the frequency f of the input signal and transmits the frequency f of the input signal to the adaptive sampling rate generation module. The adaptive sampling rate generation module generates an adaptive sampling rate FS(+) with a fixed total number of sampling points and a changing integer frequency division ratio b(+) according to the frequency f of the input signal, and transmits the adaptive sampling rate FS(+) to the ADC acquisition module for signal sampling. The ADC acquisition module mainly acquires the analog voltage signal and converts it into a digital voltage value, and transmits the obtained digital voltage value to the frequency feedback module. The frequency feedback module is a digital signal module. The current signal frequency is obtained by calculating the moment of the zero crossing point, and the frequency feedback module transmits the obtained current signal frequency to the frequency detection module. The frequency detection module stores the current signal frequency in a register as the previous signal frequency. The frequency detection module compares the previous signal frequency in the register with the current input signal frequency f. If the current input signal frequency f is inconsistent with the previous signal frequency, the input signal frequency f is transmitted to the adaptive sampling rate generation module to be adjusted to the adaptive sampling rate FS(+). At the same time, the ADC acquisition module also samples the digital voltage value according to the adaptive sampling rate FS(+) and transmits it to the harmonic calculation module. The harmonic calculation module is implemented through the FFT IP core of Xilinx to calculate the harmonic components.
[0034] The ADC acquisition module can be implemented using the ADC chip in the existing acquisition card. The ADC chip includes an ADC circuit and an amplification circuit. The acquisition card samples the signal characteristics, which include the value of the signal voltage or current. The ADC acquisition module calculates the harmonic input signal and inputs it into the harmonic calculation module. The ADC acquisition module calculates the signal frequency at the current moment and transmits it to the frequency detection module.
[0035] Based on the classic phase-locked loop circuit, the present invention makes improvements to the harmonic component calculation requirements. In the present invention, the frequency detection module is implemented by a software method, and the frequency of the signal at the previous moment is compared with the frequency of the input signal at the current moment and the frequency of the feedback signal in real time through register storage. When there is a difference between the two, the input signal is input to the adaptive sampling rate generation module.
[0036] The classic sampling frequency calculation formula is as follows:
[0037] FS / f / a=b (1-1)
[0038] Where FS is the fixed sampling rate, f is the frequency of the input signal, a is the number of sampling points in a single signal period, and b is the division ratio.
[0039] The improved calculation formula of the present invention is as follows:
[0040] f*a*b(+)=FS(+) (1-2)
[0041] a=A / T (1-3)
[0042] Where FS(+) is the adaptive sampling rate, f is the frequency of the input signal, A is the total number of sampling points, a is the number of acquisition points in a single signal cycle, T is the number of signal acquisition cycles, and b(+) is the integer division ratio after rounding.
[0043] First, the frequency division ratio b is obtained by the classic formula. In order to ensure consistency and meet the requirements of harmonic calculation, the fixed sampling rate FS is fixed and the total number of sampling points A is fixed and equal to 2. n , the number of signal acquisition cycles T can only be a positive integer, so the obtained frequency division ratio b is a decimal. By rounding b to the nearest integer, we can get the integer frequency division ratio b(+), and then we can get the final adaptive sampling rate by inverse calculation through the formula.
[0044] In the program, the integer division ratio b(+) is to take a number at intervals of b(+) points for FFT calculation. The total number of sampling points is specified as A, and after calculation by the FFT formula, it becomes a combination of 2*A real and imaginary parts.
[0045] Special attention should be paid to the extraction of harmonic orders, because the system performs multi-cycle acquisition, and when taking the harmonic orders, it is also necessary to use a method with intervals equal to the number of cycles.
[0046] Similarly, the IEC harmonic regulation stipulates that the number of signal cycles collected is 10 or 12 (international regulation), so the present invention only needs to change T to 10 or 12 to obtain the result.
[0047] After FS(+) is obtained, the system clock 10ns is used inside the FPGA to beat the signal, and the sampling period t (t=1 / FS(+)) is realized by counting. During the acquisition process, the ADC acquisition module collects data according to the total number of sampling points A, integer division ratio b(+), and signal acquisition period number T obtained previously. The acquired data is fed back to the frequency feedback module and sent to the harmonic calculation module for FFT calculation.
[0048] FFT calculation uses the IP core calling method inside the FPGA. The IP core is a medium for implementing FFT calculation. It is an officially packaged protocol or API, which is the official content of the hardware platform. It can be regarded as a process that supports N-point FFT or IFFT calculation, where N is 2m and m is 3 to 16.
[0049] For fixed-point input, the input data is N complex vectors, representing a two-way bx-bit binary complement code, that is, both the real part and the imaginary part are bx-bit binary complement codes, bx=8~34, and similarly, the phase factor bw is also 8~34 bits wide.
[0050] For single-precision floating-point input, input N complex vectors, representing dual-channel 32-bit floating-point data, and the phase factor is a 24 or 25-bit fixed-point number.
[0051] All on-chip memories can be RAM (BRAM) or distributed RAM (implemented by logic resources). FFT input data can be in natural order, and output can be in natural order or reverse order. Reverse order output takes up more resources.
[0052] The number of conversion points N, forward or reverse conversion, scaling factor and cyclic prefix length are all configurable in real time. The conversion type (FFT or IFFT), scaling factor and cyclic prefix length can be changed between frames. Changing the number of conversion points N requires resetting the IP core.
[0053] Four optional algorithms are provided: pipeline I / O, Radix-4 burst I / O, Radix-2 burst I / O, and Radix-2Lite I / O. FFT calculation can be implemented through the IP core, and the FFT calculation method is an existing technology.
[0054] The following is the experimental results of the harmonic component calculation system and control method using the dynamic sampling of the embodiment of the present invention, and the example of the adaptive sampling rate data results obtained at different frequencies is shown in FIG. Figure 3 As shown in the figure, the final calculation result obtained according to the above formulas 1-1, 1-2, and 1-3 is obtained. The division ratio b obtained by formula 1-1 is a decimal, and the decimal cannot be used as the division ratio in FPGA. After rounding to a positive integer, the integer division ratio b(+) is obtained. The final adaptive sampling rate FS(+) is obtained by formulas 1-2 and 1-3. The sampling rates are not much different and meet the requirements.
[0055] The output calculation results are displayed by MATLAB tools to arrange the data into images, such as Figure 4 As shown, it is an example diagram of a synthetic square wave obtained by arranging data for image display according to an embodiment of the present invention. The input data of the present invention is constructed by matlab, which is a square wave signal. In the field of signal processing, a square wave is a superposition of multiple sine waves.
[0056] The output calculation results are displayed by MATLAB tools to arrange the data into images, such as Figure 5 As shown in FIG. 1 , an example diagram of square wave harmonics obtained by displaying data in an image arrangement according to an embodiment of the present invention is shown. As can be seen from the figure, after harmonic calculation, the 1st harmonic, the 3rd harmonic, and the 5th harmonic are extracted and obtained by Figure 3 The same square wave signal is sampled and calculated at different adaptive sampling rates to obtain the same three groups of harmonics, which can verify that the present invention is reliable and effective.
[0057] In the embodiments of the present invention, technical features that are not described in detail are all existing technologies or conventional technical means and will not be described in detail here.
[0058] Finally, it should be noted that the above embodiments are only specific implementation methods of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them, and the protection scope of the present invention is not limited thereto. Those skilled in the art should understand that any technician familiar with the technical field can modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be covered within the protection scope of the present invention.
Claims
1. A control method for a harmonic component calculation system of dynamic sampling, characterized in that: The dynamic sampling harmonic component calculation system comprises a frequency detection module, an adaptive sampling rate generation module, an ADC acquisition module, a frequency feedback module and a harmonic calculation module, wherein the frequency detection module and the adaptive sampling rate generation module realize data interaction, the adaptive sampling rate generation module and the ADC acquisition module realize data interaction, the ADC acquisition module realizes data interaction with the frequency feedback module and the harmonic calculation module respectively, and the frequency feedback module realizes data interaction with the frequency detection module; The method comprises the following steps: the frequency detection module acquires the frequency of the input signal and transmits the frequency of the input signal to the adaptive sampling rate generation module; the adaptive sampling rate generation module generates an adaptive sampling rate with a fixed total number of sampling points and a changing integer frequency division ratio according to the frequency of the input signal, and transmits the adaptive sampling rate to the ADC acquisition module; the ADC acquisition module acquires analog voltage signals and converts them into digital voltage values, and transmits the obtained digital voltage values to the frequency feedback module; the frequency feedback module obtains the signal frequency at the current moment by calculating the moment of the zero crossing point, and the frequency feedback module transmits the obtained signal frequency at the current moment to the frequency detection module; the frequency detection module stores the signal frequency at the current moment in a register as the signal frequency at the previous moment; the frequency detection module compares the signal frequency at the previous moment in the register with the frequency of the current input signal; if the frequency of the current input signal is inconsistent with the signal frequency at the previous moment, the frequency of the input signal is transmitted to the adaptive sampling rate generation module to be adjusted to the adaptive sampling rate; at the same time, the ADC acquisition module also samples according to the adaptive sampling rate and transmits the digital voltage value to the harmonic calculation module; the harmonic calculation module is implemented by the FFTIP core of Xilinx to calculate the harmonic components; The method to generate adaptive sampling rate is: FS / f / a=b (1-1) Where FS is the fixed sampling rate, f is the frequency of the input signal, a is the number of sampling points in a single signal cycle, and b is the frequency division ratio; First, the frequency division ratio b is calculated by formula (1-1). The frequency division ratio b is a decimal. After rounding b off, the integer frequency division ratio b(+) is obtained. f*a*b(+)=FS(+) (1-2) a=A / T (1-3) Where FS(+) is the adaptive sampling rate, f is the frequency of the input signal, A is the total number of sampling points, a is the number of acquisition points in a single signal cycle, T is the number of signal acquisition cycles, and b(+) is the integer division ratio after rounding off; The adaptive sampling rate FS(+) is calculated by formula (1-2), and the integer frequency division ratio b(+) is to take a number at intervals of b(+) points for FFT calculation. After the FFT formula is calculated, it is a combination of 2*A real and imaginary parts; After the adaptive sampling rate FS(+) is obtained, it is beat by the system clock 10ns inside the FPGA, and the sampling period t (t=1 / FS(+)) is realized by counting.
2. The control method of the dynamic sampling harmonic component calculation system according to claim 1, characterized in that: During the acquisition process, the ADC acquisition module performs acquisition according to the total number of sampling points A, the integer division ratio b(+), and the number of signal acquisition cycles T. The acquired data is fed back to the frequency feedback module and transmitted to the harmonic calculation module for FFT calculation.
