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 7
(155 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 7
(144 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 7
(140 Views)

Hello,
Thank you in advance for your help.
I installed Flexlogger because I have another chassis NI cDAQ-9174 and it recognises it. The interface is very simple, but I have a few configuration questions:
- The class sensor, in this case, as it is a load cell, do I put bridge right?
- In scaling, I can make the calibration line for the mv/V ratio, which is the raw value in relation to Newtons. However, I don't get the right Newtons when I add these values to the line. What am I doing wrong?

I enclose a screenshot of the channel settings.


Regards,
Inês

inescruz32_0-1733913985146.png

inescruz32_1-1733913995050.png

 

 

0 Kudos
Message 4 of 7
(66 Views)

Hi Ines,

 


@inescruz32 wrote:

- In scaling, I can make the calibration line for the mv/V ratio, which is the raw value in relation to Newtons. However, I don't get the right Newtons when I add these values to the line.


When I use a simple calculator I get the very same result (in N) when applying your slope/offset values to the Raw value shown in your image, so I guess the calculation done by FlexLogger is correctly done!

 

This gives two options: either your slope/offset values are wrong or the Raw value…

 


@inescruz32 wrote:

The class sensor, in this case, as it is a load cell, do I put bridge right?


You didn't specify the sensor type/manufacturer yet, so the answer will be: read the fine manual (or spec sheet) of your sensor!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(63 Views)

Hi GerdW,

My calibration equation is y=0.0041x-0.0264, where x represents the force in Newtons and y represents the electrical output in mV/V. If I substitute the value I'm getting as Raw Data in the software (-0.02789) into my equation, I get a value of -0.36341, which is different from the live value in the software.
I've searched for videos explaining how this part of the program works, but there are few. The ones that exist use a project I downloaded but couldn't open.

You're right about the sensor. I'm sorry. I've enclosed its datasheet. My load cell is for 50kg.

Thank you in advance for your attention and patience 🙂

Regards

Inês

0 Kudos
Message 6 of 7
(31 Views)

Hi Inês,

 


@inescruz32 wrote:

My calibration equation is y=0.0041x-0.0264, where x represents the force in Newtons and y represents the electrical output in mV/V. If I substitute the value I'm getting as Raw Data in the software (-0.02789) into my equation, I get a value of -0.36341, which is different from the live value in the software.


Typically x is the unscaled value (raw voltage!)and y is the scaled data (force in N).

 

-0.02789 mV/V * 0.0041 N/mV/V - 0.0264 N = -0.02651 N

 

All values in this equation fit perfectly to the data shown in your image!

Hey, even the units are correct in this equation…

Maybe it would help when you convert your calibration equation:

 

from
  y = a*x+b
to
  x = (y-b)/a = 1/a*y - b/a

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(18 Views)