Communication establishment method and apparatus, electronic device, and storage medium

By generating a first configuration file and a second configuration file, the communication connection between the IoT gateway and the management terminal device and field devices is automatically configured, realizing automated data synchronization between the IoT gateway and the management terminal device, reducing manual labor and improving the efficiency of communication establishment.

CN116781770BActive Publication Date: 2025-12-05SIEMENS FACTORY AUTOMATION ENG
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310806434.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-03
Publication Date
2025-12-05
Estimated Expiration
2043-07-03

AI Technical Summary

Technical Problem

In existing technologies, establishing data communication between BAS and IoT gateway manually involves high labor intensity and time consumption, resulting in low communication establishment efficiency.

Method used

By generating a first configuration file and a second configuration file, the communication connection between the IoT gateway and field devices and management devices is automatically configured, and data synchronization is performed using the first data storage area and the second data storage area, reducing manual intervention.

Benefits of technology

It enables automated data synchronization between IoT gateways, management devices, and field devices, reducing manual labor and improving the efficiency of communication establishment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116781770B_ABST
    Figure CN116781770B_ABST
Patent Text Reader

Abstract

The application provides a communication establishment method and device, electronic equipment and storage medium, the communication establishment method is applied to the internet of things gateway, and the method comprises the following steps: generating a first configuration file and a second configuration file according to input parameter information; configuring the communication connection between the internet of things gateway and the field device according to the first configuration file; generating a first data storage area according to the command sequence included in the first configuration file, wherein the command sequence comprises at least one read-write command, and the read-write command is used for read-write operation on the field device through the data acquisition port; and sending the second configuration file to the management end device, so that the management end device generates a second data storage area matched with the first data storage area according to the second configuration file, and the first data storage area and the second data storage area are synchronized. The communication establishment method provided by the application does not need manual communication establishment, so that the efficiency of communication establishment can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of information communication, and in particular to a communication establishment method and device, an electronic device, and a storage medium. BACKGROUND

[0002] With the development of the Internet of Everything, the application of Internet of Things control technology in various industries is gradually deepening. Field devices transmit information to a comprehensive monitoring platform through an Internet of Things (IoT) gateway, so that the comprehensive monitoring platform can monitor the field devices. In the rail transit industry, a building automation system (BAS) of a rail transit station transmits data to air conditioners, ventilation systems, water supply and drainage systems, lighting systems, elevators, escalators, and other field devices in the rail transit station and the interval tunnel through an IoT gateway, so as to monitor, manage, and control the operation of the field devices. Therefore, the data communication protocol between the BAS and the IoT gateway and the data communication protocol between the IoT gateway and the field devices need to be configured.

[0003] At present, the data communication between the BAS and the IoT gateway is established manually.

[0004] However, since there are a large number of rail transit stations, and a large number of IoT gateways and field devices are arranged in each rail transit station, the manual establishment of communication is labor-intensive, time-consuming, and error-prone, which reduces the efficiency of the communication establishment process. SUMMARY

[0005] Therefore, the communication establishment method, device, electronic device, and storage medium provided by the present application can improve the efficiency of communication establishment.

[0006] According to a first aspect of an embodiment of the present application, a communication establishment method is provided, applied to an Internet of Things gateway, and the method comprises: generating a first configuration file and a second configuration file according to input parameter information; configuring a communication connection between the Internet of Things gateway and a field device according to the first configuration file; generating a first data storage area according to a command sequence included in the first configuration file, wherein the command sequence includes at least one read-write command, the read-write command is used to perform a read-write operation on the field device through a data acquisition port, and the first data storage area is used to store read-write data and command state feedback information corresponding to the command sequence; and sending the second configuration file to a management end device, so that the management end device generates a second data storage area matching the first data storage area according to the second configuration file, and synchronizes data between the first data storage area and the second data storage area.

[0007] According to a second aspect of the embodiments of the present application, a communication establishment apparatus is provided, comprising: a first generation unit configured to generate a first configuration file and a second configuration file according to input parameter information; a configuration unit configured to configure a communication connection between the Internet of Things gateway and the field device according to the first configuration file; a second generation unit configured to generate a first data storage area according to a command sequence included in the first configuration file, wherein the command sequence includes at least one read-write command, the read-write command is used for read-write operation on the field device through a data collection port, and the first data storage area is used for storing read-write data and command state feedback information corresponding to the command sequence; and a sending unit configured to send the second configuration file to a management end device, so that the management end device generates a second data storage area matching the first data storage area according to the second configuration file, and performs data synchronization between the first data storage area and the second data storage area.

[0008] According to a third aspect of the embodiments of the present application, an electronic device is provided, comprising: a processor, a communication interface, a memory and a communication bus, the processor, the memory and the communication interface complete communication with each other through the communication bus; the memory is used to store at least one executable instruction, and the executable instruction makes the processor execute the operations corresponding to the communication establishment method provided in the first aspect.

