小程序
传感搜
传感圈

OPC UA Protocol: Features, Information Models & MQTT Synergy

2023-12-16 07:50:17
关注




Illustration: © IoT For All



OPC UA (OPC Unified Architecture) is a platform-independent, service-oriented, open, and secure communication architecture. It enables interoperability of industrial automation devices, systems, and software applications from different vendors. The OPC UA information model defines the codes and formats for exchanging data using various transport protocols.

The same foundation developed OPC UA and its predecessor, Open Platform Communications (OPC), but they are significantly different. The foundation continues to develop OPC UA to create an architecture that is more desirable than the original OPC communications and more in line with the needs of evolving industrial automation.

The OPC Foundation released the first version of the OPC UA specification in 2006, and as of today, OPC UA is at version 1.05. In addition to the Client-Server (Subscriptions) model, OPC UA includes a Pub-Sub mechanism, which allows pushing JSON specifications (also using the standard-defined binary specification – UADP) over the UDP protocol, MQTT protocol, or AMQP protocol.

Through the fast, secure, and reliable transport channel provided by the MQTT protocol, OPC UA can directly use the internet for data transfer while retaining the key benefits of OPC UA’s end-to-end security and standardized data modeling.


EMQ Technologies Inc.



Features of OPC UA

  • Functional equivalence – All OPC Classic specifications map to the UA, and the OPC UA includes the DA, A&E, and HDA functionality found in OPC Classic:


FunctionalityDescriptions
DiscoveryFind available OPC servers on your local PC and/or network
Address spaceAll data is represented hierarchically (e.g. files and folders), allowing OPC clients to discover and utilize simple and complex data structures
On-demandRead and write data/information based on access rights
SubscriptionMonitor data/information and report exceptions when values change beyond the client’s settings
EventClient-based settings notify important information
MethodClients can execute programs based on methods defined on the server, etc.


  • Security – Message encryption, authentication, and auditing, one of the most important considerations for an organization when choosing a technology standard is security. OPC UA addresses security by providing a set of controls when passing through firewalls:


FunctionalityDescriptions
TransportA number of protocols are defined, providing options such as ultra-fast OPC binary transfers or the more general SOAP-HTTPS
Session encryptionInformation is transmitted securely with 128-bit or 256-bit encryption levels
Message SignatureThe signature must be identical when the message is received as when it is sent.
Sequencing Data PackagesIdentified message replay attacks eliminated through sequencing
AuthenticateEach UA client and server is identified by an OpenSSL certificate, which provides control over how applications and systems connect to each other.
User controlApplications can require user authentication (login credentials, certificates, etc.) and can further restrict or enhance user access to permissions and address space “views”.
AuditsLogging of user and/or system activity to provide an access audit trail


  • Comprehensive Information Modelling: The OPC UA Information Modeling Framework, used to define complex information, converts data into information. It allows modeling and extending even the most complex multi-level structures through fully object-oriented functionality, with the capability to define data types and structures in configuration files.


EMQ Technologies Inc.



Information Model for OPC UA

The OPC UA information model, the address space, is a network of nodes and references forming a structured graph.

Objects in a standard form are represented in the address space, where model elements are called nodes. The address space represents objects and their components as a collection of nodes, described by attributes and connected by references. OPC UA modeling is all about creating nodes and references between nodes.

Object Model

OPC UA uses objects as the basis for representing data and activities in the processing system. Variables, events, and methods are interconnected by reference within objects.


EMQ Technologies Inc.



Node Model


EMQ Technologies Inc.



  • Attributes describe nodes, and different node classes have different sets of attributes. The definition of a node class includes defining attributes, so the address space does not include attributes.
  • A Reference represents a relationship between nodes. An instance of a node of the reference type that exists in the address space defines a reference.
  • Generic properties of the node model


EMQ Technologies Inc.



Reference Model

The source node is the node containing the reference, and the target node is the referenced node. The referenced target node can be in the same address space as the source node, or in the address space of another OPC server, or even the target node can be non-existent.


EMQ Technologies Inc.



Node Types

The most important node categories in OPC UA are objects, variables, and methods.

  • Object nodes: Users use object nodes to form address spaces, and these nodes do not contain data. They use variables to expose values for objects. Users can use object nodes to group management objects, variables, or methods; variables and methods always belong to an object.
  • Variable node: Variable node represents a value. The data type of the value depends on the variable. The client can read, write, and subscribe to the value.
  • Method node: The method node represents a method in the server that the client calls and receives the result. The input parameters and the output result are in the form of variables as part of the method node. The client specifies the input parameters and gets the output result after the call.

