Jump to content
GrantJohnson73

"Data: Cleanup" not performed when running from .exe

Recommended Posts

Hello,

 

I have built my application on the JKI state machine and it works great out of LabVIEW (currently running 2014 but started with 2012). When I build the project and run it, by right clicking on it under Build Specifications and selecting Run, I get a different flow through the state machine.

 

I've written a little.vi to show me the current state and the future states. I hooked it into every JKI state machine case and ran the project. I then pressed the default OK button to exit the project and watched the flow through the states. Once this was working I built my project using a Build Specification right from LabVIEW and then ran it by right clicking on the .exe and selecting "Run". (I had to do the normal Build Specification stuff here like chose my Startup VI but nothing else.)

 

======================================================================================

Start the project by clicking the LabVIEW run arrow

======================================================================================

 

--------------------------------------------

Current State : Macro: Initialize

--------------------------------------------

Next State(s):

Data: Initialize

Initialize Core Data

UI: Initialize

UI: Front Panel State >> Open

--------------------------------------------

 

--------------------------------------------

Current State : Data: Initialize

--------------------------------------------

Next State(s):

Initialize Core Data

UI: Initialize

UI: Front Panel State >> Open

--------------------------------------------

 

--------------------------------------------

Current State : Initialize Core Data

--------------------------------------------

Next State(s):

UI: Initialize

UI: Front Panel State >> Open

--------------------------------------------

 

--------------------------------------------

Current State : UI: Initialize

--------------------------------------------

Next State(s):

UI: Front Panel State >> Open

--------------------------------------------

 

--------------------------------------------

Current State : UI: Front Panel State

--------------------------------------------

Next State(s):

--------------------------------------------

 

"Press OK"

 

--------------------------------------------

Current State : OK: Value Change

--------------------------------------------

Next State(s):

Macro: Exit

--------------------------------------------

 

--------------------------------------------

Current State : Macro: Exit

--------------------------------------------

Next State(s):

Data: Cleanup

Exit

--------------------------------------------

 

--------------------------------------------

Current State : Macro: Data: Cleanup

--------------------------------------------

Next State(s):

Exit

--------------------------------------------

 

--------------------------------------------

Current State : Exit

--------------------------------------------

Next State(s):

--------------------------------------------

 

Program Exits......

 

======================================================================================

 

 

======================================================================================

Run the .exe by right clicking on it under Build Specifications and selecting "Run".

======================================================================================

 

--------------------------------------------

Current State : Macro: Initialize

--------------------------------------------

Next State(s):

Data: Initialize

Initialize Core Data

UI: Initialize

UI: Front Panel State >> Open

--------------------------------------------

 

--------------------------------------------

Current State : Data: Initialize

--------------------------------------------

Next State(s):

Initialize Core Data

UI: Initialize

UI: Front Panel State >> Open

--------------------------------------------

 

--------------------------------------------

Current State : Initialize Core Data

--------------------------------------------

Next State(s):

UI: Initialize

UI: Front Panel State >> Open

--------------------------------------------

 

--------------------------------------------

Current State : UI: Initialize

--------------------------------------------

Next State(s):

UI: Front Panel State >> Open

--------------------------------------------

 

--------------------------------------------

Current State : UI: Front Panel State

--------------------------------------------

Next State(s):

--------------------------------------------

 

"Press OK"

 

--------------------------------------------

Current State : OK: Value Change

--------------------------------------------

Next State(s):

Macro: Exit

--------------------------------------------

 

--------------------------------------------

Current State : Macro: Exit

--------------------------------------------

Next State(s):

UI: Front Panel State >> Close (This is a different state)

Data: Cleanup

Exit

--------------------------------------------

 

--------------------------------------------

Current State : UI: Front Panel State

--------------------------------------------

Next State(s):

Data: Cleanup

Exit

--------------------------------------------

 

Program Exits....

======================================================================================

 

The states Data: Cleanup and Exit are never performed when running from an .exe! How can this be expected or desirable behavior? In my case all power is left on after the program exits because I shut everything down in Data: Cleanup state and it never runs.

 

Why the different flow for running from an EXE? As far as I can tell, when LabVIEW gets the close event it exits LabVIEW in a hurry.

 

I have previous builds that don't exhibit this behavior. Maybe I got a setting right in VI Properties->Window Appearance->Custom? Maybe I got a setting right in the Build Specifications for the project? All I know now is that I have projects on the production floor that work from LabVIEW but not from an .exe. Any help here would be greatly appreciated.

 

Thanks in advance,

 

Grant

Share this post


Link to post
Share on other sites

For my purposes I changed the default behavior of the "Macro: Exit" case. The default is to pre-pend the case "UI: Front Panel State >> Close" before "Data: Cleanup" and "Exit" but since this caused LabVIEW to before running "Data: Cleanup" I changed the behavior to :

 

Data: Cleanup

UI: Front Panel State >> Close

Exit

 

Event though Exit never runs I like knowing that "Data: Cleanup" did.

 

Grant

Share this post


Link to post
Share on other sites

I had a similar problem and now am confused what the Front panel: close method does. I always thought that Closing the front panel doesn't mean stopping all the codes. It is just close the "front panel" and the program still runs until Exit case. So it does make senses to have the clean Data after the front panel close.

 

However, it seems to me now when the front panel is closed, the loop is forced to stop and everything waiting in the queue after the front panel close case is destroyed. Is it true?

 

Thanks,

Joseph

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use.