LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Start/end a sub-vi with vi-reference in a Build (*.exe)

Hello Bob,

 

I tested the application node method, and this is exactly what I need to distinguish between the development and runtime environment. Thanks for you very comprehensive reply and explanations. Very simple.

Now my NI-Server approach to start AND end a sub-vi from the main-vi becomes more promising than the notifier/queue method I am trying to get on with (with little progress).

 

Thanks, and have a great weekend!

 

Ralf

0 Kudos
Message 21 of 26
(683 Views)

Hi Gerd,

 

looking into queues and/or notifiers there seems to be only one possibility - as you said - starting the sub-vi with the main-vi and calling the FP and other things from the sub vi using notifiers. Not really what I was looking for, but with the loop issue this seems to be necessary. Strangely, my NI-Server approach with just closing the sub vi works well. But I agree, this is far away from how it's supposed to be from a programming point of view.

 

I have modified the Main/sub VIs, and it works apart from one thing.

Eisbein_0-1629633202297.png

 

When stopping the main loop (Stop button) closing the vi takes forever. It seems that, although I can't see any reason, the lower loop runs into a timeout or anything else.

I have attached the files. Maybe anybody has an idea why.

 

Best Regards

 

Ralf

 

Download All
0 Kudos
Message 22 of 26
(679 Views)

Hi Ralf,

 


@Eisbein wrote:

When stopping the main loop (Stop button) closing the vi takes forever. It seems that, although I can't see any reason, the lower loop runs into a timeout or anything else.


Because you are doing all this much too complicated!

And you don't stop the subVI when you press the stopp button in your mainVI! You just close the frontpanel, which will not stop execution of the subVI…

 

Just cleaning up your VIs:

Notice the subtle changes I made! (No shift registers in the subVI, feedback nodes in the mainVI, small wait in the lower loop,…)

 

I recommend to use just one (1) queue to send commands from main to subVI: why do you need 3 boolean notifiers when you can do all this using just one queue sending a typedefined enum command?

 

Btw.

  • using buttons with mechanical switching behaviour is rather uncommon for UI, especially on stopp buttons. You really should use latching buttons and an event structure to determine user actions. No need for those feedback nodes…
  • You forgot to cleanup all those references in your VI. Where do you place the ReleaseNotifier functions?
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 23 of 26
(675 Views)

Hello Ralf,

 

did you have a look at the examples I gave you the link to?

Based on that (Splash Window) example I adapted the VIs. Now they show you an example how to solve your problem with a QMH (using events), passing data from the main-VI to the sub-VI and controlling the behaviour of the sub-VI exclusively from the main-VI.

 

Main- VIMain- VI

 

P.S. Another hint: use the "Highlight Execution"- button from the toolbar of your VIs block diagam. You can open both BDs (of main- & sub-VI), click on the bulb and start the main-VI. This (and some patience) will give you an impression, how this works.

Greets, Dave
0 Kudos
Message 24 of 26
(653 Views)

Hello Gerd,

as suggested I have reduced the notifiers to just one - openFP+activate and closeFP. Whenever the FP of the sub-vi closes the motorcontrol goes offline before. This works.

 

Howver, now I have ran into another issue.

The sub-vi is basically also a sub-sub-vi and is used in the main-vi and several sub-vi. Let's call it contro-vi.

I can use the control-vi in a sub-vi of the main-vi as intended. However, whenever I try to end the sub-vi to go back to the main-vi it keeps running and is waiting for the control-vi to finish/end.

Eisbein_2-1629720343600.png

 

I can't end the control-vi because I couldn't use it anymore, and closing the FP of the sub-vi doesn't seem to be enough. Just closing the FP of the sub-vi doesn't work, too...because everything is waiting for the control-vi to finish/close.

At the moment I don't see any other way than going back to the ServerVI method and open/close the control-vi whenever it's required.

 

Any idea/hint how to close the sub-vi and getting back to the main-vi would be really, really appreciated.

 

Grrrrrrr, this is driving me crazy.

 

Best Regards


Ralf

0 Kudos
Message 25 of 26
(645 Views)

Okay, it is/was quite obvious with the sub-vi in a sub-vi.

I must not open the control-vi again, but dragging the notifier all along to each sub-vi.

My head is spinning.

Ralf

0 Kudos
Message 26 of 26
(635 Views)