LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to code a parallel 'for loop' and 'while loop' where the while loop cannot terminate until the for loop has finished?? (queues also present)

Z,
 
You are exactly right.  Your consumer loop should not have anything in it that doesn't directly handle data coming out of the queue.  Ideally your consumer loop shouldn't care if it executes 100 times a second or once an hour.  It's for this reason that often times people will create a 3rd loop that handles user iterface events.  I guess this would be an event handler/producer/consumer architecture 🙂
 
-Justin D
0 Kudos
Message 11 of 14
(680 Views)

You have many possibilities around that. LabVIEW is very flexible.

  1. Just wire a small value to the timeout terminal and place code that depends on the queue element inside a case wired to the "timed out?" terminal. The loop, and all other code in it will spin just fine.
  2. If the "other" terminals are part of the computation on the dequeued element, it would be silly to read them more often that whenever a new queue element has arrived.

Dataflow is a very powerful paradigm, but you need to rethink your programming if you have a solid background in text-based coding. 😉

0 Kudos
Message 12 of 14
(677 Views)

Can you post the VI in 7.0. I am have similar problem, well I think its similar.  Or take a look at my VI at this link.

 

http://forums.ni.com/ni/board/message?board.id=170&message.id=211400

0 Kudos
Message 13 of 14
(671 Views)
well - thank you both... i definitely have to reorient the way that I think about some of this.. I was mostly a java and matlab person until I had to start working with this... there are some aspects of it that are just fantastic, and some that are a bit frustrating.  But it is a very different way of thinking at times and so far --- i like it!


@altenbach wrote:
You have many possibilities around that. LabVIEW is very flexible.
  1. Just wire a small value to the timeout terminal and place code that depends on the queue element inside a case wired to the "timed out?" terminal. The loop, and all other code in it will spin just fine.
  2. If the "other" terminals are part of the computation on the dequeued element, it would be silly to read them more often that whenever a new queue element has arrived.
Dataflow is a very powerful paradigm, but you need to rethink your programming if you have a solid background in text-based coding. 😉

btw - i tried this just to see, and it works really well.  so thatnks for sharing the idea!  I honestly would not have thought of this on my own.  Apparently i have some more practicing to do with respect to algorithms in LV!

thanks
-z
0 Kudos
Message 14 of 14
(668 Views)