LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous data aquisiton with write

Hello all,
 
I seem to have a problem with acquiring too much data (based on other posts with similar issues). However, I don't have the know how to control the buffer size and data flow with this particular application.
 
I am trying to get strain data and my only two data acquisition options are continuous or finite samples
 
I have used an example program as a base and simply added a  write *.TDMS function.
 
the configuration I have attached works OK, but is very very slow when I try to open up the data. after a few runs, it completely breaks down.
 
I have tried to change the timer to finite data and the read VI to acquire only limited samples, but I then get an error message shortly after the program runs, I have attached the screen view.
 
Thanks for any advice/recomendation
 
Alfonso
A. Lopez
Download All
0 Kudos
Message 1 of 10
(4,482 Views)
Hello Alfonso,

The error you posted is expected behavior when you configure your acquisition for finite.  You can read more about why here, but basically your DAQ card has stopped acquiring data because you set it for finite samples.  However, you have a DAQmx read inside a while loop and it tries to read samples even though no more samples will ever be available.  If you want to run this application until you press the stop button you will need to use continuous mode.

For your next question, I do not understand what you mean by "
the configuration I have attached works OK, but is very very slow when I try to open up the data. after a few runs, it completely breaks down".  Does this mean that your application runs and eventually you get an error because it is running to slow?  Or does this mean that it runs, but your TDMS file takes too long to open?  Can you please clarify?  Also, how long is each run and how large is your TDMS file when you get these errors?  If you remove the TDMS expressVI, does your application always run without error? 

Regards,

Jesse O.
Applications Engineering
National Instruments
Jesse O. | National Instruments R&D
0 Kudos
Message 2 of 10
(4,443 Views)

Jesse,

 

thanks for your reply.

Yes, you are correct about the error, but I would prefer not to acquire in continuous mode because the TDMS file size is evidently very large (take a long time to open up).  This is only for a file running for about 30 seconds.

The Labview program I attached work Ok with ALL components for the first time, but progressively slows down and then complete feezes the computer if I don't close the application and re-open.  yes, the TDMS file take a long time to open.  I have tried slowing down the data sampling rate, but then I get an error telling me to acquire samples faster or increase my buffer size.

the program works perfectly well without the TDMS VI bit attached.

 

thank you

 

Alfonso

A. Lopez
0 Kudos
Message 3 of 10
(4,435 Views)

Hello Jesse,

One more post on this issue,

On one run, I input to the sample clock a rate of 5 samples per second and to take a total of 600 samples per channel (Finite sample mode). However, the program still ended with an error the same as before and I only had one sample in my file.  The program should have run for 2 minutes before terminating at that sampling rate, but it was only active for about 3 seconds.

 

Thanks for your comments

A. Lopez
0 Kudos
Message 4 of 10
(4,423 Views)
One suggestion I have is to wire a value to "number of samples per channel" on DAQmx Read. The way you have it setup in the vi you posted, it will continuously acquire and also grab whatever is in the buffer everytime read is called. Now you're writing to the tdms file constantly. What I would do is wire your rate to this input of DAQmx Read. Then, it will always wait for 1 second of data to write to the file and the vi will not be constantly reading and writing to the file. You could also divide your rate in half so it would get half a second of data and write to the file twice a second. This depends on the requirements of the vi.
 
Read the help for DAQmx Read for more information on how to set it up to do what you want.

Message Edited by Marc A on 01-12-2007 04:44 PM

Message 5 of 10
(4,417 Views)
Also, I just opened the configuration for your Write to Measurement File express vi and I noticed that it's set to overwrite if the file exists. I don't use this vi to log data, but I'm pretty sure you need to set this to append to the file. Otherwise it's just going to always overwrite the first sample with a new one.
Message 6 of 10
(4,412 Views)

Marc,

 

thanks for your reply,

I will try wireing as you say to the read VI.  I took the program from the DaqMX examples, I will take another gander at the help.

Alfonso

A. Lopez
0 Kudos
Message 7 of 10
(4,408 Views)
The "Write To Measurement" Express VI is not optimized for performance, but for ease of use. The functions on the "TDM Streaming" palette are much faster than that. Feel free to have a look at .\examples\file\plat-tdms.llb\TDMS - Write data (time domain).vi for details on how to implement this.

In the Express VI configuration page, you have checked the option "one header per segment", which adds additional overhead that you don't need. I recommend using "only one header" instead.

Hope that helps.
Herbert


Message 8 of 10
(4,363 Views)

Herbert,

thanks for the header suggestion that helps.

I did try to use the individual write features, but was having the same issues as stated before. I thought using the express vi for "Write to measure" would save space and complexity, but I will go back to using individual write functions.

 

thanks

A. Lopez
0 Kudos
Message 9 of 10
(4,342 Views)
Actually, there's even better examples around than the one I pointed out earlier. They use voltage instead of strain gage inputs, but that shouldn't make too much of a difference at this point. There's one example shipping with LabVIEW that shows how to continuously acquire and save data to a TDMS file (./example/file/plat-tdms/Cont Acq&Graph Voltage - Write Data to File (TDMS).vi).

There's another example that is designed for very high data throughput. It shows how to write unscaled data, so you can reduce the size of your files by a factor of 2 (if you choose 32bit integer) or 4 (with 16 bit integers). Performance of writing to TDMS will improve by almost the same factors. This solution requires some extra work, e.g. you'll have to store the scaling factors to the file. The example demonstrates a way of doing that. The example also comes with a VI that reads these files and scales the data in the process. If your problem is really a lack of throughput, that might be a good solution for you (./example/file/plat-tdms/Cont Acq&Graph Voltage - Write Unscaled Data to File (TDMS).vi).

Hope that helps,
Herbert
Message 10 of 10
(4,332 Views)