LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call by reference into a subpanel won't execute called VIT with a loop

LabVIEW experts check this out....

 

I've attached a sample program (Main VI.vi) that simply calls a VIT by reference (Subpanel3 VI.vit).  The template simply adds two numbers, but the front panel does NOT show up if there is a loop in the template.  If the loop is removed, everything works fine and of course the template runs fine standalone.  You can verify this by removing the loop, then resaving the template that is called.

 

Is this a bug or am I missing something?

 

TR

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 1 of 4
(4,403 Views)

From the help for Call by reference node:

 

"If you use the Call By Reference Node to load a VI into memory and display the front panel, the rest of the block diagram does not execute until the target VI finishes executing. If you want to open only the front panel of the VI, use the Front Panel:Open method. You also can use the VI Call Configuration dialog box to configure when to load the target VI."

 

Wait until done:T on the Run VI method does the same thing.

 

 

here's more like what you want:  Edit the subpanel VI to be a reentrant vi (not a template). Take its path and get a reference to a reentrant clone. Then use the Set Control Value method to set a panel value on the (not yet running) subVI.  Run the VI as "don't wait", then load it in the subpanel.  Keep control of the reference in order to close it later, which will stop the subVI in case the outer STOP is pressed without stopping the subpanel. 

 

For that last bit, it's better to set up some message-passing structure so that you can tell the subvi to shut itself down cleanly.

 

24508iF182D04DBD61D350

-Barrett
CLD
Message 2 of 4
(4,393 Views)

This doesn't  sound like a safe workaround, you really have no control or knowledge of the state in which the subVI is left when the reference is closed.

 

Anyone from NI can tell us why is it not possible to interact with the VI in the subPanel when the WaitUntilDone flag is set?

I also tried running a VI called by reference running both synchronously and asynchroously with the same result.

 

Is this the expected behavior or a bug?

 

Is there another way to run the sub VI in a subpanel and wait until is done while being able to interact with its Front Panel?

 

Thanks!

 

<<-N->>

0 Kudos
Message 3 of 4
(4,194 Views)

Hello <<-N->>

 

In the above example, it is not possible to interact with the subpanel when the 'Wait Until Done' flag is set to TRUE because of how the run VI invoke node is wired to the subpanel invoke node. In this setup, the subpanel invoke node cannot run until the run VI node has finished due to the error wire and VI reference wire that come from the output of the run VI invoke node. Basically the subpanel is waiting on that data before it can run, and if you select the 'Wait Until Done' to be true, then the VI wont continue executing until the VI that was called is finished running. You can refer to this page for help better understanding program dataflow: http://www.ni.com/gettingstarted/labviewbasics/dataflow.htm#Wires

 

I've attached a picture of how you would construct the VI to be able to interact with the subpanel, while still setting the wait until done flag to TRUE. Note that the subpanel invoke node does not have to wait on the Run VI invoke node before it can run. (This is modified from the Simple Subpanel.VI in the example finder).

 

I hope this helps!

 

-Nathan H

Software Developer
National Instruments
0 Kudos
Message 4 of 4
(4,186 Views)