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.

Example Code

OPC client development on LabVIEW

Code and Documents

Attachment

Overview

This document provides information about how to develop powerfull, full featured OPC DA 2.X/3.0 client application on LabVIEW. The method uses OPC core components binaries (which are available for free at http://opcfoundation.org/) as a low level interface to perform all tasks. For the most of OPC features wrapper VIs exist and grouped as a standard LabVIEW libraries and classes. Upon installation logically grouped VIs will apear in functions palette. All binary dependencies will be automatically installed into <GAC> directory after packege installation.

Please refer to http://opc-da.com/ for more information.

Description

OPC DA API initiate and control communications with OPC Servers. The toolkit is meant for translate LabVIEW freindly application requests into an OPC equivalent request and send it to the appropriate OPC Server for processing. In turn, when OPC data returns from the OPC Server, the toolkit translates it back into the LabVIEW native format so the application can properly work with the data.

You can use OPC DA API in any LabVIEW application to enable it to communicate with any compliant OPC Server visible to it on the network. The intuitive implementation  of toolkit makes it irreplaceable solution for creating applications such as HMIs, trending packages, historians, report writers, etc.

Using OPC DA API you can communicate with multiple OPC Servers at the same time. Effectively, this means an OPC Client can read and write data to and from multiple data sources via their respective OPC Servers. Connect as many OPC servers as you needs to just by calling appropriate wrapper VI with correct settings.

The OPC DA API covers the most of OPC specification, such as:

1. Browse Network

2. Browse Computer’s OPC Servers List

3. Connect to OPC Server

4. Browse OPC Server

5. Create OPC Groups

6. Add Items Into Group

7. Synchronous and asynchronous read and write

8. Remove Items from Group

9. Remove OPC Groups

10. Disconnect from OPC Server

11. Accses OPC Item properties

12. Accses OPC Group properties

13. Accses OPC server properties

14. Accses OPC server status

For detailed documentation of OPC DA API please refer to http://opc-da.com/Documentation.html

For FAQ about OPC DA API please refer to http://opc-da.com/FAQ.html



Steps to Implement or Execute Code

  1. Download the OPC DA API from http://opc-da.com/toolkits/opc_support_lib_opc_da_api-1.1.0.24.vip
  2. Download the simple OPC client example which is using OPC DA API from http://opc-da.com/resources/OPC-DA_Example.zip  (starting from ver. 1.1.0.24 example VI's are included into installation package)
  3. Run the "opcda_simply_client_example.vi"
  4. Click on the "Browse Network". The client application will browse local network. Choose one of local network computers where OPC server is running from listbox.
  5. Select specification. Use eiather 2.X or 3.0.
  6. Click on "Browse Computer". The client application will show all running OPC servers on selected machine. Choose one of the OPC servers from listbox.
  7. Click on "Connect". The client application wil automatically browse the root folder of selected OPC server and populate it on "Browser".
  8. Double click on tags folder in "Browser" to navigate into it.
  9. Read or write tag value.

Requirements

Software

LabVIEW 2015 Base, Full, or Professional Development System.

.NET Framework >= 4.5.

Hardware

Additional Images or Video


Benchmarking

Here is the benchmarking of how fast the OPC DA API can work.

image017.png

As you can see, as big your tag set that you wish to read as fast it will be performed. In this example we read all data types: String, Boolean, Double, Float, U8-U32, I8-I32, Array.

A 20 % of tag quantity were array at list with 5 elements.

MS Windows Security Configuration

If you wish to connect to OPC server within local network you need configure DCOM security settings first. The easiest way to do this is explained here.

Application distribution which uses LabVIEW OPC DA API

Upon creating distributive application (.exe) from LabVIEW code, which uses LabVIEW OPC DA API you have to download and include the OPC DA 3.00 Binaries installer to your application installer (or install it manually on the machine which will run the application) in order to guarantee proper work of the application.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
golzioge
Member
Member
on

After download and installation a Licence is required.

On your website you said that there are 10 days of free trials.

Regards

Golzio

opc-da-support-team
Member
Member
on

Dear golzioge,

 

Thank you for contacting us.

 

We will extend your trial period after you send the user code 1 and user code 2 to support@opc-da.com email (For this you should select activate option from dialog).

Anyway, we will check it out why you were unable to use 10 days of free trial.

With best regards,

OPC Support Team

Contributors