[0009] According to a fourth aspect of the embodiments of the present application, a computer readable storage medium is provided, and the computer readable storage medium stores computer instructions, and the computer instructions make the processor execute the operations corresponding to the communication establishment method provided in the first aspect when the processor executes the computer instructions.

[0010] According to a fifth aspect of the embodiments of the present application, a computer program product is provided, and the computer program product is tangibly stored on a computer readable medium and includes computer executable instructions, and the computer executable instructions make at least one processor execute the communication establishment method provided in the first aspect or any possible implementation manner of the first aspect when the computer executable instructions are executed.

[0011] According to the technical scheme, the first configuration file and the second configuration file are generated according to the input parameter information, then the data acquisition port of the Internet of Things gateway is initialized and the first data storage area is generated according to the first configuration file, and the second configuration file is sent to the management end device, so that the management end device generates the second data storage area, thereby realizing the data synchronization between the management end device and the Internet of Things gateway through the data synchronization between the first data storage area and the second data storage area. Since the first configuration file and the second configuration file are automatically generated according to the input parameters, and the subsequent process is automatically performed according to the first configuration file and the second configuration file, it is not necessary to manually establish the communication between the Internet of Things gateway and the management end device, and it is not necessary to manually establish the communication between the Internet of Things gateway and the field device, thereby reducing the labor intensity and improving the efficiency of the communication establishment process. BRIEF DESCRIPTION OF DRAWINGS

[0012] Figure 1 is a flowchart of a communication establishment method provided by an embodiment of the present application;

[0013] Figure 2 is a schematic diagram of a communication establishment device provided by an embodiment of the present application;

[0014] Figure 3 is a schematic diagram of an electronic device provided by an embodiment of the present application.

[0015] LIST OF REFERENCE NUMERALS

[0016] 101: generating a first configuration file and a second configuration file according to input parameter information

[0017] 102: configuring the communication connection between the Internet of Things gateway and the field device according to the first configuration file

[0018] 103: generating a first data storage area according to the command sequence included in the first configuration file

[0019] 104: sending the second configuration file to the management end device, so that the management end device generates a second data storage area matching the first data storage area according to the second configuration file, and the first data storage area and the second data storage area are synchronized

[0020] 100: communication establishment method 200: communication establishment device 201: first generation unit

[0021] 202: configuration unit 203: second generation unit 204: sending unit

[0022] 300: electronic device 302: processor 304: communication interface

[0023] 306: memory 308: communication bus 310: program DETAILED DESCRIPTION

[0024] As mentioned before, with the development of the Internet of Things, the application of Internet of Things control technology in various industries is gradually deepened. Field devices transmit information to the integrated monitoring platform through the IoT gateway, so that the integrated monitoring platform can monitor the field devices. In the rail transit industry, the BAS of the rail transit station transmits data to the air conditioning, ventilation, water supply and drainage, lighting, elevator, escalator and other field devices in the rail transit station and the interval tunnel through the IoT gateway for data monitoring, operation management and control. Therefore, it is necessary to configure the data communication protocol between the BAS and the IoT gateway, and the data communication protocol between the IoT gateway and the field devices.

[0025] Currently, the data communication between the BAS and the IoT gateway is established by manual operation. First, the basic hardware parameters of the Internet of Things gateway, such as Internet Protocol (IP) address, device name, slave address and data acquisition channel, are manually initialized and configured. Then, the data and protocols required by each channel of the IoT gateway are configured in turn, such as configuring Modbus protocol to collect serial port or network port data.

[0026] After configuring the data and protocols required by each channel of the IoT gateway, the original data obtained by each IoT gateway channel is usually manually rearranged and processed in the configuration software of each manufacturer's IoT gateway to obtain the device data collected by each channel and the diagnostic information of the current connection state of each device channel. Then, the data is mapped to the internal data address of the gateway, the data length of each IoT gateway exchanged with the BAS is determined, and finally the IO communication configuration file of each IoT gateway is exported or the server data source is generated in the internal IoT gateway, such as generating a data source based on Modbus, TCPIP and OPC protocols for the BAS to access.

[0027] The BAS can first import the IO configuration file of each IoT gateway, and define the data length of the input and output of each gateway IO configuration file in the BAS according to the data length of the mapped internal data address area, so as to obtain the data of the IoT gateway. Alternatively, the BAS platform defines the start address, data length and protocol of the data read / write of each IoT gateway through separate programming or configuration and the communication program of each IoT gateway to obtain the device information of the mapped internal data address area of the IoT gateway. After the BAS obtains the data of each IoT gateway, the monitoring data, control data and diagnostic information of each IoT gateway are separated from the obtained data. When the single IoT gateway debugging is completed, the above process is performed on all IoT gateways in the station to complete the connection between the BAS and all IoT gateways in the field.

[0028] As can be seen from the above, for the connection between the BAS and each IoT gateway, the field engineer usually needs to perform a large amount of configuration / programming debugging work in the IoT gateway and the BAS. The IoT gateway side needs to define the data acquisition information of each channel in the gateway configuration software, and after acquiring the data, the address rearrangement and mapping of the data to be uploaded are manually performed. The BAS side needs to configure the IO configuration file of each IoT gateway, or realize communication through programming.

