LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow sampling rate with DAQmx PCI-6601

Hi,

 

I am using a PCI 6601 DAQmx card with a SCB-68 connector block.  I am performing pulse width counting from four channels. My algoritm must calculate an (x,y) position of a robot. It uses four time measurements to do this. When all four measurements are known the (x,y) position will be calculated. After every 50 ms all four measurements are known. It seems Labview is not able to calculate the (x,y) position every 50 ms. When I track the time between each (x,y) location this is about 150 ms. How is it possible that Labview is not able to execute my VI in 50 ms? The result should be that I get more (x,y) locations within 1 s. 

 

Do I need some type of real-time package? My computer is very fast: Quad-Core (2.67 GHz with 4GB) so that is not the problem. 

 

A copy of my VI is added as an attachment. 

0 Kudos
Message 1 of 12
(3,738 Views)

Actually what you posted is not your VI.  It is just a screenshot of  your block diagram.  Having your actual VI would allow us to look into those express VI's.

 

What kind of frequencies are you expecting for your signals?  Perhaps the pulses are coming in so slow that it is taking longer than you think to acquire them.

0 Kudos
Message 2 of 12
(3,715 Views)

As Ravens Fan mentioned it is impossible to tell what the Express vis are doing from a picture.

 

Some general suggestions:

1. Do the calculations with LV primitives and functions rather than text based code.   None of the code is very complicated and it may be faster to use the LV functions.  Try it both ways to see which is faster.

2. Move the Write to File to a parallel loop.  File operations can be time consuming, especially if the OS has to reallocate file space as the file grows.

3. Put the data acquisition in a separate parallel loop from all calculations, front panel displays, and file operations.  Look at the Producer/Consumer Design Patterns.

 

Lynn 

0 Kudos
Message 3 of 12
(3,699 Views)

Hi, thanks for your help so far. This is my VI, I am sorry for the inconvenience.

Wouter

0 Kudos
Message 4 of 12
(3,690 Views)

You still haven't said what are the frequencies/expected pulse widths of your signals.

 

You may want to try placing all 4 counters in a single DAQ ExpressVI and splitting apart the outputs rather than having 4 separate DAQ assistants with a single data point each.  It may make the counting operations more efficient.  I don't know how the DAQmx drivers handle multiple counter tasks.

 

You may want to benchmark your code.  It looks like you have 5 distinct activities going on.

 

1.  Acquire pulse widths.

2.  Run a mathscript node.

3.  Run a formula node.

4.  Build an XY graph.

5.  Write to File.

 

Break everything up into some sequence frames and place millisecond timers appropriately to determine how long it takes to run each frame.  Here is an example of how to do the file writing part.

 

I would bet #4 and especially number 5 are the time consuming activities.  #4 not so much early on, but maybe later if the XY graph grows large.

 

If writing to file proves to be too slow, you will probably want to move that into its own while loop and pass data to it using the producer/consumer architecture.

 

#2 and #3 should probably be merged into a single node.  While running text based code is slower than using LabVIEW based primitives, I don't know if it would be that slow.  Using formula or mathscript nodes do add a convenience factor for doing somewhat complicated or long math instructions in a small amount of block diagram space, as long as it isn't too big a cost in CPU time.  Benchmarking would tell.

 

Message Edited by Ravens Fan on 03-20-2009 09:44 AM
Message 5 of 12
(3,685 Views)

Thank you very much, I will implement this in my VI Ravens Fan. Expected pulses from each of my four measurements are between 10-50 ms per signal. The signals always come in sequential order, so T1, T2, T3, and T4. The mathscript node and formula node are needed to compensate for a missed measurement. When the time out value of the script has been reached it will choose another case from the mathscript. The algorithm can work with one missed measurement.

 

The algorithm will start when all measurements are known so, 4*(10-50 ms)=40-200 ms

0 Kudos
Message 6 of 12
(3,678 Views)

Hi,

 

It seems that the Data AQcuisition  Express VI is the slow element. I've implemented a sequence structure with ms timers. For calculating one (x,y) location it takes the following steps:

1. DAQ Express VI takes 4 time measurements that last 80 ms in total (see Ttotal in attached screenshot). The total acquisition of this step takes 145 ms. This is the slowest component.

2. Mathscript (0 ms)

3. XY script (0 ms)

4. XY graph (0 ms)

5. Writing to measurement file (11 ms)

 

Could someone help me with speeding up the DAQ Express VI?

 

Wouter

 

Download All
0 Kudos
Message 7 of 12
(3,600 Views)
Try combining all 4 pulse width measurements into a single DAQ express VI.  Instead of 4 blue Express VI's with 1 channel each, Use 1 blue Express VI with 4 channels.  Use can use the Split Signals function under Express/Signal Manipulation palette to break the single blue dynamic data wire into 4 blue dynaminc data wires.
0 Kudos
Message 8 of 12
(3,593 Views)

Hi,

 

It seems it is not possible to use four counters in one express VI. When I use four counters I get the following error:

 

Error 200147: "There cannot be multiple counters in the same task for input operations. Use a separate task for each counter.

How can I speed up Data Acquisition?

 

Another minor problem is updating the XY graph. Now a new plot is generated after each measurement. I would like to see the previous measurements also.

 

Thanks so far,

Wouter

0 Kudos
Message 9 of 12
(3,495 Views)
How are you running this VI?  Right now it is set up to run once.  Please don't tell me your are hitting the run continuously button.  In order to properly run this, you should have a while loop around all the code with a Stop button wired to the stop terminal of the loop.
0 Kudos
Message 10 of 12
(3,481 Views)