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: 

Torque measurement: can't find the problem

Hi all,

 

I'm trying to write a VI (attached: "DAQ_LG") based on another one that runs without a problem (attached: "ORIGINAL") for a very similar application.

 

The problem occurs when I add the first frame of the Flat Sequence to acquire data at 20 Hz to my VI DAQ_LG, more precisely, I get the Error 200279 "Attempted to read samples that are no longer available.".

 

I can't understand why in the ORIGINAL everything runs without a problem.

 

I kindly ask for someone to help me. 

 

Thanks a lot.

 

 

 

Download All
0 Kudos
Message 1 of 4
(2,466 Views)

What is different between the two VI's?

 

Something must be taking longer in the second VI than the first.

 

You are using Continuous Samples at a 1000 Hz rate, but you are only reading 1 sample at a time.  That means your loop has to execute at least 1000 times persecond in order to keep up.  With all the file operations in there, they are very likely to slow down your loop rate.  Maybe an odd combination of circumstances allows one to run fast enough to keep up, and the other one to run too slow to keep up.

 

You should really use the hardware timing and read multiple samples per iteration (even -1 to read all available).  Right now you are doing somewhat of a software timed acquisition.  The "metronome" function, wait until next (msec),  really isn't helping you at all and may actually be hindering you.

Message 2 of 4
(2,461 Views)

First of all, thanks a lot for your help RavensFan, I really appreciate it.

 

Your First Question: That's exactly the problem. I can't find the thing that is taking longer. Basically, all file operations will allow me to run the software continuously, and then, everytime needed, I will record several tests to different files.

 

The "ORIGINAL" was developed by a very experienced labview engineer that doesn't work any more at the company, and now I'm trying to adapt the software to do very similar things. 

 

The reason to be acquiring at 20 Hz this way is because I remember that he said "I use to set the modules at high frequency (constant) and then, depending of the situation, I do sub sampling."

 

I don't know why. Do you see advantages? Or should I define 20 Hz instead of 1000 Hz ?

 

Once again, thanks for your help.

 

 

 

 

 

 

 

0 Kudos
Message 3 of 4
(2,435 Views)

In first place, even "ORIGINAL" vi may not execute continuously at all due to the fact that it will through the “buffer over flow error”. "ORIGINAL" vi was designed to run at every 50ms or integer multiple of 50ms. It means "ORIGINAL" vi reads the one sample from all the channels at best 20 times in a second, assuming all the other operations completes in 50ms. In that case with the sampling rate 1000sample/sec, buffer will fill up at the rate of 980 samples/sec.

 

I suspect, this may not be the final one working in the system. Ensure this once again. I even don’t see any other hardware trigger is involved based on the DAQmx API's used in the VI

 

Second to your problem, at 20Hz loop rate read number of samples per channel as sampling rate/20Hz and average the data in every iteration or change the sampling rate to 20Hz.

 

Hope this helps.

0 Kudos
Message 4 of 4
(2,416 Views)