[0029] However, since the number of rail transit stations is large, and a large number of IoT gateways and field devices are arranged in a rail transit station, the manual labor intensity is large and the time consumed is large when the communication is established manually, so that the efficiency of the communication establishment process is low.

[0030] In the embodiment of the present application, the first configuration file and the second configuration file are generated according to the input parameter information, then the data acquisition port of the Internet of Things gateway is initialized and the first data storage area is generated according to the first configuration file, and the second configuration file is sent to the management end device, so that the management end device generates the second data storage area. Thus, the data synchronization between the first data storage area and the second data storage area can be realized to realize the data synchronization between the management end device and the Internet of Things gateway. Since the first configuration file and the second configuration file are automatically generated according to the input parameters, and the subsequent process is automatically performed according to the first configuration file and the second configuration file, the communication between the Internet of Things gateway and the management end device does not need to be established manually, and the communication between the Internet of Things gateway and the field device does not need to be established manually, thereby reducing the manual labor intensity and improving the efficiency of the communication establishment process.

[0031] The communication establishment method, device and electronic equipment provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0032] Figure 1is a flow chart of a communication establishment method 100 provided by an embodiment of the present application. As shown in Figure 1 The communication establishment method 100 is used for an Internet of Things gateway, and the communication establishment method 100 comprises the following steps.

[0033] In step 101, a first configuration file and a second configuration file are generated according to input parameter information.

[0034] The first configuration file and the second configuration file are generated according to the input parameter information. The parameter information can be input by a person from a graphical user interface. Optionally, the input parameter information can comprise parameters required for configuring a communication serial port, such as enable En, baud rate Baud, data bit Data_Bit, stop bit Stop_Bit, and check mode Pair. The input parameter information can also comprise communication parameters between the Internet of Things gateway and a field device, such as address S_ID, function code Fun_Code, start address addr, data length length, and cycle time Cycle_time. The input parameter information can also comprise communication parameters between the Internet of Things gateway and a management end device (for example, a PLC), such as PLC_Type, communication port number Port, PLC IP, PLC rack number Rack, slot number Slot, field data storage DB block number, and TCP server monitoring port.

[0035] It should be understood that the above parameters are only used as an example for illustration, and should not limit the embodiments of the present application. The specific input parameter settings can be set according to the types of the Internet of Things gateway, the field device, and the management end device, as well as the communication mode and the communication protocol between different devices.

[0036] The first configuration file and the second configuration file are generated according to the input parameter information. Exemplarily, the first configuration file can be used to configure the communication connection between the Internet of Things gateway and the field device, and the second configuration file can be used to configure the communication between the Internet of Things gateway and the management end device.

[0037] In step 102, the communication connection between the Internet of Things gateway and the field device is configured according to the first configuration file.

[0038] The communication connection between the Internet of Things gateway and the field device is configured according to various parameters included in the first configuration file. The data acquisition port is initialized. Exemplarily, the communication serial port can be used for communication between the IOT gateway and the field device. The communication serial port can be initialized according to the enable En, baud rate Baud, data bit Data_Bit, stop bit Stop_Bit, and check mode Pair included in the first configuration file, so as to enable the communication between the IOT gateway and the field device.

[0039] Step 103, generating the first data storage area according to the command sequence included in the first configuration file.

[0040] The command sequence included in the first configuration file is generated according to the input parameter, and the command sequence includes at least one read-write command, the read-write command can perform read-write operation on the field device through the data acquisition port, and the first data storage area can store read-write data and command state feedback information corresponding to the command sequence.

[0041] In an example, the command sequence can be a Modbus RTU command, and in the first configuration file, a slave address, a command type, a start address, a data quantity, and the like can be included. The slave address is the address of the field device, the command type is the task to be executed, for example, a read task, a write task, and the like, the start address is the start position of the read-write data, and the data quantity is the quantity of data to be read or written. Thus, the data can be read or written from the field device through the command sequence included in the first configuration file.

[0042] The command state feedback information is the completion of the read-write command in the command sequence, for example, when the read-write command in the command sequence is successfully executed, the command state feedback information is that the command is executed successfully, and when the read-write command in the command sequence is not successfully executed, the command state feedback information is that the command is executed unsuccessfully, and the like.

[0043] The first data storage area can be generated according to the command sequence included in the first configuration file, and the storage length of the first data storage area can be the length sum of the data read from the field device, the data to be written into the field device, and the command state feedback information according to the read-write command in the command sequence. For example, the length of the first data storage area can be equal to the sum of the length of the data read from the field device, the length of the data to be written into the field device, and the number of read-write commands, that is, the read data, the data to be written, and the command state feedback information can be stored. It should be understood that the read data and the data to be written into the field device can be stored in the first data storage area in the form of an array, or the read data and the data to be written into the field device can be stored in the first data storage area in the form of a storage register address, or other storage manners can be used, which are not limited in the embodiments of the present application.

