Frequency measurement system based on FPGA

文档序号:1476663 发布日期:2020-02-25 浏览:19次 中文

阅读说明:本技术 基于fpga的频率测量系统 (Frequency measurement system based on FPGA ) 是由 许波 程玉华 陈凯 杨云鹏 王伊凡 张硕 韩文强 赵佳 孔子薇 于 2019-10-31 设计创作,主要内容包括:本发明公开了一种基于FPGA的频率测量系统,输入信号经比较器模块后得到与输入信号同频同相的矩形波信号,ADC模块对输入信号进行采集后采用FFT分析法初步确定输入信号的频率,参考时钟选择模块用于根据初步确定的频率选择一个参考时钟clk_fre作为滤毛刺模块中滤除毛刺成分的时钟源,滤毛刺模块对矩形波信号中的毛刺进行滤除,频率测量模块基于测频法或测周法对滤除后的信号进行测量得到脉冲计数结果,上位机基于脉冲计数结果计算得到输入信号的频率测量结果。本发明首先通过FFT分析法粗略计算出输入信号的基波频率,经过滤除毛刺后通过测频法或测周法精确测量出信号的频率,从而在信号中存在谐波成分时对基波频率进行准确测量。(The invention discloses a frequency measurement system based on FPGA, an input signal obtains a rectangular wave signal with the same frequency and phase as the input signal after passing through a comparator module, an ADC module acquires the input signal and then preliminarily determines the frequency of the input signal by adopting an FFT analysis method, a reference clock selection module is used for selecting a reference clock clk _ fre according to the preliminarily determined frequency as a clock source for filtering a burr component in a burr filtering module, the burr filtering module filters burrs in the rectangular wave signal, the frequency measurement module measures the filtered signal based on a frequency measurement method or a cycle measurement method to obtain a pulse counting result, and an upper computer calculates the frequency measurement result of the input signal based on the pulse counting result. According to the invention, firstly, the fundamental frequency of the input signal is roughly calculated by an FFT analysis method, and the frequency of the signal is accurately measured by a frequency measurement method or a cycle measurement method after burrs are filtered, so that the fundamental frequency is accurately measured when harmonic components exist in the signal.)

1. The utility model provides a frequency measurement system based on FPGA, its characterized in that includes the comparator module, the ADC module, FFT operation module, reference clock selection module, the burr filtering module, frequency measurement module and host computer, wherein FFT operation module, reference clock selection module, burr filtering module and frequency measurement module realize in FPGA, wherein:

the comparator module is used for carrying out 0 comparison on the input signal after alternating current coupling to obtain a rectangular wave signal CARD _ CNV with the same frequency and phase as the input signal, and outputting the rectangular wave signal CARD _ CNV to the burr filtering module;

the ADC module is used for collecting the same input signal and sending a collected DATA sequence ADC _ DATA containing N sampling points to the FFT operation module;

the FFT operation module preliminarily determines the frequency of the input signal by adopting an FFT analysis method, and the specific method comprises the following steps: performing FFT operation on a received acquired DATA sequence ADC _ DATA, outputting a frequency spectrum sequence of N points, recording that the frequency spectrum of each point comprises a real part Re [ k ] and an imaginary part Im [ k ], wherein k is 1,2, … and N, and calculating the frequency energy X [ k ] of the point k by adopting the following formula:

Figure FDA0002255851150000011

finding out frequency energy X [ k ]]Maximum value of (d) and its corresponding dot sequence number kmaxNumber k of dotsmaxSending the reference clock to a reference clock selection module;

the reference clock selection module is used for selecting a reference clock clk _ fre as a clock source for filtering the glitch component in the glitch filtering module, wherein the frequency f of the reference clock clk _ frerefAnd the condition that the corresponding mask value m needs to satisfy needs isf1Which represents the frequency of the fundamental wave,

Figure FDA0002255851150000013

the burr filtering module is used for filtering burrs in the rectangular wave signal CARD _ CNV according to the mask value m and the reference clock clk _ fre to obtain a rectangular wave signal CARD _ FREQ and sending the rectangular wave signal CARD _ FREQ to the frequency measuring module;

