Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

JLAnderson

Member

03-04-2013 06:40 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I am working on a project and need to know how to calculate the accuracy of a frequency measurement using the NI PXI-5114 digitizer. The only timing specification I can find in the specs is the 25ppm using the built-in clock. The signal being measured is a 250KHz, 10 Vpp, square wave, no offset. The help documentation states one full period at the 50% level (0 V) is used to determine the frequency. The code uses VB6 with C library calls as follows:

niScope_ConfigureHorizontalTiming(sesnOS, 20000000, 1000, 40, 1, NISCOPE_VAL_TRUE)

niScope_FetchMeasurement(sesnOS, "1", 10, NISCOPE_VAL_FREQUENCY, Frequency)

Test data indicates about a +/-800 Hz spread. Using just the 25ppm gives an accuracy of about +/-6 Hz. There must be an accuracy term based on the sample rate. How do I calculate the accuracy and how can I make the readings more accurate? Thanks.

John Anderson

Kaitlin-N

Member

03-05-2013 09:41 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi John,

What are you using to verify the frequency of your input signal? Are the values always relatively close to 800Hz off? What happens if you increase the sample rate to 200M?

Regards,

Kaitlin N.

National Instruments

Applications Engineer

National Instruments

Applications Engineer

DFGray

NI Employee (retired)

03-06-2013 07:31 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

As you guessed, the clock accuracy is just part of the issue. The algorithm used to find the frequency is fairly simple, and should work very well with a square wave, provided you do not have much noise on your signal. First, the entire signal is binned into a histogram (usually 256 levels) to determine the high and low values. The average of these is used to find the zero point. The algorithm then scans the waveform looking for two zero crossings in the same direction. When it finds them, it linearly interpolates the points on either side of the zero crossing to find the time of the two zero crossings. The difference in the times is the period. The inverse is the frequency.

Noise on your signal can cause this to go very wrong. How wrong will depend upon the slew rate of the edges of your square wave and how much noise there actually is. You can improve the situation in several ways:

- As mentioned above, take data at a higher rate. If you noise is low enough, this will help your accuracy.
- Take many measurements and average them. You can also calculate statistics on these measurements to determine how accurate a single measurement is likely to be.
- Roll your own similar algorithm. The obvious first step is to do a line fit on the points around the zero crossings instead of a simple linear interpolation of two points.
- Roll your own different algorithm. Another way to do this is to use the tone extraction VIs, although you will need ten or more cycles for this to work well. More cycles gives more accuracy.

Post some of your raw data and we can offer more concrete solutions. Good luck!

This account is no longer active. Contact ShadesOfGray for current posts and information.

03-06-2013 11:44 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

My function is QA so I don't have direct access to the test equipment but I can request the test engineer collect some data. The test is for a 1553 bus using a NI PXI-5402 function generator set at 250 KHz, 10 Vpp. The circuitry has several resistors and a step down transformer in the path. It is also shielded. The scope is connected to the other end and sees about a 8 Vpp signal. I don't have a screen shot of the waveform yet but based on what I have seen on other test sets, the noise should be low. The average frequency reading is 250,010 Hz so the data is fairly even around the nominal. The attached is spreadsheet showing only passed data. There are some failures that range from 80 KHz to 500 KHz that could have been TE problems.

My real problem is determining how accurate the instrument is using the frequency function since there is software interpolation of the data. I also need an accuracy formula for the PXI-5402 function generator if it is not 25 ppm * frequency. I will have the test engineer try some different setups and collect raw waveforms for analysis but this may take a while.

John Anderson

DFGray

NI Employee (retired)

03-07-2013 09:38 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

The PXI-5402 does have a 25ppm frequency accuracy spec. It also has a 100MHz sample clock. 250kHz should be a direct submultiple of this, so should not give you any waveform edge jitter for a square wave. You are seeing about a 40ppm error (10Hz on 250kHz signal). How long has it been since the 5402 was calibrated? The standard calibration interval for this instrument is two years.

