LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does my VI take so long to stop executing?

HI,

I am currently developing a GUI with 5 different control drives. The main body of the application is in a while loop which terminates on an EXIT button. Inside the loop is an event structure which has a 'Value Changed' event for each of the 5 controls. There is no code after exiting the while loop.

When I exit this VI by pressing the EXIT button, the VI continues to execute for a random time (between 5 and 50 seconds) where nothing is happening. Is there some garbage collection going on behind the scenes? Is there any way in which I can reduce the length of time this takes? What is it doing during this time?
0 Kudos
Message 1 of 6
(3,258 Views)
You're saying "the main body". Is there more? If you have another loop with a long wait time in it, you'll have to wait until it completes the current iteration and the next one before it stops. There shouldn't be any cleanup or grabage collection holding you.
To watch the execution, you can turn on Highlight execution (the light bulb button) and see exactly which code is running. If this doesn't help, I suggest you post your code.

___________________
Try to take over the world!
0 Kudos
Message 2 of 6
(3,251 Views)
It would really help to at least post a picture of your diagram, for example I don't even know what a "control drive" is! 😉 So far we can only make wild guesses:

How long do the other events take to execute? For example, if one of the events would contain a lengthy computation, the next event (including pressing of the EXIT button!) would have to wait until it completes.

I assume that you also have an event for the EXIT button. Do you?
0 Kudos
Message 3 of 6
(3,247 Views)
More info:
I have added a timer vi which returns the current time.
The whole VI is nested in a case statment to catch for errors coming in.

I currently get the time on the following events:

When EXIT is requested
When the while loop is closed
When the case statment exits

The time between the first two timers is consistently 100 ms but the time between the second two timers fluctuates between 5 and 50 seconds. I have looked at the execution with the lightbulb on, all the wires go to the case statment then sit idle for 5-50 seconds before going to the output terminals.

Interestingly enough, if I remove the case statment then the time delay now appears between the first two times. Is there some sort of optimisation going on?

I havent added the EXIT to the event structure because I read in the help that its not a good idea for a latching boolean to be used in this way.
0 Kudos
Message 4 of 6
(3,225 Views)
Hi Bry,


What's happening in the case statement? A picture or attachment of your VI's would really help everyone.

Maybe you have something hidden by the case statement.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 5 of 6
(3,218 Views)
Doh!

A colleague of mine has just helped me solve it. I had accidentaly left a vi unwired in the initialisation part before the while loop but the wire looked like it was going through it. Beacuse it wasnt sequenced, it was getting executed after the while loop completed.

Thanks for looking guys!
(Boy do I feel sheepish) 😉
0 Kudos
Message 6 of 6
(3,214 Views)