LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Release free running subvi from grip of main vi so that both of them can be used simultaneously

Hi Labview Developers.
I have a question:
Once I opened and ran subvi from the main vi by means of menu bar. I would like to release the grip of the main vi from subvi so that both of them can be used during free running. How do I do that?
 
Normally I would use while loop, event structure, runtime menu and while loop to open subvi. However as long as the subvi is still running inside one of the case in the evnt structure.
 
How can I release it, not close or abort so that I can use both of them at the same time.
 
Please advise
Clement
0 Kudos
Message 1 of 8
(3,312 Views)

Hi Clement,

you can load your subvi dynamically, use the "Open VI Reference" function for it.

Mike

0 Kudos
Message 2 of 8
(3,310 Views)
Hi,

As Mike said, you can load and call VI dynamically.

See document here :
http://zone.ni.com/reference/en-XX/help/371361D-01/lvconcepts/dynamic_loadcall_vis/

Regards,
Chris
0 Kudos
Message 3 of 8
(3,290 Views)
In the old days Lv6.1 or was it 5.1 there was an additional point to look at:
To run a former sub vi (rocket)  indepentend from the main vi (launcher) , the rocket should open a reference to itself.
Otherwise the rocket will be stopped by if the launcher does.

But maybe that has changed in the vi-server engine..

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 8
(3,279 Views)

Hi Henrik,

afaik, it´s in LV7.1 the same.

Mike

0 Kudos
Message 5 of 8
(3,275 Views)
Hi Mike,
 
After indigesting through methods and properties for hours, I found a way to make it work but do you think this is the correct way although the note on reentrant execution did not say much about it.
 
Here's the pic of the block diagram
 
 
Here how it works like this:-
When the host (main vi) runs for the first time, interactivity on the control is still possible until I click on the menu to open the subvi
In this case, the host opens it, feeds the value and run it. Note that the subvi is free from the host after it is opened and  they do not depend on each other, unlike run or execution methods or properties or call by reference node (ie; the host  cannot do anything till intended sub vi is closed.) However, one thing to note is that it is possible only if the intended subvi is set to reentant execution!!. Note that the host's controls still can be interacted even though the intended subvi either is still running or closed.
 
Cheers.
Clement 
0 Kudos
Message 6 of 8
(3,274 Views)

Hi Clement,

why is this only possible it the sub vi is reentrant? If it is not reentrant, then you can load it only ones. If you need it more than ones, change your sub vi to a vi template.

Mike

0 Kudos
Message 7 of 8
(3,270 Views)

Your screenshot is right in the neighborhood of what I'd suggest.  A couple comments:

1.  The notion of re-entrancy ought to match.  If re-entrancy is desired, both the subvi's "VI Properties" should include it *and* the call to Open the vi reference should also use the correct mode designation in one of the inputs.  I *think* the magic number for dynamic re-entrant open is 8.   If re-entrancy isn't desired, then I'm puzzled about the need to have the re-entrant execution property set in the subvi.  I'm also a little surprised that attempting a non-reentrant Open on a reentrant subvi didn't generate an error.

2. Dunno if it's *wrong*, but I never have wired in a type descriptor when opening a reference to a vi that I intend to run using the "Run VI" method.  I've only done such wiring when using an invoke node.  For what you are wanting to do, the "Run VI" method is the right way to go.  I'm left wondering if perhaps somehow the wired type descriptor is at fault for requiring that the subvi be set up as reentrant.

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 8 of 8
(3,248 Views)