LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop a VI if it does not give a value or it exceeds a certain time

Solved!
Go to solution

Hello,

I would like to stop a running vi if a timer exceeds a certain time. I am running a calculation but sometimes it takes ages to finish so, I would like to programmaticaly stop its VI if let's say run over 1min without giving a result and stopping by itself.

I tried the elapsed time with the while loop but it is not working as I have a control&simulation loop inside the while loop and it is stucked there (slow integration) which prohibits the while loop to stop if the maximum run time is reached.

Thanks,

Zied

0 Kudos
Message 1 of 7
(3,400 Views)
Solution
Accepted by topic author ziedhosni

 

Maybe you could modify this VI to suit your needs.

 

 

 

 

========================
=== Engineer Ambiguously ===
========================
Message 2 of 7
(3,374 Views)

I have all the time a specific vi that I want to stop . I notice that the order of the VIs in memory can change and I have to select manually the right name.

So, I put as constante the VI reference. Unfortunately, I t did not stop the VI and I got error 1004.

I attached the modified VI.

0 Kudos
Message 3 of 7
(3,347 Views)

Can you try replacing the spaces in vi name with maybe "_" or some other but without spaces?

Make sure the vi is open before executing this.

Ref:http://digital.ni.com/public.nsf/allkb/96143643917AF5E6862570D90081152B?OpenDocument

Thanks
uday
0 Kudos
Message 4 of 7
(3,332 Views)

Try this:

Abort.png

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 7
(3,325 Views)

This last method worked for me but when I use the VI as a subvi I get error 1000 and the main VI gives the following error:

Error 1000 occurred at Invoke Node in formula (SubVI).vi->core algorithm v11.vi

Possible reason(s):

LabVIEW:  The VI is not in a state compatible with this operation.

Method Name: Abort VI

0 Kudos
Message 6 of 7
(3,308 Views)

Then don't make it a sub-vi.

 

I would just put something like this right on the top level VI block diagram and have it run independently of the main program.

 

abort2.png

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 7
(3,302 Views)