LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I cancel a sub vi stuck in an infinite loop?

Hi,

 

I am attempting an implementation of the Constrained Nonlinear Optimization sub vi.  It works perfectly 99.9% of the time but gets stuck the other .1% of the time.  It is supposed to time out when it cannot find a solution, but it is failing to do so.  Consequently my VI regularly crashes.

 

Apparently this is a known issue with this subvi.  The NI whitepaper mentions that this is caused by a subvi while loop that can get stuck in an infinite loop.  The work around is suggested to be to add a counter to the loop and exit it after a certain number of iterations.

 

I can find the infinite loop occuring in the subvi.  But the sub vi opens as a clone and will not let me edit it.  How do I work around that?

 

Failing that, is there a way from the main vi to cancel the optimization vi after a certain time so that the program can move on?

 

Suggestions would be appreciated.

 

 

0 Kudos
Message 1 of 3
(2,445 Views)

Abort the program. Press ctrl+M when you have VI opened as clone. This will open it in edit mode.

0 Kudos
Message 2 of 3
(2,441 Views)

Thanks for the suggestion.  That did the trick and saved me a lot of time not knowing what I was looking for.

0 Kudos
Message 3 of 3
(2,377 Views)