[0044] Step 104, sending the second configuration file to the management end device, so that the management end device generates a second data storage area with a structure matched with the first data storage area according to the second configuration file, and synchronizes the first data storage area with the second data storage area.

[0045] The second configuration file is sent to a management terminal device, which can be a PLC, a PC or other device with a control function. After receiving the second configuration file, the management terminal device generates a second data storage area matching the first data storage area. The second data storage area can store data with the same length as the first data storage area. The first data storage area and the second data storage area can exchange data to achieve data synchronization.

[0046] In an example, the input parameters include parameters for communication between the management terminal device and the IoT gateway, such as PLC_Type, Port, PLCIP, Rack, Slot, DB block number, TCP server monitoring port, and other information. The first configuration file includes communication instructions for communication between the management terminal device and the IoT gateway generated according to the above parameters. Thus, the first data storage area and the second data storage area can exchange data to achieve data synchronization.

[0047] In the embodiments of the present application, the first configuration file and the second configuration file are generated according to the input parameter information. Then, the IoT gateway is initialized for data collection port and the first data storage area is generated according to the first configuration file. The second configuration file is sent to the management terminal device to make the management terminal device generate the second data storage area. Thus, the first data storage area and the second data storage area can synchronize data to achieve data synchronization between the management terminal device and the IoT gateway. Since the first configuration file and the second configuration file are automatically generated according to the input parameters, and the subsequent process is automatically performed according to the first configuration file and the second configuration file, it is not necessary to manually establish communication between the IoT gateway and the management terminal device, and it is not necessary to manually establish communication between the IoT gateway and the field device. This reduces the labor intensity and improves the efficiency of the communication establishment process.

[0048] In a possible implementation, the first data storage area includes a first sub-data storage area and a second sub-data storage area. The first sub-data storage area can store first data, wherein the first data includes data written to the field device by the write command in the command sequence. The second sub-data storage area can store second data, wherein the second data includes data read from the field device by the read command in the command sequence, command state feedback information of the write command, and command state feedback information of the read command.

[0049] The first data storage area includes a first sub-data storage area and a second sub-data storage area, the first sub-data storage area is used to store data to be written into the field device, the data to be written into the field device can be control data, etc., the management end device synchronizes the data to be written into the field device from the second data storage area to the first sub-data storage area in the first data storage area, and then the Internet of Things gateway can write the data stored in the first sub-data storage area into the field device.

[0050] The second sub-data storage area stores data read from the field device, command state feedback information of a write command, and command state feedback information of a read command, and the management end device can realize reading data and reading state feedback information of each read-write command in the read-write command sequence according to the data stored in the second sub-data storage area synchronized to the second data storage area.

[0051] In the embodiment of the present application, the first data storage area includes a first sub-data storage area and a second sub-data storage area, so that the read-write data can be separated, and when the data in the second data storage area in the management end device and the first data storage area is synchronized, the data written into the field device by the management end device can be stored in the first sub-data storage area, and the data of the field device to be read by the management end device can be stored in the second sub-data storage area, thereby improving the efficiency of data synchronization between the first data storage area and the second data storage area.

[0052] In a possible implementation, when the first data storage area and the second data storage area are synchronized, the data length of the first data and the second data can be determined, then the first data and the second data are packaged according to the data length of the first data and the second data and the communication protocol between the Internet of Things gateway and the management end device, M data packets are obtained, wherein M is a positive integer greater than or equal to 2, and the M data packets are synchronized between the first data storage area and the second data storage area through the communication protocol.

[0053] The data length of the first data and the second data is determined, the data length of the first data can be obtained by adding the length of the write register of the data to be written into the field device, and the length of the second data can be obtained by adding the length of the read register of the data read from the field device and the number of read-write commands in the command sequence. It should be understood that since each read-write command corresponds to a command state feedback information, the length of the command state feedback information is equal to the number of read-write commands.

[0054] After the data length of the first data and the second data is determined, the first data and the second data are packetized according to a communication protocol between the Internet of Things gateway and the management terminal device, M data packets are obtained, and the M data packets are synchronized between the first data storage area and the second data storage area through the communication protocol.

[0055] It should be understood that the process of synchronizing the M data packets between the first data storage area and the second data storage area is that the management terminal device synchronizes each data packet included in the first data stored in the second data storage area to the first data storage area of the Internet of Things gateway, and the Internet of Things gateway synchronizes each data packet included in the second data stored in the first data storage area to the second data storage area of the management terminal device. Thus, the read and write of the management terminal device to the Internet of Things gateway are realized.

[0056] In the embodiments of the present application, the data length of the first data and the second data is determined first, then the first data and the second data are packetized according to the communication protocol and the data length, M data packets are obtained, and the M data packets are synchronized between the first data storage area and the second data storage area. Thus, the read and write operation of the management terminal device to the Internet of Things gateway is realized, the data synchronization is realized, and since the first data and the second data are packetized according to the communication protocol, the complete transmission of the first data and the second data is ensured, and the incomplete transmission of the first data and the second data due to the protocol limiting the data length is avoided.

