Jump to content

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


GrantJohnson73

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

Link to comment
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

Link to comment
Share on other sites

  • 1 year later...

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

Link to comment
Share on other sites

  • 1 year later...
On 11/10/2014 at 1:29 PM, GrantJohnson73 said:

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...

 

On 11/17/2016 at 12:13 PM, yuchia said:

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

Hey Grant & Joseph,

The issue is that in a built application, if there's no Window (Front Panel) open, then Windows will force the application to stop -- it just pulls the plug on it. I guess that makes sense, since it is "Windows" after all.

For JKI State Machine's running as the Top Level UI of a built EXE, you'll want to make sure that they don't close the front panel until after all execution is complete. One way you can "close" the front panel without it being killed by Windows, is to set the FP State to "hidden".

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

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