07-14-2009 04:06 AM
Hello,
i have a lot of VIs that i use as teststep in TestStand. There i pass values to the VI.
Inside of the VI i execute VISA-write and VISA-read. I dont use VISA-open and VISA-close.
Now i found the option in Lavciew-Menu "Automatically close Visa-sessions".
My question is: Does each run of the VI in teststand open a new Visa-session?
I also pass as parameter a Visa-address like "GPIB0::4::INSTR" into the vi from Teststand.
This address then goes into the Visa-Write and then to Visa-read.
Can this be a memory-problem when the option "automatically close visa-sessions" is NOT enabled?
Thanks for all help
07-14-2009 07:49 AM - edited 07-14-2009 07:54 AM
A good practice for any software that opens a reference is to close it. That includes VISA sessions.
I always open the VISA session, configure it, the read write and do whatever it has to do and at the end I always close the Session.
Since you are calling it from TestStand, you could call a VI to open / configure the session and another one to close it. Both would be called from TestStand. Unless all your communication to the target are done within one VI and a single TestStand step, then you could open, do whatever is needed and close within the same VI. Some may argue that the latter is the better approach. You simply have toconsider the overhead of opening and closing VISA sessions multiple times.
I've never used the feature to automatically close the VISA Sessions, simply because I make sure that the code does it. Using it is probably better than not closing the VISA Sessions at all. Not closing VISA Sessions (or any reference) will result in memory leaks and if done repeatedly, can cause memory problems.
R
07-14-2009 08:09 AM - edited 07-14-2009 08:11 AM
So you mean i just create two new VIs that i intergrate in TestStand?
One at the begining (Visa-Open) and one ate the End of my testplan (Visa-close).
Does Visa-write automatically creates a new Visa-session without Visa-open?
07-14-2009 09:10 AM
A VISA Write will automatically create a VISA session if one does not exist. You will not get duplicate sessions unless you choose to do so with the VISA Open.
07-14-2009 10:21 AM
Hi Dennis,
thanks for the explanation, but why do duplicate sessions exist? What is the use of it?
Does the first Visa-Write then create a new Visa-session that stays available for the next Visa-Write in another teststep?
07-14-2009 10:34 AM
I've never used duplicate sessions so I'm not sure when and why you would want to create them.
Yes, once created, the session is available until you call the VISA Close.
07-14-2009 10:41 AM
1. Is there a way to check if a session to a given Visa-Address is alread opened?
and
2. When i set the option in Labview "Automatically close Visa-session" then each teststand-step with a visa-write would open a new session, is this correct?
07-14-2009 11:48 AM
I don't know of any way to get a list of open resources. How is this important to you?
I'm not sure about how the option works in TestStand. I would have to do some testing. It's easy enough to check. In a VI that is open, place a VISA Resource Name control. Set the option to automatically close and call a step in TestStand. Run the sequence and set a breakpoint after the step executes. Click on the arrow on the resource control. Open sessions have a little icon next to the resource name.
07-15-2009 02:46 AM
Its not important, just to know it.
The idea was to create a testplan with the steps.
1. Visa-write
2. check if session is open (result==true)
3. visa-close
4. check if session is open (result==false)
07-15-2009 09:16 AM
Hi
attached you get an example sequence with the steps visa_open, visa_write, visa_read, visa_close.
The session handle is stored in a local variable between the steps.
You can check for errors from the visa open and visa close function. If there are no errors you can assume that the session is open/closed.