[0057] In a possible implementation, when the first data and the second data are packetized according to the data length of the first data, the data length of the second data, and the data length threshold of the transmission protocol, and M third data are obtained, if the data length of the first data is less than or equal to the data length threshold defined by the communication protocol, the first data is divided into one data packet; if the data length of the first data is greater than the data length threshold, the first data is divided into m data packets, where m is a positive integer greater than or equal to 2, the data length of the 1st to the m-1th data packets in the m data packets is equal to the data length threshold, and the data length of the mth data packet in the m data packets is less than or equal to the data length threshold.

[0058] If the data length of the second data is less than or equal to the data length threshold, the second data is divided into one data packet; if the data length of the second data is greater than the data length threshold, the second data is divided into n data packets, where n is a positive integer greater than or equal to 2, the data length of the 1st to the n-1th data packets in the n data packets is equal to the data length threshold, the data length of the nth data packet in the n data packets is less than or equal to the data length threshold, and M = m + n.

[0059] It should be understood that the data length of the mth data packet in the m data packets of the first data split is L1-(m-1)*x, where L1 is used to represent the data length of the first data, and x is used to represent the data length threshold, and the data length of the nth data packet in the n data packets of the second data split is L2-(n-1)*x, where L2 is used to represent the data length of the second data, and x is used to represent the data length threshold.

[0060] In the embodiments of the present application, the first data and the second data are packetized according to the communication protocol and the data length, and M data packets are obtained, so that the management end device can perform read and write operations on the Internet of Things gateway, data synchronization is achieved, and because the first data is split into 1 or m data packets and the second data is split into 1 or n data packets according to the communication protocol, the complete transmission of the first data and the second data is ensured, and incomplete transmission of the first data and the second data due to protocol-limited data length is avoided.

[0061] In a possible implementation, the third data storage area and the fourth data storage area are generated according to the command sequence, the third data storage area is used to store the first write data that needs to be written to the field device, and the fourth data storage area is used to store the read data read from the field device and the command state feedback information of the command sequence; the data stored in the third data storage area and the fourth data storage area is sorted and processed according to the data type; and the first write data, the read data and the command state feedback information after the sorting processing are written to the first data storage area.

[0062] According to the command sequence included in the first configuration file, the third data storage area and the fourth data storage area are generated, the third data storage area can store the first write data that needs to be written to the field device, the first write data can include the slave address, the start address and the write data area of each write command, and the fourth data storage area can store the first read data read from the field device, the first read data can include the slave address, the start address, the command length and the like of each read command.

[0063] The data stored in the third data storage area and the fourth data storage area is sorted and pre-processed, and the data stored in the third data storage area and the fourth data storage area after the sorting is stored to the first data storage area.

[0064] In the embodiments of the present application, the third data storage area and the fourth data storage area are generated according to the command sequence in the first configuration file, so that the first write data that needs to be written to the field device can be stored, and the first read data read from the field device and the command state feedback information of each read and write data can be stored.

[0065] In a possible implementation, when sorting the data stored in the third data storage area and the fourth data storage area according to the data type, the write command state feedback information corresponding to the write command can be filtered from the command state feedback information stored in the fourth data storage area, and then the read data corresponding to the same read command and the command state feedback information in the fourth data storage area are combined to obtain at least one data pair, wherein the data pair includes the read data corresponding to the same read command and the command state feedback information, and the data stored in the third data storage area and the fourth data storage area are sorted in the order of the first write-in data, the write command state feedback information, and the data pair.

[0066] The command state feedback information corresponding to the write command is separated from the fourth data storage area, and then the read data of the field device read by each read command and the command state feedback information corresponding to the read command are separated from the fourth data storage area, and are determined as a data pair, and are sorted in the order of the first write-in data, the write command state feedback information, and the data pair. Specifically, the order is the first write-in data, the write command state feedback information, the read data 1 corresponding to the read command 1, the state feedback information of the read command 1, the read data 2 corresponding to the read command 2, the state feedback information of the read command 2, the read data 3 corresponding to the read command 3, the state feedback information of the read command 3, and so on.

[0067] In an example, the sorted first write-in data can be stored as first data to the first sub-data storage area, and the sorted write command state feedback information and data pair can be stored as second data to the second sub-data storage area, thereby realizing the storage of the sorted data stored in the third storage area and the fourth storage area to the first data storage area.

[0068] In the embodiment of the present application, the data stored in the third data storage area and the fourth data storage area is sorted in the order of the first write-in data, the write command state feedback information, and the data pair, thereby realizing the storage of the read-write separated data stored in the third data storage area and the fourth data storage area to the first data storage area, and improving the efficiency of data synchronization.

[0069] In a possible implementation, the data comparison area can be generated according to the command sequence, wherein the data comparison area is used to store the second write-in data which only changes the write command to write the field device, and then the second write-in data is compared with the first write-in data. If the second write-in data is different from the first write-in data, the second write-in data is determined as the first write-in data and is stored in the third data storage area.

