Support for OPC-UA input and output plug-ins
Feature Request
The OPC-UA protocol is heavily used in the energy and utilities industries and was originally developed for SCADA systems. As companies try to update their metrics collection platforms to next generation time series databases like InfluxDB they'd like to tap into this established infrastructure based on OPC-UA.
There is an OPC-UA logger that was developed to insert data into InfluxDB but nothing for writing back out to OPC-UA: https://github.com/coussej/node-opcua-logger
There are a number of open source projects that one might be able to tap into while developing such a plug in which are listed here: https://github.com/open62541/open62541/wiki/List-of-Open-Source-OPC-UA-Implementations
Companies interested in these plug ins:
- Schlumberger
- NOV
- Emerson
Proposal:
Current behavior:
Desired behavior:
Use case:
OPC-UA is the new standard, correct? There is also the older standard which was just OPC.
A very common issue is that each OPC server is implemented a little different per vendor.
Yes, OPC-UA is the "new" standard (formally IEC 62541 published between 2010 and 2012), and replaces the classical OPC which utilised Windows DCOM. OPC-UA allows non-Windows devices to communicate, which was not the case with the classical OPC.
Good descriptions here: https://en.wikipedia.org/wiki/OPC_Unified_Architecture https://opcfoundation.org/about/opc-technologies/opc-ua/
Free OPC test/simulations tools are available from Matrikon, including clients and servers: http://www.matrikonopc.com/products/opc-desktop-tools/index.aspx
I would like to start an initiative for this. I will be starting with the node library as a base and attempting to translate it into Go. If anyone would like to help I will be storing my code here,
https://github.com/dprice809/opcua_listener
Thanks for your efforts.
Can I ask what you mean by the term “listener”? This sounds like telegraf would perform the role of server, and wait for a client to push data to telegraf.
Generally industrial control systems would provide an OPC Server, so extracting data from them would be done by an OPC client sending queries for data for certain “tags”. A data historian collector like telegraf would normally perform the client role of regularly sending these queries to the server.
To be honest, E&P companies are still using OPC DA/HDA protocol primarily, not the UA version, therefore it would be better to develop "legacy" windows only clients for telegraph to feed the database with data. I could start to develop this client but not sure if it would be useful for Linux oriented customers since it cannot be implemented without old DCOM+ bindings.
While majority might be still using classic OPC, the new OPC UA standard is gaining traction more and more. Taking into account that development of the plugin will take some time, over that period the ratio will change more towards OPC UA. For that reason perhaps plugin should be for OPC UA. Classic OPC data sources can be accessed using existing in the market protocol converters, like OPC UA Proxy from Matrikon.
Another alternative perhaps could be to build generic OPC UA adapter for SQL database, particularly PostgreSQL, for which there is already plugin. There are some optimized to store time series data versions of databases do exist, like TimescaleDb, which is accessible as regular PostgreSQL database.
Another aspect is that OPC classic is based on Microsoft’s DCOM, so I believe telegraf could only realistically support it on Windows.
OPC UA on the other hand does not rely on DCOM and works on any operating system.
Yet another reason to focus on OPC UA.
I believe that supporting OPC UA natively (not via a database middleman) should be a major priority for telegraf. This would effectively extend telegraf and influxdb from a purely IT monitoring historian, to a viable control system historian (OT).
Control system historians is a BIG industry, and the competitors are largely older technology. There could be big demand for this.
I would agree with the OPC-UA objective. There are lots of cases where having a low friction way to get industrial/manufacturing data into a time series database, would be valuable. One of the challenges would be coming up with a good way to map the data to the influx schema.
Yes, it can be kind of enterprise historian. I say "kind of", because cannot see how OPC UA model information can be utilized in full on the Influx architecture. For example, OPC UA variables have not only value and timestamp, they have engineering units, range, description, display name (which BTW can be localized) - those characteristics are required on the visualization side. There is also deadband support to eliminate noise before collecting data into historian. In the Influx architecture I see that the Chronograf module gets all data from InfluxDB, so if the DB does not have all that OPC UA model metadata mapped into it, then all that valuable info is lost and the system as a whole requires duplication of configuration: for example, instead of using engineering units available via OPC UA server, the user will have to type/select it on the Chronograf dashboard configuration. One more aspect is that OPC UA Servers can generate alarms and events. they need to be historized too, and displayed on the dashboard too, and operator needs a way to react to them. I don't see how OPC UA alarms and events can be utilized in InfluxDB architecture.
Concluding, the questions are: can OPC UA model and alarms/event be utilized in Influx ecosystem?
If Chronograf could access them over generic API via some OPC UA plugin which connects directly to OPC UA servers to get model and events, and historian data via InfluxDB, perhaps that would be doable. Or map them into InfluxDB, not sure if that is doable, I just started looking at InfluxDB and don't know its internals.
The approach I have used is to use the tag set and field set to define these additional attributes. Keep in mind that most of the process historians (Pi, WW Historian) that I have dealt with don't consume all of this data from OPC-UA Either. That is why I made my comment about developing a good strategy in the telegraf connection on how the OPC-UA data would be mapped into influx's tagset and fieldset schema.
I guess those historians are legacy and do not use all information provided by OPC UA Servers in full. Ideally, it would be nice for example to have feature to browse OPC UA Server address space and select OPC UA variable from there right on dashboard configuration GUI, and that selection would populate settings in the dashboard like display range, or units, automatically. I wonder, can address space somehow mapped into InfluxDB together with all OPC UA node attributes/properties?
We should keep this effort limited to identifying if data can be properly storred in InfluxDB. While many other products provide things like displays and alarming those pieces are typically provided as additional products and not features of the historian itself (ex. PI Notifications and Processbook.)
As for the additional fields and data. Could we get away with serializing this data in something like a JSON format? And I’m sure there is a clever solution for deadband and compression
I wasn't aware that there was a UI for telegraf. serializing the contextual data could be done, but it would not be optimal if you needed to use that data for retrieval.
I was thinking a lot of the metadata like engineering units, description, devMin, devMax are defined at the “tag” level. So it does not need to be attached to each time series event. This would also reduce indexing overheard.
Yes, but it is also possible for the tag configuration to change over time. E.g. a tag recording a pressure could use units "psi(g)" for the first 1 month, and then its configuration could later change to use units "kPa(g)". There needs to be a method in influxdb to record which units stored values use.
The alarms and events portion of OPC UA is a separate component. This functionality does not need to be implemented in the first instance - it could be added later (or not at all). I agree that it is a useful component, but it is not mandatory.
InfluxDB has the ability to store both regular and irregular (events) time-series data. So for alarms this information could be written to a separate measurement. An upstream process (i.e. Kapacitor) could scan this data and alert on the presence of an alarm. For the fluctuating units case a tag (pressure_units) could define what units the field value represents.
In the TICK stack architecture (https://www.influxdata.com/time-series-platform/) Telegraf and Chronograf both interact with InfluxDB (the first collects data from various sources and writes it to the DB, and second reads data and visualizes it). For me it is hard to imagine how OPC UA model information can be propagated and used by visualization component. I don't see that Chronograf allows using of some custom data source, which can provide both data and model.
If you look at Grafana, it provides API to add custom data sources. I guess you could add data source for OPC UA, which can provide all you need for visualization - real time data, historical data, alarms and event, and most importantly, information model. Note that the model could be used to create and configure dashboards, users do not need to enter settings like localized display name, description, display ranges, units, etc. That data source can get data either from ordinary OPC UA Servers directly, or it might be some historian with OPC UA Server interface, using in the backend some TSDB like InfluxDB or anything else.
I could lead such a project if there are interested parties.