08-13-2020 08:57 AM
I have a complex VI that needs to be run multiple times to iterate a solution. Right now, I hit the "Run Continuous" button and wait until it converges to a solution. I would like to be able to turn off the Run Continuous mode once I detect convergence within the program. Is this possible? I was looking at a "This VI" ref to an invoke node, but do not see an option here.
I don't want to trigger a "Stop" as I want the program to finish it's current iteration normally.
Yes, I could make a calling program, but there are too many variables etc. that would need to be wired into the connector pane.
Thanks for any suggestions.
Solved! Go to Solution.
08-13-2020 09:21 AM
Hi,
Is there a reason to not enclose the whole vi in a while loop and use a stop button to stop the loop? The loop will finish its current iteration when the stop button is triggered.
08-13-2020 09:28 AM
@TCChun wrote:
Hi,
Is there a reason to not enclose the whole vi in a while loop and use a stop button to stop the loop? The loop will finish its current iteration when the stop button is triggered.
Well, let's put it this way:
There is every reason to stop using the "Run Continuously" button as your solution, and every reason to use a loop, instead. The "Run Continuously" button is only a debugging tool. If used on anything other than a VI with the simplest architecture, it could lead to some unexpected results.
08-13-2020 09:30 AM
Yes, that is possible with my "converged" indicator stopping the loop. I will probably do that if there is no way to just turn off the Run Continuous mode from within the program.
The reason I am not doing that is I have a mode of operation that only needs to run once, but I suppose I could just stop the while loop at 1 run in that event.
But, I have become curious now whether it is possible to do what I asked. Perhaps, I may learn something following that path...
Thanks for the suggestion.
08-13-2020 09:42 AM
If you need to run continuously until some condition is met you should use a while loop and exit on that condition. You should not be using the "Run Continuously" button.
08-13-2020 09:58 AM
Thanks for knocking that dumb idea out of my head -- that is what I needed. I have already implemented the while loop and it (of course) works fine. I am not sure why I didn't do this initially as I have done the same thing many times in the past. Sometimes your thinking can get stuck in a certain direction and it takes some prodding to reset.
Another obvious reason to make the program self-contained is if I wanted to make an executable.
12-09-2021 06:52 PM
You can turn of "Run Continuous" in VI by select file then Vi property then window appearance then select Dialog then OK.
12-09-2021 07:35 PM
@binh1959 wrote:
You can turn of "Run Continuous" in VI by select file then Vi property then window appearance then select Dialog then OK.
I think you misinterpreted the original intent of the post, which was to stop continuous running, not hide the button.
12-10-2021 07:09 AM
Yes, it can be done. But I don't recommend it.
Note: You can do crazy things with this. Like faking that a running VI is not running; then edit the running VI (usually crashes LabVIEW).