From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

'Application Instance Close' not triggered during PXI shutdown

I have a headless application that runs at startup on a NI PXIe-8133.  My hope was to cleanly close the application when the user restarts the PXI either through MAX or by physically powering down the PXI.  I thought the 'Application Instance Close' would be triggered in these cases, but it doesn't look like it is triggered in either case.  Is the 'Application Instance Close' meant more for closing an application through a UI?  Is what I'm trying to do possible?

0 Kudos
Message 1 of 6
(2,701 Views)

The application instance close event is triggered when your software is told to exit by the operating system. 

image.png

 Is your PXI chassis running Linux RT?  There isn't much documentation about the behavior of this in a real time operating environment so I would question if it's designed for that case.  Are you trying to make sure your software accomplishes a clean shutdown upon reboot?  That's generally what this event case is used for and it can be accomplished other ways if so.  Let me know if that is helpful.

 

Best Regards, 

 

Tim

0 Kudos
Message 2 of 6
(2,672 Views)

The PXI is running NI Real-Time Phar Lap ETS 13.1.

 

The reason I want to cleanly shutdown is that there is another application (not made by me) that is polling the state of hardware IO over DAQmx, and once they start a shutdown the DAQmx calls start throwing errors (I'm assuming when the driver is deinitialized) and causes a lot of log spam.  Would like to also capture the shutdown event and close the connections to the hardware.

 

Was hoping the Application Instance Close event would capture this, but maybe the OS doesn't stop the application before shutting down.  This seems to echo what this thread is saying.

0 Kudos
Message 3 of 6
(2,662 Views)

Could you use the DAQmx errors to execute a shutdown event?  

0 Kudos
Message 4 of 6
(2,640 Views)

Hey mbremer,

 

There is not an inherent way of programmatically shutting your system down within LabVIEW and this is done intentionally. The ability to entirely shutdown your system is controlled by a mechanical switch so that Real-Time systems that are running remotely don't remain shutdown which would require the user to have to physically travel to the system and flip a switch to turn it back on. However, there are ways to save your data and restart your system which can be found in the following KB. 

 

Reboot LabVIEW Real-Time Controller Itself Programmatically

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019L46SAE

 

Best regards,

Trent Fields

Applications Engineer

0 Kudos
Message 5 of 6
(2,623 Views)

@Tim_McClung

I could, but I don't think I can guarantee the errors will happen every time at shutdown or that they wouldn't happen during regular use.  I think we going to move away from requiring the user to restart the PXI to reset the application and build in a reset command that cleans up the IO.  We did the former to simplify the software, but it turns out it's costing our customer a lot of time (rebooting the PXI can sometimes take several minutes).

 

@A_Hint_From_Trent

I don't want to shutdown the PXI programmatically, but just want to capture when the user powers down the device (using the physical button or through MAX).  On desktop this is done through the Application Instance Close event, where there's a chance to perform some cleanup before the application is stopped.  on PXI it seems this event is not triggered in the cases I mentioned above.

 

 

0 Kudos
Message 6 of 6
(2,612 Views)