[0070] The data comparison area can be generated according to the command sequence in the first configuration file, the data comparison area and the third data storage area are matched, that is, the data lengths are consistent, the data comparison area can store second write data, the second write data is data that needs to be written to the field device, when the second write data is received, the second write data can be compared with the first write data stored in the third data storage area, at this time, if the second write data and the first write data are inconsistent, the second write data is stored as the first write data in the third data storage area, and a write command is executed, if the second write data and the first write data are consistent, the write data stored in the third data storage area is not changed, and the write command is not executed, that is, the write command is only executed when the data is changed.

[0071] Optionally, the data comparison area is generated only when the command for writing data only when the data is changed is included in the first configuration file, and the data comparison area is not generated when only the command for writing constant data is included in the first configuration file.

[0072] In the embodiment of the application, the data comparison area is generated according to the command sequence, and the second write data stored in the data comparison area is compared with the first write data stored in the third data storage area, so that the write data operation only when the data is changed can be realized, and the efficiency of writing data from the Internet of Things gateway to the field device and / or writing data from the management end device to the Internet of Things gateway is improved.

[0073] Figure 2 is a schematic diagram of a communication establishment device 200 provided by an embodiment of the application. As shown in Figure 2 , the communication establishment device 200 includes:

[0074] The first generation unit 201 is configured to generate a first configuration file and a second configuration file according to input parameter information;

[0075] The configuration unit 202 is configured to configure a communication connection between the Internet of Things gateway and the field device according to the first configuration file;

[0076] The second generation unit 203 is configured to generate a first data storage area according to a command sequence included in the first configuration file, wherein the command sequence includes at least one read-write command, the read-write command is used for read-write operation on the field device through a data acquisition port, and the first data storage area is used for storing read-write data and command state feedback information corresponding to the command sequence;

[0077] The sending unit 204 is configured to send the second configuration file to the management end device, so that the management end device generates a second data storage area matching the structure of the first data storage area according to the second configuration file, and the first data storage area and the second data storage area are synchronized.

[0078] In the embodiments of the present application, the first generating unit 201 can be configured to perform step 101 in the method embodiments described above, the configuring unit 202 can be configured to perform step 102 in the method embodiments described above, the second generating unit 203 can be configured to perform step 103 in the method embodiments described above, and the sending unit 204 can be configured to perform step 104 in the method embodiments described above.

[0079] In a possible implementation, the first data storage area includes a first sub-data storage area and a second sub-data storage area; the first sub-data storage area is configured to store first data, wherein the first data includes data written to the field device by a write command in the command sequence; and the second sub-data storage area is configured to store second data, wherein the second data includes data read from the field device by a read command in the command sequence, command state feedback information of the write command, and command state feedback information of the read command.

[0080] In a possible implementation, the sending unit 204 can be configured to determine data lengths of the first data and the second data; package the first data and the second data respectively according to the data lengths of the first data and the second data and a communication protocol between the Internet of Things gateway and the management terminal device, to obtain M data packets, wherein M is a positive integer greater than or equal to 2; and synchronize the M data packets between the first data storage area and the second data storage area through the communication protocol.

[0081] In a possible implementation, the sending unit 204 can be configured to, if the data length of the first data is less than or equal to a data length threshold defined by the communication protocol, divide the first data into one data packet; if the data length of the first data is greater than the data length threshold, divide the first data into m data packets, wherein m is a positive integer greater than or equal to 2, the data lengths of the first to (m-1)th data packets in the m data packets are equal to the data length threshold, and the data length of the mth data packet in the m data packets is less than or equal to the data length threshold; if the data length of the second data is less than or equal to the data length threshold, divide the second data into one data packet; if the data length of the second data is greater than the data length threshold, divide the second data into n data packets, wherein n is a positive integer greater than or equal to 2, the data lengths of the first to (n-1)th data packets in the n data packets are equal to the data length threshold, and the data length of the nth data packet in the n data packets is less than or equal to the data length threshold, and M = m + n.

[0082] In a possible implementation, the third data storage area and the fourth data storage area are generated according to the command sequence, the third data storage area is used to store first write data that needs to be written to the field device, and the fourth data storage area is used to store read data read from the field device and command state feedback information of the command sequence; the data stored in the third data storage area and the fourth data storage area is sorted according to the data type; and the first write data, the read data, and the command state feedback information after sorting are written to the first data storage area.

[0083] In a possible implementation, the sorting of the data stored in the third data storage area and the fourth data storage area according to the data type includes: screening write command state feedback information corresponding to a write command from the command state feedback information stored in the fourth data storage area; combining read data and command state feedback information corresponding to a same read command in the fourth data storage area to obtain at least one data pair, where the data pair includes the read data and the command state feedback information corresponding to the same read command; and sorting the data stored in the third data storage area and the fourth data storage area in the order of the first write data, the write command state feedback information, and the data pair.

[0084] In a possible implementation, the data comparison area is generated according to the command sequence, where the data comparison area is used to store second write data that is changed only by a write command to write to the field device; the second write data is compared with the first write data; and if the second write data is different from the first write data, the second write data is determined as the first write data and stored in the third data storage area.