In almost all cases, measurements from NI-SCOPE are done in the driver software, not on the scope hardware. The waveform is fetched and the measurement taken, then returned to the caller. Most of these measurements are also available in the analysis palettes of LabVIEW, if you want details of how they are done. I cannot give you an accuracy for this particular measurement, since I do not have access to the original waveforms and the accuracy will depend upon your edge slew rates and the noise on the signal. You are seeing about the error rates I would expect, however, given how the measurement is being taken. If you want more accuracy, you will need to use a better method (average, FFT, line fit to zero crossings, etc.). The errors do seem to be normally distributed about the mean.

My apologies for not being more help. If you can post a raw waveform, we may be able to give more information.

This account is no longer active. Contact ShadesOfGray for current posts and information.

Henrik_Volkers

Trusted Enthusiast

03-12-2013 11:04 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Instead of the NI-Scope measurement functions for frequency estination ( 😉 ) I found the extract single tone vi to give better results. Much more consistent over different samplerates and measured frequency. Take at least 20 periodes and the highest possible samplerate.

Create a signal that is locked to your PXI card clock (PFI0 square for 10x probe compensation) and check the standard deviation 🙂 should be in the ppb range with the extract single tone vi. the NI-Scope frequency output will always be at the same value, but if you now take a stable (slowly drifting) uncoupled signal generator and look at the values and the stddev you should find the NI-Scope value 'jump' around.

As of uncertaincy: The digitizer clock spec is one thing, but if used in a PXI rack you have to check if the pxi- backplane clock is enabled or not.

The standard PXI-CLK10 migth be worse but if you can usually use the best clock in the system as the PXI-master clock and sync your scope card with that.

We use 6652 timer cards.

Or do you just need a number for your QA system ?

Greetings from Germany

Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

03-12-2013 12:50 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

The stated accuracy of the generator and the scope is 25 ppm. From a hardware point of view (25+25) ppm * KHz = +/-12.5 Hz error. After looking at 4 channels of data instead of one, standard deviation is about +/- 1200 Hz. This is about two orders of magnitude worst than expected. The low sampling rate currently being used is the primary suspect. I would like to use a very accurate frequency counter on both the function generator and the scope input to see what is really going on. There is no room for a counter in the test set. I would have preferred using a 1553 card to test the 1553 bus and avoided all these headaches.

Recommending the single tone.vi is fine but there does not seem to be any equivalent niScope call for C code. Creating our own algorithm as suggested by DFGray is a possibility. The bottom line is I need to determine the accuracy of the measurement no matter what method we end up with. The test engineer has no access to a UUT so I have to wait for more data. Thank you for your comments.

DFGray

NI Employee (retired)

03-12-2013 01:34 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Henrik brings up a good point. Your 5114 and 5402 should definitely be using the same clock. This is easy to do on a PXI rack. Look at the specs for the rack, scope, and arb and use the best clock.

The tone extraction algorithm is actually relatively simple. Apply a Hanning window to the waveform, do a power spectrum, then search for peaks. The peaks have a particular shape due to the Hanning window. Do a three point fit to this function to the top three points in the peak. Use the fit coefficients to find both the peak location and height. I believe the function is a sinc, and you can do a three point fit with a simple mathematical calculation (three equations, three unknowns - position, width, height). I realize there are a lot of details I left out, but that is about as much as I can remember. A web search should find the rest.

This account is no longer active. Contact ShadesOfGray for current posts and information.

Henrik_Volkers

Trusted Enthusiast

03-13-2013 02:06 AM - edited 03-13-2013 02:12 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

here

http://forums.ni.com/t5/LabVIEW/Sine-fit-algorithm/m-p/1617458#M585388

I posted a NI presentation (I currently can't find at the NI pages)

about the tone detection algorythm.

A search with '4 parameter sine fit' will bring lots of papers on how to program another solution with established (ISO standard) algorythms.

Greetings from Germany

Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

Bicbehr

Member

12-19-2013 08:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

After reading this forum I am still a little confused. I have to determine the accuracy of a PXI 5122 when measuring frequency.

I see the 25 ppm spec, but 25 ppm of what? The sample rate or measurement?