A data gateway for multi-channel protocol conversion
By designing a data gateway for multi-protocol conversion, using the processing unit, storage unit and communication unit, combined with the standard communication interface converter and the backend server to generate a virtual protocol conversion model, the problem of difficulty and high cost of multi-protocol conversion in the existing technology is solved. , achieving efficient communication compatibility between devices.
Patent Information
- Application Number
- CN202410686009.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-05-30
AI Technical Summary
When existing data gateways implement multi-protocol conversion, the manufacturing difficulty and manufacturing cost are high, and the versatility is not strong, and they cannot effectively be compatible with communication between devices with different communication protocols.
Design a data gateway for multi-channel protocol conversion, including a processing unit, a storage unit and a communication unit. A virtual protocol conversion model is generated through a standard communication interface converter and a backend server to realize data conversion between different communication protocols.
The compatibility of multi-channel protocol conversion is achieved, while the manufacturing difficulty and cost are reduced, and the communication and interconnection capabilities between devices are improved.
Smart Images

Figure CN118282806B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data gateways, and in particular to a data gateway for multi-path protocol conversion. Background Art
[0002] Due to the wide variety of sensors, intelligent instruments and mechanical equipment involved in the market, they usually use different communication protocols, such as Modbus protocol, OPC-UA (Open Platform Communications Unified Architecture) protocol, Profinet protocol, MQTT (Message Queuing Telemetry Transport) protocol, etc. Different communication protocols have different data formats and encoding methods. Devices using different communication protocols cannot communicate with each other. Therefore, the compatibility of communication protocols has become an important issue restricting the communication and interconnection between devices.
[0003] In order to solve the problem of communication protocol compatibility, people have designed various communication protocol converters, but these communication protocol converters are usually point-to-point connected, can only achieve a single protocol conversion, are applicable to a narrow environment, and are not very versatile. Another solution is to design a data gateway with multi-protocol conversion capabilities. In order to have higher compatibility, this requires the data gateway to have a large number of communication interfaces applicable to commonly used communication protocols on the market, and to be able to convert the data of these communication protocols. This also puts higher requirements on the processing capabilities of the data gateway, resulting in a more complex structure of a highly compatible data gateway. Correspondingly, its manufacturing difficulty and manufacturing cost are also high. Summary of the invention
[0004] Based on the above problems, the present invention proposes a data gateway for multi-protocol conversion, which is compatible with various communication protocols to achieve multi-protocol conversion and has lower manufacturing difficulty and manufacturing cost.
[0005] In view of this, the first aspect of the present invention proposes a multi-channel protocol conversion system, including an industrial data gateway having multiple standard communication interfaces, a standard communication interface converter for connecting industrial field devices that use different communication protocols and have different communication interfaces to the standard communication interface of the industrial data gateway, and a background server for generating a virtual protocol conversion model.
[0006] A second aspect of the present invention provides a data gateway for multi-protocol conversion, comprising a processing unit, a storage unit and a communication unit, wherein the storage unit comprises a non-volatile storage unit and a volatile cache unit, and the communication unit comprises a first communication unit having a multi-channel standard communication interface, wherein the first communication unit is connected to a standard communication interface converter through the standard communication interface to communicate with industrial field devices using different communication protocols through the standard communication interface converter, and the processing unit is configured as follows:
[0007] Monitoring the device access status of each standard communication interface by the first communication unit, wherein the device access status of the standard communication interface includes an idle state and an access state;
[0008] When the device access state of any standard communication interface is switched from an idle state to an access state, initialization configuration is performed on the industrial field device accessed by the corresponding standard communication interface, wherein the initialization configuration includes generating a virtual protocol conversion model in the volatile cache unit for converting a first communication protocol adopted by the industrial field device into a second communication protocol;
[0009] Acquire, by the first communication unit, first communication data transmitted by the industrial field device using the first communication protocol;
[0010] inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol;
[0011] The second communication data is transmitted to the target device through the first communication unit.
[0012] Preferably, in the step of initializing the configuration of the industrial field device connected to the corresponding standard communication interface, the processing unit is configured as follows:
[0013] Receiving a handshake data packet sent by the industrial field device for establishing a communication connection;
[0014] Determine whether the handshake data packet is a plaintext data packet or an encrypted data packet;
[0015] When the handshake data packet is a plaintext data packet, parsing the handshake data packet to extract protocol features and a communication address of the target device from the handshake data packet;
[0016] Determining a first communication protocol adopted by the industrial field device according to the protocol characteristics;
[0017] Determining a second communication protocol adopted by the target device according to the communication address of the target device;
[0018] A virtual protocol conversion model for converting a first communication protocol into a second communication protocol is generated in the volatile cache unit.
[0019] Preferably, before the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit, the processing unit is configured to:
[0020] Obtaining a list of virtual protocol conversion models that have been generated in the volatile cache unit;
[0021] Determining whether the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol;
[0022] When the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol, a protocol conversion processing thread is generated for executing conversion of data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0023] Preferably, the communication unit further includes a second communication unit for connecting to the backend server via a local area network or a wide area network, and in the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit, the processing unit is configured to:
[0024] Sending the protocol identifier of the first communication protocol and the protocol identifier of the second communication protocol to the backend server through the second communication unit;
[0025] Receiving a virtual protocol conversion model for converting a first communication protocol into a second communication protocol returned by the background server, the virtual protocol conversion model comprising a first communication protocol entity, a second communication protocol entity, an identifier mapping function of entity attributes, and a payload conversion function;
[0026] Writing the virtual protocol conversion model into the volatile cache unit;
[0027] A protocol conversion processing thread is generated to convert data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0028] Preferably, in the step of generating a protocol conversion processing thread for converting data of the first communication protocol into the second communication protocol through the virtual protocol conversion model, the processing unit is configured to:
[0029] Obtaining a device identification of the industrial field device, or an interface number of a standard communication interface on the data gateway that is connected to the industrial field device;
[0030] The protocol conversion processing thread is bound to the industrial field device according to the device identification, or the protocol conversion processing thread is bound to a standard communication interface on the data gateway that is connected to the industrial field device according to the interface number.
[0031] Preferably, in the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to:
[0032] Instantiating the first communication protocol entity and the second communication protocol entity in the virtual protocol conversion model to obtain a first communication protocol entity instance and a second communication protocol entity instance;
[0033] Parsing a packet header portion of the first communication data to obtain contents of each communication identifier of the first communication data;
[0034] Assigning the content of the communication identifier to the corresponding identifier attribute in the first communication protocol entity instance;
[0035] Obtaining a payload of the first communication data;
[0036] Decoding the payload of the first communication data using the payload decoding function of the first communication protocol to obtain plain text content corresponding to the payload;
[0037] Assign the plaintext content to the payload attribute of the first communication protocol entity instance.
[0038] Preferably, after the step of assigning the plaintext content to the payload attribute of the first communication protocol entity instance, the processing unit is configured to:
[0039] Mapping the identifier attribute of the first communication protocol entity instance to the identifier attribute of the second communication protocol entity instance through the identifier mapping function;
[0040] Using the payload encoding function of the second communication protocol to encode the payload attribute content of the first communication protocol entity instance to obtain the encoded content of the payload corresponding to the second communication protocol;
[0041] Assign the encoded content to the payload attribute of the second communication protocol entity instance.
[0042] Preferably, after the step of determining whether the handshake data packet is a plaintext data packet or an encrypted data packet, the processing unit is configured to:
[0043] When the handshake data packet is an encrypted data packet, the handshake data packet is sent to the backend server through the second communication unit, so that the backend server inputs the handshake data packet into a pre-trained protocol type recognition model to identify the communication protocol type of the handshake data packet;
[0044] Receive the communication protocol type of the handshake data packet returned by the background server;
[0045] The communication protocol type is determined to be a first communication protocol adopted by the industrial field device.
[0046] Preferably, the virtual protocol conversion model further includes a first communication data decryption function and a second communication data encryption function, and before the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to:
[0047] When the first communication data is an encrypted data packet, decrypting the first communication data using the first communication data decryption function to obtain a corresponding plaintext data packet;
[0048] After the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to:
[0049] The second communication data is encrypted using the second communication data encryption function to obtain a corresponding encrypted data packet.
[0050] Preferably, after the step of determining the first communication protocol adopted by the industrial field device according to the protocol characteristics, the processing unit is configured to:
[0051] Associating and storing the device identification of the industrial field device and the protocol identification of the first communication protocol;
[0052] In the step of determining the second communication protocol adopted by the target device according to the communication address of the target device, the processing unit is configured to:
[0053] Determine a device identification of the target device according to the address of the target device;
[0054] The communication protocol stored in association with the target device identifier is determined as the second communication protocol.
[0055] A third aspect of the present invention provides a control method for a data gateway for multi-protocol conversion, comprising:
[0056] Monitoring the device access status of each standard communication interface by the first communication unit, wherein the device access status of the standard communication interface includes an idle state and an access state;
[0057] When the device access state of any standard communication interface is switched from an idle state to an access state, initialization configuration is performed on the industrial field device accessed by the corresponding standard communication interface, wherein the initialization configuration includes generating a virtual protocol conversion model in the volatile cache unit for converting a first communication protocol adopted by the industrial field device into a second communication protocol;
[0058] Acquire, by the first communication unit, first communication data transmitted by the industrial field device using the first communication protocol;
[0059] inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol;
[0060] The second communication data is transmitted to the target device through the first communication unit.
[0061] Preferably, the step of initializing the configuration of the industrial field device connected to the corresponding standard communication interface specifically includes:
[0062] Receiving a handshake data packet sent by the industrial field device for establishing a communication connection;
[0063] Determine whether the handshake data packet is a plaintext data packet or an encrypted data packet;
[0064] When the handshake data packet is a plaintext data packet, parsing the handshake data packet to extract protocol features and a communication address of the target device from the handshake data packet;
[0065] Determining a first communication protocol adopted by the industrial field device according to the protocol characteristics;
[0066] Determining a second communication protocol adopted by the target device according to the communication address of the target device;
[0067] A virtual protocol conversion model for converting a first communication protocol into a second communication protocol is generated in the volatile cache unit.
[0068] Preferably, before the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit, the method further includes:
[0069] Obtaining a list of virtual protocol conversion models that have been generated in the volatile cache unit;
[0070] Determining whether the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol;
[0071] When the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol, a protocol conversion processing thread is generated for executing conversion of data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0072] Preferably, the communication unit further includes a second communication unit for connecting to the backend server via a local area network or a wide area network, and the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit specifically includes:
[0073] Sending the protocol identifier of the first communication protocol and the protocol identifier of the second communication protocol to the backend server through the second communication unit;
[0074] Receiving a virtual protocol conversion model for converting a first communication protocol into a second communication protocol returned by the background server, the virtual protocol conversion model comprising a first communication protocol entity, a second communication protocol entity, an identifier mapping function of entity attributes, and a payload conversion function;
[0075] Writing the virtual protocol conversion model into the volatile cache unit;
[0076] A protocol conversion processing thread is generated to convert data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0077] Preferably, the step of generating a protocol conversion processing thread for converting data of the first communication protocol into data of the second communication protocol through the virtual protocol conversion model specifically includes:
[0078] Obtaining a device identification of the industrial field device, or an interface number of a standard communication interface on the data gateway that is connected to the industrial field device;
[0079] The protocol conversion processing thread is bound to the industrial field device according to the device identification, or the protocol conversion processing thread is bound to a standard communication interface on the data gateway that is connected to the industrial field device according to the interface number.
[0080] Preferably, the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol specifically includes:
[0081] Instantiating the first communication protocol entity and the second communication protocol entity in the virtual protocol conversion model to obtain a first communication protocol entity instance and a second communication protocol entity instance;
[0082] Parsing a packet header portion of the first communication data to obtain contents of each communication identifier of the first communication data;
[0083] Assigning the content of the communication identifier to the corresponding identifier attribute in the first communication protocol entity instance;
[0084] Obtaining a payload of the first communication data;
[0085] Decoding the payload of the first communication data using the payload decoding function of the first communication protocol to obtain plain text content corresponding to the payload;
[0086] Assign the plaintext content to the payload attribute of the first communication protocol entity instance.
[0087] Preferably, after the step of assigning the plain text content to the payload attribute of the first communication protocol entity instance, the method further comprises:
[0088] Mapping the identifier attribute of the first communication protocol entity instance to the identifier attribute of the second communication protocol entity instance through the identifier mapping function;
[0089] Using the payload encoding function of the second communication protocol to encode the payload attribute content of the first communication protocol entity instance to obtain the encoded content of the payload corresponding to the second communication protocol;
[0090] Assign the encoded content to the payload attribute of the second communication protocol entity instance.
[0091] Preferably, after the step of determining whether the handshake data packet is a plaintext data packet or an encrypted data packet, the method further includes:
[0092] When the handshake data packet is an encrypted data packet, the handshake data packet is sent to the backend server through the second communication unit, so that the backend server inputs the handshake data packet into a pre-trained protocol type recognition model to identify the communication protocol type of the handshake data packet;
[0093] Receive the communication protocol type of the handshake data packet returned by the background server;
[0094] The communication protocol type is determined to be a first communication protocol adopted by the industrial field device.
[0095] Preferably, the virtual protocol conversion model further includes a first communication data decryption function and a second communication data encryption function, and before the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, further includes:
[0096] When the first communication data is an encrypted data packet, decrypting the first communication data using the first communication data decryption function to obtain a corresponding plaintext data packet;
[0097] After the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to:
[0098] The second communication data is encrypted using the second communication data encryption function to obtain a corresponding encrypted data packet.
[0099] Preferably, after the step of determining the first communication protocol adopted by the industrial field device according to the protocol characteristics, the method further includes:
[0100] Associating and storing the device identification of the industrial field device and the protocol identification of the first communication protocol;
[0101] The step of determining the second communication protocol adopted by the target device according to the communication address of the target device specifically includes:
[0102] Determine a device identification of the target device according to the address of the target device;
[0103] The communication protocol stored in association with the target device identifier is determined as the second communication protocol.
[0104] The present invention proposes a multi-channel protocol conversion system, a data gateway and a control method for the data gateway. When the device access state of any standard communication interface of the data gateway is switched to the access state, the industrial field device connected to the corresponding standard communication interface is initialized and configured, including generating a virtual protocol conversion model for converting a first communication protocol adopted by the industrial field device into a second communication protocol in the volatile cache unit, obtaining first communication data transmitted by the industrial field device through the first communication unit, inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data adopting the second communication protocol, and transmitting the second communication data to the target device through the first communication unit. It can be compatible with various communication protocols to realize multi-channel protocol conversion while having lower manufacturing difficulty and manufacturing cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0105] Figure 1 is a schematic diagram of a multi-channel protocol conversion system provided by an embodiment of the present invention;
[0106] Figure 2 It is a schematic diagram of a data gateway for multi-channel protocol conversion provided by an embodiment of the present invention;
[0107] Figure 3 It is a schematic diagram of a control method for a data gateway with multi-protocol conversion provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0108] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0109] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present invention is not limited to the specific embodiments disclosed below.
[0110] In the description of the present invention, the term "multiple" refers to two or more. Unless otherwise clearly defined, the orientation or positional relationship indicated by the terms "upper", "lower", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present invention and simplifying the description, and does not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it cannot be understood as a limitation of the present invention. The terms "connection", "installation", "fixation", etc. should be understood in a broad sense. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be directly connected or indirectly connected through an intermediate medium. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to the specific circumstances. In addition, the terms "first", "second", etc. are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first", "second", etc. can explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, the meaning of "multiple" is two or more.
[0111] In the description of this specification, the description of the terms "one embodiment", "some implementations", "specific embodiments", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0112] A data gateway for multi-protocol conversion provided according to some embodiments of the present invention will be described below with reference to the accompanying drawings.
[0113] like Figure 1 As shown, the first aspect of the present invention proposes a multi-channel protocol conversion system, including an industrial data gateway having multiple standard communication interfaces, a standard communication interface converter for connecting industrial field devices using different communication protocols and having different communication interfaces to the standard communication interface of the industrial data gateway, and a background server for generating a virtual protocol conversion model.
[0114] The standard communication interface may be an Ethernet interface or an interface commonly used in industrial environments such as an RS-232 / RS-485 serial interface. The industrial field equipment includes but is not limited to various types of sensors, intelligent instruments, intelligent meters or mechanical equipment such as CNC machine tools, which usually use Ethernet interfaces, RS-232 / RS-485 serial interfaces, Profibus interfaces, Modbus interfaces or CAN (Controller Area Network) interfaces, etc. The standard communication interface converter includes multiple types. Taking the standard communication interface as an Ethernet interface as an example, the standard communication interface converter includes a serial interface to Ethernet interface converter, a Profibus interface to Ethernet interface converter, a Modbus interface to Ethernet interface converter, a CAN interface to Ethernet interface converter, etc. When the communication interface of the industrial field device is not an Ethernet interface, the corresponding interface converter can be used to convert it to an Ethernet interface to connect to the standard communication interface of the data gateway. On the contrary, when the communication interface of the industrial field device is an Ethernet interface, it can be directly connected to the standard communication interface of the data gateway without using the standard communication interface converter. In the technical solution of the present invention, the standard communication interface converter only performs interface conversion at the physical level and does not have a protocol conversion function. That is, the standard communication interface converter is only used for data transmission and does not perform content analysis or protocol conversion on the data transmitted by the connected industrial field equipment.
[0115] The background server may be a dedicated server for generating the virtual protocol conversion model, or the monitoring, management and remote control server of the industrial field equipment may be reused as the background server for generating the virtual protocol conversion model. It should be known that the background server may be a cloud server connected to the data gateway via the Internet, or a local server connected to the data gateway via a local area network.
[0116] like Figure 2 As shown, the second aspect of the present invention proposes a data gateway with multi-protocol conversion, including a processing unit, a storage unit and a communication unit, the storage unit includes a non-volatile storage unit and a volatile cache unit, the communication unit includes a first communication unit with a multi-channel standard communication interface, the first communication unit is connected to a standard communication interface converter through the standard communication interface to communicate with industrial field devices using different communication protocols through the standard communication interface converter.
[0117] like Figure 3 As shown, the processing unit is configured as follows:
[0118] Monitoring the device access status of each standard communication interface by the first communication unit, wherein the device access status of the standard communication interface includes an idle state and an access state;
[0119] When the device access state of any standard communication interface is switched from an idle state to an access state, initialization configuration is performed on the industrial field device accessed by the corresponding standard communication interface, wherein the initialization configuration includes generating a virtual protocol conversion model in the volatile cache unit for converting a first communication protocol adopted by the industrial field device into a second communication protocol;
[0120] Acquire, by the first communication unit, first communication data transmitted by the industrial field device using the first communication protocol;
[0121] inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol;
[0122] The second communication data is transmitted to the target device through the first communication unit.
[0123] Specifically, the non-volatile storage unit is ROM (Read-Only Memory) or Flash, which has the characteristic of not losing data when power is off, and is used to persist data. The volatile storage unit is RAM (Random Access Memory), which has the characteristic of data volatility, that is, once the power is off, the stored data will be lost, and is usually used in computers and digital systems to temporarily store programs, data and intermediate results.
[0124] In the technical solution of the above-mentioned implementation mode, when any industrial field device accesses one of the standard communication interfaces of the data gateway through the standard communication interface converter, the industrial field device will send a handshake data packet to the first communication unit through the standard communication interface converter to establish a communication connection with the data gateway. After the industrial field device and the data gateway establish a communication connection, the data gateway marks the device access status of the standard communication interface connected to the industrial field device as an access status. It should be known that directly connecting a standard communication interface converter that is not connected to an industrial field device to the standard communication interface of the data gateway will not cause the data gateway to mark the device access status of the corresponding standard communication interface as an access status. In this case, the device access status of the standard communication interface connected to the standard communication interface converter remains vacant.
[0125] In the technical solution of the above-mentioned implementation mode, the first communication protocol is the communication protocol adopted by the industrial field device, and the second communication protocol is the communication protocol adopted by the target device. The communication unit of the data gateway also includes a second communication unit for connecting to a local area network or a wide area network. The target device is a device for receiving the second communication data that has established a communication connection with the data gateway. It can be other industrial field devices connected to the standard communication interface of the data gateway and communicating with the data gateway through the first communication unit, or it can be other network devices in the same local area network as the data gateway or on the Internet that communicate with the data gateway through the second communication unit, such as the background server or workstation.
[0126] Preferably, in the step of initializing the configuration of the industrial field device connected to the corresponding standard communication interface, the processing unit is configured as follows:
[0127] Receiving a handshake data packet sent by the industrial field device for establishing a communication connection;
[0128] Determine whether the handshake data packet is a plaintext data packet or an encrypted data packet;
[0129] When the handshake data packet is a plaintext data packet, parsing the handshake data packet to extract protocol features and a communication address of the target device from the handshake data packet;
[0130] Determining a first communication protocol adopted by the industrial field device according to the protocol characteristics;
[0131] Determining a second communication protocol adopted by the target device according to the communication address of the target device;
[0132] A virtual protocol conversion model for converting a first communication protocol into a second communication protocol is generated in the volatile cache unit.
[0133] Specifically, the plaintext data packet refers to a data packet whose header is divided into plaintext data. Similarly, the encrypted data packet refers to a data packet whose header is divided into encrypted data. In order to increase the security and privacy protection of communication, some industrial field devices encrypt the header part of their communication data packets through encryption algorithms to generate the encrypted data packets, so as to prevent attackers from obtaining sensitive information about the communication, such as source address, destination address, data packet size, etc., by analyzing the header information. Other industrial field devices focus more on performance or compatibility rather than security, and use plaintext data as the header part of their communication data packets. Their communication data packets are the plaintext data packets referred to in the present invention.
[0134] The data packets of different communication protocols carry protocol features corresponding to the communication protocols. These protocol features include but are not limited to communication port number, message format, parameter identifier, etc. When the packet header of the handshake data packet is divided into plain text data, the communication protocol adopted can be identified by parsing a specific protocol feature in the handshake data packet, or a combination of multiple protocol features.
[0135] The data gateway can establish a communication connection with the target device according to the communication address of the target device for data transmission. It should be known that the target device is a device that has established a communication connection with the data gateway before the step of initializing the configuration of the industrial field device connected to the corresponding standard communication interface.
[0136] Preferably, before the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit, the processing unit is configured to:
[0137] Obtaining a list of virtual protocol conversion models that have been generated in the volatile cache unit;
[0138] Determining whether the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol;
[0139] When the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol, a protocol conversion processing thread is generated for executing conversion of data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0140] In the technical solution of the above-mentioned implementation, the number of the virtual protocol conversion models is related to the protocol type, and has no direct correlation with the number of interfaces or the number of industrial field devices. Specifically, when there are multiple industrial field devices that are all devices using the first communication protocol, and the target devices communicating with these industrial field devices are all devices using the second communication protocol, no matter how many of these industrial field devices there are and how many of their corresponding target devices there are, only one virtual protocol conversion model for converting the first communication protocol into the second communication protocol needs to be generated in the volatile storage unit, thereby saving cache space. In an industrial environment, the data transmission of industrial field devices has very high real-time requirements. If a large number of industrial field devices corresponding to the same virtual protocol conversion model all use the same protocol conversion processing thread, data congestion or data transmission delay may be serious. Therefore, when initializing and configuring each industrial field device, it is necessary to generate a protocol conversion processing thread bound to each industrial field device, that is, to execute the protocol conversion processing thread that converts the data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0141] Preferably, the communication unit further includes a second communication unit for connecting to the backend server via a local area network or a wide area network, and in the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit, the processing unit is configured to:
[0142] Sending the protocol identifier of the first communication protocol and the protocol identifier of the second communication protocol to the backend server through the second communication unit;
[0143] Receiving a virtual protocol conversion model for converting a first communication protocol into a second communication protocol returned by the background server, the virtual protocol conversion model comprising a first communication protocol entity, a second communication protocol entity, an identifier mapping function of entity attributes, and a payload conversion function;
[0144] Writing the virtual protocol conversion model into the volatile cache unit;
[0145] A protocol conversion processing thread is generated to convert data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0146] Specifically, the protocol identifier may be a protocol name or a specific character or code representing the communication protocol. In the above implementation, the background server stores entity templates of various communication protocols, an identifier mapping function for mapping the identifier attribute of any communication protocol entity to the identifier attribute of another communication protocol entity, and a payload decoding function and a payload encoding function for each communication protocol.
[0147] After the data gateway sends the protocol identifier of the first communication protocol and the protocol identifier of the second communication protocol to the background server through the second communication unit, the background server is configured as follows:
[0148] Acquire a first communication protocol entity corresponding to the first communication protocol and a second communication protocol entity corresponding to the second communication protocol according to the protocol identifier of the first communication protocol and the protocol identifier of the second communication protocol;
[0149] Obtaining an identifier mapping function that maps an identifier attribute of the first communication protocol entity to an identifier attribute of the second communication protocol entity;
[0150] Obtaining a payload decoding function of the first communication protocol and a payload encoding function of the second communication protocol;
[0151] Encapsulating the first communication protocol entity, the second communication protocol entity, the identifier mapping function, the payload decoding function of the first communication protocol, and the payload encoding function of the second communication protocol into the virtual protocol conversion model;
[0152] The virtual protocol conversion model is sent to the data gateway.
[0153] The first communication protocol entity and the second communication protocol entity use the identifier content constituting the corresponding protocol data packet as the corresponding entity identifier attribute. In the technical solutions of some embodiments, the first communication protocol entity and the second communication protocol entity also include an identifier reading function and an identifier assignment function for reading and writing entity identifier attributes. The identifier mapping function is a pre-configured mapping function that maps the identifier attribute of the first communication protocol font to the identifier attribute of the second communication protocol entity.
[0154] The payload conversion function is composed of a payload decoding function of the first communication protocol and a payload encoding function of the second communication protocol, and is used to decode the payload in the data packet of the first communication data through the payload decoding function of the first communication protocol to obtain the corresponding plaintext content, and then encode the plaintext content into the payload in the data packet of the second communication data through the payload encoding function of the second communication protocol.
[0155] In the technical solution of the above implementation, the target device may also be a background server that is communicatively connected to the data gateway through the second communication unit. After the data gateway inputs the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the method further includes:
[0156] When the target device is a background server, the second communication data is transmitted to the background server through the second communication unit.
[0157] Preferably, in the step of generating a protocol conversion processing thread for converting data of the first communication protocol into the second communication protocol through the virtual protocol conversion model, the processing unit is configured to:
[0158] Obtaining a device identification of the industrial field device, or an interface number of a standard communication interface on the data gateway that is connected to the industrial field device;
[0159] The protocol conversion processing thread is bound to the industrial field device according to the device identification, or the protocol conversion processing thread is bound to a standard communication interface on the data gateway that is connected to the industrial field device according to the interface number.
[0160] Specifically, the device identification of the industrial field device may be the product serial number of the industrial field device, the Mac address (Media Access Control Address) or the unique identity code assigned by the data gateway to the industrial field device, and the data gateway identifies or locates the industrial field device through the device identification of the industrial field device. In the technical solutions of some embodiments of the present invention, the data gateway binds the industrial field device to the corresponding protocol conversion processing thread based on the device identification of the industrial field device, so that the first communication data transmitted from the industrial field device to the data gateway will be processed by the corresponding protocol conversion processing thread for protocol conversion to obtain the corresponding second communication data. In the technical solutions of other embodiments of the present invention, the data gateway binds the standard communication interface of the data gateway connected to the industrial field device to the corresponding protocol conversion processing thread based on the interface number of the standard communication interface of the data gateway connected to the industrial field device, so that the first communication data transmitted from the standard communication interface of the data gateway connected to the industrial field device to the data gateway will be processed by the corresponding protocol conversion processing thread for protocol conversion to obtain the corresponding second communication data.
[0161] Preferably, in the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to:
[0162] Instantiating the first communication protocol entity and the second communication protocol entity in the virtual protocol conversion model to obtain a first communication protocol entity instance and a second communication protocol entity instance;
[0163] Parsing a packet header portion of the first communication data to obtain contents of each communication identifier of the first communication data;
[0164] Assigning the content of the communication identifier to the corresponding identifier attribute in the first communication protocol entity instance;
[0165] Obtaining a payload of the first communication data;
[0166] Decoding the payload of the first communication data using the payload decoding function of the first communication protocol to obtain plain text content corresponding to the payload;
[0167] Assign the plaintext content to the payload attribute of the first communication protocol entity instance.
[0168] Specifically, the first communication protocol entity instance is obtained based on the instantiation of the first communication protocol entity, and the second communication protocol entity instance is obtained based on the instantiation of the second communication protocol entity, so the first communication protocol entity instance and the first communication protocol entity, the second communication protocol entity instance and the second communication protocol entity have the same data structure, that is, the first communication protocol entity instance and the first communication protocol entity have the same number and type of identifier attributes corresponding to the communication identifier, and the second communication protocol entity instance and the second communication protocol entity have the same number and type of identifier attributes corresponding to the communication identifier. Depending on the data packet structure of the communication protocol, the communication identifier may include but is not limited to the source address, destination address, port number, and protocol identifier of the data packet.
[0169] Preferably, after the step of assigning the plaintext content to the payload attribute of the first communication protocol entity instance, the processing unit is configured to:
[0170] Mapping the identifier attribute of the first communication protocol entity instance to the identifier attribute of the second communication protocol entity instance through the identifier mapping function;
[0171] Using the payload encoding function of the second communication protocol to encode the payload attribute content of the first communication protocol entity instance to obtain the encoded content of the payload corresponding to the second communication protocol;
[0172] Assign the encoded content to the payload attribute of the second communication protocol entity instance.
[0173] In the technical scheme of the above-mentioned embodiment, the step of mapping the identifier attribute of the first communication protocol entity instance to the identifier attribute of the second communication protocol entity instance through the identifier mapping function is specifically to assign the identifier attribute content of the first communication protocol entity instance to the identifier attribute of the second communication protocol entity instance according to the mapping relationship between the identifier attribute of the first communication protocol entity instance and the identifier attribute of the second communication protocol entity instance.
[0174] Preferably, after the step of determining whether the handshake data packet is a plaintext data packet or an encrypted data packet, the processing unit is configured to:
[0175] When the handshake data packet is an encrypted data packet, the handshake data packet is sent to the backend server through the second communication unit, so that the backend server inputs the handshake data packet into a pre-trained protocol type recognition model to identify the communication protocol type of the handshake data packet;
[0176] Receive the communication protocol type of the handshake data packet returned by the background server;
[0177] The communication protocol type is determined to be a first communication protocol adopted by the industrial field device.
[0178] Specifically, when the handshake data packet is an encrypted data packet, it is impossible to extract the protocol features of the handshake data packet by parsing the header content of the handshake data packet. In the technical solution of the above-mentioned implementation mode, in the background server, a large number of communication data packets of various communication protocols are used as sample data through supervised training to train a protocol type recognition model for identifying the protocol type of encrypted communication data packets, so that the protocol type recognition model can be used to identify the communication protocol type of the handshake data packet uploaded by the data gateway.
[0179] Similarly, when the handshake data packet is an encrypted data packet, it is impossible to extract the communication address of the target device in the handshake data packet by parsing the header content of the handshake data packet. In the technical solutions of some embodiments of the present invention, when the handshake data packet is an encrypted data packet, the user configures the device identifier of the target device corresponding to the industrial field device through the background server, or configures the protocol identifier of the second communication protocol of the target device corresponding to the industrial field device, so that the background server can generate a corresponding virtual protocol conversion model and provide it to the data gateway.
[0180] Preferably, the virtual protocol conversion model further includes a first communication data decryption function and a second communication data encryption function, and before the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to:
[0181] When the first communication data is an encrypted data packet, decrypting the first communication data using the first communication data decryption function to obtain a corresponding plaintext data packet;
[0182] After the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to:
[0183] The second communication data is encrypted using the second communication data encryption function to obtain a corresponding encrypted data packet.
[0184] In the technical solutions of some embodiments of the present invention, after the step of decrypting the first communication data using the first communication data decryption function to obtain a corresponding plaintext data packet, the processing unit is configured to:
[0185] Parsing the header portion of the plaintext data packet to obtain the communication address of the target device;
[0186] Determining a second communication protocol adopted by the target device according to the communication address of the target device;
[0187] When the second communication protocol adopted by the target device does not match the virtual protocol conversion model, the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit is re-executed.
[0188] In the actual implementation process, the industrial field equipment may need to communicate with more than just a single target device. Therefore, the virtual protocol conversion model generated during the initial configuration may not be applicable to all target devices of the industrial field equipment. It is necessary to redetermine the second communication protocol adopted by the target device based on the target device address during real-time transmission and regenerate the corresponding virtual protocol conversion model.
[0189] Preferably, after the step of determining the first communication protocol adopted by the industrial field device according to the protocol characteristics, the processing unit is configured to:
[0190] Associating and storing the device identification of the industrial field device and the protocol identification of the first communication protocol;
[0191] In the step of determining the second communication protocol adopted by the target device according to the communication address of the target device, the processing unit is configured to:
[0192] Determine a device identification of the target device according to the address of the target device;
[0193] The communication protocol stored in association with the target device identifier is determined as the second communication protocol.
[0194] Similarly, after the step of determining the communication protocol type as the first communication protocol adopted by the industrial field device, the processing unit is configured to:
[0195] The device identification of the industrial field device and the protocol identification of the first communication protocol are associated and stored.
[0196] like Figure 3 As shown, the third aspect of the present invention proposes a control method for a data gateway for multi-channel protocol conversion, comprising:
[0197] Monitoring the device access status of each standard communication interface by the first communication unit, wherein the device access status of the standard communication interface includes an idle state and an access state;
[0198] When the device access state of any standard communication interface is switched from an idle state to an access state, initialization configuration is performed on the industrial field device accessed by the corresponding standard communication interface, wherein the initialization configuration includes generating a virtual protocol conversion model in the volatile cache unit for converting a first communication protocol adopted by the industrial field device into a second communication protocol;
[0199] Acquire, by the first communication unit, first communication data transmitted by the industrial field device using the first communication protocol;
[0200] inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol;
[0201] The second communication data is transmitted to the target device through the first communication unit.
[0202] Specifically, the non-volatile storage unit is ROM (Read-Only Memory) or Flash, which has the characteristic of not losing data when power is off, and is used to persist data. The volatile storage unit is RAM (Random Access Memory), which has the characteristic of data volatility, that is, once the power is off, the stored data will be lost, and is usually used in computers and digital systems to temporarily store programs, data and intermediate results.
[0203] In the technical solution of the above-mentioned implementation mode, when any industrial field device accesses one of the standard communication interfaces of the data gateway through the standard communication interface converter, the industrial field device will send a handshake data packet to the first communication unit through the standard communication interface converter to establish a communication connection with the data gateway. After the industrial field device and the data gateway establish a communication connection, the data gateway marks the device access status of the standard communication interface connected to the industrial field device as an access status. It should be known that directly connecting a standard communication interface converter that is not connected to an industrial field device to the standard communication interface of the data gateway will not cause the data gateway to mark the device access status of the corresponding standard communication interface as an access status. In this case, the device access status of the standard communication interface connected to the standard communication interface converter remains vacant.
[0204] In the technical solution of the above-mentioned implementation mode, the first communication protocol is the communication protocol adopted by the industrial field device, and the second communication protocol is the communication protocol adopted by the target device. The communication unit of the data gateway also includes a second communication unit for connecting to a local area network or a wide area network. The target device is a device for receiving the second communication data that has established a communication connection with the data gateway. It can be other industrial field devices connected to the standard communication interface of the data gateway and communicating with the data gateway through the first communication unit, or it can be other network devices in the same local area network as the data gateway or on the Internet that communicate with the data gateway through the second communication unit, such as the background server or workstation.
[0205] Preferably, the step of initializing the configuration of the industrial field device connected to the corresponding standard communication interface specifically includes:
[0206] Receiving a handshake data packet sent by the industrial field device for establishing a communication connection;
[0207] Determine whether the handshake data packet is a plaintext data packet or an encrypted data packet;
[0208] When the handshake data packet is a plaintext data packet, parsing the handshake data packet to extract protocol features and a communication address of the target device from the handshake data packet;
[0209] Determining a first communication protocol adopted by the industrial field device according to the protocol characteristics;
[0210] Determining a second communication protocol adopted by the target device according to the communication address of the target device;
[0211] A virtual protocol conversion model for converting a first communication protocol into a second communication protocol is generated in the volatile cache unit.
[0212] Specifically, the plaintext data packet refers to a data packet whose header is divided into plaintext data. Similarly, the encrypted data packet refers to a data packet whose header is divided into encrypted data. In order to increase the security and privacy protection of communication, some industrial field devices encrypt the header part of their communication data packets through encryption algorithms to generate the encrypted data packets, so as to prevent attackers from obtaining sensitive information about the communication, such as source address, destination address, data packet size, etc., by analyzing the header information. Other industrial field devices focus more on performance or compatibility rather than security, and use plaintext data as the header part of their communication data packets. Their communication data packets are the plaintext data packets referred to in the present invention.
[0213] The data packets of different communication protocols carry protocol features corresponding to the communication protocols. These protocol features include but are not limited to communication port number, message format, parameter identifier, etc. When the packet header of the handshake data packet is divided into plain text data, the communication protocol adopted can be identified by parsing a specific protocol feature in the handshake data packet, or a combination of multiple protocol features.
[0214] The data gateway can establish a communication connection with the target device according to the communication address of the target device for data transmission. It should be known that the target device is a device that has established a communication connection with the data gateway before the step of initializing the configuration of the industrial field device connected to the corresponding standard communication interface.
[0215] Preferably, before the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit, the method further includes:
[0216] Obtaining a list of virtual protocol conversion models that have been generated in the volatile cache unit;
[0217] Determining whether the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol;
[0218] When the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol, a protocol conversion processing thread is generated for executing conversion of data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0219] In the technical solution of the above-mentioned implementation, the number of the virtual protocol conversion models is related to the protocol type, and has no direct correlation with the number of interfaces or the number of industrial field devices. Specifically, when there are multiple industrial field devices that are all devices using the first communication protocol, and the target devices communicating with these industrial field devices are all devices using the second communication protocol, no matter how many of these industrial field devices there are and how many of their corresponding target devices there are, only one virtual protocol conversion model for converting the first communication protocol into the second communication protocol needs to be generated in the volatile storage unit, thereby saving cache space. In an industrial environment, the data transmission of industrial field devices has very high real-time requirements. If a large number of industrial field devices corresponding to the same virtual protocol conversion model all use the same protocol conversion processing thread, data congestion or data transmission delay may be serious. Therefore, when initializing and configuring each industrial field device, it is necessary to generate a protocol conversion processing thread bound to each industrial field device, that is, to execute the protocol conversion processing thread that converts the data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0220] Preferably, the communication unit further includes a second communication unit for connecting to the backend server via a local area network or a wide area network, and the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit specifically includes:
[0221] Sending the protocol identifier of the first communication protocol and the protocol identifier of the second communication protocol to the backend server through the second communication unit;
[0222] Receiving a virtual protocol conversion model for converting a first communication protocol into a second communication protocol returned by the background server, the virtual protocol conversion model comprising a first communication protocol entity, a second communication protocol entity, an identifier mapping function of entity attributes, and a payload conversion function;
[0223] Writing the virtual protocol conversion model into the volatile cache unit;
[0224] A protocol conversion processing thread is generated to convert data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
[0225] Specifically, the protocol identifier may be a protocol name or a specific character or code representing the communication protocol. In the above implementation, the background server stores entity templates of various communication protocols, an identifier mapping function for mapping the identifier attribute of any communication protocol entity to the identifier attribute of another communication protocol entity, and a payload decoding function and a payload encoding function for each communication protocol.
[0226] After the data gateway sends the protocol identifier of the first communication protocol and the protocol identifier of the second communication protocol to the background server through the second communication unit, the method further includes:
[0227] Acquire a first communication protocol entity corresponding to the first communication protocol and a second communication protocol entity corresponding to the second communication protocol according to the protocol identifier of the first communication protocol and the protocol identifier of the second communication protocol;
[0228] Obtaining an identifier mapping function that maps an identifier attribute of the first communication protocol entity to an identifier attribute of the second communication protocol entity;
[0229] Obtaining a payload decoding function of the first communication protocol and a payload encoding function of the second communication protocol;
[0230] Encapsulating the first communication protocol entity, the second communication protocol entity, the identifier mapping function, the payload decoding function of the first communication protocol, and the payload encoding function of the second communication protocol into the virtual protocol conversion model;
[0231] The virtual protocol conversion model is sent to the data gateway.
[0232] The first communication protocol entity and the second communication protocol entity use the identifier content constituting the corresponding protocol data packet as the corresponding entity identifier attribute. In the technical solutions of some embodiments, the first communication protocol entity and the second communication protocol entity also include an identifier reading function and an identifier assignment function for reading and writing entity identifier attributes. The identifier mapping function is a pre-configured mapping function that maps the identifier attribute of the first communication protocol font to the identifier attribute of the second communication protocol entity.
[0233] The payload conversion function is composed of a payload decoding function of the first communication protocol and a payload encoding function of the second communication protocol, and is used to decode the payload in the data packet of the first communication data through the payload decoding function of the first communication protocol to obtain the corresponding plaintext content, and then encode the plaintext content into the payload in the data packet of the second communication data through the payload encoding function of the second communication protocol.
[0234] In the technical solution of the above implementation, the target device may also be a background server that is communicatively connected to the data gateway through the second communication unit. After the data gateway inputs the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the method further includes:
[0235] When the target device is a background server, the second communication data is transmitted to the background server through the second communication unit.
[0236] Preferably, the step of generating a protocol conversion processing thread for converting data of the first communication protocol into data of the second communication protocol through the virtual protocol conversion model specifically includes:
[0237] Obtaining a device identification of the industrial field device, or an interface number of a standard communication interface on the data gateway that is connected to the industrial field device;
[0238] The protocol conversion processing thread is bound to the industrial field device according to the device identification, or the protocol conversion processing thread is bound to a standard communication interface on the data gateway that is connected to the industrial field device according to the interface number.
[0239] Specifically, the device identification of the industrial field device may be the product serial number of the industrial field device, the Mac address (Media Access Control Address) or the unique identity code assigned by the data gateway to the industrial field device, and the data gateway identifies or locates the industrial field device through the device identification of the industrial field device. In the technical solutions of some embodiments of the present invention, the data gateway binds the industrial field device to the corresponding protocol conversion processing thread based on the device identification of the industrial field device, so that the first communication data transmitted from the industrial field device to the data gateway will be processed by the corresponding protocol conversion processing thread for protocol conversion to obtain the corresponding second communication data. In the technical solutions of other embodiments of the present invention, the data gateway binds the standard communication interface of the data gateway connected to the industrial field device to the corresponding protocol conversion processing thread based on the interface number of the standard communication interface of the data gateway connected to the industrial field device, so that the first communication data transmitted from the standard communication interface of the data gateway connected to the industrial field device to the data gateway will be processed by the corresponding protocol conversion processing thread for protocol conversion to obtain the corresponding second communication data.
[0240] Preferably, the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol specifically includes:
[0241] Instantiating the first communication protocol entity and the second communication protocol entity in the virtual protocol conversion model to obtain a first communication protocol entity instance and a second communication protocol entity instance;
[0242] Parsing a packet header portion of the first communication data to obtain contents of each communication identifier of the first communication data;
[0243] Assigning the content of the communication identifier to the corresponding identifier attribute in the first communication protocol entity instance;
[0244] Obtaining a payload of the first communication data;
[0245] Decoding the payload of the first communication data using the payload decoding function of the first communication protocol to obtain plain text content corresponding to the payload;
[0246] Assign the plaintext content to the payload attribute of the first communication protocol entity instance.
[0247] Specifically, the first communication protocol entity instance is obtained based on the instantiation of the first communication protocol entity, and the second communication protocol entity instance is obtained based on the instantiation of the second communication protocol entity, so the first communication protocol entity instance and the first communication protocol entity, the second communication protocol entity instance and the second communication protocol entity have the same data structure, that is, the first communication protocol entity instance and the first communication protocol entity have the same number and type of identifier attributes corresponding to the communication identifier, and the second communication protocol entity instance and the second communication protocol entity have the same number and type of identifier attributes corresponding to the communication identifier. Depending on the data packet structure of the communication protocol, the communication identifier may include but is not limited to the source address, destination address, port number, and protocol identifier of the data packet.
[0248] Preferably, after the step of assigning the plain text content to the payload attribute of the first communication protocol entity instance, the method further comprises:
[0249] Mapping the identifier attribute of the first communication protocol entity instance to the identifier attribute of the second communication protocol entity instance through the identifier mapping function;
[0250] Using the payload encoding function of the second communication protocol to encode the payload attribute content of the first communication protocol entity instance to obtain the encoded content of the payload corresponding to the second communication protocol;
[0251] Assign the encoded content to the payload attribute of the second communication protocol entity instance.
[0252] In the technical scheme of the above-mentioned embodiment, the step of mapping the identifier attribute of the first communication protocol entity instance to the identifier attribute of the second communication protocol entity instance through the identifier mapping function is specifically to assign the identifier attribute content of the first communication protocol entity instance to the identifier attribute of the second communication protocol entity instance according to the mapping relationship between the identifier attribute of the first communication protocol entity instance and the identifier attribute of the second communication protocol entity instance.
[0253] Preferably, after the step of determining whether the handshake data packet is a plaintext data packet or an encrypted data packet, the method further includes:
[0254] When the handshake data packet is an encrypted data packet, the handshake data packet is sent to the backend server through the second communication unit, so that the backend server inputs the handshake data packet into a pre-trained protocol type recognition model to identify the communication protocol type of the handshake data packet;
[0255] Receive the communication protocol type of the handshake data packet returned by the background server;
[0256] The communication protocol type is determined to be a first communication protocol adopted by the industrial field device.
[0257] Specifically, when the handshake data packet is an encrypted data packet, it is impossible to extract the protocol features of the handshake data packet by parsing the header content of the handshake data packet. In the technical solution of the above-mentioned implementation mode, in the background server, a large number of communication data packets of various communication protocols are used as sample data through supervised training to train a protocol type recognition model for identifying the protocol type of encrypted communication data packets, so that the protocol type recognition model can be used to identify the communication protocol type of the handshake data packet uploaded by the data gateway.
[0258] Similarly, when the handshake data packet is an encrypted data packet, it is impossible to extract the communication address of the target device in the handshake data packet by parsing the header content of the handshake data packet. In the technical solutions of some embodiments of the present invention, when the handshake data packet is an encrypted data packet, the user configures the device identifier of the target device corresponding to the industrial field device through the background server, or configures the protocol identifier of the second communication protocol of the target device corresponding to the industrial field device, so that the background server can generate a corresponding virtual protocol conversion model and provide it to the data gateway.
[0259] Preferably, the virtual protocol conversion model further includes a first communication data decryption function and a second communication data encryption function, and before the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, further includes:
[0260] When the first communication data is an encrypted data packet, decrypting the first communication data using the first communication data decryption function to obtain a corresponding plaintext data packet;
[0261] After the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the method further includes:
[0262] The second communication data is encrypted using the second communication data encryption function to obtain a corresponding encrypted data packet.
[0263] In the technical solutions of some embodiments of the present invention, after the step of using the first communication data decryption function to decrypt the first communication data to obtain a corresponding plaintext data packet, the method further includes:
[0264] Parsing the header portion of the plaintext data packet to obtain the communication address of the target device;
[0265] Determining a second communication protocol adopted by the target device according to the communication address of the target device;
[0266] When the second communication protocol adopted by the target device does not match the virtual protocol conversion model, the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit is re-executed.
[0267] In the actual implementation process, the industrial field equipment may need to communicate with more than just a single target device. Therefore, the virtual protocol conversion model generated during the initial configuration may not be applicable to all target devices of the industrial field equipment. It is necessary to redetermine the second communication protocol adopted by the target device based on the target device address during real-time transmission and regenerate the corresponding virtual protocol conversion model.
[0268] Preferably, after the step of determining the first communication protocol adopted by the industrial field device according to the protocol characteristics, the method further includes:
[0269] Associating and storing the device identification of the industrial field device and the protocol identification of the first communication protocol;
[0270] The step of determining the second communication protocol adopted by the target device according to the communication address of the target device specifically includes:
[0271] Determine a device identification of the target device according to the address of the target device;
[0272] The communication protocol stored in association with the target device identifier is determined as the second communication protocol.
[0273] Similarly, after the step of determining the communication protocol type as the first communication protocol adopted by the industrial field device, the method further includes:
[0274] The device identification of the industrial field device and the protocol identification of the first communication protocol are associated and stored.
[0275] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0276] According to the embodiments of the present invention as described above, these embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and changes can be made based on the above description. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can make good use of the present invention and the modified use based on the present invention. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A data gateway for multi-channel protocol conversion, characterized in that: The invention comprises a processing unit, a storage unit and a communication unit, wherein the storage unit comprises a non-volatile storage unit and a volatile cache unit, the communication unit comprises a first communication unit having a multi-channel standard communication interface, the first communication unit is connected to a standard communication interface converter through the standard communication interface, so as to communicate with industrial field devices using different communication protocols through the standard communication interface converter, and the processing unit is configured as follows: Monitoring the device access status of each standard communication interface by the first communication unit, wherein the device access status of the standard communication interface includes an idle state and an access state; When the device access state of any standard communication interface is switched from an idle state to an access state, initialization configuration is performed on the industrial field device accessed by the corresponding standard communication interface, wherein the initialization configuration includes generating a virtual protocol conversion model in the volatile cache unit for converting a first communication protocol adopted by the industrial field device into a second communication protocol, wherein the virtual protocol conversion model includes a first communication protocol entity, a second communication protocol entity, an identifier mapping function of entity attributes, and a payload conversion function; Acquire, by the first communication unit, first communication data transmitted by the industrial field device using the first communication protocol; inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol; transmitting the second communication data to a target device through the first communication unit; In the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to: Instantiating the first communication protocol entity and the second communication protocol entity in the virtual protocol conversion model to obtain a first communication protocol entity instance and a second communication protocol entity instance; Parsing a packet header portion of the first communication data to obtain contents of each communication identifier of the first communication data; Assigning the content of the communication identifier to the corresponding identifier attribute in the first communication protocol entity instance; Obtaining a payload of the first communication data; Decoding the payload of the first communication data using the payload decoding function of the first communication protocol to obtain plain text content corresponding to the payload; Assign the plaintext content to the payload attribute of the first communication protocol entity instance.
2. The data gateway according to claim 1, characterized in that: In the step of initializing the configuration of the industrial field device connected to the corresponding standard communication interface, the processing unit is configured to: Receiving a handshake data packet sent by the industrial field device for establishing a communication connection; Determine whether the handshake data packet is a plaintext data packet or an encrypted data packet; When the handshake data packet is a plaintext data packet, parsing the handshake data packet to extract protocol features and a communication address of the target device from the handshake data packet; Determining a first communication protocol adopted by the industrial field device according to the protocol characteristics; Determining a second communication protocol adopted by the target device according to the communication address of the target device; A virtual protocol conversion model for converting a first communication protocol into a second communication protocol is generated in the volatile cache unit.
3. The data gateway according to claim 2, characterized in that: Before the step of generating, in the volatile cache unit, a virtual protocol conversion model for converting the first communication protocol into the second communication protocol, the processing unit is configured to: Obtaining a list of virtual protocol conversion models that have been generated in the volatile cache unit; Determining whether the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol; When the virtual protocol conversion model list includes a virtual protocol conversion model for converting a first communication protocol into a second communication protocol, a protocol conversion processing thread is generated for executing conversion of data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
4. The data gateway according to claim 3, characterized in that: The communication unit further includes a second communication unit for connecting to the backend server via a local area network or a wide area network. In the step of generating a virtual protocol conversion model for converting the first communication protocol into the second communication protocol in the volatile cache unit, the processing unit is configured to: Sending the protocol identifier of the first communication protocol and the protocol identifier of the second communication protocol to the backend server through the second communication unit; Receiving a virtual protocol conversion model returned by the background server for converting a first communication protocol into a second communication protocol; Writing the virtual protocol conversion model into the volatile cache unit; A protocol conversion processing thread is generated to convert data of the first communication protocol into the second communication protocol through the virtual protocol conversion model.
5. The data gateway according to claim 3 or 4, characterized in that: In the step of generating a protocol conversion processing thread for converting data of the first communication protocol into the second communication protocol through the virtual protocol conversion model, the processing unit is configured to: Obtaining a device identification of the industrial field device, or an interface number of a standard communication interface on the data gateway that is connected to the industrial field device; The protocol conversion processing thread is bound to the industrial field device according to the device identification, or the protocol conversion processing thread is bound to a standard communication interface on the data gateway that is connected to the industrial field device according to the interface number.
6. The data gateway according to claim 1, characterized in that: After the step of assigning the plaintext content to the payload attribute of the first communication protocol entity instance, the processing unit is configured to: Mapping the identifier attribute of the first communication protocol entity instance to the identifier attribute of the second communication protocol entity instance through the identifier mapping function; Using the payload encoding function of the second communication protocol to encode the payload attribute content of the first communication protocol entity instance to obtain the encoded content of the payload corresponding to the second communication protocol; Assign the encoded content to the payload attribute of the second communication protocol entity instance.
7. The data gateway according to claim 4, characterized in that: After the step of determining whether the handshake data packet is a plaintext data packet or an encrypted data packet, the processing unit is configured to: When the handshake data packet is an encrypted data packet, the handshake data packet is sent to the backend server through the second communication unit, so that the backend server inputs the handshake data packet into a pre-trained protocol type recognition model to identify the communication protocol type of the handshake data packet; Receive the communication protocol type of the handshake data packet returned by the background server; The communication protocol type is determined to be a first communication protocol adopted by the industrial field device.
8. The data gateway according to claim 6, characterized in that: The virtual protocol conversion model further includes a first communication data decryption function and a second communication data encryption function. Before the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to: When the first communication data is an encrypted data packet, decrypting the first communication data using the first communication data decryption function to obtain a corresponding plaintext data packet; After the step of inputting the first communication data into the virtual protocol conversion model to convert the first communication data into second communication data using the second communication protocol, the processing unit is configured to: The second communication data is encrypted using the second communication data encryption function to obtain a corresponding encrypted data packet.
9. The data gateway according to claim 2, characterized in that: After the step of determining the first communication protocol adopted by the industrial field device according to the protocol characteristics, the processing unit is configured to: Associating and storing the device identification of the industrial field device and the protocol identification of the first communication protocol; In the step of determining the second communication protocol adopted by the target device according to the communication address of the target device, the processing unit is configured to: Determine a device identification of the target device according to the address of the target device; The communication protocol stored in association with the target device identifier is determined as the second communication protocol.
