LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timed Loop in Producer/Consumer Loop

Solved!
Go to solution

Hello!

I have a producer/consumer loop LabVIEW program setup to allow me to properly capture images that are quite large (8MP) at approximately 14 frames per second (FPS). The program works great when the consumer loop is a 'while loop' (records at 14fps no problem), but I wanted to make it into a timed loop, so that I may vary the FPS as required. An oddity arises when I do this. Anywhere below 12fps, the loop works fine and the data is recorded properly. However, when I bump it up to 13fps, the consumer calculated FPS goes haywire and starts jumping between ~9 and ~13fps (data processing gets bogged?). When I set the required FPS to 14, the loop executes at a steady 7FPS maximum. Is there something I can do to rectify this situation?

 

I have attached my .VI

 

Thanks in advance!


Capture.PNG

0 Kudos
Message 1 of 6
(4,520 Views)
Solution
Accepted by topic author palanski

Palanski,

 

Are you using LabVIEW Real-Time? Timed loops in a windows OS don't really increase determinism more than a while loop with a wait until next multiple timer. Before you changed the producer consumer loop to include a while loop was the programming running correctly? You may also want to vuse the VI analyizer to see how long things are taking to run. I would leave the producer consumer loop in the traditional set up and change the FPS by controlling the wait timer, after benchmarking your code this should be done the same way as you have it for the timed loop 🙂

Sam S
Applications Engineer
National Instruments
Message 2 of 6
(4,493 Views)

Yes, I am using it in real-time. Your 'wait until next' solution looks to have alleviated most of my symptoms, although the execution of the consumer loop is still lagging behind the producer loop by about .25FPS. I will try benchmarking to see where the bottleneck is occuring.

 

Thank you so much!

0 Kudos
Message 3 of 6
(4,488 Views)

No problem glad to help

Sam S
Applications Engineer
National Instruments
0 Kudos
Message 4 of 6
(4,479 Views)

Just realized my institution doesn't have the VI Analyzer. Is there any other way of getting information that would be helpful to me?

0 Kudos
Message 5 of 6
(4,467 Views)

Palanski,

 

It would depend on the data you are trying to collect. But for the sake of keeping our forums up to date you may want to make a new forum 🙂

If you have the Real-Time moduleyou can use the built in example under Toolkits and modules>Real-Time > Benchmarking project

 

for just LabVIEW code you can look at using a comparison of get time and date in seconds reading 🙂

Sam S
Applications Engineer
National Instruments
0 Kudos
Message 6 of 6
(4,456 Views)