LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using control reference with a Sub-vi over a TCP VI Server connection

I tried to use a Call by Reference Node to run a sub-vi on a remote PC through a TCP VI Server. An output of the sub-vi is connected to an indicator in the main vi using a control reference.

The sub-vi started on the remote PC, but the information from the sub-vi was not passed to the control reference in the main vi. However, if I change the client name to the host PC, ie. running the server and client vi on the same machine, the code works as planned. I wonder if control reference is not suppose to work over a TCP VI Server connection?

Any suggestion would be very much appreciated.

Regards,
Calvin Tsang
Download All
0 Kudos
Message 1 of 7
(3,285 Views)
Refnums are local to the application where they are created. You can't pass a refnum from one application to another.

For a control to be operated by the remote application, the remote app must open references to that control locally e.g. you pass the VI name and the control name, then the remote app opens a reference to local application, then to local VI. You then read from the VI Panel property the list of refnums to all controls (Controls[] property) and search the list for the control with that name.

See the attachment VI


LabVIEW, C'est LabVIEW

0 Kudos
Message 2 of 7
(3,285 Views)
Is the LV on the target machine configured to serve the VI in question?

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 7
(3,285 Views)
All options inside the "VI server: configuration" were enabled and with TCP/vi access set appropriately in both machines.

The VI started on the target machine fine, but the "live" indicator/control were not connected between the machines.

Ben, is this what you were asking, or I had misinterpreted the question?

Regards,
Calv
0 Kudos
Message 4 of 7
(3,285 Views)
Yes!

That was what I was talking about.

Keep us posted.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(3,285 Views)
Thank Jean-Pierre for pointing out that Refnums are local to an application and so control reference doesn't work between different applications on separate machines.

In addition to the method shown in Jean-Pierre's example vi, I found that the use of "invoke method: GET control value" and "invoke method: SET control value" can produce similar results. See the attached files for an example. In this example, the indicator on the local vi is used to monitor the progress of the remote vi and the local control is used to stop the remote vi. So the data synchronisation between the two vi is not important here.

However, you may notice the indicator "current counter" in main1_vi.vi doesn't properly interpret the binary string from "invoke method: GET control
value", can someone shed some light on this, please?

Calv
Download All
0 Kudos
Message 6 of 7
(3,285 Views)
I found the answer myself.

Set the representation of the dummy variable to double precision at the "Type" input of "unflatten from string"
0 Kudos
Message 7 of 7
(3,285 Views)