How to close SMU sessions handle that are no longer valid/in use

Updated Nov 12, 2020



  • LabVIEW

I've found that when initializing a SMU session by using niDCPower with a device alias that is already opened due to an abort or other programming error. The device reference has an integer increment with each initialize call. In my clean up, I would like to close all open sessions. 

How to check and close all open sessions?

When Initializing a session to a device that already has a session open, NI-DCPower closes the previous session and returns a new one. Since the Close VI was not called, the previous session remains registered in LabVIEW.

Below shows a way to get all the initialized session and close them to prevent multiple session remain unregistered. Please refer to attached VI for further reference. The code should be placed before the Initialization to make sure all the sessions are closed before a new initialization is called.