Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Celebrating as our community reaches 100,000 members! Thank you!
Labels (1)
avatar
Rising Star

Accessing data from industrial control devices can be made easier and safer by utilizing an OPC Server. OPC Servers provide protocol proxy services by translating requests for data from a standardized protocol like OPC to the native protocol of the industrial control device. Since the typical OPC Server can proxy many requests into many different protocols each for a different family of data sources they also make ideal aggregation points for control system data. Centralized data access also has advantages in security that should not be overlooked. The OPC Sever and Nifi can work together to provide certificate based authentication and role based data access to devices in process control networks. Nifi's unique pedigree is capable of complying with the stringent network ingress and regress rules.

Get started fast with Kepware and Apache Nifi

Out of the box tools available in KepServer Ex can make data available via HTTP and MQTT.

----|Kepware|---HTTP REST API-----|NIFI|

or

----|Kepware|-----------MQTT-----------|NIFI|

Data can also be acquired via OPC UA but this requires you to build the Nifi processor available at

https://github.com/wadesalazar/NIFI-OPCUA

First Get Kepware

Download and install a copy of Kepware's Kepserver on a Windows VM host. You can download the application at at https://my.kepware.com/download/demo/ex/ The installation is straightforward but be sure to install select the optional IoT Gateway Plug-in.

Start KepServer Configuration from the Windows Start menu. After being started a unlicensed demo will run for 2 hours before “timing out”. Restarting the server will restore it.

Open the KepServerEX Configuration tool and select IoT Gateway

Right click on the default agent and select New IoT Item

Select Sin1 from the simulation functions and apply this tag. Selecting a scan rate and ok applies this tag configuration to this agent. From here you can export a CSV file that can be used for batch imports of IoT Item configurations

Again right click on the Agent but select Properties this time. On the Endpoint tab of the dialogue box you will find the port configuration and option to enable HTTPS. Here you can also find a test link for the server which will bring you to a docs page that explains the available queries and JSON response format

Now the data has been exposed over HTTP you may make REST requests to KepServer for data.

Configure Get HTTP processor

The URL is something of the form: http://YOUR.KEPSERVER.ADDRESS:39320/iotgateway/read?ids=Simulation%20Examples.Functions.Sine1

Review the acquired data in the data providence section of Nifi

FYI

the default JSON from Kepware puts [] around the inner document like this:

{"readResults":[{"id":"Simulation Examples.Functions.Sine1","s":true,"r":"","v":33.705616,"t":1462251936055}]}

Using MQTT or OPC UA is a very similar process requiring only changes in the Nifi processors used.

Enjoy!

4,422 Views