02-25-2014 11:28 AM
Hello guys,
I'm working on a project that I have to use lots of While Loops since I have lots of parallel stuff going on. However I feel that it is a little disorganized since my program got too big and it's somewhat hard to find specific things.
Are there any main tips to organize a big program with lots of while loops? Is it bad to have many parallel loops? Is there a general way to reduce them?
Thanks. Best regards,
William Kiyoji Ariyoshi (LV8.5)
Solved! Go to Solution.
02-25-2014 11:46 AM
I would start wrapping up while loops and putting them in subVI's, that way the top level only shows a subVI, and the details of the while loop are within the subVI. Of course you will need a communication mechanism such as queues to communicate between while loops, but since you have so many parallel while loops, you probably have that in your architecture already.
02-25-2014 12:04 PM
It's not bad at all to have a large number of while loops - if all of them are really needed. LabVIEW plays very well with multiple parallel processes. I, too recommend putting your loops in subvi's and utilize the synchronization pallet to pass data around.
02-25-2014 12:41 PM
Thanks for your answers. Good to know that it isn't a problem to use many while loops.
So I will try putting the while loops in subvi's. I don't have much practice using queues, but I will manage somehow.
02-26-2014 05:20 AM
Hi,
You can also organize your loops by its functions. Using SubVIs, will help you with that. Here are some materials about Queues:
Application Design Patterns: Producer/Consumer
If you are using the same data inside 2 loops or more, you will have some problems with your queue, because, once an element was dequeued in one loop, it will not be available in the queue in another loop. You will have to enqueue this element again or use another queue.
Regards,