Digital Multimeters (DMMs) and Precision DC Sources

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow AC measurement in C++ application with DMM-4065

Solved!
Go to solution

Good morning.

 

My company recently purchased a NI-4065 DMM USB and I am in the process of writing my own application in C++ Builder 6.0 to interface with it.

 

The purpose of the application is to do all ranges of measurements for DC Voltage, DC Current, AC Voltage, AC Current and 2-Wire Resistance. I have the application working properly and interfacing with the hardware properly. My DC readings and Resistance readings are very quick to update, but my problem with which I need assistance is the AC measurements. Although the measurement itsself is correct, it takes extremely long to read a value (2-3 seconds) no matter the resolution, min frequency, max frequency or power line parameters I set it up with.

 

I am using "niDMM_ConfigureMeasurementDigits" and "niDMM_ConfigureACBandwidth" to set up the session for AC measurement, and using "niDMM_Read" for reading the measurement value. I use this same read function to read my DC measurements and resistance and they execute very quickly.

 

Am I missing the initialization of some crucial properties for AC measurements to enable it to read quickly, or am I doing something completely wrong? I would like to have at least 1 reading per second but prefer more with less than 6.5 digits. I am also experiencing a huge time delay when switching measurement modes and sessions get closed and created again.

 

Please assist me with this problem if possible, as it is crucial to have a good measurement update rate.

 

Thank you.

0 Kudos
Message 1 of 9
(7,409 Views)

The 4065 has an aperture time of 1 second when acquiring AC signals at 6.5digits.  Decreasing the resolution in digits will decrease acquisition time, since we need to average less measurements for lower resolution. 

 

However, 3 seconds is not 1 second, so there's likely some other culprit.  How long does it take to acquire an AC waveform using the example text-based code?

C:\Users\Public\Documents\National Instruments\NI-DMM\examples

-John Sullivan
Problem Solver
0 Kudos
Message 2 of 9
(7,401 Views)

Default settling time for ACV seems to be 1.5 seconds.  Add that to the default 1 second aperture, and there's your 2-3 seconds.  You should be able to shorten both the aperture and the settling time, but be prepared for a decrease in accuracy.

0 Kudos
Message 3 of 9
(7,396 Views)

Thanks for the replies guys.

 

After posting this I got the info regarding the settling time that I needed and proceeded to change that, as well as the aperature time.


@John, I initially used the example code, and it resulted in a 2-3s measurement regardless of the resolution, unfortunately I don't have the exact time it took.

 

Now here is the thing that is baffling me and maybe you guys can give some insight into this:

If I set my settling time to 0.5s and my aperature time to 0.5s, I get a reading in about 0.53s regardless of the resolution. Why would the resolution change not implement any change in the measurement

time?

 

I basically want to be able to match the DMM Soft Front Panel measurements in terms of speed. I see on there it gets faster as the resolution gets smaller and I understand why. But does this mean that for me to achieve those speeds that I have to manually configure my settling time and aperature time for every different resolution setting?

 

The way I want to make it work currently (with the resolution not affecting the measurement time) is:

 - 3.5 & 4.5 Digit resolution = Settling time & Aperature time at 5mS each for 100 reading/second potential

 - 5.5 Digit resolution = Settling time & Aperature time at 50mS each for 10 reading/second potential

 - 6.5 Digit resolution = Settling time & Aperature time at 500mS each for 1 reading/second potential

 

Would this be sufficient for getting an accurate reading for the 5.5 and 6.5 digits?

 

On a side note, I'm starting to think the resolution change doesn't actually do anything, although I am certain that it configures the measurement digits with the correct value. Strange.

 

Thanks again.

0 Kudos
Message 4 of 9
(7,376 Views)

Setting the resolution just changes the aperture.  If you set the aperture directly, then the resolution setting is overridden.

 

The help file page on measurement defaults should clarify things: http://zone.ni.com/reference/en-XX/help/370384N-01/dmm/4065_dmm_defaults/

