Publish LabVIEW Data to an OPC Server

Updated Oct 3, 2022

Environment

Software

  • OPC Servers
  • LabVIEW

I want to publish LabVIEW data to an OPC Server and read the data in a third party application acting as an OPC client.

The best way to publish LabVIEW data to an OPC server is to use shared variables. Using OPC Quick Client is the most up to date method for this procedure. Steps can be found in Using the LabVIEW Network-Published Shared Variable and OPC with NI-DAQmx .

If you have NI software that predates OPC Quick Client, you can use Server Explorer to verify that your data is getting published to the OPC server.
  1. In your LabVIEW project, create a double type shared variable called Variable1.
  1. Right-click the library and select Deploy All.
  2. Open Server Explorer (Start>>Programs>>National Instruments>>ServerExplorer).
  3. Expand My Computer, right-click Variable Engine and select Connect to Server...
  4. Click Connect at the Connect to Server dialog
  5. Right-click Variable Engine and select Add/Edit Groups...
  6. When the Add Groups dialog pops up, click the Add button then click OK, as shown in the following image. This will create the group Gr1, as seen in the following image.
  1. Right-click the group Gr1 under the Variable Engine, and then select Add/Edit Items...
  2. When the Add/Edit Items dialog appears, you will see the name of your shared variable library on the left (Untitled Library 1 in this case).
  3. Highlight Untitled Library 1 and you will see the names of all the variables in this library in the center pane, as seen in the following image.
  1. Highlight Variable 1, click Add, then click OK.
  2. You are now monitoring the value of the shared variable through the OPC Server. If the variable shows a value of ??? as shown in the following figure, you may not have written a value to the shared variable yet.


Additional Information

The shared variable engine contains an OPC server that hosts any currently deployed shared variables for other applications with an OPC client to access.