Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
LabVIEW-Measurements.pdf
Скачиваний:
61
Добавлен:
29.05.2015
Размер:
3.37 Mб
Скачать

Chapter 4 Example Measurements

How to Measure Frequency and Period of a Repetitive Signal

Measuring Frequency and Period Example

For this example, you need to have a repetitive signal. Our measurement system is similar to that of Figure 4-24, except that the analysis is to measure frequency. To get reasonable results, be aware of the Nyquist Theorem, which states that the highest frequency that can be accurately represented is half the sampling rate. This means that if you want to measure the frequency of a 100 Hz signal, you will need a sampling rate of at least 200 S/s. In practice, sampling rates of five to ten times the expected frequencies are used. Figure 4-28 shows the block diagram to take this measurement. Once the frequency has been determined, the period of the signal is simply the inverse of the frequency.

Figure 4-28. Measuring Frequency and Period

In addition to sample rate, you need to determine the number of samples to acquire. In general, more is better, but there are two things to consider. First, a minimum of three cycles of the signal must be sampled. That means in the 100 Hz example, if the sample rate is 500 S/s, you would need to collect at least 15 points. This is because you are sampling about five times faster than our signal frequency. That means you sample about 5 points per cycle of the signal. Because you need data from 3 cycles you get 5 × 3 = 15 samples. Second, the number of points you collect determines the number of frequency “bins” your data will fall into. With more bins, the frequency you measure might fit into one bin rather than several bins. The size of each bin is the sampling rate divided by the number of points collected. If you sample at 500 S/s and collect 100 points, you have bins at 5 Hz intervals. The Extract Single Tone Information VI used in this example uses data from the three dominant bins to determine the frequency. One rule of thumb is to sample 5 to 10 times faster than your expected signal, and to acquire 10 or more cycles.

LabVIEW Measurements Manual

4-16

www.ni.com

Chapter 4 Example Measurements

Frequency also can be measured using an instrument. The instrument control system setup is the same as Figure 4-26. Figure 4-29 shows the block diagram for this measurement. Notice that this is like Figure 4-27 except the measurement function and output are frequency. Because frequency measurement is inherent to the instrument, the frequency value is not calculated in LabVIEW. Rather, it is simply returned by the instrument.

Figure 4-29. Measuring Frequency Using an Instrument

Measuring Frequency and Period with

Filtering Example

As shown in the Measuring Frequency and Period Example, the Nyquist frequency is the bandwidth of the sampled signal and is equal to half the sampling frequency. But what happens to other frequency components that might be mixed in with the signal you are trying to measure? Frequency components below the Nyquist frequency simply appear as they are.

A frequency component above the Nyquist frequency appears aliased between 0 and the Nyquist frequency. The aliased component is the absolute value of the difference between the actual component and the closest integer multiple of the sampling rate. For example, if you have a signal with a component at 800 Hz, and you sample at 500 S/s, that component appears aliased at

800 – ( 2 500) = 200Hz

One way to eliminate aliased components is to use an analog hardware filter prior to digitizing and analyzing for frequency information. Refer to Chapter 16, Digital Filtering, for more information about hardware filtering. If you want to do all of your filtering in software, you must first sample at a rate fast enough to correctly represent the highest frequency component contained in your signal. For this example, with the highest component at 800 Hz, the minimum sample rate is 1600 Hz. In practice, a

© National Instruments Corporation

4-17

LabVIEW Measurements Manual

Chapter 4 Example Measurements

sampling rate of five to ten times faster than 800 Hz should be used. Suppose now that the frequency you are trying to measure is around

100 Hz. You can use a lowpass Butterworth filter with a cutoff frequency (fc) set to 250 Hz. This filters out frequencies above 250 Hz and pass frequencies below 250 Hz. Figure 4-30 shows a lowpass filter.

Figure 4-30. Lowpass Filter

The Ideal Filter is what you want. All frequencies above the Nyquist are rejected. The Real Filter is what you might actually be able to accomplish with a Butterworth filter. The pass band is where Vout/Vin is close to 1.

The stop band is where Vout/Vin is close to 0. In between is the transition region, where frequencies are gradually attenuated.

Figure 4-31 shows the block diagram to filter before measuring frequency.

Notice the Digital IIR Filter VI and the IIR filter specifications.

Figure 4-31. Measuring Frequency after Filtering

LabVIEW Measurements Manual

4-18

www.ni.com

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]