OPC UA provides security mechanisms for authentication of users, clients and servers, checking the integrity of communications and providing security at transport level by encrypting and signing messages.
OPC UA seeks to facilitate the way of operating between the devices of different manufacturers by establishing a common form of communication, this makes it especially useful in industrial environments where devices of different manufacturers can coexist, allowing the communication of all of them with a single client, or even between the devices themselves.
COMPARISON
Currently, after seeing their main characteristics, we can affirm that making a
comparison between these two protocols is not entirely fair. MQTT is a protocol where the data field coding and its content are specific to each application, therefore, it will be useful when the communication of messages is for a specific application developed for those data fields.
OPC UA (Unified Architecture) is a complete architecture where the communication protocol is only a part. An OPC UA application allows to see all network nodes, methods, data structures. The communication can be based both on a published subscription model and on the client server model where the server shows a group of services to access the nodes of the network making possible the reading, writing, calling methods of the servers, and so on.
Now let's give an example, such as the writing of a variable hosted in a PLC.
As we saw earlier, MQTT is designed to be lightweight and energy efficient. For that reason it does not have implemented the search of the topic nor of the broker where the message is published, this does that it is necessary that the client knows it beforehand. In the same way it does not have any mechanism implemented for the writing of the variable in the machine.
Therefore, for this implementation we will need a client program that is subscribed to the topic in the broker, this program must process the message published, access the PLC and write the variable.
This has several problems:
- Processing of the message, the published message does not have a specific format, therefore, the subscriber has to know the format in which he will receive the message.
- The writing of the data in the PLC varies depending on the manufacturer.
Once these problems have been solved, our client program will only be valid for that particular machine and publisher.
All these problems are solved with OPC UA. For the writing of a variable in an OPC UA server, it would be simply with a series of requests from the OPC client itself. The steps that the protocol would follow would be: open a secure channel, see the list of available endpoints, create the session, write the value of the variable, close the session and close the channel.
On the other hand, the bandwidth consumption of doing the writing, without counting the sending of the writing request, exceeds 600 Bytes when sending the variable to write using the MQTT protocol consumes about 17 Bytes.
The conclusion we reached is that each protocol must be used for what it was designed for. MQTT for devices with low resources, low bandwidth networks, high latency or in applications that require the flexibility of this protocol and OPC UA for industrial environments, since it seeks to unify the way of operating with different manufacturers of industrial devices being a complete solution that covers from the communication of the devices to their interoperability, in these environments the increase in bandwidth consumption is not so critical as not to compensate all the advantages that OPC UA brings us.
Muutech's Minerva platform, based on Zabbix and Grafana works with both protocols, so do not hesitate to contact us if you need a
monitoring platform that combines the IoT world with the world of industrial and IT systems.