OPC

Hans-Petter Halvorsen

What is OPC?

OPC is a standard that defines the communication of data between devices from different manufactures.

OPC requires an OPC server that communicates with one or more OPC clients. OPC allows “plug-and-play”, gives benefits as reduces installation time and the opportunity to choose products from different manufactures.

We have different OPC standards:

The organization OPC Foundation maintain the OPC standards.

 

Video: OPC with Practical Examples (YouTube):

PowerPoint used in the Video

 

OPC UA Demo Software

OPC UA Demo Server (YouTube) + PowerPoint (PDF)

Download OPC UA Demo Software.

 

Below you find additional OPC resources.

MatrikonOPC Simulation Server

MatrikonOPC Simulation Server is free and can be used for testing OPC DA.

Download MatrikonOPC Simulation Server

Troubleshooting

Problems with installing or using the software?

If you have issues, please contact support@matrikonopc.com.

 

NI OPC Servers

An alternative to Matrikon is NI OPC Server.

A Demo version is included with "LabVIEW DSC Module" or "LabVIEW Real-Time module". This one can also be downloaded separately.

Download NI OPC Servers

LabVIEW OPC with NI OPC Servers

 

OPC UA Server Simulator

OPC UA Server Simulator (with LabVIEW/MATLAB Examples) + PowerPoint used in the Video

 

OPC UA Resources

OPC Foundation provides a set of sample code to demonstrate Server and Client implementations.

Download OPC UA Simulation Server and Sample Applications

OPC in LabVIEW

You can either uses OPC DA or OPC UA. LabVIEW has built-in support for OPC DA using the DataSocket palette. For OPC UA you need the LabVIEW OPC UA toolkit.

 

OPC DA in LabVIEW

OPC DA in LabVIEW + PowerPoint used in the Video

Note! OPC communication (OPC DA) using Datasocket is supported only in LabVIEW 32-bit version. Why: OPC foundation does not provide 64 bit binaries of the OPC core redistributables for OPC version 2.0. 

 

For OPC DA you may need to use OPC Tunneller Software. Here are some examples:

 

OPC UA in LabVIEW

LabVIEW OPC UA (YouTube Video) + Tutorial (PDF) + LabVIEW OPC UA Examples (ZIP)

 

OPC UA in LabVIEW 2017 and newer

The LabVIEW OPC UA Toolkit contains the OPC UA API that was formerly part of the LabVIEW Datalogging and Supervisory Control (DSC) Module and the LabVIEW Real-Time Module. From the 2017 release, the LabVIEW OPC UA Toolkit becomes a standalone product. The LabVIEW DSC Module and the LabVIEW Real-Time Module no longer contain the OPC UA API. Read more.

 

Note! When creating OPC Clients: The VIs Write.vi and Read.vi that was previously used in LabVIEW 2016 has been replaced with Multiple Write.vi and Multiple Read.vi.

This means: In LabVIEW 2017 and newer it is recommended to use Multiple Write.vi and Multiple Read.vi instead of Write.vi and Read.vi for new applications. Note that Multiple Write.vi and Multiple Read.vi are slightly more complicated to use.

But if you open previous code in LabVIEW 2017 or newer, it will still work, because the old Write.vi and Read.vi are still included, but hidden in the palette in LabVIEW. You will find them here:

C:\Program Files...\National Instruments\LabVIEW 20xx\vi.lib\OPCUA\client\internal\

 

More information about LabVIEW OPC UA Toolkit (National instruments)

Examples from National Instruments:

 

 

Download LabVIEW OPC UA Toolkit

The LabVIEW OPC UA Toolkit contains the OPC UA API that was formerly part of the LabVIEW Datalogging and Supervisory Control (DSC) Module and the LabVIEW Real-Time Module. From the 2017 release, the LabVIEW OPC UA Toolkit becomes a standalone product. The LabVIEW DSC Module and the LabVIEW Real-Time Module no longer contain the OPC UA API. Read more.

 

OPC UA in LabVIEW 2016:

OPC UA in LabVIEW + PowerPoint used in the Video + LabVIEW Examples

OPC in Visual Studio/C#

There are no built-in support for OPC in Visual Studio/C#, so you need to use a 3.part sooftware package. If you only need OPC DA, you can, e.g., use Measurement Studio from National Instruments.

 

OPC DA in Visial Studio/C#

Measurement Studio

Download Measurement Studio

Note! A new Mesurement Studio 2019 (with support for Visual Studio 2019) has "just" been released. Here they have changed the way you implement an OPC Client.

University of South-Eastern Norway (USN) has a site license for LabVIEW and other software from National Instruments, including Measurement Studio. If you are a student or staff at USN, you can freely download and install Measurement Studio and many other software from National Instruments.

For OPC DA you may need to use OPC Tunneller Software. Here are some examples:

 

Measurement Studio 2015

Mesurement Studio 2015 Tutorial

OPC with Visual Studio + PowerPoint used in the Video

Note! Measurement Studio 2015 with Microsoft Visual Studio 2015 and Newer

 

Measurement Studio 2019

Mesurement Studio 2019 Tutorial

OPC with Visual Studio 2019 and Measurement Studio 2019

Code Example

 

OPC UA in Visual Studio/C#

OPC UA with Visual Studio and C# + PowerPoint used in the Video

 

Other resources:

Build OPC UA .NET applications using .NET StandardLibrary (OPC Foundation)

Official OPC UA .Net Standard Stack and Samples from the OPC Foundation (GitHub)

OPC in MATLAB

MATLAB is a tool for technical computing, computation and visualization in an integrated environment. MATLAB is an abbreviation for MATrix LABoratory, so it is well suited for matrix manipulation and problem solving related to Linear Algebra, Modelling, Simulation and Control applications, etc. MATLAB is developed by MathWorks.

In MATLAB you can use the Industrial Communication Toolbox in order to communicate with an OPC Server. The Industrial Communication Toolbox supports both OPC DA and OPC UA.

The “Industrial Communication Toolbox” is a new Toolbox that is included in “MATLAB R2022a” and newer versions of MATLAB.

The previous name was "MATLAB OPC Toolbox", but they have now combined different communication protocols like OPC, Modbus and MQTT into one new Toolbox.

 

Resources:

OPC with MATLAB using Industrial Communication Toolbox (YouTube) + PowerPoint (PDF) - Tutorial with OPC DA and OPC UA Examples

MATLAB OPC Toolbox (YouTube) + PowerPoint (PDF)

 

University of South-Eastern Norway (USN) has a site license for MATLAB, including the Industrial Communication Toolbox. If you are a student or staff at USN, you can freely download and install MATLAB and the Industrial Communication Toolbox.

OPC in Python

Both OPC DA and OPC UA libraries are available for Python.

OPC UA in Python (YouTube) + PowerPoint (PDF)

OPC Resources

Below you will find more interesting OPC resources


LabVIEW

LabVIEW Programming and Tutorials

MATLAB

MATLAB programming and Training



OPC Videos

OPC Videos within different Applications and Areas

Industrial IT

Industrial IT resouces



Automation

Automation and Control resources

SCADA

Supervisory Control and Data Acquisition