CN-121173882-B - Multi-protocol conversion gateway data interaction method, system, equipment and storage medium
Abstract
The application relates to a multi-protocol conversion gateway data interaction method, a system, equipment and a storage medium, wherein the method comprises the steps of receiving and reading a data packet to be analyzed, judging the source equipment type of the data packet to be analyzed, selecting a corresponding protocol analysis rule according to the source equipment type, analyzing the data packet to be analyzed to obtain an analysis field, carrying out address mapping and communication protocol selection according to the analysis field, determining a final equipment address and a target communication protocol of target equipment, carrying out data packet format conversion according to the target communication protocol and the analysis field to obtain a data packet to be forwarded, forwarding the data packet to be forwarded to the final equipment address according to the target communication protocol, and sending the data packet to the target equipment. The application has the effect of improving the convenience of multi-protocol data interaction.
Inventors
- YU ZHIHENG
- CHEN LIANG
- HUANG SHANFU
Assignees
- 深圳市华茂欧特科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20251121
Claims (7)
- 1. The multi-protocol conversion gateway data interaction method is characterized by comprising the following steps of: receiving and reading a data packet to be analyzed, and judging the type of source equipment of the data packet to be analyzed; Selecting a corresponding protocol analysis rule according to the source equipment type and analyzing the data packet to be analyzed to obtain an analysis field; address mapping and communication protocol selection are carried out according to the analysis field, and the final equipment address and the target communication protocol of the target equipment are determined; carrying out data packet format conversion according to the target communication protocol and the analysis field to obtain a data packet to be forwarded; Forwarding the data packet to be forwarded to the final equipment address according to the target communication protocol, and sending the data packet to be forwarded to the target equipment; The step of selecting a corresponding protocol analysis rule according to the source equipment type and analyzing the data packet to be analyzed to obtain an analysis field, specifically comprising: Selecting a corresponding protocol analysis rule according to the type of the source equipment; according to the protocol analysis rule, analyzing the data packet to be analyzed into an analysis field with a corresponding format, wherein the analysis field comprises an original data packet head, an original data field and an original CRC check bit; after parsing the data packet to be parsed into the parsing field with the corresponding format, the method further comprises: performing CRC on the data packet to be analyzed according to the original CRC bit to obtain a check result; when the verification result is that the verification fails, analyzing the original data packet header according to the protocol analysis rule to obtain a source equipment address, and sending a data packet retransmission request to the source equipment address; The address mapping and communication protocol selection are performed according to the analysis field, and the final equipment address and the target communication protocol of the target equipment are determined, which concretely comprises the following steps: analyzing the original data packet header through the protocol analysis rule to obtain a target equipment address; Obtaining a pre-constructed device address comparison table, and searching a target device type and a final device address corresponding to the target device address in the device address comparison table; And matching the target communication protocol corresponding to the target equipment according to the type of the target equipment.
- 2. The method for interacting data of a multi-protocol conversion gateway according to claim 1, wherein the steps of receiving and reading a data packet to be parsed, and determining a source device type of the data packet to be parsed include: reading a protocol identification field in a data packet to be analyzed and carrying out feature recognition to obtain protocol identification feature information; and judging the type of the source equipment of the data packet to be analyzed according to the protocol identification characteristic information.
- 3. The method for interacting data of a multi-protocol conversion gateway according to claim 1, wherein the converting the format of the data packet according to the target communication protocol and the parsing field to obtain the data packet to be forwarded specifically includes: generating a data packet head to be forwarded according to the target communication protocol, and recalculating a CRC check value to obtain the CRC to be forwarded; and encapsulating the data packet head to be forwarded, the CRC to be forwarded and the original data field into a data packet to be forwarded according to the target communication protocol.
- 4. A multi-protocol conversion gateway data interaction system, the multi-protocol conversion gateway data interaction system comprising: The data receiving module is used for receiving and reading the data packet to be analyzed and judging the type of source equipment of the data packet to be analyzed; The data analysis module is used for selecting a corresponding protocol analysis rule according to the type of the source equipment and analyzing the data packet to be analyzed to obtain an analysis field; The mapping and protocol selection module is used for carrying out address mapping and communication protocol selection according to the analysis field and determining the final equipment address and the target communication protocol of the target equipment; the format conversion module is used for carrying out data packet format conversion according to the target communication protocol and the analysis field to obtain a data packet to be forwarded; The data forwarding module is used for forwarding the data packet to be forwarded to the final equipment address according to the target communication protocol and sending the data packet to be forwarded to the target equipment; the data analysis module comprises: the rule selection submodule is used for selecting a corresponding protocol analysis rule according to the type of the source equipment; The field analysis submodule is used for analyzing the data packet to be analyzed into an analysis field with a corresponding format according to a protocol analysis rule, wherein the analysis field comprises an original data packet head, an original data field and an original CRC check bit; The field parsing submodule includes: The checking execution unit is used for carrying out CRC check on the data packet to be analyzed according to the original CRC check bit to obtain a check result; The retransmission request unit is used for resolving the original data packet header according to the protocol resolving rule to obtain the source equipment address when the checking result is that the checking fails, and sending a data packet retransmission request to the source equipment address; the mapping and protocol selection module comprises: the target analysis submodule is used for analyzing the original data packet header through the protocol analysis rule to obtain a target equipment address; the address mapping sub-module is used for acquiring a pre-constructed device address comparison table, and searching a target device type and a final device address corresponding to the target device address in the device address comparison table; And the protocol matching sub-module is used for matching the target communication protocol corresponding to the target equipment according to the type of the target equipment.
- 5. The multi-protocol conversion gateway data interaction system according to claim 4, wherein the data receiving module specifically comprises: The protocol identification sub-module is used for reading the protocol identification field in the data packet to be analyzed and carrying out feature identification to obtain the protocol identification feature information; And the source type judging sub-module is used for judging the source equipment type of the data packet to be analyzed according to the protocol identification characteristic information.
- 6. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the multi-protocol conversion gateway data interaction method according to any of claims 1 to 3 when the computer program is executed.
- 7. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of the multiprotocol conversion gateway data interaction method of any one of claims 1 to 3.
Description
Multi-protocol conversion gateway data interaction method, system, equipment and storage medium Technical Field The present application relates to the technical field of industrial automation system communication, and in particular, to a method, a system, a device and a storage medium for data interaction of a multi-protocol conversion gateway. Background Currently, in industrial automation systems, a plurality of communication protocols are widely used, and different manufacturers and different devices often adopt respective communication standards, such as CC-LINK, deviceNet, modbus, etherNet/IP and the like. These protocols are characterized, but due to differences of protocol formats, data structures and communication mechanisms, direct communication between different protocol devices is often difficult to realize, and flexibility and expansibility of system integration are limited. In the prior art, the multi-protocol data interaction is usually realized through a special hardware interface converter, but the hardware interface module has complex design and high cost, and can only complete the data interaction of a communication protocol defined by the hardware interface when the hardware interface is originally designed, so that the universality is poor. The prior art scheme has the defect that the prior multi-protocol data interaction mode is inconvenient. Disclosure of Invention In order to improve convenience of multi-protocol data interaction, the application provides a multi-protocol conversion gateway data interaction method, a system, equipment and a storage medium. The first object of the present application is achieved by the following technical solutions: A multi-protocol conversion gateway data interaction method, the multi-protocol conversion gateway data interaction method comprising: receiving and reading a data packet to be analyzed, and judging the type of source equipment of the data packet to be analyzed; Selecting a corresponding protocol analysis rule according to the source equipment type and analyzing the data packet to be analyzed to obtain an analysis field; address mapping and communication protocol selection are carried out according to the analysis field, and the final equipment address and the target communication protocol of the target equipment are determined; carrying out data packet format conversion according to the target communication protocol and the analysis field to obtain a data packet to be forwarded; and forwarding the data packet to be forwarded to the final equipment address according to the target communication protocol, and sending the data packet to be forwarded to the target equipment. By adopting the technical scheme, the method and the device can finish the accurate classification of the data source protocol at the entrance side by receiving and reading the data packet to be analyzed and judging the type of the source device, reduce the subsequent analysis ambiguity and error branches, improve the accuracy of multi-protocol gateway data interaction, structurally extract key elements such as an original packet header, data and verification by selecting the corresponding protocol analysis rule according to the type of the source device and analyzing to obtain an analysis field, provide standardized input for subsequent mapping and conversion, improve the accuracy of multi-protocol gateway data interaction, and automatically finish the cross-protocol addressing and link strategy decision by carrying out address mapping and communication protocol selection according to the analysis field to determine the final device address and the target communication protocol, thereby avoiding manual configuration errors and improving the expansion adaptation capability of new protocol/new device, improving the convenience of multi-protocol gateway data interaction, and reconstructing frame header/control and verification and forwarding according to the target protocol on the premise of keeping the service load unchanged by carrying out data packet format conversion according to the target communication protocol and accordingly completing transmission, thereby ensuring the acceptance of the target side and improving the accuracy of the multi-protocol interaction and the accuracy of the data interaction. The present application may be further configured in a preferred example to receive and read a data packet to be parsed, and determine a source device type of the data packet to be parsed, which specifically includes: reading a protocol identification field in a data packet to be analyzed and carrying out feature recognition to obtain protocol identification feature information; and judging the type of the source equipment of the data packet to be analyzed according to the protocol identification characteristic information. By adopting the technical scheme, the source equipment type can be judged by reading the protocol identification field and carrying out feature recogn