NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Change TS Labview Server from Labview OI?

I have tried the NI recommended way to select the LabView server programatically from TestStand which works fine e.g.

 

 RunState.Engine.GetAdapterByKeyName("G Flexible VI Adapter").AsLabVIEWAdapter.SetServerInfo(LabVIEWServer_RTEServer, "C:\\Program Files\\National Instruments\\Shared\\LabVIEW Run-Time\\8.6\\lvrt.dll")

But I would like to call the same functionality from a LabView Operator Interface...

 

After I get the engine reference I can use an Invoke node for GetAdapterByKeyname but I am struggling with the next AsLabVIEWAdapter.SetServerInfo part - I can't see these methods. Any tips/examples how to do this?

 

Thanks.

0 Kudos
Message 1 of 9
(4,619 Views)

On a similar subject - if this statement:

 

RunState.Engine.GetAdapterByKeyName("G Flexible VI Adapter").AsLabVIEWAdapter.SetServerInfo(LabVIEWServer_RTEServer, "C:\\Program Files\\National Instruments\\Shared\\LabVIEW Run-Time\\8.6\\lvrt.dll")

 

switches the runtime adapter to the labView Runtime engine, what similar statement will switch to the development environment?

 

 (Using TS 4.1.1, LV 8.6.1)

 

Thanks

0 Kudos
Message 2 of 9
(4,612 Views)

Hi,

 

I've just been working through this same problem today.

The trick is you need to use the "Adapter.AsPropertyObject" method, then you can convert this reference to a LabVIEWAdapter reference using the ActiveX Variant to Data VI.

 

I've attached an example.

 

 

If you are using this in a User Interface make sure you call this after you have called the Application Manager "Start" method and you are logged in with previlges to "Configure Adapter"

 

I found that if you use it before these conditions, it will still work, but cause LabVIEW to lockup on exit, and generate some Debug Warning Message from the TestStand Engine.

 

PS: You will need to change the Path, I'm currently on a German Version of Windows which uses "C:\Programe\National Instuments...\

Simon Holman
Software Engineer
Certified LabVIEW Developer
Certified TestStand Developer

measX GmbH & Co. KG.
http://www.measx.com
Message 3 of 9
(4,605 Views)
Thanks, that's really helpful.
0 Kudos
Message 4 of 9
(4,570 Views)

Simon,

 

Thank you for providing CIM1 with this VI! I have made a few improvements to the VI and attached it below. You don't actually have to use the Adapter.AsPropertyObject method at all, you can directly connect the Adapter reference to the Variant to Data VI and cast it to a LabVIEW Adapter.

 

Also, the logic that was used for determing the type of LabVIEW Server seems incorrect. According to the LabVIEWServerTypes Enumeration Help, the LabVIEWServer_ExecServer enum should be used for the LabVIEW development environment or a LabVIEW executable that registers itself as a LabVIEW ActiveX Automation Server. The LabVIEWServer_RTEServer enum should only be used for the LabVIEW Run-Time Engine. In your code it seemed like you were setting the LabVIEWServer_RTEServer enum for both the LabVIEW Run-Time Engine as well as a LabVIEW executable server. I've modified this portion of the VI as well to behave correctly.

 

Let me know if you have any questions.

Manooch H.
National Instruments
Message 5 of 9
(4,550 Views)

Great thanks for the improvement Manooch.

 

Sorry I never really tested the "other executable" option, as I don't use it.

 

Simon Holman
Software Engineer
Certified LabVIEW Developer
Certified TestStand Developer

measX GmbH & Co. KG.
http://www.measx.com
0 Kudos
Message 6 of 9
(4,539 Views)

My pleasure Simon,

 

I attempted to reproduce the behavior you described with LabVIEW locking up on exit if the subVI is called prior to ApplicationMgr.Start, but was unable to. I used LabVIEW 8.6.1 with TestStand 4.1.1 as well as TestStand 4.2.

 

What versions were you using when you saw this behavior?

 

 

Manooch H.
National Instruments
0 Kudos
Message 7 of 9
(4,528 Views)

Hey Manooch,

 

I am currently using LabVIEW 8.6.1 and TestStand 4.1.1.

I also just tried modifying the Default TS UI and had no problem,

I think there was another problem with my Custom UI.

 

Sorry for the confusion.

Simon Holman
Software Engineer
Certified LabVIEW Developer
Certified TestStand Developer

measX GmbH & Co. KG.
http://www.measx.com
0 Kudos
Message 8 of 9
(4,504 Views)
No problem Simon. Thanks!
Manooch H.
National Instruments
0 Kudos
Message 9 of 9
(4,496 Views)