LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sub VI simultaneous execution

Hi

I know that it is possible to execute sub VIs simultaneously (Sub VIs
carried out parallel). I have read previous posts, but have not fully
understood the way to do it.

I have tried changing: VI Properties -> Execution -> "Normal
Priority" to Reentrant. This however seem not to help.

In my Main.VI, I call a Sub1.VI which does nothing more than just show
values in a Table. ( While loop which ends with STOP button).

Is it possible that even though I dont close Sub1.VI, I can execute
Sub2.VI in the Main.VI??


Thank you in advance.
0 Kudos
Message 1 of 8
(4,291 Views)
Yes.

But to give you a good answer I would need to look at your current implementation.
Could you post the main VI or a screenshot thereof?
Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 8
(4,288 Views)

Set "Reentrant" a vi, you want to execute, multiple copies of it, at the same time.

To execute two vis in parallel simple wire them in parallell. Labview will do the rest !

Be more specisic, if you want more info

0 Kudos
Message 3 of 8
(4,283 Views)
I have posted a screenshot of my the Main.VI
 
As explained, I would like Sub2.VI to run eventhough Sub1.VI is not closed.
 
 
Thanks.
 
Regards
 
Azfar
0 Kudos
Message 4 of 8
(4,278 Views)
With this architecture a solution is to create a second while loop outside the main loop and use a local to stop it and a local to check the start condition.
Regards,
André (CLA, CLED)
Message 5 of 8
(4,257 Views)

Correct me if i am wrong but i think they are in parallel.

Sub2 should run, even if Sub1 is not finished.

0 Kudos
Message 6 of 8
(4,226 Views)


@Pnt wrote:

Correct me if i am wrong but i think they are in parallel.

Sub2 should run, even if Sub1 is not finished.



They are in parallel.  The issue is that if one of the two subVIs takes longer to execute, the other subVI cannot run again until the first finishes.  Also, the subVI in the case statement will not repsond to the change in the boolean until the other VI has run and the loop iterates again.

If these VI's ran quickly, the user probably wouldn't notice, ad the way the program is written, everything would work fine.  But if the VI in the case statement takes 100ms to run and the other VI takes 30s to run, the user will notice that the click on the Boolean and nothing appears to happen.  By moving them to two seperate while loops, then they can run at different periods and the user can run either VI whenever they choose.

Since his sub2 doesn't close for a while, subvi runs once if the boolean happens to be in the right state, then won't run again until sub2 finishes.


Message Edited by Matthew Kelton on 12-21-2007 01:35 AM
0 Kudos
Message 7 of 8
(4,215 Views)
you can always have multiple VIs, or loops running in parallel (provided they are independent and are not exchanging any values trough wires ), but remember one thing, as labview runs on dataflow technique, any sub VI or function will not execute unless and until it do not get all the input values wired to it.
 
And if, say one input of subvi2 is wired to an output of subVI1, then you cant run these two VIs independently. If no wires connected between 2 then its always possible to run them independly.
0 Kudos
Message 8 of 8
(4,202 Views)