Execute VI Remotely by Using VI Server

Updated Oct 25, 2023

Environment

Software

  • LabVIEW

VI Server is a powerful LabVIEW feature that allows the user to programmatically access and control LabVIEW-related actions and environments. This article will demonstrate how to run a LabVIEW VI remotely from two different computers but within the same network using VI Server.

The steps below include preparations that have to be done on both local and remote computers:

Remote Computer:

  1. Determine and jot down the IP address of the remote computer.
  2. Determine the VI to be executed remotely. A simple while loop with stop button VI is created with 500 ms of delay and an indicator for loop iteration is created for demonstration purposes, as illustrated below. 
    remote simple vi.png 
    Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a 
    snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
  3. Jot down the local path to the VI.
  4. In LabVIEW, go to Tools>>Options>>VI Server.
  5. Enabled TCP/IP and remember the value of Port and Service name2023-06-30_18h52_19.png
  6. Click OK to close the Options windows.

Local Computer

  1. Launch LabVIEW and create an empty VI.
  2. Use Open Application Reference function to open a reference to the remote application instance by using IP address and VI Server's port number or service name of the remote computer.
  3. Use the Open VI Reference function to open a reference to a VI on the remote computer by using its local path on the remote computer.
  4. Use Invoke Nodes to invoke methods such as to show the front panel and run the VI. 
  5. Use the Close Reference function to close any open references to free up the memory LabVIEW allocated for that reference. The image below shows the logic implemented in the block diagram. 
    remote.png 
    Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a 
    snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
    

When the local computer's VI is run, you will see the remote computer's simple while loop VI being executed remotely.