Also this one on measurement timing: http://zone.ni.com/reference/en-XX/help/370384N-01/dmm/setting_aperture_time/

 

I suspect the soft front panel sets settling time to something very low (since it takes repeated measurements without switching anything; the driver may even do this automatically), and lets the driver choose the aperture based on the requested resolution and minimum frequency.

 

0 Kudos
Message 5 of 9
(7,369 Views)

If you want the same settings that the Soft Front Panel uses, you can find out by running NI I/O Trace and then switching the Soft Front Panel to AC Voltage/Current. There are a lot of traces from it since it will continue to log all measurements being taken, so I don't recommend keeping I/O Trace logging for very long so that it's easier to sort through.

Tobias
Principal Software Engineer
Driver Software
National Instruments
0 Kudos
Message 6 of 9
(7,362 Views)

@Chris R. wrote:

Setting the resolution just changes the aperture.  If you set the aperture directly, then the resolution setting is overridden.

 

The help file page on measurement defaults should clarify things: http://zone.ni.com/reference/en-XX/help/370384N-01/dmm/4065_dmm_defaults/

Also this one on measurement timing: http://zone.ni.com/reference/en-XX/help/370384N-01/dmm/setting_aperture_time/

 

I suspect the soft front panel sets settling time to something very low (since it takes repeated measurements without switching anything; the driver may even do this automatically), and lets the driver choose the aperture based on the requested resolution and minimum frequency.

 


@ Chris - Thanks for the info. After learning about the settling time and aperature time adjustments I started playing around with them and now have my measurement speed in an acceptable range. Those links explained things very well, thanks.

@Tobias G wrote:

If you want the same settings that the Soft Front Panel uses, you can find out by running NI I/O Trace and then switching the Soft Front Panel to AC Voltage/Current. There are a lot of traces from it since it will continue to log all measurements being taken, so I don't recommend keeping I/O Trace logging for very long so that it's easier to sort through.


@ Tobias - Thanks so much for telling me about this! I didn't even know of this tool and it has helped me sort out some errors on my part... Very usefull!!

 

 

My measurements now happen quite quick, but using IO Trace shows me that with the Soft Front Panel only uses ReadStatus functions and never really a Read function, so where does this get done? I am assuming from NI there are a few optimizations done to make the soft front panel as fast as it is, the average duration of a function via IO Trace is 0.004s for the Soft Front Panel, and for my application its about 0.03s.. I would love to be able to achieve a 0.004s excecution speed. Any tips on this?

 

Thanks again for all your support it has been very helpful!

 

0 Kudos
Message 7 of 9
(7,330 Views)
Solution
Accepted by mateq_jj

The Soft Front Panel does not use niDMM_Read(), it uses niDMM_FetchMultiPoint(). The niDMM_ReadStatus() that you see traced merely checks the size of the measurement backlog and the status of the acquisition (running, finished with backlog, finished with no backlog, etc.). It does not take a measurement, which is why it returns so much faster than FetchMultiPoint().

 

There are no special tricks to increase the speed of the Soft Front Panel. What you see traced are the actual calls it makes to the driver.

 

If you are currently using niDMM_Read() in a loop, you should be able to increase your measurement speed further by switching to use niDMM_FetchMultiPoint() instead. Internally Read() calls Initiate() and Abort(), which when you're measuring as quickly as you are, can take up a large percentage of your measurement time.

 

That said, the speed of your application will be highly dependent on your configuration - if you lower your aperture time, your measurement quality will be reduced, and depending on how accurate and precise you need your measurements to be, that may be unacceptable

Tobias
Principal Software Engineer
Driver Software
National Instruments
0 Kudos
Message 8 of 9
(7,325 Views)

Thanks again for your help Tobias! I have found the problem regarding measurement times yesterday when doing a bit more research on multi point measurements and although my duration is accpetable at the moment, I am certain I'll be changing over to it.

 

Thank you for all the help and everybody that was willing to share their knowledge!! It is much appreciated!

0 Kudos
Message 9 of 9
(7,311 Views)