LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to start the same VI in several parallel executions?

I want to start, from my main program, the same VI in several parallel executions. I want to feed them with different input information, and then get different output results. BUT I need to run them parallel, because every test takes several weeks.

Is it possible?
0 Kudos
Message 1 of 10
(3,835 Views)
Hi EKrille,

It is possible. You need to enable the 'reentrant execution' property for the VI you want to run in parallel.

You can find the setting in 'VI Properties' in category 'executions'.

Might be worth reading up on reentrant executions aswel. Youll find stuff in the help files or manual.

Good luck

Bazza
Message 2 of 10
(3,829 Views)
Hello again.

Is it possible to get different front panels for the parallel VI:s? (for indication)
0 Kudos
Message 3 of 10
(3,818 Views)
EKrille,

You can not show front panels on reentrant VIs. Also, VIs running in this manner are notoriously difficult to debug.

There are a couple of different ways of solving your problem.

The simplest would be to have several identical VIs that you run in parallel.... you could even let the calling code make copies of the VI you wanted to run in parallel and run each of the copies independentally - remembering to delete the VIs when the code has finished. You could show each front panel as normal if you chose this way.

You could still use the reentrant approach and implement a queue system (or notifier) in the VI where it can post info (for indication) back to the calling VI (or another VI used purely for indication). See LV example files for details on how to implement the queue / notifier VIs

Bazza
Message 4 of 10
(3,811 Views)
Thank you!

I think I am going to use the first suggestion, just multiply the original file.
I am not sure how to do that, but It seems easier.
0 Kudos
Message 5 of 10
(3,807 Views)
I understand how I just copy the original file. But how can I launch a subVI and make all threads connected during the program run. Is there any special tool fore this purpose?
0 Kudos
Message 6 of 10
(3,804 Views)
Hello again,

If you are making the copies of the VIs dynamically you will be able to launch each of the VIs with a dynamic call using a VI server method.

Attached is a very simple example of how you implement a VI server. I have not included the VIs the caller will run but you should seee the general approach. One comment worth making is that the the input to invoke 'auto dispose ref' determines how the reference is handled. Setting it false means the calling VI has ultimate control over the dynamic VI being launched - all launched VIs in this way will close when the caller closes. Setting it to True passes control to the launched VI so when the caller terminates the launched VI continues.

Good practise would be to close each reference of the launched VIs when finished with.

Cheers,

Bazza
Message 7 of 10
(3,788 Views)
You can control subVIs programmaticaly using VI server methods. The VIs for it can be found in the application control palette. You can use invoke nodes or call by reference nodes in a loop to run several VIs in parallel. Search this site for "VI server" to find tutrials and examples.

___________________
Try to take over the world!
Message 8 of 10
(3,787 Views)
Thank you for your help!!

One last question!
What configuration should I use if I want to send parameters in to the Parallel VI:s??
0 Kudos
Message 9 of 10
(3,773 Views)
Using a call by reference node, you have the VI's connector pane, which you can use as if it was a regular subVI. If you want to write values while the program is running, you can use the "Set Control Value" method, which is found in the invoke node. If you use it, be sure to watch out for race conditions (You write a certain value to a control and the code within the VI write a different one or vice versa). Also, make sure you use the exact name of the control (capitalization matters).

___________________
Try to take over the world!
Message 10 of 10
(3,768 Views)