Modbus Over OPC UA

Lately, I’ve been writing a lot about the hundreds of thousands, if not millions, of Modbus devices in the world. I think we’ve finally reached our peak of Modbus deployment and now have to start thinking about ways to convert these Modbus devices to OPC UA.

Why OPC UA? OPC UA, which is often referred to as just UA, is a secure, open, reliable mechanism for transferring information between servers and clients. It provides a set of open transports, better security, and a more complete information model than every other mechanism I know. It provides a very flexible and adaptable mechanism for moving data between enterprise-type systems and the kinds of controls, monitoring devices, and sensors that interact with real world data.

In previous articles, I introduced four ways to convert your Modbus device to OPC UA. In this article, I’ll discuss the one that I call Modbus Native Representation. It is by far the simplest way to convert your Modbus data to OPC UA.

We all know that Modbus has a very simple address space with four 64K blocks of data. Two contain unsigned integer data: Holding Registers containing working data and Input Registers containing field data. Two others contain binary data: Input Coils contain binary on/off data from the field while Status Coils contain working binary data. Device designers pick some portion of these data spaces to expose internal device data to the Modbus or Modbus TCP network. It’s all very simple and straightforward, but very limited.

OPC UA, on the other hand, is very flexible in how it represents data. It represents physical and virtual entities as objects, uses many more formats for variables, creates hierarchical relationships between objects, and associates meta-data like last update time, engineering units, and maximum and minimum value with a variable.

Let’s look at an abbreviated example of curing oven from my book “The Everyman’s Guide to OPC UA.” The address space for this example is much more complicated than a Modbus address space and contains much more information. It contains Objects, Object Types, Variables, Meta-variables, and Methods.

A simple conversion mechanism that I call Modbus Native Representation is for every Modbus Register and Coil to become a Variable in a simple OPC UA Address Space. The following example shows how each Modbus data type becomes a set of Objects under the OPC UA Objects Folder and each Register or Coil becomes a variable under its Object Type. This address space illustrates a device with ten holding registers and ten status coils but could be extended to any number of registers and coils of any Modbus type.

This is a very simple way of converting your Modbus address space to an OPC UA address space. It doesn’t really provide any the power that OPC UA offers – it just represents the same Modbus data in an OPC UA address space. There are other slightly more complicated mechanisms that can be used to convert your Modbus device to OPC UA and I will discuss those in future articles.