the frequency measurement module is used for measuring the rectangular wave signal CARD _ FREQ based on a frequency measurement method or a cycle measurement method to obtain a pulse counting result COUNT _ T and sending the pulse counting result COUNT _ T to an upper computer;

after receiving the pulse counting result COUNT _ T, the upper computer calculates the frequency of the rectangular wave signal CARD _ FREQ according to a calculation formula corresponding to a frequency measurement method or a frequency measurement method applied in the frequency measurement module, thereby obtaining the frequency measurement result of the input signal.

Technical Field

The invention belongs to the technical field of testing, and particularly relates to a frequency measurement system based on an FPGA (field programmable gate array).

Background

In today's society, electrical energy has become closely related to human life. Particularly, in the industrial field, more and more power electronic devices are applied to the power electronic rectifying device, the electric locomotive, the arc furnace, the ac motor and other high-power electric devices with nonlinear characteristics are greatly inrush into the power grid, so that the problem of power grid harmonic waves in the power system is increasingly serious, and the access of various nonlinear and impact devices can bring negative effects such as three-phase voltage fluctuation, waveform distortion, reactive power increase and the like to the power grid. These problems are receiving increasing attention from the power sector and consumers.

Due to the influence of a large number of non-linear consumers connected in the grid, a large number of harmonics are present in the grid, which poses a not insignificant challenge for frequency measurement. Only by effectively and accurately monitoring and analyzing the power parameters of the power grid can effective measures be made to improve the power quality problem of the power grid. The power analyzer is capable of measuring various power parameters, including frequency measurement, FFT (fast Fourier transform) operation, harmonic analysis, and the like. In the prior art, there are three main ways for a power analyzer to measure frequency:

the first mode is as follows: and (4) frequency measurement. The frequency measurement method includes that an input signal passes through an amplifying and shaping circuit to form counted narrow pulses, the number of the pulses of the signal to be measured is measured in a given time gate, and the frequency of the input signal is calculated according to the number of the pulses. When the frequency of the measured signal is low, the method has large measurement error, so that the frequency measurement method is suitable for measuring high-frequency signals. When the input fundamental wave signal contains a harmonic component, the narrow pulses output after the input signal passes through the shaping circuit become dense due to the harmonic component, the count value of the pulses becomes large, and the frequency measurement result becomes large.

The second mode is as follows: and (4) a week measuring method. The cycle measurement method converts the frequency by measuring the signal period. The input signal passes through the amplifying and shaping circuit and then outputs a gate time with the same length as the period time of the signal to be detected. The counter counts high-frequency narrow pulses within a given gate time, calculates the period of an input signal according to the number of the pulses, and further calculates the frequency. When the frequency of the measured signal is higher, the method has larger measurement error, so the frequency measurement method is suitable for measuring the low-frequency signal. When the input fundamental wave signal contains a harmonic component, the gate time of the output of the input signal after passing through the shaping circuit is shortened, the count value of the pulse is reduced, and the frequency measurement result is increased.

The third mode is as follows: FFT analysis. The method comprises the steps of establishing an FFT IP core in an FPGA (Field-Programmable Gate Array), inputting N sampled data points into the IP core, and outputting N point spectrum images by the IP core. And the frequency corresponding to the spectral line with the largest numerical value in the spectral image is the fundamental frequency. The method has the advantages that the fundamental frequency and the harmonic frequency can be seen through the frequency spectrum image, and has the disadvantages that the measurement result is limited by the frequency resolution, the measurement precision of the frequency is low, the FFT operation needs long time, and the refresh time of the measured value is long.

Disclosure of Invention

The invention aims to overcome the defects of the prior art and provides a frequency measurement system based on an FPGA (field programmable gate array). firstly, the fundamental frequency of an input signal is roughly calculated by an FFT (fast Fourier transform) analysis method, and the frequency of the signal is accurately measured by a frequency measurement method or a cycle measurement method after burrs are filtered, so that the fundamental frequency is accurately measured when harmonic components exist in the signal.

In order to achieve the above object, the frequency measurement system based on FPGA of the present invention includes a comparator module, an ADC module, an FFT operation module, a reference clock selection module, a spur filtering module, a frequency measurement module and an upper computer, wherein the FFT operation module, the reference clock selection module, the spur filtering module and the frequency measurement module are implemented in FPGA, wherein:

