02-07-2013 12:19 PM
Hi,
I’m struggeling with following: I have 8 equal devices, each performing an independent routine, so they will run asynchronous from each other, in parallel. As all devices perform the same task, I created a re-entrant vi. The time each device can spend on their routine depends on what the user has defined per device. The start of the routine is triggered by a user input. I thought to use a state machine to analyze the users input, followed by the corresponding device triggering. I would store the corresponding trigger in a variable . This variable will trigger the re-entrant vi outside the state machine (because I don’t want to block any further user input due to the wait-times in the routine). The question I have is, do I need to copy this for each of the 8 devices since all have wait steps inside? Or is there an elegant way, like a kind of case structure, but running several cases at the same time?
Hope I described the problem clear enough. Please don't shoot at me, since i just recently started with labiew.
Looking forward,
Pieter
02-07-2013 01:09 PM
It probably would be significantly clearer if you could attach your code. What is a variable?
Easiest would be to have each instance in its own while loop.
02-07-2013 02:01 PM
I would recommend that you start your VIs dynamically. This will allow you to change the number of devices without requiring a code change. You can use the Start Asynchronous Call. I would also use queues or notifiers to communicate with your parallel tasks. You should probably look at the examples of the producer/consumer architecture.
02-07-2013 02:12 PM
Why do not you include the time consuming routine with execution time specific for each device into the reentrant subVI? It gets user parameters, prepares, starts the device, waits till it finishes. Then reports to the main VI (user event, queue, etc) that the device number N has finished.
02-08-2013 02:57 AM
Ok, thanks for your usefull feedback, I was not aware of the asynchronous call function. Now i have a starting point for the development.
02-08-2013 11:01 AM
Do each of the subVIs run only once, or should the faster ones be able to called again while the slower ones are still processing their first call?