Publish OPC DA Data with Telegraf

Publish OPC DA Data with Telegraf

How to gather data from OPC Classic sources

·

3 min read

Telegraf is an open-source plugin-driven server agent for collecting and sending metrics and events from databases, systems, and IoT sensors. This blog post describes a method to gather data from Legacy OPC DA data sources and publish the data using Telegraf.

The problem

OPC DA, short for Data Access, is based on Microsoft COM technology. Several SCADA platforms use OPC DA as the default means of communication between their native protocol drivers and SCADA applications. For example:

  • Rockwell Automation RSLinx Classic Gateway
  • AVEVA System Platform (Wonderware) OI Servers

It is often desired to publish this data to external applications for collecting historical data, alarming, statistical analysis, machine learning, and so on.

The common practice is to use another native protocol drive such as Kepware or use a protocol converter/tunneller/wrapper solution offered by many vendors.

Telegraf has the unique strength of being open source and has over 200+ plugins. It is a standalone executable written in Go and is therefore lightweight and container friendly. It can act as a key component to consolidate all of your industrial data sources.

It is worth mentioning that Telegraf already supports OPC UA, MQTT, Siemens S7 and Modbus data sources via existing plugins.

The plugin

A Telegraf external input plugin to gather data from OPC DA sources was developed by me using the OPC DA in Go library. The plugin can be downloaded from my GitHub repository.

Following the installation steps to register the Graybox OPC Automation Wrapper and compile the plugin with Go. Make sure to compile to 32-bit binary. You should get a single executable file.

Example with System Platform OI Servers

This plugin can be used to publish InTouch tags to external data sinks such as AVEVA Insight or InfluxDB. The advantage of this approach is that the existing Intouch application is not affected. Moreover, PLC communication load is not increased if a tag is already being polled from the PLC.

Firstly, add an Internal - SIM Communication Driver like below:

Screenshot 2021-10-03 210606.png

Test the plugin by running it on the same machine where the OPC DA server is installed. Modify the config file if necessary.

> opcda.exe -config plugin.conf

The default config file has the following content:

[[inputs.opcda]]
  # Measurement name
  name = "sim"

  # OPC DA server
  server = "OI.SIM.1"
  nodes = ["localhost"]

  # Node ID configuration
  # name              - field name to use in the output (optional)
  # identifier        - OPC TAG (tag as shown in opcda browser)
  opc_tags = [
    { identifier = "PORT.PLC.int" },
    { name = "randomFloat", identifier = "PORT.PLC.float" },
  ]

Then, download Telegraf Windows Binary from InfluxData's website. Modify the relevant sections in the Telegraf config file.

#############################################################################
#                           OUTPUT PLUGINS                                  #
#############################################################################

[[outputs.file]]
  files = ["stdout"]
  data_format = "influx"


#############################################################################
#                           INPUT PLUGINS                                   #
#############################################################################

[[inputs.execd]]
   command = ["opcda", "-config", "opcda.conf"]
   signal = "none"
   restart_delay = "10s"
   data_format = "influx"

Run the Telegraf executable with the following command:

> telegraf -config path\to\telegraf.conf

If everything goes well, you should see the output like this:

Screenshot 2021-10-03 210939.png

Now you can explore the endless possibility provided by Telegraf and route your data from Wonderware / System Platform to your heart's content.