CN-122001962-A - Data communication method, device and storage medium
Abstract
The application discloses a data communication method, equipment and a storage medium, which relate to the technical field of data interaction and comprise the steps of sending a data acquisition command to industrial equipment based on dynamic protocol communication according to a preset data acquisition period, receiving an original byte stream returned by the industrial equipment, performing byte order conversion and data extraction on the original byte stream, and then packaging the original byte stream into structured data, wherein the original byte stream is generated according to equipment functions of the industrial equipment and stored in a register of the industrial equipment, uploading the structured data to a cloud platform for the cloud platform to receive the structured data reported by a gateway, and performing targeted processing on the structured data to complete a data communication task. The application can meet the acquisition requirement of industrial field on 'plug and play, extension without stopping machine and unified access'.
Inventors
- YANG XIANHU
- ZHOU CHUANCHENG
- HUANG GUANGCAI
- LUO QICE
- FANG SHUIBO
- CHEN ZHILIE
Assignees
- 深圳市九牛一毛智能物联科技有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20260128
Claims (10)
- 1. A method of data communication, the method being applied to a gateway and comprising: Transmitting a data acquisition command to industrial equipment based on dynamic protocol communication according to a preset data acquisition period, receiving an original byte stream returned by the industrial equipment, performing byte order conversion and data extraction on the original byte stream, and packaging the byte stream into structured data, wherein the original byte stream is generated according to equipment functions of the industrial equipment and is stored in a register of the industrial equipment; Uploading the structured data to a cloud platform, so that the cloud platform receives the structured data reported by the gateway and carries out targeted processing on the structured data to complete a data communication task.
- 2. The data communication method of claim 1, wherein the establishment procedure of the dynamic protocol communication comprises: Acquiring protocol type information of the industrial equipment, and positioning a matched protocol driving library in a preset catalog according to the protocol type information; calling a dynamic link function to load the protocol driving library into a memory, and acquiring a standard interface function in the protocol driving library through a symbol searching function; based on the standard interface function, the configuration parameters of the hardware interface are transmitted to initialize the protocol driving library, a protocol driving instance is generated and registered to a driving management list; and calling a hardware interface through the protocol driving example, sending a protocol detection command to the industrial equipment, and completing communication connection establishment according to equipment response.
- 3. The data communication method according to claim 1, wherein the encapsulating the original byte stream into structured data after performing byte order conversion and data extraction comprises: Acquiring byte order type and data type information corresponding to the industrial equipment, and adjusting byte order sequence of the original byte stream according to the byte order type; Extracting a target value from the adjusted original byte stream according to the data type information, wherein the data type comprises an integer, a floating point number, a character string and bit data; and acquiring a device identifier and a data generation timestamp, and packaging the target value, the device identifier and the data generation timestamp into structured data in a uniform format.
- 4. The data communication method of claim 1, wherein the method further comprises: receiving and analyzing an equipment control instruction issued by the cloud platform to acquire target equipment information, control type, control parameters and variable identifiers in the equipment control instruction; Searching register configuration information according to the variable identifier, and converting the register configuration information into a protocol format control command supported by the industrial equipment by combining the control type and the control parameter; And issuing the protocol format control command to the industrial equipment through the registered protocol driving example, receiving an instruction execution result after the industrial equipment executes, and feeding back the instruction execution result to the cloud platform.
- 5. The data communication method is characterized by being applied to a cloud platform and comprising the following steps of: Receiving structured data reported by a gateway, wherein the structured data is obtained by the gateway sending a data acquisition command to the industrial equipment based on dynamic protocol communication according to a preset data acquisition period, receiving an original byte stream returned by the industrial equipment, performing byte order conversion and data extraction on the original byte stream, and then packaging the original byte stream; and carrying out targeted processing on the structured data to complete a data communication task.
- 6. The data communication method of claim 5, wherein the method further comprises: Acquiring and analyzing an operation instruction of a target user, and determining target equipment information, a control type, a control parameter and a variable identifier corresponding to the operation instruction; generating a standardized device control instruction according to the control type, the control parameter and the variable identifier, and sending the device control instruction to a gateway according to the target device information; And receiving an instruction execution result returned by the gateway, carrying out state identification on the instruction execution result, and feeding back to the target user to complete the control instruction interaction flow.
- 7. A method of data communication, the method being applied to an industrial device, comprising: Generating an original byte stream according to the equipment function of the industrial equipment, and storing the original byte stream in a register; And receiving a data acquisition command sent by the gateway according to a preset data acquisition period based on dynamic protocol communication, returning an original byte stream in the register so that the gateway can package the original byte stream into structured data after performing byte order conversion and data extraction on the original byte stream, uploading the structured data to a cloud platform so that the cloud platform can receive the structured data reported by the gateway, and performing targeted processing on the structured data to complete a data communication task.
- 8. The data communication method of claim 7, wherein the method further comprises: Receiving a protocol format control command issued by the gateway based on dynamic protocol communication, and analyzing and acquiring a control type, a control parameter and a variable identifier in the protocol format control command; Based on the variable identification, executing the equipment action corresponding to the control type and the control parameter, and generating an instruction execution result; and feeding back the instruction execution result to the gateway to complete the control instruction execution flow.
- 9. A data communication device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the data communication method according to any one of claims 1-4, claims 5-6, and claims 7-8.
- 10. A storage medium, characterized in that the storage medium is a computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of the data communication method according to any one of claims 1-4, claims 5-6, and claims 7-8.
Description
Data communication method, device and storage medium Technical Field The present application relates to the field of data interaction technologies, and in particular, to a data communication method, device, and storage medium. Background The industrial Internet of things has more than ten heterogeneous protocols such as Modbus RTU/TCP, profinet, etherNet/IP, OPC UA and the like for a long time on site, and equipment manufacturers respectively define register layout, byte order and data types, so that 'unified collection of instrument data in different languages' becomes the need. The traditional data acquisition system generally adopts a single-protocol single gateway or a multi-protocol static compiling framework, wherein all protocol drives are burned at one time when the gateway leaves a factory, a new protocol can be extended only through whole package upgrade on site, protocol conversion logic and service codes are coupled in the same process, a mapping table is written in source codes, and differences such as byte order, floating point format and the like depend on manual script processing. The static mode exposes rigid defects when a production line expands capacity or protocol iterates, a PLC (programmable logic controller ) is newly added, a whole package firmware must be recompiled, the upgrading process is stopped for a plurality of hours, any protocol defect can drag down the whole acquisition process due to high coupling of driving and service, isolation failure is global disconnection, a mapping surface cannot be replaced with equipment model heat, only on-site code changing can be carried out on the mapping surface, maintenance cost is increased directly, all driving resident memories are occupied by a redundant protocol, and resources are strived for reducing instantaneity in a high concurrency scene. More troublesome is that the upper computer is required to write an independent interface for each type of protocol due to lack of unified equipment abstraction, the development quantity of an application side is multiplied by data format fragmentation, and the acquisition requirement of an industrial site on 'plug and play, non-stop expansion and unified access' is not met for a long time. Disclosure of Invention The application mainly aims to provide a data communication method, equipment and a storage medium, and aims to solve the problem that the acquisition requirement of 'plug and play, non-stop expansion and unified access' of an industrial field cannot be met for a long time. To achieve the above object, the present application provides a data communication method, which is applied to a gateway, including: Transmitting a data acquisition command to the industrial equipment based on dynamic protocol communication according to a preset data acquisition period, receiving an original byte stream returned by the industrial equipment, performing byte order conversion and data extraction on the original byte stream, and packaging the byte stream into structured data, wherein the original byte stream is generated according to equipment functions of the industrial equipment and is stored in a register of the industrial equipment; Uploading the structured data to a cloud platform, so that the cloud platform receives the structured data reported by the gateway and carries out targeted processing on the structured data to complete a data communication task. In one possible implementation, the dynamic protocol communication establishment procedure includes: Acquiring protocol type information of the industrial equipment, and positioning a matched protocol driving library in a preset catalog according to the protocol type information; calling a dynamic link function to load the protocol driving library into a memory, and acquiring a standard interface function in the protocol driving library through a symbol searching function; based on the standard interface function, the configuration parameters of the hardware interface are transmitted to initialize the protocol driving library, a protocol driving instance is generated and registered to a driving management list; and calling a hardware interface through the protocol driving example, sending a protocol detection command to the industrial equipment, and completing communication connection establishment according to equipment response. In one possible implementation manner, after performing byte order conversion and data extraction on the original byte stream, the method encapsulates the byte stream into structured data, and includes: Acquiring byte order type and data type information corresponding to the industrial equipment, and adjusting byte order sequence of the original byte stream according to the byte order type; Extracting a target value from the adjusted original byte stream according to the data type information, wherein the data type comprises an integer, a floating point number, a character string and bit data; and acquiring a device id