LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parallel wait functions

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

0 Kudos
Message 1 of 6
(3,082 Views)

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.

0 Kudos
Message 2 of 6
(3,061 Views)

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.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 6
(3,045 Views)

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.

 

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

Ok, thanks for your usefull feedback, I was not aware of the asynchronous call function. Now i have a starting point for the development.

Message 5 of 6
(3,009 Views)

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?

0 Kudos
Message 6 of 6
(2,992 Views)