Lightweight MQTT heterogeneous protocol conversion gateway architecture system and method
By designing a lightweight MQTT heterogeneous protocol conversion gateway architecture system, the problem of real-time and low efficiency of traditional OPC technology is solved, and the rapid deployment of field devices and efficient data processing is achieved.
Patent Information
- Application Number
- CN202510403386.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-01
- Publication Date
- 2025-06-24
AI Technical Summary
The problem of low real-time and low efficiency of traditional OPC technologies.
Design a lightweight MQTT heterogeneous protocol conversion gateway architecture system, including core board, multi-protocol hardware interface module, layered deployment protocol converter, communication architecture and power management module, to realize dynamic conversion of PROFIBUS-DP and Modbus protocols and packaging of MQTT protocols.
It realizes "plug and play" on-site equipment, shortens deployment time, improves data processing efficiency, and supports real-time communication and efficient protocol conversion.
Smart Images

Figure CN120201105A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of protocol conversion, and particularly to a lightweight MQTT heterogeneous protocol conversion gateway architecture system and method. Background Art
[0002] Data acquisition of equipment at the bottom layer of the power station site is a fundamental and important link in the intelligentization of the power system data monitoring system. Data acquisition of on-site equipment is a process of converting information in the real physical world into electrical signals. When the power station equipment generates electricity, it is necessary to monitor the operating status and production process of the equipment, such as production data such as the rotation speed of the water turbine shaft, the rotation speed of the fan, the working temperature of the equipment, and the power output status. On-site data acquisition should adapt to various complex on-site environments, integrate multiple interfaces, and field bus communication protocols.
[0003] Data acquisition of the data monitoring system should consider the complexity of the industrial environment and the real-time nature of heterogeneous data acquisition. There are many types of industrial field protocols with different structures. When collecting data, as many on-site communication protocols as possible should be compatible. Protocol conversion is generally achieved through technologies such as OPC and protocol converters. The real-time performance of technologies such as OPC is not high. Protocol converters are suitable for industrial scenarios with high requirements for real-time performance and efficiency and simple deployment. Summary of the Invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the technical problem solved by the present invention is the problem of low real-time performance and low efficiency of traditional technologies such as OPC.
[0006] To solve the above technical problems, the present invention provides the following technical solution: A lightweight MQTT heterogeneous protocol conversion gateway architecture system, which includes,
[0007] A core board for running a real-time operating system;
[0008] A multi-protocol hardware interface module integrated on the core board, the multi-protocol hardware interface module includes RS-232 / 485 serial ports, RJ45 Ethernet interfaces, USB interfaces, and WiFi modules;
[0009] A hierarchically deployed protocol converter provided on the core board for dynamically converting PROFIBUS-DP and Modbus protocols at each layer of the OSI model;
[0010] A communication architecture on the core board, including a publish or subscribe message broker mechanism;
[0011] A power management module connected to the core board for dynamic power consumption regulation and power-off protection mechanism.
[0012] As a preferred solution of a lightweight MQTT heterogeneous protocol conversion gateway architecture system according to the present invention, wherein: the multi-protocol hardware interface module further includes,
[0013] A 4G communication module extended through a USB interface, used for LTE Cat.4 network access;
[0014] An isolated DC-DC power circuit, used to achieve electromagnetic interference isolation between the signal channel and the power channel;
[0015] And an on-board storage unit, configured as a combination of NOR Flash and DDR2 SDRAM.
[0016] As a preferred solution of a lightweight MQTT heterogeneous protocol conversion gateway architecture system according to the present invention, wherein: the operation method of the protocol converter includes,
[0017] Upward data path: After parsing the physical layer data of the PROFIBUS-DP protocol through the data link layer, map it to the data unit of the Modbus TCP protocol through the application layer;
[0018] Downward data path: After encapsulating the MQTT protocol payload data through the TCP / IP protocol stack, convert it into PROFIBUS-DP service primitives;
[0019] A dynamic protocol mapping table, used to maintain the correspondence between physical addresses and IP addresses.
[0020] As a preferred solution of a lightweight MQTT heterogeneous protocol conversion gateway architecture system according to the present invention, wherein: the operation method of the protocol converter further includes,
[0021] Establish a double-buffer mapping area to store upward parsed data and downward encapsulated data respectively;
[0022] Adopt an event-driven mechanism to trigger protocol conversion operations, and the response time is less than 50 μs;
[0023] Implement format conversion between FDL frames and Modbus ADUs at the data link layer.
[0024] As a preferred solution of a lightweight MQTT heterogeneous protocol conversion gateway architecture system according to the present invention, wherein: the communication architecture includes,
[0025] A quality of service grading mechanism, dynamically selecting different levels according to the network conditions;
[0026] Subject tree naming space management, used for multi-level device identifier encoding;
[0027] The load balancing strategy of the message broker server, which dynamically allocates proxy nodes based on connection heartbeat packets.
[0028] As a preferred solution of a lightweight MQTT heterogeneous protocol conversion gateway architecture system according to the present invention, wherein: the message transmission process of the communication architecture includes
[0029] Establish a secure connection between the client and the proxy server using an encrypted channel to implement the will message mechanism for handling abnormal disconnection scenarios;
[0030] Among them, the encrypted channel is based on the multi-level subscription filtering function of topic wildcards.
[0031] As a preferred solution of a lightweight MQTT heterogeneous protocol conversion gateway architecture system according to the present invention, wherein: the power management module includes
[0032] An input preset voltage range wide voltage adaptation circuit;
[0033] A supercapacitor backup power supply for maintaining emergency power supply for 30 seconds in case of abnormal power failure;
[0034] And a dynamic frequency adjustment module for adjusting the CPU main frequency according to the load.
[0035] Another object of the present invention is to provide a lightweight MQTT heterogeneous protocol conversion gateway architecture method, including the following steps
[0036] Establish a protocol syntax tree and a semantic mapping rule library;
[0037] Quickly identify the protocol type through protocol feature codes;
[0038] Adopt CRC check retransmission and protocol fallback mechanisms;
[0039] Among them, the protocol feature code recognition includes
[0040] Perform pattern matching on the start delimiter and frame check sequence of the PROFIBUS-DP frame;
[0041] Perform transaction identifier analysis on the MBAP message header of ModbusTCP;
[0042] Establish a protocol fingerprint library to support a fuzzy matching fault tolerance mechanism.
[0043] The present invention provides a computer device, including a memory and a processor, the memory stores a computer program, and is characterized in that when the processor executes the computer program, it implements the lightweight MQTT heterogeneous protocol conversion gateway architecture system described above.
[0044] The present invention provides a computer-readable storage medium, on which a computer program is stored. It is characterized in that when the computer program is executed by a processor, the lightweight MQTT heterogeneous protocol conversion gateway architecture system is implemented.
[0045] Advantages of the present invention:
[0046] Establish an intelligent mapping between the physical address, i.e., the PROFIBUS-DP station address, and the IP address, support "plug and play" of field devices, and shorten the deployment time from several hours in the traditional way to 10 minutes. Secondly, by analyzing characteristic codes such as the start delimiter and transaction identifier, automatic protocol type recognition is realized, avoiding manual configuration errors, and then normalizing different protocol data into MQTT topic messages, so that the cloud does not need to adapt multiple protocol interfaces, improving the data processing efficiency.
[0047] This method also supports 9 - 36VDC input, while the traditional gateway is 24V ± 10%. It is built-in with TVS tubes and magnetic coupling isolation, can pass the 4kV surge test defined by the IEC61000-4-5 standard, and maintains the operation of the core system for 30 seconds when powered off to ensure that key data is saved to Flash, avoiding the high-temperature failure risk of the traditional battery backup power supply scheme. Secondly, when detecting abnormal ModbusTCP communication, it automatically switches to the ModbusRTU mode to shorten the communication recovery time. Description of the Drawings
[0048] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0049] Figure 1 It is the bus device - to - device transmission method of a lightweight MQTT heterogeneous protocol conversion gateway architecture system provided by an embodiment of the present invention.
[0050] Figure 2 It is the protocol structure analysis diagram of a lightweight MQTT heterogeneous protocol conversion gateway architecture system provided by an embodiment of the present invention.
[0051] Figure 3 It is the protocol conversion communication model of a lightweight MQTT heterogeneous protocol conversion gateway architecture system provided by an embodiment of the present invention.
[0052] Figure 4 It is the MQTT message transmission model diagram of a lightweight MQTT heterogeneous protocol conversion gateway architecture system provided by an embodiment of the present invention.
[0053] Figure 5 The MQTT communication protocol architecture diagram of a lightweight MQTT heterogeneous protocol conversion gateway architecture system provided by an embodiment of the present invention.
[0054] Figure 6 The hardware platform structure diagram of a lightweight MQTT heterogeneous protocol conversion gateway architecture system provided by an embodiment of the present invention.
[0055] Figure 7 The gateway management system architecture diagram of a lightweight MQTT heterogeneous protocol conversion gateway architecture system provided by an embodiment of the present invention. Detailed implementation manners
[0056] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will describe the detailed implementation manners of the present invention in conjunction with the accompanying drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of them. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0057] First, it should be known that:
[0058] MQTT (Message Queuing Telemetry Transport), a lightweight Internet of Things communication protocol based on the publish / subscribe model, is designed for low-bandwidth, high-latency, or unreliable networks. It supports three service quality (QoS) levels: QoS0 (at most once): The message is transmitted as best as possible without guaranteeing arrival; QoS1 (at least once): Ensures the message arrives, but may be repeated; QoS2 (exactly once): Strictly guarantees that the message is transmitted only once. In the invention, the gateway uploads industrial device data to the cloud platform through the MQTT protocol and receives cloud instructions.
[0059] The OSI model (Open Systems Interconnection Model) is a seven-layer network communication framework defined by the International Organization for Standardization (ISO): Physical layer (such as RS-485, Ethernet PHY): responsible for electrical signal transmission; Data Link layer (such as FDL frame, Modbus ADU): processes data frame encapsulation and verification; Network layer (such as IP protocol): realizes routing and addressing; Transport layer (such as TCP / UDP): ensures end-to-end reliable transmission; Session layer: manages communication sessions; Presentation layer: data format conversion (such as encryption / decryption); Application layer (such as MQTT, Modbus TCP): provides user interface services. In the present invention, the protocol converter utilizes the OSI layering characteristics to achieve dynamic mapping of PROFIBUS-DP and Modbus protocols at different levels.
[0060] PROFIBUS-DP (Decentralized Periphery) is an industrial fieldbus protocol dedicated to high-speed communication at the device level (such as between PLC and sensors), and its characteristics include: Physical layer: differential signal transmission based on RS-485; Data Link layer: adopts the FDL (Fieldbus Data Link) frame structure, including start delimiter (SD), destination address, data unit, and frame check sequence (FCS); Application layer: defines service primitives such as device parameter reading / writing and diagnosis. In the present invention, the gateway parses the FDL frame of PROFIBUS-DP, extracts the payload, and then converts it into the Modbus ADU format.
[0061] The Modbus protocol includes two variants: One is Modbus RTU / ASCII: a binary / ASCII encoding protocol based on serial ports (RS-232 / 485); The other is Modbus TCP / UDP: a protocol based on Ethernet, using the MBAP (Modbus Application Protocol) header, which contains fields such as transaction identifier and protocol identifier. In the present invention, the gateway encapsulates the Modbus TCP data unit (ADU) through MQTT and uploads it to the cloud, and reversely converts the cloud instructions into Modbus service requests.
[0062] RS-232 / 485 includes RS-232: a point-to-point serial communication standard with a short transmission distance (<15m), commonly used for debugging interfaces; and RS-485: a differential signal bus that supports multi-point communication (up to 1200m) and has strong anti-interference ability, used for interconnection of industrial field devices. The RS-485 interface is connected to the PLC device, and RS-232 is used for local debugging.
[0063] The LTE Cat.4 is a 4G communication module that supports the 4G network standard with a maximum downlink rate of 150 Mbps and an uplink rate of 50 Mbps. In the embodiment, it is extended through the USB interface to provide the gateway with cellular network access capabilities.
[0064] The NOR Flash is used to store firmware, configuration CRC files, and logs, and supports the XIP (Execute In Place) feature, while the DDR2 SDRAM serves as the system running memory to cache real-time data and intermediate results of protocol conversion.
[0065] The FDL frame is the data link layer frame structure of PROFIBUS-DP, which includes SD (Start Delimiter), DA / SA (Destination / Source Address), FC (Function Code), data unit, and FCS (Frame Check Sequence); the Modbus ADU is the application data unit, including the message structure of Modbus TCP, which consists of the MBAP header (Transaction ID, Protocol ID, etc.) and PDU (Protocol Data Unit).
[0066] CRC check is the Cyclic Redundancy Check, a data integrity verification algorithm, which is used in the present invention for data verification before and after protocol conversion. If an error is detected, the retransmission mechanism is triggered.
[0067] Example 1, referring to Figures 1 to 7 , is the first embodiment of the present invention. This embodiment provides a lightweight MQTT heterogeneous protocol conversion gateway architecture system, including:
[0068] A core board for running a real-time operating system;
[0069] A multi-protocol hardware interface module integrated on the core board, which includes RS-232 / 485 serial ports, RJ45 Ethernet interfaces, USB interfaces, and WiFi modules;
[0070] A hierarchically deployed protocol converter set on the core board for dynamically converting PROFIBUS-DP and Modbus protocols at each layer of the OSI model;
[0071] A communication architecture on the core board, including a publish or subscribe message broker mechanism;
[0072] A power management module connected to the core board for dynamic power consumption regulation and power-off protection mechanisms.
[0073] In an optional embodiment, the core board used is the core board of the MT7628AN processor, running the YHFT SylixOS embedded real-time operating system; the communication architecture is built based on the MQTT protocol.
[0074] Based on the hard real-time kernel of SylixOS, combined with the hierarchical analysis of the OSI model (physical layer → application layer), the protocol conversion time from PROFIBUS-DP to Modbus is compressed to 45 μs, meeting the emergency instruction transmission requirements (IEC 61850 standard) in scenarios such as turbine overspeed protection;
[0075] The multi-protocol hardware interface module also includes,
[0076] A 4G communication module extended through a USB interface for LTE Cat.4 network access;
[0077] An isolated DC-DC power circuit for electromagnetic interference isolation between the signal channel and the power channel;
[0078] And an on-board storage unit configured as a combination of NOR Flash and DDR2 SDRAM.
[0079] The operation method of the protocol converter includes,
[0080] Upward data path: After parsing the physical layer data of the PROFIBUS-DP protocol through the data link layer, map it to the data unit of the Modbus TCP protocol through the application layer; This ensures that data can be quickly and accurately transmitted from the PROFIBUS-DP network to the Modbus TCP network.
[0081] Downward data path: Encapsulate the MQTT protocol payload data through the TCP / IP protocol stack and convert it into PROFIBUS-DP service primitives; This conversion process ensures the integrity and real-time nature of the data.
[0082] A dynamic protocol mapping table for maintaining the correspondence between physical addresses and IP addresses.
[0083] This method supports multiple protocols such as PROFIBUS-DP, Modbus TCP, and MQTT, enabling the system to seamlessly connect different industrial devices and Internet of Things devices, improving the compatibility and interoperability of the system. By maintaining the correspondence between physical addresses and IP addresses through the dynamic protocol mapping table, communication between different network layer devices is ensured, enhancing the flexibility and adaptability of the system.
[0084] The operation method of the protocol converter also includes,
[0085] Establish a double-buffer mapping area to store the upward parsed data and the downward encapsulated data respectively; By establishing a double-buffer mapping area to store the upward parsed data and the downward encapsulated data respectively, the integrity of the data during the conversion process is ensured. This mechanism can prevent data read-write conflicts, avoid data loss or errors, and improve the reliability of data transmission.
[0086] The event-driven mechanism is adopted to trigger protocol conversion operations, and the response time is less than 50 μs. This mechanism ensures that the system can quickly respond to data changes, meets the high requirements for real-time performance in industrial automation, and improves the system's response speed and data processing efficiency.
[0087] The format conversion between FDL frames and Modbus ADUs is implemented at the data link layer. This ensures the compatibility of data formats between different protocols. This conversion mechanism improves the system's compatibility, enabling seamless docking of devices with different protocols.
[0088] The communication architecture includes
[0089] A quality of service grading mechanism that dynamically selects different levels according to the network conditions. Dynamically selecting different quality of service levels according to the network conditions ensures the transmission priority of critical data and improves the overall quality of service of the system.
[0090] Subject tree-shaped namespace management for multi-level device identifier encoding. Through multi-level device identifier encoding, the identification and management of devices are simplified, the efficiency and accuracy of device management are improved, and the management of a large number of devices is supported, enabling the system to easily expand and adapt to the growing number of devices.
[0091] The load balancing strategy of the message broker server, which dynamically allocates proxy nodes based on connection heartbeat packets. Dynamically allocating proxy nodes based on connection heartbeat packets ensures the load balancing of the message broker server and improves the reliability and availability of the system.
[0092] The message transmission process of the communication architecture includes
[0093] An encrypted channel is used to establish a secure connection between the client and the proxy server for implementing the will message mechanism to handle abnormal disconnection scenarios. This ensures the confidentiality and integrity of data during transmission, preventing data from being stolen or tampered with. Secondly, when the client disconnects abnormally, the proxy server can receive and process the will message in a timely manner, ensuring that the system can respond to abnormal situations in a timely manner and improving the reliability and fault tolerance of the system.
[0094] Among them, the encrypted channel is based on the multi-level subscription filtering function of topic wildcards, enabling the client to flexibly subscribe to messages of specific topics, improving the flexibility and pertinence of message distribution, and adapting to the growing number of devices and complex message transmission requirements.
[0095] The power management module includes
[0096] An input preset voltage range wide-voltage adaptation circuit;
[0097] A supercapacitor backup power supply for maintaining emergency power supply for 30 seconds in case of abnormal power-off;
[0098] And a dynamic frequency adjustment module, configured to adjust the main frequency of the CPU according to the load.
[0099] In an optional embodiment, in order to achieve good generality, compatibility, and real-time performance, the gateway device used runs the SylixOS embedded operating system of YH, so there are certain requirements for the processing performance of the hardware processor and peripherals. The MT7628 with comprehensive integrated functions is used as the processor of the gateway core board, and the hardware circuits of each part of the gateway are designed accordingly.
[0100] The MT7628AN chip is a new generation of system-on-chip, which can effectively improve the radio frequency performance, reduce power consumption, and optimize the overall bill of materials (BOM) cost. It is the most cost-effective 2x2 802.11n solution. The chip integrates a WiFi transceiver, a 580MHz MIPS24k CPU core, a 5-port high-speed Ethernet port physical layer (Ethernet PHY), and multiple slow input / output (I / O) for connecting different sensors, etc. The MT7628AN chip adopts a QFN package form, and generally, a PCB board with 4 layers or more needs to be drawn for the design, and manual soldering is inconvenient. There are now multiple MT7628AN core boards, minimum system boards, and development boards on the market. Based on the MT7628AN core board, the peripheral module circuits can be designed and built, thereby shortening the development cycle and improving the development efficiency. The MT7628 core board adopted in the present invention is used as the basis, and a power management module, a serial communication module, a USB module, a network interface module, a WIFI module, etc. are designed on this basis to complete the hardware functions.
[0101] And the gateway adopts the domestic SylixOS system of YH. SylixOS provides a complete development platform integrating design, development, debugging, simulation, deployment, and testing, which is convenient for system development and debugging, speeds up software R & D, shortens the product development cycle, and helps users focus on application development. The embedded real-time operating system has strong real-time performance and openness. The development work of the embedded system is mainly carried out on a non-standard hardware platform. Based on an open-source system, system transplantation and customized development will be easier.
[0102] The protocol converter is based on the OSI 7-layer reference model and is fully reused in the 7-layer model of the gateway. The protocols required for protocol conversion are deployed at each layer. Users can then process data and issue commands at the application layer. The data or commands are continuously packed, parsed, and then translated and packed into another protocol or parsed in another protocol format. Different transmission media and data forwarding mechanisms are available at different layers. Therefore, the protocol converter can deploy the required protocols layer by layer in each layer of the gateway with the help of the hardware conditions of the gateway to achieve the conversion of different bus protocols.
[0103] The function of protocol conversion is to transmit the data of the source device to the target device through the established communication connection. In the industrial field, the efficiency requirement for data transmission is relatively high, and generally the 3rd - 6th layers are omitted. Figure 1 It is the transmission method of the fieldbus protocol between different devices.
[0104] There are various industrial protocols in the power station site. Now, two relatively commonly used protocols, PROFIBUS - DP and MODBUS, are analyzed. The analysis methods of other protocols are similar to theirs. The protocol structure analysis of the two is as Figure 2 shown.
[0105] The PROFIBUS - DP protocol structure includes three layers: the physical layer, the data link layer, and the application layer. Among them, the physical layer protocol is IEC61158 - 2, which includes various protocols of the IEC61158 standard; the data link layer protocol is FDL. The FDL protocol has the advantage of almost the same data throughput rate as that provided by the hardware and has high flexibility; the application layer is the S7 protocol family, including the presentation layer, the session layer, and the application layer. The S7 protocol must send a communication request after establishing a connection. Otherwise, the server will disconnect the connection. The MODBUS protocol includes ModbusRTU / ASCII and ModbusTCP / UDP. The former's physical layer protocol is RS - 485 / 232, and the latter's physical layer protocol is the Ethernet port ModbusTCP / UDP.
[0106] The protocol transport layer and the network layer are the TCP / IP protocol. The application layer of the MODBUS protocol defines the application data unit. The protocol specifications and the number of layers of each layer of the two protocols are different except for the physical layer. To implement the intelligent production monitoring function of the system, the system needs protocol conversion to establish a communication transmission path from the perception layer device to the application layer server.
[0107] Through the above - mentioned analysis of the protocol conversion principle and protocol structure, the protocol conversion of PROFIBUS / Modbus is based on the TCP / IP protocol stack, and the application layer is in the form of MQTT protocol transmission. The present invention proposes an industrial field multi - protocol communication model as Figure 3 shown.
[0108] Figure 3 The multi - protocol communication model in [] is based on hierarchical design. The core idea of its conversion is to parse the data content carried by the PROFIBUS or Modbus protocol to be converted layer by layer and store it in the mapping area (Readmap), and then publish the data to the server through the application layer MQTT protocol to complete the data uplink transmission. The server data is stored in the write mapping area (Writemap) through MQTT transmission, and then reaches the PLC device through layer - by - layer encapsulation to achieve data downlink transmission, thus completing the protocol conversion.
[0109] When comparing the HTTP protocol and the MQTT protocol in the industrial Internet of Things environment, using the MQTT protocol for communication transmission under limited bandwidth resources is an ideal choice. By analyzing the communication principle and message of the MQTT protocol, the communication architecture design of the system's MQTT protocol is proposed.
[0110] The message transmission model of MQTT protocol communication is as Figure 4 shown. The communication architecture based on the MQTT protocol mainly has three identities, namely the publisher (Pub), the subscriber (Sub), and the message broker. Both the publisher and the subscriber are MQTT clients, and the message broker is the message broker server. The subscriber and the publisher do not communicate directly. They need to go through the message broker server for message filtering and forwarding to send the messages published by the publisher to the subscriber, and the two do not interfere with each other.
[0111] The communication between MQTT clients is mainly achieved through the topic. Different levels of topics are used to distinguish different information. Subscribers can obtain corresponding data by subscribing to different topics and different levels. The MQTT protocol determines the distribution of application messages through the defined quality of service (QoS) levels. There are a total of 3 service levels, allowing users to select different service levels in different working environments to ensure the reliable and accurate transmission of messages.
[0112] Based on the MQTT protocol message transmission model and the three-layer system architecture, the communication architecture of the MQTT protocol is designed as Figure 5 shown. The MQTT clients deployed on the gateway and the cloud platform are both at the application layer. After configuring the IP and port number through the network, they are connected to the message broker server. The server will assign a uniquely identified ID number to the client. The client can publish messages on any topic to the message broker server, and the message broker server will forward this topic message to all subscribers who subscribe to this topic message, realizing the communication between the publisher and the subscriber.
[0113] The gateway core board uses Feiteng FD 2000 as the main control chip, and expands corresponding functional modules and interfaces peripherally. The solution adopted by this gateway mainly uses the main control chip with the MIPS architecture to control the network port and serial port to collect data of industrial field devices, and then realizes various network access methods through external modules and conducts data communication with the cloud server at the application layer. The architecture is as Figure 6 shown. Accordingly, the key points of hardware design are summarized as follows:
[0114] The gateway provides 3 RJ45 Ethernet interfaces and supports WiFi access, with basic networking capabilities; the gateway provides a USB interface as the interface for the 4G module, enabling the device to have 4G Internet access capabilities; the gateway has certain power management capabilities, such as reducing power consumption, handling accidental power outages, and adding anti-interference isolation, etc.; the gateway has certain storage capabilities (32MB Flash, 128MB DDR2 memory) to store the system, programs, configuration files, and historical data; the gateway provides RS-232 and RS-485 serial interfaces to achieve communication between the gateway and the devices in the perception layer; the gateway provides a standard USB interface to enable U disk program upgrades.
[0115] The main processor of the gateway integrates WiFi and a 5-port 100M Ethernet port, and the power module provides the working voltage for the main processor and peripheral circuits; the serial communication module realizes data communication between the gateway and the devices in the perception layer and is responsible for collecting device production data.
[0116] The USB module provides interfaces to ensure user program upgrades and implement USB interface functions; the network interface module ensures the wired network connection between the gateway and the perception devices, the communication between the gateway and the cloud platform, and completes the remote debugging of the gateway software.
[0117] The 4G module mainly provides the 4G Internet access method for the gateway and provides GPS positioning services to improve the versatility of the gateway.
[0118] The system software mainly consists of gateway software and cloud platform software. The gateway mainly realizes functions such as system data collection, transmission, and security; the cloud platform mainly realizes functions such as data display, storage, and monitoring. The XINJE cloud platform is selected for the cloud platform, which is not only simple to deploy and convenient to use, but also free for users. The gateway software is based on the SylixOS system and mainly consists of a general module, protocol conversion, MQTT protocol communication, and data security module.
[0119] In the gateway software system, it includes MQTTClient, industrial protocol drivers (OPCUA protocol, Modbus protocol, Siemens S7 protocol), and other functions. The main tasks are to complete the two-way transmission between industrial data and MQTT data and perform data format conversion according to relevant protocols. It realizes data interaction with the cloud platform through the MQTT protocol. The protocol parameter configuration module is responsible for configuring the access parameters of industrial protocol data, the data parsing module is responsible for converting the standard and format of the uplink and downlink data, the gateway log module is responsible for recording the actions during the operation of the cloud gateway, and the data synchronization module is responsible for local backup storage of data.
[0120] In another alternative embodiment, a certain hydropower station needs to monitor key parameters such as the turbine speed (0 - 500 rpm), the generator winding temperature (0 - 150 °C), and the output voltage (10 kV ± 5%) in real time. The on-site devices include: PROFIBUS-DP devices: Siemens S7-1200 PLC, which collects turbine bearing vibration data through the RS-485 bus; Modbus TCP devices: Schneider electric energy meters, which upload power generation data through the Ethernet; local sensors: temperature transmitters (RS-485 interface, Modbus RTU protocol). The traditional solution requires the deployment of multiple protocol-specific gateways, resulting in complex wiring and difficult data integration. The gateway architecture adopted in this embodiment realizes unified access of multiple protocols and cloud monitoring.
[0121] In the scenario of network interruption, such as the loss of WiFi signal, when the gateway detects that the heartbeat packet times out, the present invention automatically switches to the 4G cellular network (switching time < 500 ms); enables the Last Will message to notify the cloud that the "gateway is offline"; locally caches the unuploaded data to Flash (maximum storage for 24 hours).
[0122] In the scenario of protocol verification failure, such as receiving a PROFIBUS-DP frame with a CRC verification error, discard the error frame, record the error code in the log; retransmit the last 3 valid data through the dynamic protocol mapping table; if the consecutive errors > 5 times, switch to the backup RS-485 channel.
[0123] In this embodiment, a single gateway simultaneously processes PROFIBUS-DP, Modbus RTU / TCP protocols, reducing the number of devices and wiring costs; the hierarchical protocol conversion and double buffering technology ensure that the transmission delay of emergency instructions (such as overvoltage protection) < 80 ms; the wide voltage input and super capacitor backup power design pass the 72-hour salt spray test and the -40 °C low-temperature start test; support U disk firmware upgrade and cloud rule configuration, and shorten the new device adaptation time to 2 hours.
[0124] Embodiment 2 is the second embodiment of the present invention, which is different from the previous embodiment in that:
[0125] If the above-mentioned functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0126] The logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a predefined sequence list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or in combination with these instruction execution systems, apparatuses, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in combination with an instruction execution system, apparatus, or device.
[0127] More specific examples (nonexhaustive list) of computer-readable media include the following: electrical connection parts with one or more wirings (electronic devices), portable computer disk cartridges (magnetic devices), random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memories), fiber optic devices, and portable compact disc read-only memories (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, then editing, interpreting, or processing it in other suitable ways if necessary, and then storing it in a computer memory.
[0128] It should be understood that various parts of the present invention can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logic functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
[0129] Embodiment 3 is the third embodiment of the present invention. This embodiment provides a lightweight MQTT heterogeneous protocol conversion gateway architecture method, including the following steps:
[0130] Establish a protocol syntax tree and a semantic mapping rule library;
[0131] Quickly identify the protocol type through protocol feature codes;
[0132] Adopt a CRC check retransmission and protocol fallback mechanism;
[0133] Among them, the protocol feature code identification includes:
[0134] Perform pattern matching on the start delimiter and frame check sequence of the PROFIBUS-DP frame;
[0135] Perform transaction identifier analysis on the MBAP message header of ModbusTCP;
[0136] Establish a protocol fingerprint library to support a fuzzy matching fault tolerance mechanism.
[0137] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not restrictive. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention, and they should all be covered by the scope of the claims of the present invention.
Claims
1. A lightweight MQTT heterogeneous protocol conversion gateway architecture system, characterized by: include, Core board, used to run real-time operating system; A multi-protocol hardware interface module integrated on the core board, the multi-protocol hardware interface module comprising an RS-232 / 485 serial port, an RJ45 Ethernet interface, a USB interface and a WiFi module; A hierarchically deployed protocol converter arranged on the core board is used to realize dynamic conversion between PROFIBUS-DP and Modbus protocols at each layer of the OSI model; The communication architecture on the core board includes a publish or subscribe message agent mechanism; The power management module connected to the core board is used for dynamic power consumption regulation and power-off protection mechanism.
2. A lightweight MQTT heterogeneous protocol conversion gateway architecture system as described in claim 1, characterized in that: The multi-protocol hardware interface module also includes: 4G communication module expanded through USB interface for LTE Cat.4 network access; Isolated DC-DC power supply circuit, used to achieve electromagnetic interference isolation between signal channel and power channel; And an onboard memory unit configured as a combination of NOR Flash and DDR2 SDRAM.
3. A lightweight MQTT heterogeneous protocol conversion gateway architecture system as described in claim 2, characterized in that: The operating method of the protocol converter includes: Uplink data path: After the physical layer data of the PROFIBUS-DP protocol is parsed by the data link layer, it is mapped to the data unit of the ModbusTCP protocol through the application layer; Downstream data path: The MQTT protocol payload data is encapsulated by the TCP / IP protocol stack and converted into PROFIBUS-DP service primitives; Dynamic protocol mapping table, used to maintain the correspondence between physical addresses and IP addresses.
4. A lightweight MQTT heterogeneous protocol conversion gateway architecture system as described in claim 3, characterized in that: The operation method of the protocol converter also includes: Establish a double buffer mapping area to store uplink parsed data and downlink encapsulated data respectively; An event-driven mechanism is used to trigger protocol conversion operations, and the response time is less than 50μs; Implement format conversion between FDL frame and ModbusADU at the data link layer.
5. A lightweight MQTT heterogeneous protocol conversion gateway architecture system as described in claim 4, characterized in that: The communication architecture includes: Service quality grading mechanism, dynamically selecting different levels according to network conditions; Topic tree namespace management for multi-level device identifier encoding; The load balancing strategy of the message proxy server dynamically allocates proxy nodes based on connection heartbeat packets.
6. A lightweight MQTT heterogeneous protocol conversion gateway architecture system as described in claim 5, characterized in that: The message transmission process of the communication architecture includes: An encrypted channel is used to establish a secure connection between the client and the proxy server to implement the will message mechanism to handle abnormal disconnection scenarios; The encrypted channel has a multi-level subscription filtering function based on topic wildcards.
7. A lightweight MQTT heterogeneous protocol conversion gateway architecture system as claimed in claim 6, characterized in that: The power management module includes: Input preset voltage range wide voltage adaptation circuit; Supercapacitor backup power supply, used to maintain 30 seconds of emergency power supply in the event of abnormal power outage; And, a dynamic frequency adjustment module is used to adjust the CPU main frequency according to the load.
8. A heterogeneous protocol conversion method, applied to a lightweight MQTT heterogeneous protocol conversion gateway architecture system as described in any one of claims 1-7, characterized in that: The following steps are included: Establish protocol syntax tree and semantic mapping rule base; Quickly identify protocol types through protocol signature codes; Adopt CRC check retransmission and protocol fallback mechanism; Wherein, the protocol feature code identification includes: Perform pattern matching on the start delimiter and frame check sequence of PROFIBUS-DP frame; Perform transaction identifier analysis on the MBAP message header of ModbusTCP; Establish a protocol fingerprint library to support fuzzy matching fault tolerance mechanism.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, a lightweight MQTT heterogeneous protocol conversion gateway architecture system as described in any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, a lightweight MQTT heterogeneous protocol conversion gateway architecture system according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
4G and Modbus multi-protocol conversion gateway and method
CN121037466A