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: 

Session Manager, Logical Names and VISA Resources

Hi

 

As suggested in TestStand Best Practices I am using the "Session Manager" to manage hardware references.

This currently works fine if I supply the "VISA Resource Name" (e.g. TCPIP0::192.168.0.11::5025::SOCKET) of the relevant instruments to the "Session Manager - Get Instrument Session"-VI.

 

I would though really like to use more logical and simple instrument names/references. Reading the various documentation this indeed seems possible - but i haven't been able to make it work.

 

Below is depicted how I assign a descriptive and simple name to a VISA instrument. That is "HMP4040".

ni_max.png

 

When I need to configure the "Class Type" in the "Session to Refnum" I can indeed use "HMP4040".

class_type.PNG

When the "Session Name" is the "VISA Resource Name" everything works fine.

ok_session_name.PNG

 

But the driver session name is not recognized when the "Session Name" is the logical name.

bad_session_name.PNG

 

Can anybody help me figure out how to use logical names when working with VISA resources and session manager.

 

Best regards

Jesper

0 Kudos
Message 1 of 5
(1,704 Views)

Why don't you simply use VISA Open with your logical instrument name? VISA Open under the hood will acquire a VISA Session Manager resource if needed.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 5
(1,651 Views)

Hi Rolf

 

If I am using VISA open that would either mean that

  • I would need to use VISA open in each VI that operates on the instruments.

or

  • I would need to pass on the handle from the init/VISA open VI, to every VI that subsequently operates on the instrument.

Is that correct?

 

In the TestStand Best Practices article explicit usage of the session manager is encouraged, among other things because; "Modules and sequences pass a logical name, such as “DMM1”, to obtain a session object from the Session Manager, which contains the corresponding instrument handle".
That's why I am trying to rely on the session manager.

 

Best regards Jesper

0 Kudos
Message 3 of 5
(1,625 Views)

That is only true for the C VISA API. LabVIEW has that inherently build in. Try to wire a string with the VISA Alias to any VISA function and it will magically work. That is because the VISA Refnum in LabVIEW does the session management internally.

It does require to have a VISA alias in NI-Max if you do not want to use the VISA session name. So if you rely on DMM1 instead of ASRL3[::INSTR] that DMM1 alias must have been created in NI-Max (more specifically in the VISA config file).

 

In your first post you show that you have already created that alias (instrument name). Wiring HMP4040 (as string or VISA refnum control) to any VISA function will connect to the instrument if not already connected and then communicate with it. LabVIEW does an automatic string to VISA refnum coercion. It's still a good idea to have at some point an Initialize vi that you call as first function, which calls an explicit VISA Open and does other things like checking that you talk to the right device (compare device ID or something) and default configuration stuff.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 5
(1,584 Views)

Thank you for helping Rolf!

 

I don't feel that I got a hold on my original agenda; the Session Manger, Logical Named and VISA Resources.

- but I don't mind, because I now feel comfortable with regards to just supplying the VISA alias to any VISA function without passing back the VISA handle to TestStand.

 

I desperately tried to find documentation for this approach but it was not a huge success.

I found these (old) topics that touches the subject:

https://forums.ni.com/t5/NI-TestStand/labview-instrument-handle-data-type-in-teststand/td-p/1250794?...

https://forums.ni.com/t5/LabVIEW/When-do-i-need-quot-Automatically-close-Visa-sessions-quot/td-p/944...

 

The Help related to "VISA Resource Name Control" also, I believe, explains the purpose of the "VISA resource name out" as incitement for dataflow programming. So passing on the VISA resource name is strictly speaking not necessary (which is useful especially in TestStand).

JesperSJustesen_0-1606917458699.png

 

 

0 Kudos
Message 5 of 5
(1,569 Views)