Jump to content


Photo

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


  • Please log in to reply
3 replies to this topic

#1 GrantJohnson73

GrantJohnson73
  • Members
  • 2 posts

Posted 06 November 2014 - 09:49 PM

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
  • 0

#2 GrantJohnson73

GrantJohnson73
  • Members
  • 2 posts

Posted 10 November 2014 - 09:29 PM

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
  • 0

#3 Ashish

Ashish
  • JKI Team
  • 252 posts
  • Gender:Male

Posted 18 November 2014 - 09:19 AM

Grant,

Thanks for the updates.
  • 0
Ashish Uttarwar
Product Support Engineer and Certified LabVIEW Developer, JKI

#4 yuchia

yuchia
  • Members
  • 4 posts

Posted 17 November 2016 - 08:13 PM

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


  • 0