Why Bridge OPC UA to MQTT?

MQTT is a lightweight, efficient, and reliable messaging protocol for IoT, using a publish-and-subscribe model to support real-time communication. MQTT is well-suited for resource-constrained environments, especially scenarios requiring efficient power and bandwidth use.

Built on MQTT 3.1.1, SparkplugB ensures flexible, efficient basic data modeling for industrial IoT through an industry-established specification. SparkPlugB achieves strong interoperability and network state awareness, thanks to MQTT’s excellent design.

OPC UA and MQTT have a certain degree of functionality overlap, but their use of scenarios is very different:

  • OPC UA facilitates seamless communication among diverse equipment and systems in the industry by using a standardized language.
  • MQTT efficiently handles real-time sensor data over the Internet, addressing low bandwidth and unreliable network conditions in IoT applications. Its read/publish mechanism offers remarkable flexibility in usage.

In industrial scenarios, MQTT excels at messaging in distributed systems, while OPC UA focuses on providing interoperability. OPC UA abstracts and aggregates business data, and MQTT facilitates seamless, distributed data exchange with its strong connectivity capabilities.

OPC UA over MQTT

The Pub-Sub model proposed by the OPC Foundation in the latest specification of OPC UA allows data changes to be pushed to subscribers using the MQTT Broker.


EMQ Technologies Inc.



Pub-Sub security is a bit more complex than that in client/server, and the specification is not as detailed. In an MQTT network, security is based on SSL/TLS, and the broker can define application-level authentication in addition to enabling SSL/TLS for transport.

In principle, these security models are either all or nothing for every subscriber and publisher that can join the network. The ongoing standardization of OPC UA is still a work in progress, and it remains unclear how to best map the rich OPC UA information model to MQTT.




