LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Troubleshooting Data Acquisition Issues in LabVIEW 2015

Good afternoon,

I have a Labview program to which a load cell is connected. I'm using a Hi-Speed USB Carrier chassis (NI USB-9162) and a NI 9219 board. The aim is to collect force for a few seconds for different swimming styles, and we want to achieve an acquisition rate of 100 Hz. The force data obtained is stored in an LVM file. However, we are facing some problems, such as:
1. The acquisition rate is not constant; sometimes I get 100Hz and sometimes I only get 70/80 Hz;
2. There is a very long delay between acquiring and displaying the data on the front panel;
3. There is also a very long delay when saving data
4. Labview stops after approximately 3450 samples and gives an error -200279.

 

I can't understand what the problem is. I've attached the program, the DAQ settings, and the error it gives us.

I hope you can help me 🙂

Regards

 

0 Kudos
Message 1 of 3
(72 Views)

Hi Ines,

 


@inescruz32 wrote:

1. The acquisition rate is not constant; sometimes I get 100Hz and sometimes I only get 70/80 Hz;
2. There is a very long delay between acquiring and displaying the data on the front panel;
3. There is also a very long delay when saving data
4. Labview stops after approximately 3450 samples and gives an error -200279.


Simple answers:

  1. Don't read just 1 sample per iteration. Read atleast 10 samples (= 1/10 of sample rate) per iteration!
  2. Don't use the DAQAssistent, but use plain DAQmx functions instead. They are explained in all those example VIs found in the example finder and in this wonderful article!
  3. Don't save each iteration, collect a decent amount of samples and save larger blocks at once: MUCH less overhead!
  4. Use the logging feature of DAQmx (see item 2) to save the data immediatly into a TDMS file. No overhead at all!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 3
(61 Views)

Hi Insecruz32,

 

running a loop at 100Hz on Windows is possible, but there is always a chance for jitter that exceeds that timing and cause slower update rates. Also the Express VIs for acquisition and writing to file are not optimized for that fast executions and will for sure cause jitter and delays. Usually with such applications you would run the loop for every N samples of the acquisition. So e.g. 100Hz Sample rate and read 10 Samples/Iteration of the loop. That way your loop will run with 10Hz and always display and log 10 samples. That should run fine on a normal Windows system.

Also you should use the low-level VIs for DAQmx and the FileIO. Initialize your File and Hardware left of the loop, then do the operations (DAQmx Read and Write to File) inside the loop, then close them right of the loop.
https://control.com/technical-articles/simple-file-output-in-labview/

 

But I highly recommend using the built-in logging feature of DAQmx. There you only need DAQmx code, and the driver will log the data to a tdms file automatically. For the display you can still use the data you read.


There is an example doing everthing you need, go to Help->Find Examples -> Hardware Input and Output -> DAQmx -> Analog Input -> Strain - Continuous Input.vi

JGoebel_0-1733164829662.png

It already contains logging to tdms file. tdms files can be opened in Excel:
https://www.ni.com/en/support/downloads/tools-network/download.tdm-excel-add-in-for-microsoft-excel....

Then you can save it to another format if necessary. This would be the easiest way to go without writing any code.

Also you may want to look at NI FlexLogger, it's a configurable Datalogging Application that is very intuitive to use. You can configure all kinds of Data Acquisition Applications with a few clicks and no code. Here is an introduction:
https://www.youtube.com/watch?v=6PMq151-wDw&list=PLlys7J2EbeEkXwN7B2B4V5J5qOKbGa3mM

But I'm afraid you're USB-9162 is not supported in Flexlogger anymore, the NI-9219 still is. But if you have a different cDAQ-Chassis (e.g. cDAQ-9185/cDAQ-9189), that would be a very convenient solution.
You can download a trial here:
https://www.ni.com/en/support/downloads/software-products/download.flexlogger.html

 

Hope this helps 🙂

0 Kudos
Message 3 of 3
(57 Views)