[0085] It should be noted that the information interaction and execution process between the units in the communication establishment apparatus described above are based on the same concept as the communication establishment method embodiments described above, and the specific content can be referred to the description in the communication establishment method embodiments described above, which will not be repeated here.

[0086] Figure 3 is a schematic diagram of an electronic device provided by an embodiment of the present application, and embodiments of the present application do not limit the specific implementation of the electronic device. Referring to Figure 3 The electronic device 300 provided by the embodiment of the present application includes a processor 302, a communications interface 304, a memory 306, and a communications bus 308. Wherein:

[0087] The processor 302, the communications interface 304, and the memory 306 complete the communication between each other through the communications bus 308.

[0088] The communication interface 304 is configured to communicate with other electronic devices or servers.

[0089] The processor 302 is configured to execute the program 310, and specifically can execute the related steps in any of the preceding communication establishment method embodiments.

[0090] Specifically, the program 310 can include program codes including computer operation instructions.

[0091] The processor 302 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the smart device can be the same type of processor, such as one or more CPUs; or can be different types of processors, such as one or more CPUs and one or more ASICs.

[0092] The memory 306 is configured to store the program 310. The memory 306 can include a high-speed RAM memory, and can also include a non-volatile memory such as at least one disk memory.

[0093] The program 310 can be specifically used to cause the processor 302 to execute the communication establishment method in any of the preceding embodiments.

[0094] The specific implementation of each step in the program 310 can refer to the corresponding description in the corresponding steps and units in any of the preceding communication establishment method embodiments, and will not be described here. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described devices and modules can refer to the corresponding process description in the preceding method embodiments, which will not be described here.

[0095] Through the electronic device of the embodiments of the present application, the first configuration file and the second configuration file are generated according to the input parameter information, then the data collection port of the Internet of Things gateway is initialized and the first data storage area is generated according to the first configuration file, and the second configuration file is sent to the management end device to make the management end device generate the second data storage area, so that the data synchronization between the first data storage area and the second data storage area can be realized to realize the data synchronization between the management end device and the Internet of Things gateway. Since the first configuration file and the second configuration file are automatically generated according to the input parameters, and the subsequent process is automatically performed according to the first configuration file and the second configuration file, it is not necessary to manually establish the communication between the Internet of Things gateway and the management end device, and it is not necessary to manually establish the communication between the Internet of Things gateway and the field device, thereby reducing the labor intensity and improving the efficiency of the communication establishment process.

[0096] The embodiments of the present application also provide a computer readable storage medium storing instructions for causing a machine to perform the communication establishment method as described herein. Specifically, a system or apparatus equipped with a storage medium on which a software program code for implementing the functions of any of the above embodiments is stored can be provided, and the computer (or CPU or MPU) of the system or apparatus is caused to read out and execute the program code stored in the storage medium.

[0097] In this case, the program code read out from the storage medium can itself implement the functions of any of the above embodiments, and therefore the program code and the storage medium storing the program code constitute a part of the present application.

[0098] The storage medium for providing the program code includes a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as a CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0099] Furthermore, it should be understood that, not only the program code read out by the computer, but also the operating system or the like operating on the computer based on the instructions of the program code can perform part or all of the actual operations to realize the functions of any of the above embodiments.

[0100] Furthermore, it should be understood that the program code read out by the storage medium can be written into a memory provided in an expansion board inserted into the computer or a memory provided in an expansion module connected to the computer, and then part or all of the actual operations can be performed by a CPU or the like installed on the expansion board or the expansion module based on the instructions of the program code to realize the functions of any of the above embodiments.

[0101] The embodiments of the present application also provide a computer program product tangibly stored on a computer readable medium and including computer executable instructions that, when executed, cause at least one processor to perform the communication establishment method provided by each of the above embodiments. It should be understood that each of the schemes in the present embodiment has the corresponding technical effects in the above method embodiments, which will not be described here.

[0102] It should be noted that not all steps and modules in the above processes and system structure diagrams are necessary, and some steps or modules can be omitted according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in each of the above embodiments can be a physical structure or a logical structure, that is, some modules can be implemented by the same physical entity, or some modules can be implemented by multiple physical entities, or can be implemented by some components in multiple independent devices together.

[0103] The nouns and pronouns related to persons in this patent application are not limited to a specific gender.

[0104] In each of the above embodiments, a hardware module can be implemented mechanically or with electrical components. For example, a hardware module can include dedicated permanent circuitry or logic (e.g., a special processor, FPGA, or ASIC) to complete the corresponding operation. A hardware module can also include programmable logic or circuitry (e.g., a general processor or other programmable processor) that can be temporarily configured by software to complete the corresponding operation. The specific implementation method (mechanical method, or dedicated permanent circuit, or temporarily configured circuit) can be determined based on cost and time considerations.

[0105] The above has been disclosed and described in detail through the accompanying drawings and preferred embodiments, but the present application is not limited to these disclosed embodiments, and those skilled in the art can know that the code review means in the above different embodiments can be combined to obtain more embodiments of the present application, and these embodiments are also within the protection scope of the present application.

