I am having issues with terminating a subvi. From searching the forum, I have found that several people want a similar setup, but I was unable to find one that met my needs. I am trying to have a "main" vi that have "links" to other "vi's" so that when you click the button on the main front panel, the front panel of the subvi opens. This part I was able to accomplish fine, however, I have been having difficulty terminating and closing just the vi without causing an error across the entire setup or terminating the entire setup. The main issue in the sample code below, is that the front panel will close, but will still be running in the background, as can be seen when looking at the main vi. Any help would
be greatly appreciated. The main vi is labeled "trial.vi" and the subvi is "furnace 1."
Thank you for your time
In Furnace.vi you have two loops with event structures. That is generally not a good idea. Please read the caveats about event structures in the help. Second, both event structures have subVIs which are quite complex, containing their own event structures. Event structures should not contain any code which takes more than perhaps a few tens of milliseconds to execute. Anything longer than that should be in a parallel loop. Those loops will not respond to the stop buttons until after an event occurs.
Similarly, Trial.vi will not stop unitl the stop button is read and the event structure executes. Since the Stop button will probably be read before an event occurs, another iteration of the loop will likely occur after the stop button is pressed, meaing that it will wait for another event to occur and complete before stopping.
I would be amazed if you could actually get this thing to stop!
Look at Producer/Consumer (Events) Design Pattern. I suspect that you can do everything you need to do with two loops and one event structure.
I think that I tried something similar to that solution. It is not in the sample one that I posted, but basically what I tried was using a local variable connected to a stop and then the rest of the stops for the loops referenced the value written by that local variable, which I think is kind of how that example you show is set up, with the exception that you have global variables.