Skip to content

Use-Cases for OPC UA Methods, Pub/Sub, & Companion Specs


    By now, we expect that most readers have probably used or explored using the OPC Unified Architecture (UA) standards. If you haven’t, it’s time you look at moving to OPC UA for its security, robustness, and multiplatform support, even if all you need is basic data access. At the end of this article, we’ll provide links to help you in that migration.

    What you may not realize is the power available to you in other parts of the OPC UA standard. If you’re an integrator, you may start seeing these in use on machinery or systems, or in customer requirements specifications, as adoption grows. In this article we will cover the 3 functionalities we are seeing most often to help you learn what they are and how you can utilize them.

    • OPC UA Methods
    • OPC UA Pub/Sub
    • OPC UA Companion Specifications & Information Models

    As we look at the problems each one is meant to solve, we will share an application use case and software tools to help you leverage these features. We will also show you how use them today with your solutions that may not yet support the features but do support OPC UA data access and OPC Classic.

    OPC UA Methods

    Experienced OPC users are used to reading and writing values, or maybe simple arrays of values with OPC. The OPC server usually is connected to a physical device and handles the communication with the device, sending or retrieving these basic values.

    The OPC UA specification creators realized there would be applications that needed more than just basic value transfers. There would be a need to make a function call to an OPC server, and pass 1 to N parameters, and the OPC Server would have to do some work with the parameters and return a result or results.  That’s why OPC UA methods exist. With the OPC UA methods specification, the OPC UA server developer can choose to expose functions, handle the steps required inside their server, and return the result. Of course, the OPC UA client will also need to know how to call a method.

    Use Case: Product Changeover Inspection Setup

    A use case we worked with using OPC Methods was with Dr. Schenck vision inspection machines. The machines implement an OPC UA server interface for integration to other systems.  To set the inspection profile or recipe for a specific product, the client system must call an OPC UA method on the UA server in the machine.  The customer we worked with was using an HMI system that does not support OPC UA methods but did support OPC UA and OPC Classic.

    To solve the problem, the customer worked with Software Toolbox to implement the OPC Router as a drop-in solution.  The OPC Router is a multi-functional Industry 4.0 integration software tool with visual workflows to enable data connections. The customer connected their HMI to the OPC UA interface in the OPC Router, passing in the necessary recipe information and a trigger at product changeover time. The OPC Router would receive the trigger, move the data through a visually mapped configuration to the parameter calls on the OPC UA client method call, and make the call to the vision system. Once the vision system replied to the call, status was passed back via OPC UA data access to the HMI and the trigger was reset for the next product changeover.

    More OPC UA Methods Solutions

    Although the above use case just used OPC UA Method client functionality in OPC Router, the software can also act as an OPC UA Methods server. Engineers can implement interfaces to other OPC systems, databases, web services, and ERP and expose an OPC UA method call to trigger action by the OPC Router. You can learn more about how this works in this short video tutorial.

    Below is an example configuration from the OPC Router acting as an OPC UA Methods server that passes in 3 parameters, does a database lookup, sends a print command to a printer, and then sends 3 values back to the OPC UA methods client application.

    What about Developers of OPC UA clients? For developers of OPC UA clients needing to implement support for OPC UA Methods into their custom applications, they could use OPC Router and just connect to OPC Router as an OPC UA server like the use case we described. If that is not practical, developers can use the Software Toolbox OPC Data Client development toolkit to implement OPC UA Methods functionality.

    OPC UA Pub/Sub

    This OPC UA standard works on a publish-subscribe model. OPC UA clients supporting Pub/Sub can be a Publisher that sends data, or a Subscriber that receives data. There must be a broker in the system that has implemented the Pub/Sub specification to be able to receive the data from publishers, and then deliver it to consumers or Subscribers, as shown below.

    In applications where many senders and receivers need to share data, this solution is much more efficient than direct sender-receiver connections. OPC UA Pub/Sub is transport independent and can be carried over UDP or MQTT, giving users choice with the benefits of standards.

    What makes OPC UA Pub/Sub particularly powerful, is the implementation of standard ways of organizing and packing the data. Where some publish-subscribe solutions just offer an envelope transport with limited to no standardization of how the data is organized in the envelope, which creates interoperability challenges, the use of OPC UA over UA Pub/Sub solves that problem with an open, published, accepted standard with defined data mappings.

    Use Case: Recording Temperature Data

    In a system with large numbers of sensors on a machine, the sensors publish their data using OPC UA Pub/Sub to the broker, and then any number of client applications can receive that data without 1-1 connections.  If the sensors have also subscribed to feedback from the clients, they can receive instructions back down from the client as needed for the application.

    Software Solutions

    In these and other applications, the OPC Router UA Pub/Sub plug-in can be a publisher or a subscriber. A trigger object is provided that subscribes to a broker end point, and upon receiving data, visually passes it to other applications, such as a database as shown below. Because the OPC Router can visually connect and map interfaces with OPC Classic, databases, files, RESTful & SOAP web services, and ERP systems, it can act as a gateway to OPC UA Pub/Sub for those applications, avoiding the need for any custom code.

    The Pub/Sub writer object in OPC Router can take data from other systems, and publish it to a broker, again with visual configuration, as shown below.

    Writing your own OPC UA client? If you are developing a custom OPC UA client application instead of using an off-the-shelf client and need to implement the OPC UA Pub/Sub functionality, the Software Toolbox OPC Data Client development toolkit provides the tools to implement OPC UA Client Pub/Sub over UDP, MQTT, with parsing of a variety of message mappings, filtering, and a demo publisher application to test your client with.  Applications written with the OPC Data Client toolkit will also work with the OPC Router and it’s OPC UA Pub/Sub functionality.

    OPC UA Companion Specifications & Information Models

    So we’ve talked about calling methods with a few parameters, and using Pub/Sub for efficient many-to-many data exchanges, but what about when you need more structure to your information?  That’s where the OPC UA information models and companion specifications come in. OPC UA has the ability to handle complex data structures. In a generic sense, it starts with the information model that defines data sets, data types, and hierarchical structures within the model. Users or industry groups can then build and publish standardized, re-usable information models for specific device classes and vertical industries. Those standardized models are called Companion Specifications.  The OPC Foundation publishes a list of available Companion Specification Documents which can be downloaded for use by implementers.  We’ll talk about implementation in a moment, but first let’s see a few use cases for Companion Specifications.

    Use Case: EUROMAP Standards for Injection Molding Machines

    The EUROMAP standards were created by the European Plastics and Rubber Machinery association as a means to encourage integration and interoperability of machinery in their space. The early EUROMAP standards pre-dated the availability of OPC UA Companion Specifications and thus used their own protocol transports, for example EUROMAP 63 which was a file exchange based standard and, if you happen to have older IMMs still requiring EUROMAP 63, Software Toolbox has an OPC UA server.

    Seeing the need for real-time interfaces to meet digital transformation and Industry 4.0 initiatives, in 2019, the EUROMAP organization and the OPC Foundation established a joint working group to create Companion Specifications for the EUROMAP standards. Since then, they have published companion specifications for EUROMAP 77, 82 and 83 and are working on others. By having OPC UA as the transport, their standards can benefit from the security and robustness of the standard, and avoid the custom code of proprietary network transports, which results in faster time to market and increased interoperability.

    The OPC Router can use Companion Specification information digital XML model implementations for EUROMAP that the OPC Foundation has published in their OPC UA CloudLib for download and use. Referencing the downloadable models avoids any custom code, and once loaded into OPC Router, it can then be interfaced to devices implementing the Companion Specifications, including EUROMAP standards.

    Use Case: RFID and AutoID Systems (AutoID)  – RFID readers from Harting, Siemens, and TURCK have implemented the OPC UA AutoID companion specification in the UA interfaces in their devices. When an RFID tag is in the reading zone of the reader, the reader will gather the data and make it available using OPC UA in the standardized defined mapping.  Using OPC Router, as shown below, the data can be received from the reader over OPC UA, the information model decoded and made available as variables, and acted upon. In the example, a database query is performed, and the resulting relevant data as chosen and defined in the user’s visual mapping configuration is delivered to a PLC via an OPC server for that PLC brand, all without writing any code.

    From Specification to Implementation: Starting with a specification is fine but then you are writing code.  As you saw in the above use cases, OPC Router can avoid the cost & risk of custom code. Through a built-in direct link to the OPC Foundation Cloud Library, which you can get a free login for, there’s no extra work. Connect to the library, pick the model you want to implement, and bring it into OPC Router and it’s ready to connect to your data sources and destinations and start using with other systems implementing the Companion Specification.  Because OPC Router is an OPC Classic and UA generic data client and UA generic data server, you’ll be able to integrate any HMI, SCADA, MES or other system supporting the basic OPC standards with the powerful OPC UA Companion Specifications.  Why wait to start taking advantage of these benefits? Put OPC Router to work for you.

    What if you want to build your own company-specific, internal model?  For sophisticated users, the OPC UA specifications define how to construct an XML file that describes your model, which you can then also reference and import into OPC Router without having to put it into the OPC Foundation public library.


    You’ve now seen how OPC UA can go far beyond just simple data movement, performing compound operations and exchanges using OPC UA Methods, making efficient many-to-many connections with a standard data model over open transports, and integrating industry specific machinery and data exchange schemas using OPC Companion Specifications and Information Models.

    Software Toolbox can help you integrate these standards using OPC Router and for developers of OPC UA clients, using the OPC Data Client Toolkit. Combined with our variety of OPC Servers and 27 years experience with OPC, we’re here to help you get the most out of investments in OPC UA.

    If you need to move to OPC UA for basic data collection only, your OPC server products probably already support OPC UA and you may just need an upgrade. It’s important all OPC users consider this for the benefits of security, robustness, and multi-platform support, but also because of security changes Microsoft has made to DCOM, an underlying technology used in OPC Classic.  All Software Toolbox OPC products already support OPC UA and have for many years, so contact us if you need to upgrade. If you have an OPC Classic server or client and it is not yet OPC UA enabled, we can help with the DataHub OPC Gateway as a quick, cost-effective solution.

    Software Toolbox is a preferred partner for the OPC Router product, developed by inray Industriesoftware GmbH.  Software Toolbox provides technical support, licensing, and consulting in the US and Canada for OPC Router and we thank inray Industriesoftware GmbH for their contributions to this article.