Claims

1. A communication establishment method (100) applied to an Internet of Things gateway, characterized in that, The method comprises: generating a first configuration file and a second configuration file according to input parameter information; configuring a communication connection between the Internet of Things gateway and the field device according to the first configuration file; generating a first data storage area according to a command sequence included in the first configuration file, wherein the command sequence includes at least one read-write command for read-write operation on the field device through a data acquisition port, and the first data storage area is used to store read-write data and command state feedback information corresponding to the command sequence; sending the second configuration file to a management terminal device to enable the management terminal device to generate a second data storage area matching the structure of the first data storage area according to the second configuration file, and to enable the first data storage area and the second data storage area to perform data synchronization.

2. The method of claim 1, wherein, The first data storage area includes a first sub-data storage area and a second sub-data storage area; the first sub-data storage area is used to store first data, wherein the first data includes data written into the field device by a write command in the command sequence; the second sub-data storage area is used to store second data, wherein the second data includes data read from the field device by a read command in the command sequence, command state feedback information of the write command, and command state feedback information of the read command.

3. The method of claim 2, wherein, The data synchronization between the first data storage area and the second data storage area comprises: determining data lengths of the first data and the second data; packaging the first data and the second data according to the data lengths of the first data and the second data and a communication protocol between the Internet of Things gateway and the management terminal device to obtain M data packets, wherein M is a positive integer greater than or equal to 2; synchronizing the M data packets between the first data storage area and the second data storage area through the communication protocol.

4. The method of claim 3, wherein, The packaging of the first data and the second data according to the data lengths of the first data and the second data and a data length threshold of a transmission protocol to obtain M third data comprises: if the data length of the first data is less than or equal to the data length threshold defined by the communication protocol, the first data is divided into one data packet; if the data length of the first data is greater than the data length threshold, the first data is divided into m data packets, wherein m is a positive integer greater than or equal to 2, the data lengths of the first m-1 data packets are equal to the data length threshold, and the data length of the mth data packet is less than or equal to the data length threshold; if the data length of the second data is less than or equal to the data length threshold, the second data is divided into one data packet; If the data length of the second data is greater than the data length threshold, the second data is divided into n data packets, where n is a positive integer greater than or equal to 2, the data length of the first to the n-1th data packets in the n data packets is equal to the data length threshold, the data length of the n data packet in the n data packets is less than or equal to the data length threshold, and M = m + n.

5. The method according to any one of claims 1 to 4, characterized in that, The method further comprises: According to the command sequence, a third data storage area and a fourth data storage area are generated, wherein the third data storage area is used to store first write data that needs to be written to the field device, and the fourth data storage area is used to store read data read from the field device and command state feedback information of the command sequence; According to the data type, the data stored in the third data storage area and the fourth data storage area are sorted; The first write data, the read data and the command state feedback information after sorting are written to the first data storage area.

6. The method of claim 5, wherein, The sorting of the data stored in the third data storage area and the fourth data storage area according to the data type comprises: Filtering write command state feedback information corresponding to a write command from the command state feedback information stored in the fourth data storage area; Combining read data and command state feedback information corresponding to the same read command in the fourth data storage area to obtain at least one data pair, wherein the data pair comprises read data and command state feedback information corresponding to the same read command; According to the order of the first write data, the write command state feedback information and the data pair, the data stored in the third data storage area and the fourth data storage area are sorted.

7. The method of claim 5, wherein, The method further comprises: According to the command sequence, a data comparison area is generated, wherein the data comparison area is used to store second write data written to the field device by only changing write commands; Comparing the second write data with the first write data; If the second write data is different from the first write data, the second write data is determined as the first write data and stored in the third data storage area.

8. A communication setup apparatus (200), characterized by, Comprise: A first generation unit (201) is configured to generate a first configuration file and a second configuration file according to input parameter information; A configuration unit (202) is configured to configure a communication connection between an Internet of Things gateway and a field device according to the first configuration file; A second generation unit (203) is configured to generate a first data storage area according to a command sequence included in the first configuration file, wherein the command sequence comprises at least one read-write command, the read-write command is used to perform read-write operations on the field device through a data acquisition port, and the first data storage area is used to store read-write data and command state feedback information corresponding to the command sequence. The sending unit (204) is configured to send the second configuration file to the management terminal device, so that the management terminal device generates a second data storage area matching the first data storage area according to a structure of the second configuration file, and performs data synchronization between the first data storage area and the second data storage area.

9. An electronic device (300), characterized by The method comprises the following steps: The processor (302), the communication interface (304), the memory (306) and the communication bus (308) can communicate with each other through the communication bus (308); The memory (306) is configured to store at least one executable instruction, and the executable instruction causes the processor (302) to perform the operation corresponding to the communication establishment method (100) in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions cause the processor to execute the method in any one of claims 1-7 when executed by the processor.

Citation Information

Patent Citations

  • Method and system for communicating with device

    CN106656639A

  • Industrial Internet of Things operation and maintenance platform

    CN113886061A