the comparator module is used for carrying out 0 comparison on the input signal after alternating current coupling to obtain a rectangular wave signal CARD _ CNV with the same frequency and phase as the input signal, and outputting the rectangular wave signal CARD _ CNV to the burr filtering module;

the ADC module is used for collecting the same input signal and sending a collected DATA sequence ADC _ DATA containing N sampling points to the FFT operation module;

the FFT operation module preliminarily determines the frequency of the input signal by adopting an FFT analysis method, and the specific method comprises the following steps: performing FFT operation on a received acquired DATA sequence ADC _ DATA, outputting a frequency spectrum sequence of N points, recording that the frequency spectrum of each point comprises a real part Re [ k ] and an imaginary part Im [ k ], wherein k is 1,2, … and N, and calculating the frequency energy X [ k ] of the point k by adopting the following formula:

finding out frequency energy X [ k ]]Maximum value of (d) and its corresponding dot sequence number kmaxNumber k of dotsmaxSending the reference clock to a reference clock selection module;

the reference clock selection module is used for selecting a reference clock clk _ fre as a clock source for filtering the glitch component in the glitch filtering module, wherein the frequency f of the reference clock clk _ frerefAnd the corresponding mask value m needs to satisfy the condition of

Figure BDA0002255851160000031

f1Which represents the frequency of the fundamental wave,f2which represents the frequency of the second harmonic wave,

Figure BDA0002255851160000033

Δ f denotes the frequency resolution, Δ f ═ fs/N;

The burr filtering module is used for filtering burrs in the rectangular wave signal CARD _ CNV according to the mask value m and the reference clock clk _ fre to obtain a rectangular wave signal CARD _ FREQ and sending the rectangular wave signal CARD _ FREQ to the frequency measuring module;

the frequency measurement module is used for measuring the rectangular wave signal CARD _ FREQ based on a frequency measurement method or a cycle measurement method to obtain a pulse counting result COUNT _ T and sending the pulse counting result COUNT _ T to an upper computer;

after receiving the pulse counting result COUNT _ T, the upper computer calculates the frequency of the rectangular wave signal CARD _ FREQ according to a calculation formula corresponding to a frequency measurement method or a frequency measurement method applied in the frequency measurement module, thereby obtaining a frequency measurement result.

The invention relates to a frequency measurement system based on FPGA, an input signal passes through a comparator module to obtain a rectangular wave signal with the same frequency and phase as the input signal, an ADC module acquires the input signal and then preliminarily determines the frequency of the input signal by adopting an FFT analysis method, a reference clock selection module is used for selecting a reference clock clk _ fre according to the preliminarily determined frequency to be used as a clock source for filtering burr components in a burr filtering module, the burr filtering module filters burrs in the rectangular wave signal, the frequency measurement module measures the filtered signal based on a frequency measurement method or a cycle measurement method to obtain a pulse counting result, and an upper computer calculates the frequency measurement result of the input signal based on the pulse counting result.

The invention combines the existing frequency measurement methods, firstly obtains an approximate frequency of a fundamental wave through an FFT analysis method, sets a mask value and a reference clock frequency for filtering burrs based on the approximate frequency, then filters the burrs to obtain a rectangular wave signal with the same frequency and phase as the input signal, and finally obtains the accurate frequency of the input signal through a cycle measurement method or a frequency measurement method, thereby accurately measuring the frequency of the fundamental wave when harmonic components exist in the signal.

Drawings

FIG. 1 is a block diagram of an embodiment of an FPGA-based frequency measurement system of the present invention;

FIG. 2 is a schematic diagram of spur generation and frequency measurement in the present invention;

fig. 3 is a schematic diagram of the burr filtering of the present invention.

Detailed Description

The following description of the embodiments of the present invention is provided in order to better understand the present invention for those skilled in the art with reference to the accompanying drawings. It is to be expressly noted that in the following description, a detailed description of known functions and designs will be omitted when it may obscure the subject matter of the present invention.

10页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种电力系统中谐波和间谐波的分析方法与装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!