LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling Rate Issue

I am using the following program to log the analog channels from a measurements computing daq board. Basically, I would like to collect the data every 0.5 seconds. It works great for several minutes (4 - 5 min?) but then the sampling rate gradually increases. I need the program to sample at this high rate so I don't miss my measured event. Any help is appreciated.  

0 Kudos
Message 1 of 6
(2,917 Views)

I am not familiar with the MC products, but you should be able to put all of your channels into a single task and perform the read all at once.  There should also be a timing setup VI so that you can have the hardware perform the sample rate instead of your software.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 6
(2,907 Views)

I'm not 100% on the underlying operation of the write to measurement file express VI but given your description, I think this is probably the most likely cause of the problem, with increasing file size slowing down the opening and writing operations. How big are your data files are the few minutes that you have had the program running?

 

As a quick test on whether this is the issue or not, try moving the file name creation inside of the while loop, this should move it to recording the data into minute long files and limit the size of the files.

Message 3 of 6
(2,874 Views)

I'm sorry, but I just don't "get it".  I think your device is similar to NI's USB-600x series of modules, capable of multiple channel A/D at speeds up to a few KHz.  You are talking about taking samples at a very slow rate, 2Hz, for a few hundred seconds, so you'll have at most a few thousand points to handle.  Yet you say that the sampling rate increases as time goes on ... (I might expect a decrease if the amount of data became too much to handle in half-a-second).

 

Some suggestions:

  • Have you tried your device out with MAX to be sure that it "works" for, say, 10 minutes?
  • Have you tried your code without the Save to Measurement File, i.e. just acquiring and displaying?

Often trying "pieces" of a program can be a quick way to isolate the problem spots.

 

Bob Schor

0 Kudos
Message 4 of 6
(2,871 Views)

Hello sir,

 

I am sorry I misspoke. What I meant to say was the time between samples gradually increased. The program starts our at a sample every 0.5 seconds, but by the end of my testing it is sampling every 1 second.  Thank you, for your input.

0 Kudos
Message 5 of 6
(2,826 Views)

I still believe the steps Bob provided will allow you to isolate the problem.

 

Quote:

Some suggestions:

  • Have you tried your device out with MAX to be sure that it "works" for, say, 10 minutes?
  • Have you tried your code without the Save to Measurement File, i.e. just acquiring and displaying?

Often trying "pieces" of a program can be a quick way to isolate the problem spots.

Anthony M.
Applications Engineering
National Instruments
0 Kudos
Message 6 of 6
(2,799 Views)