参考译文
OPC UA协议:功能、信息模型与MQTT协同# 示例输入与输出**输入**人工智能(AI)是计算机科学的一个分支,旨在开发表现出人类智能的软件或机器。这包括从经验中学习、理解自然语言、解决问题以及识别模式。**输出**人工智能(AI)是计算机科学的一个分支,旨在开发表现出人类智能的软件或机器。这包括从经验中学习、理解自然语言、解决问题以及识别模式。
插图:© IoT For All OPC UA(OPC 统一架构)是一种跨平台、面向服务、开放且安全的通信架构。它使得来自不同厂商的工业自动化设备、系统和软件应用能够实现互操作性。OPC UA 的信息模型定义了使用各种传输协议交换数据所需的代码和格式。 同样的组织也开发了 OPC UA 及其前身开放平台通信(OPC),但它们之间存在显著差异。该组织继续改进 OPC UA,以创建比原始 OPC 通信更优的架构,并更符合工业自动化不断发展的需求。OPC 基金会于 2006 年发布了 OPC UA 规范的第一个版本,截至目前,OPC UA 的版本为 1.05。除了客户端-服务器(订阅)模型外,OPC UA 还包含了发布-订阅机制,允许通过 UDP 协议、MQTT 协议或 AMQP 协议推送 JSON 规范(也可以使用标准定义的二进制规范 – UADP)。 通过 MQTT 协议提供的快速、安全且可靠的传输通道,OPC UA 可以直接通过互联网进行数据传输,同时保留 OPC UA 端到端安全性和标准化数据建模的关键优势。 EMQ Technologies Inc. ### OPC UA 的特点 **功能等价性** – 所有 OPC 经典规范都映射到 UA,并且 OPC UA 包括了 OPC 经典中发现的 DA、A&E 和 HDA 功能: | 功能 | 描述 | |------|------| | 发现 | 在本地 PC 或网络中查找可用的 OPC 服务器 | | 地址空间 | 所有数据以分层结构表示(如文件和文件夹),允许 OPC 客户端发现和使用简单和复杂的数据结构 | | 按需读写 | 根据访问权限读取和写入数据/信息 | | 订阅 | 监视数据/信息并在值超出客户端设置时报告异常 | | 事件 | 客户端设置通知重要信息 | | 方法 | 客户端可以基于服务器定义的方法执行程序等 | **安全** – 消息加密、身份验证和审计是组织选择技术标准时最重要的考虑因素之一。OPC UA 通过在防火墙之间传递数据时提供一套控制机制来解决安全性问题: | 功能 | 描述 | |------|------| | 传输 | 定义了多种协议,提供诸如超快速的 OPC 二进制传输或更通用的 SOAP-HTTPS 等选项 | | 会话加密 | 使用 128 位或 256 位加密级别,安全传输信息 | | 消息签名 | 接收时的消息签名必须与发送时一致 | | 数据包排序 | 通过排序消除消息重放攻击 | | 身份验证 | 每个 UA 客户端和服务器通过 OpenSSL 证书进行识别,提供对应用程序和系统之间连接的控制 | | 用户控制 | 应用程序可以要求用户进行身份验证(登录凭据、证书等),并可进一步限制或增强用户访问权限和地址空间“视图” | | 审计 | 记录用户和/或系统活动,以提供访问审计跟踪 | **全面的信息建模**:OPC UA 信息建模框架用于定义复杂信息,将数据转换为信息。它允许通过完全面向对象的功能来建模和扩展甚至最复杂的多层结构,并具备在配置文件中定义数据类型和结构的能力。 EMQ Technologies Inc. ### OPC UA 的信息模型 OPC UA 信息模型(地址空间)是由节点和引用组成的网络结构图。标准形式的对象在地址空间中表示,模型元素称为节点。地址空间将对象及其组件表示为节点的集合,由属性描述并通过引用连接。OPC UA 的建模就是创建节点和节点之间的引用。 **对象模型** OPC UA 使用对象作为表示处理系统中数据和活动的基础。变量、事件和方法在对象内通过引用相互连接。 EMQ Technologies Inc. ### 节点模型 EMQ Technologies Inc. **属性** 描述节点,不同的节点类具有不同的属性集。节点类的定义包括定义其属性,因此地址空间不包括属性。 **引用** 表示节点之间的关系。地址空间中存在的引用类型节点实例定义了一个引用。 **节点模型的通用属性** EMQ Technologies Inc. ### 引用模型 源节点是包含引用的节点,目标节点是被引用的节点。被引用的目标节点可以与源节点在同一地址空间中,也可以在另一个 OPC 服务器的地址空间中,甚至目标节点可以不存在。 EMQ Technologies Inc. ### 节点类型 OPC UA 中最重要的节点类别包括对象、变量和方法。 **对象节点**:用户使用对象节点构建地址空间,这些节点不包含数据。它们使用变量公开对象的值。用户可以使用对象节点分组管理对象、变量或方法;变量和方法始终归属于某个对象。 **变量节点**:变量节点表示一个值。该值的数据类型取决于变量。客户端可以读取、写入并订阅该值。 **方法节点**:方法节点表示客户端调用的服务器中的方法,并接收结果。输入参数和输出结果以变量形式作为方法节点的一部分。客户端指定输入参数,并在调用后获取输出结果。 ### 为什么将 OPC UA 与 MQTT 进行桥接? MQTT 是一种适用于物联网的轻量级、高效、可靠的通信协议,使用发布-订阅模型支持实时通信。MQTT 非常适合资源受限的环境,特别是在需要高效使用电力和带宽的场景中。 基于 MQTT 3.1.1,SparkplugB 通过行业公认的规范确保了工业物联网中灵活高效的基本数据建模。由于 MQTT 优秀的设计,SparkPlugB 实现了高度的互操作性和网络状态感知。 OPC UA 和 MQTT 在某些功能上存在重叠,但它们的使用场景非常不同: - OPC UA 通过使用标准化语言,促进工业中多种设备和系统之间的无缝通信。 - MQTT 在互联网上高效处理实时传感器数据,应对物联网应用中的低带宽和不可靠网络条件。其读/发布机制在使用上具有显著的灵活性。 在工业场景中,MQTT 在分布式系统的消息传递方面表现出色,而 OPC UA 则专注于提供互操作性。OPC UA 抽象并聚合业务数据,而 MQTT 则利用其强大的连接能力实现无缝、分布式的数据交换。 ### OPC UA over MQTT OPC 基金会在最新版 OPC UA 规范中提出的发布-订阅模型允许通过 MQTT 代理将数据变更推送给订阅者。 EMQ Technologies Inc. 发布-订阅的安全性比客户端/服务器模型稍微复杂一些,规范也未那么详细。在 MQTT 网络中,安全性基于 SSL/TLS,且代理可以在启用 SSL/TLS 传输的同时定义应用级别的身份验证。原则上,这些安全模型对每一个可以加入网络的订阅者和发布者而言都是“全有或全无”。OPC UA 的持续标准化仍在进行中,如何将丰富的 OPC UA 信息模型最佳地映射到 MQTT 上尚不明确。
您觉得本篇内容如何
评分

评论

您需要登录才可以回复|注册

提交评论

广告

iotforall

这家伙很懒,什么描述也没留下

关注

点击进入下一篇

OpenTelemetry 对于 MQTT 和物联网可观测性的优势

提取码
复制提取码
点击跳转至百度网盘