LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I run a fast timed loop?

It appears that a timed loop cannot run faster than 100 hz. In other words, the "period" input for a timed loop cannot be less than 10. Is this true? I am using the Elapsed Time VI to measure time increments. The time increments output from this VI are at least 0.01 secs regardless of how fast I attempt to run the time loop. Perhaps the limitation lies in the Elapsed Time VI, not in the Timed Loop. Should I try a different approach to measuring the delta time between iterations of a time loop? TIA. Smiley Sad

 

-jlivermore

0 Kudos
Message 1 of 11
(3,732 Views)

Hi, jlivermore,

 

Try to measure number of increments within one second instead of measure of the time difference between iterations...

 

Andrey.

 

Message 2 of 11
(3,722 Views)
Use the tick count and a shift register. The "elapsed time" express VI carries a lot of extra baggage.
Message 3 of 11
(3,717 Views)

Here's the simple way to measure loop timing:

 

 

 

Actually, what else is running in your loop (e.g. property nodes, DAQ, etc.)? Can you show us your code? What is your LabVIEW version?

Message Edited by altenbach on 09-29-2008 11:22 AM
Message 4 of 11
(3,711 Views)

Even using "elapsed time", it can easily run at 1KHz here.

 

  • What is your OS and LabVIEW version?
  • What is your computer hardware (CPU, etc).
Message 5 of 11
(3,698 Views)
Also check if there's something else slowing down the loop. For instance, if you had a Wait function in the Timed Loop, or a DAQmx Task set to read samples at 100Hz, or anything like that. A Timed Loop can't speed up the code inside it, it just tries as hard as it can to schedule code at a certain rate and a certain priority over other code, and to report if it can't do that for any reason.
Jarrod S.
National Instruments
0 Kudos
Message 6 of 11
(3,681 Views)

Alten-

I'm running WinXP SP2 on a Dell Precision 330 running at 1.4 GHz. I'm running LabVIEW 8.2.1. My script will eventually write data to a file. I will try your suggestion of using a tic count per your reply. I can also switch to a Dell Precision T7400 with a Xeon CPU running at 3.16 Ghz. Thanks.Smiley Happy

 

-jlivermore

0 Kudos
Message 7 of 11
(3,657 Views)

jlivermore wrote:

My script will eventually write data to a file.


  • Does your loop contain a script node (Mathscript, matlab, scilab, etc)?
  • Are you trying to do the file I/O inside the loop?
Message 8 of 11
(3,651 Views)

Alten-

Here is a copy of the block diagram. The file I/O is inside the loop so that it happens at a controlled rate. I've added some extra logic to measure performance. Some of this is redundant.

-jlivemrore

 

 

0 Kudos
Message 9 of 11
(3,638 Views)

First, you don't want to open and close the file on every iteration of that loop 1000 times per second.  Move the open file before the loop and the close file after the loop.

 

Use a path constant instead of using a string constant that you are converting to a path.

 

You may want to set this up as a producer/consumer architecture and pass the data to the consumer loop as a queue.  Let the consumer loop do the writing to the file.  Let it batch multiple items together and write them in larger groups to the file at a slower rate.

Message 10 of 11
(3,614 Views)