From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read and log analog input as fast as possible.

Hello All,

I have this simple program to acquire a voltage and write it to a file.

I am thankfull for any suggestions that makes acquire and write data to the file as fast as possible.

One channel input 0 - 10volts on Multifunction DAQ

 

I am using LabVIEW 2009.

 

thanks

 

 

 

0 Kudos
Message 1 of 8
(2,994 Views)

You are collecting 50 samples at a time on a 10kHz. clock.  That means your loop will have to run as fast as 5 msec per iteration to keep up.  That is pretty quick.  I don't even know if the file writing can occur that quickly.

 

You need a producer/consumer architecture so that one loop gets the DAQ data and passes it to the consumer loop via a queue for writing out to a file.  That way delays in file writing don't slow down your data acquisition.

 

I would also collect more than 50 samples at a time.  Try 1000-5000 samples at a time.  When you send that data to the file writing loop, the file writing will be far more efficient writing out a larger dataset than a small number of bytes.

Message 2 of 8
(2,981 Views)

I would suggest you to use queue to write the data to a file as shown below. This gives an option for extending your current code and provide loss less and high speed data acquisition.

 

Analog input acq..png

 

Good luck

-----

The best solution is the one you find it by yourself
Message 3 of 8
(2,980 Views)

I have had a luck with file handling performance by using TDMS files. I believe its buffered but I am sure an expert on here can go into much more detail

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
Message 4 of 8
(2,970 Views)

Its a tensile strength experiment the more data the better.

I am trying to seperate the data collection from the logging process, fully aware the opening and closing a file will tax the speed. I tried the producer architecture but i got hang up somewhere as such i wanted to go back to basics.

I tried the 50 samples at 10kHz just to see the limits but agree at runtime i will use 1000 samples. thanks

0 Kudos
Message 5 of 8
(2,949 Views)

the way im doing it, is to initialise my file handling including open the tdms file, set up read data and get that started in the producer section. In the consumer section i write it straight to the tdms file (To be processed properly later). When test is finished i close the tdms file. There are a number of good articles about producer/consumer architecture and i would suggest you try to use this method

 

hope it helps 

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
Message 6 of 8
(2,947 Views)

Try posting the code that you have tried.

-----

The best solution is the one you find it by yourself
Message 7 of 8
(2,945 Views)

Here was one of the attempts it is similar to P Anand.

0 Kudos
Message 8 of 8
(2,935 Views)