LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Low sample rate with NI USB-6008

Hello,

We are working on a project collecting data from a hybrid rocket motor for University research. We are using a NI USB-6008, which has a sample rate of 10kHz. We are using 3 channels and getting a sample rate of ~60 samples per second. I have attached the VI. Is this slowed by software, or physical computer computation speed? This sample rate needs to be much higher. Any help is greatly appreciated.
- Theo


0 Kudos
Message 1 of 5
(3,578 Views)
Theo,

You should look at the style guides for programming. Your diagram covers about three times as much space as is needed and is hard to read. Diagrams (and front panels should not be larger than one screen. Wiring should go left to right.

You also need to learn more about dataflow. Your Write to Text File appears to be a header for the columns in the file, but it conceivably could be written after the data! A simple rewiring of the refnum in and out can take care of this.

The conversion of the path to and array of strings and back seems to have not purpose.

On to your primary question: You are reading 1 sample on each of the (three?) channels each time the loop iterates. If the Record to Disk is true, you also write once per iteration. Disk writing can take time and the amount of time can vary from call to call depending on what the OS is doing. So, to speed things up, do two things. One, read multiple samples at a time. And, two, accumulate data until you have a bunch and then write to disk, outside the loop. The best way of doing this depends upon the amount of data and other things.

Lynn
0 Kudos
Message 2 of 5
(3,563 Views)

Theo,

You have configured your analog input to read one sample per channel per loop iteration.  With all the other stuff going on in your loop, I am not suprised by the rate you are getting.  This is basically software timed analog input.  You need to configure your analog input to acquire multiple channels, multiple samples.  This way, the hardware will acquire data at the rate you configure it to run.  In example finder, look at "Cont Acq&Graph Voltage-Int Clk.vi" for an example on how to configure analog input using sample clock and hardware buffering (not as horrible or hard as this sounds).  Also keep in mind, non-simultaneous sampling DAQ cards (like your 6008) multiplex the analog inputs.  So best you could do is 10K Samples/sec divided by the number of channels (3 in your case) = 3333samples/second/channel.

-cb

0 Kudos
Message 3 of 5
(3,557 Views)

Thanks very much, I'm giving that a shot and I'll post back my results or questions as issues arise.

- Theo



0 Kudos
Message 4 of 5
(3,540 Views)

Hi Rocket 154,


You’ve already had some great responses, but I just wanted to add a little bit. A great starting point to writing good code would be the Getting Started with NI-DAQmx: Main Page, as well as the shipping examples (In LabVIEW, Help » Find Examples) already mentioned.

If you navigate a bit through the links (Basic Programming with NI-DAQmx » Getting Started with NI-DAQmx Programming in LabVIEW) you’ll end up with some great resources. I recommend Learn 10 Functions in NI-DAQmx and Handle 80% of your Data Acquisition Applications. It will detail many of the functions you can use and give you a feel for proper code style in LabVIEW.

I hope that helps.

Mark E.
Precision DC Product Support Engineer
National Instruments

Message 5 of 5
(3,502 Views)