LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with buffer size (error -200279)

Solved!
Go to solution

Hello,

I am using an USB-6002 and an Encoder to get angular velocity measurements in actual time. The encoder can reach 5000RPM, doing some basic math it can reach for aproximately 17000 pulses/second so I have my rate acquisition set to 50kHz (which is the top of my DAQ). The problem is: when I set my buffer size to some value higher than "100" I lose data depending on the speed I am rotating the encoder (the angular position showed doesn't equal the real angular position of the encoder) and when I set the buffer size to some value lower than 30 for example, I get a smooth an apparentely correct read but it doesn't take too long to receive the "-200279" error saying that I have to increase my buffer size.

 

Can someone enlight me with what my problem is?

Thanks.

 

0 Kudos
Message 1 of 4
(3,448 Views)

I don't see where you do anything with your acquired data, other than check to see if it is greater than 1. If it is greater than one, you output a 5.  If less than 1, you output 0.  HUH?  I would think you need to do some signal processing on your data and get a frequency value so you can count the number of pulses and convert it to a velocity.

 

Regarding the buffer size, if your rate is set at 50k samples/sec, why would you only want to buffer 30-100 samples.  According to the help file, it should be around 100kS buffer size.Capture.PNG

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 4
(3,427 Views)
Solution
Accepted by topic author jonasmedeiros

Hi jonas,

 

Can someone enlight me with what my problem is?

The "buffer size error" is seldomly really related to buffer size, but most often to speed of data reading… 🙂

You simply need to read your data either "more often"/"faster" or "in bigger chunks"!

 

when I set my buffer size to some value higher than "100" I lose data depending on the speed I am rotating the encoder

Wrong!

You "lose" data because you are using an ExpressVI and work with DDT wires!

Example: in your VI you set the DAQAssistent to read 20 samples, then you compare the samples with "1" and wire the resulting DDT wire to the selector of a case structure: here you get a coercion dot and here you actually lose 19 from your 20 samples! (And of course in the case structure as you output just 0 or 5 as a scalar value, independent from number of samples read…)

 

Search for "daqmx 10 functions" to get an appnote on how to use the 10 most important DAQmx functions (and to get rid of ExpressVIs like DAQAssistent)!

Also think about your algorithm: with a sample rate or 50kS/s you should read data in chunks of 5000 samples (1/10 of samplerate) and you should analyze ALL the samples, not just one!

Why do you read an analog input? Why not use the PFI0 counter of your USB6002??? This will work with up to 10MHz and you will not lose any counts…

Best regards,
GerdW


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

Will try that. Thanks for your response!

0 Kudos
Message 4 of 4
(3,400 Views)