A communication method and system of a power distribution terminal based on MQTT file synchronization technology

CN116723181BActive Publication Date: 2026-09-22ZHUHAI RADIANCE ELECTRIC
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202310540945.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-12
Publication Date
2026-09-22
Estimated Expiration
2043-05-12

AI Technical Summary

Technical Problem

普通类型的传输数据,如遥信、遥测、遥控、定值、较时、SOE,由于其数据量很小,占用资源少,所以很容易达到快速传输的目的,而对于文件的传输,由于嵌入式硬件设备资源有限、传输过程中信道占用时间长、文件丢包等因素使得文件传输不能在很短的时间内同步到综合通讯单元中,不利于主站及时分析故障原因和作出判断

Benefits of technology

[0017]根据本发明提供的一种基于MQTT文件同步技术的配网终端,所述MQTT处理模块包括MQTT分析模块和MQTT转发模块,所述MQTT分析模块接收来自MQTT总线或云平台的MQTT报文并通过所述MQTT转发模块向所述MQTT总线或云平台发送MQTT报文。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116723181B_ABST
    Figure CN116723181B_ABST
Patent Text Reader

Abstract

The application provides a communication method and system of a network configuration terminal based on an MQTT file synchronization technology, which comprises: establishing MQTT communication between a plurality of slaves and a master; continuously scanning a new file directory by the slave; when the slave detects a new file, judging whether the format of the new file meets transmission requirements; if yes, sending a file request sending command; judging whether a request sending confirmation command is received; if yes, entering a file sending state; after sending a frame of message by the slave, waiting for the master to send a numbered message confirmation frame; after the slave receives the numbered message confirmation frame, if the confirmation frame number is correct and file sending is not completed, continuing to send the next frame of message; when file transmission data is sent to the last frame, sending a file end request command; entering a file end request process to complete file transmission. The file synchronization technology based on the MQTT protocol can realize stable and fast file transmission between terminals.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power distribution network automation technology, specifically to a power distribution network terminal based on MQTT file synchronization technology and a communication method using the terminal. Background Technology

[0002] The National Energy Administration has proposed achieving a distribution network automation coverage rate of over 95%. Based on this goal, my country's distribution network construction and distribution automation coverage have significantly improved in recent years. With the rapid development of distribution networks, more and more distribution automation master stations are connecting to distribution network terminal equipment, and the standards for distribution network equipment access are becoming increasingly clear. Among these standards, the timeliness of distribution network equipment documentation is explicitly required.

[0003] In field applications, the only device communicating with the master station is the integrated communication unit. The protection and control unit is responsible for synchronizing all data and files to the integrated communication unit. Common types of transmitted data, such as remote signaling, telemetry, remote control, setting values, timing, and SOE, are easily transmitted quickly due to their small data size and low resource consumption. However, for file transmission, limited embedded hardware resources, long channel occupancy times during transmission, and packet loss prevent timely synchronization of files to the integrated communication unit, hindering the master station's ability to analyze fault causes and make timely judgments. Summary of the Invention

[0004] To overcome the shortcomings of existing technologies, this invention addresses the problem of long file transmission synchronization time by providing a communication method and system for distribution network terminals based on MQTT file synchronization technology. This method and system, based on MQTT protocol file synchronization technology, can achieve stable and fast file transmission between terminals.

[0005] To solve the above problems, the technical solution adopted by the present invention is as follows:

[0006] A communication method for a distribution network terminal based on MQTT file synchronization technology includes the following steps:

[0007] The integrated communication unit and protection and control unit are divided into master and slave units. Multiple slave units establish MQTT communication with the master unit. The slave units continuously scan the directory of newly added files. When a slave unit detects a newly added file, it determines whether the format of the newly added file meets the transmission requirements. If it does, it sends a file request send command. It then checks whether it receives a request send confirmation command. If so, it enters the file send state. After each frame is sent, the slave unit waits for the master to send a numbered message confirmation frame. After receiving the numbered message confirmation frame, if the confirmation frame number is correct and the file transmission is not complete, it continues to send the next frame. If the numbered confirmation frame times out, it retransmits the previous frame. If a transmission error command is received, it enters the transmission error state. When the file transmission data is sent to the last frame, a file end request command is sent. The file end request process is then initiated, and the file end request message is packaged and sent. After the file end request message is successfully sent, it enters the waiting state for a request end reply, completing the file transmission.

[0008] According to the communication method of a distribution network terminal based on MQTT file synchronization technology provided by the present invention, when sending a file request sending command, the host checks the list of received commands in real time to determine whether a file request sending command has been received. If so, it enters the file sequence number command receiving state, and replies with a number message confirmation frame for each file sequence number received. It also determines whether a file end request command has been received, and if so, sends a file end confirmation frame.

[0009] According to the communication method of a distribution network terminal based on MQTT file synchronization technology provided by the present invention, the condition for determining whether the format of the newly added file meets the transmission requirements includes: judging the name of the newly added file; if the name of the newly added file in the directory is a preset file format, then the file is included in the transmission list.

[0010] According to the communication method of a distribution network terminal based on MQTT file synchronization technology provided by the present invention, the preset file format is .cfg and .dat file format, wherein .cfg and .dat are a set of waveform recording files.

[0011] According to the communication method of a distribution network terminal based on MQTT file synchronization technology provided by the present invention, when it is determined that the format of the newly added file meets the transmission requirements, the file name is parsed and the data in the file is parsed. The file name is the first packet of data when it is transmitted, and its sequence number is 1. When the data in the file is transmitted, the sequence number corresponding to the first packet is 1+1, the data corresponding to the second packet is 1+2, and so on until the data transmission is completed.

[0012] According to the communication method of a distribution network terminal based on MQTT file synchronization technology provided by the present invention, when entering the file sending state, the slave first sends the first packet of data as the file name. If the master does not reply with an acknowledgment frame for the first packet of data, the slave does not send the second packet of data. If no acknowledgment frame is received from the master within a predetermined time, the data packet is resent.

[0013] If the slave device receives an acknowledgment frame for the first data packet sent by the master device, the slave device sends the second data packet and then waits for an acknowledgment frame for the second data packet from the master device. If no acknowledgment frame for the second data packet is received, the slave device times out and retransmits. If an acknowledgment frame for the second data packet is received, the slave device sends the third data packet, and so on, until the data transmission is complete.

[0014] A distribution network terminal based on MQTT file synchronization technology includes:

[0015] The system comprises a master unit and a slave unit. The slave unit includes a network port module with an MQTT conversion module. The master unit includes an MQTT processing module and a communication module. The MQTT processing module transmits MQTT messages with the network port module via an MQTT bus. The communication module transmits MQTT messages with the MQTT processing module via an MQTT bus. The MQTT processing module can send MQTT messages to the cloud platform via the MQTT protocol. The MQTT processing module can also receive MQTT messages from the cloud platform via the MQTT protocol. The communication module can organize the MQTT messages into a suitable message format and send it to the master station. The communication module can also receive messages from the master station.

[0016] According to the present invention, a distribution network terminal based on MQTT file synchronization technology is provided. The MQTT conversion module includes an MQTT protocol module and an MQTT parsing module. The network port module includes a network port receiving module, a parsing module, and an MQTT sending module. The network port receiving module is used to receive messages from the slave device. The parsing module is used to parse the messages received by the slave device. The MQTT protocol module converts the parsed messages into MQTT messages. The MQTT sending module sends the converted MQTT messages to the MQTT processing module through the MQTT bus.

[0017] According to the present invention, a distribution network terminal based on MQTT file synchronization technology is provided. The MQTT processing module includes an MQTT analysis module and an MQTT forwarding module. The MQTT analysis module receives MQTT messages from the MQTT bus or cloud platform and sends MQTT messages to the MQTT bus or cloud platform through the MQTT forwarding module.

[0018] Therefore, compared to existing technologies, this invention, in order to transmit files more quickly and meet the timely file request requirements of the power distribution master station, uses the MQTT protocol for file transmission. In field applications, the integrated communication unit and the protection and control unit are divided into master and slave modes. The slave needs to synchronize all newly added files that meet the format requirements to the master. The master can collect all files from the slaves and interact with the master station. This invention is compatible with existing MQTT protocols, ensuring that devices supporting the standard MQTT protocol can also be connected normally. Each slave and master uses an MQTT connection as a channel for synchronization requests, thereby enabling the master to achieve synchronous communication between slaves through forwarding and transparent transmission.

[0019] In addition, this distribution network terminal based on MQTT file synchronization technology can complete the access of serial port devices of various protocol types through the network port module, MQTT processing module and communication module contained in the terminal system. It can convert the slave's Modbus protocol message into the MQTT protocol format commonly used in the Internet of Things and forward it to the cloud platform or master station, thus completing the collection and transmission of information.

[0020] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. Attached Figure Description

[0021] Figure 1 This is a flowchart of an embodiment of a communication method for a distribution network terminal based on MQTT file synchronization technology according to the present invention.

[0022] Figure 2 This is a flowchart of the slave device in an embodiment of a communication method for a distribution network terminal based on MQTT file synchronization technology according to the present invention.

[0023] Figure 3 This is a flowchart of the host in an embodiment of a communication method for a distribution network terminal based on MQTT file synchronization technology according to the present invention.

[0024] Figure 4 This is a schematic diagram of a distribution network terminal based on MQTT file synchronization technology according to the present invention. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0026] See Figures 1 to 3This embodiment provides a communication method for a distribution network terminal based on MQTT file synchronization technology, including the following steps:

[0027] Step S1: Divide the integrated communication unit and the protection and control unit into master and slave units, and establish MQTT communication between multiple slave units and the master unit;

[0028] Step S2: The slave device continuously scans the directory of newly added files. When the slave device detects a newly added file, it determines whether the format of the newly added file meets the transmission requirements. If so, it sends a file request command.

[0029] Step S3: Determine whether a request to send an acknowledgment command has been received. If so, enter the file sending state. After each frame is sent, the slave waits for the master to send a numbered acknowledgment frame. After the slave receives the numbered acknowledgment frame, if the acknowledgment frame number is correct and the file sending is not yet complete, it continues to send the next frame.

[0030] Step S4: If the number confirmation frame times out, retransmit the previous frame message; if a transmission error command is received, enter the transmission error state; when the file transmission data is sent to the last frame, send a file end request command.

[0031] Step S5: Enter the file end request process, complete the packaging and sending of the file end request message, and after the file end request message is successfully sent, enter the waiting state for the end request reply to complete the file transfer.

[0032] In this embodiment, when sending a file request command, the host checks the list of received commands in real time to determine whether a file request command has been received. If so, it enters the file sequence number command receiving state and replies with a numbered message confirmation frame for each received file sequence number. It also determines whether a file end request command has been received. If so, it sends a file end confirmation frame.

[0033] In this embodiment, the conditions for determining whether the format of the newly added file meets the transmission requirements include: judging the name of the newly added file; if the name of the newly added file in the directory is a preset file format, then the file is added to the transmission list.

[0034] The default file formats are .cfg and .dat, where .cfg and .dat are a set of waveform recording files.

[0035] In this embodiment, after determining that the format of the newly added file meets the transmission requirements, the file name and the data in the file are parsed. The file name is the first data packet with the sequence number 1 during transmission. When the data in the file is transmitted, the sequence number of the first packet is 1+1, and the data of the second packet is 1+2, until the data transmission is completed.

[0036] When entering the file transmission state, the slave device first sends the first packet containing the file name. If the master device does not reply with an acknowledgment frame for the first packet, the slave device will not send the second packet. If no acknowledgment frame is received from the master device within a predetermined time, the slave device will retransmit the first packet. If the slave device receives the acknowledgment frame for the first packet from the master device, it will send the second packet and then wait for the master device to send the acknowledgment frame for the second packet. If no acknowledgment frame is received for the second packet, the slave device will retransmit after a timeout. If the acknowledgment frame is received, the slave device will send the third packet, and so on, until the data transmission is complete.

[0037] In practical applications, when the slave device detects a new file, it determines the file format. If the file is to be transferred, it splits and numbers the file and sends a file request command. After sending the command, it waits for a file transfer confirmation command.

[0038] If a file sending confirmation command is received, the file number is transmitted. If a file sending rejection command is received from the host, a timed file request command is initiated. If no file request command is received from the host, a timed file request command is also initiated.

[0039] When entering the file transmission state, the slave device waits for the master to send a numbered acknowledgment frame after sending each frame. Upon receiving the numbered acknowledgment frame, if the frame number is correct and the file transmission is not yet complete, the slave device continues to send the next frame. If the numbered acknowledgment frame times out, the slave device retransmits the previous frame. If a transmission error command is received, the slave device enters the transmission error state. When the file transmission data is sent to the last frame, a file end request command is sent.

[0040] When entering the file end request process, the main task is to package and send the file end request message. After the message is successfully sent, it automatically jumps to the waiting state for the request end reply.

[0041] When entering the waiting process, if a correct completion reply is received, the file transfer will proceed to the successful state. If the confirmation reply times out, the file transfer will also proceed to the successful state by default.

[0042] The file format and file name are checked. If a new file in the directory is in .cfg or .dat format, it is added to the transfer list. (Fault recording files, .cfg and .dat are one set of recording files).

[0043] When splitting and numbering files, the filenames are parsed, and then the data within the files is parsed. During transmission, the filename is the first data packet, with a sequence number of 1. During data transmission, the sequence number of the first packet is 1+1, the sequence number of the second packet is 1+2, and so on, until data transmission is complete. Each packet can transmit a maximum of 600 bytes.

[0044] The slave device first sends the file name as the first data packet. If the master device does not reply with an acknowledgment frame for the first data packet, the slave device will not send the second data packet. If it does not receive an acknowledgment frame from the master device within 3 seconds, it will resend the data packet (the master device sending an acknowledgment frame is equivalent to telling the slave device that the master device has received the first data packet).

[0045] If the slave device receives an acknowledgment frame for the first data packet sent by the master device, the slave device will send the first data packet and then wait for an acknowledgment frame for the second data packet from the master device. If it does not receive the acknowledgment frame, it will time out and retransmit. If it receives the acknowledgment frame, it will send the third data packet. This logic continues until the transmission is complete.

[0046] An embodiment of a distribution network terminal based on MQTT file synchronization technology

[0047] A distribution network terminal based on MQTT file synchronization technology includes:

[0048] like Figure 4 As shown, there is a host 3 and a slave 1. The slave 1 includes a network port module 20 with an MQTT conversion module 10. The host 3 includes an MQTT processing module 30 and a communication module 33. The MQTT processing module 30 transmits MQTT messages with the network port module 20 through the MQTT bus. The communication module 33 transmits MQTT messages with the MQTT processing module 30 through the MQTT bus.

[0049] The MQTT processing module 30 can send MQTT messages to the cloud platform 4 via the MQTT protocol, and the MQTT processing module 30 can receive MQTT messages from the cloud platform 4 via the MQTT protocol. The communication module 33 can organize MQTT messages into a suitable message format and send them to the master station 5. The communication module 33 can receive messages from the master station 5.

[0050] The MQTT conversion module 10 includes an MQTT protocol module 11 and an MQTT parsing module 12. The network port module 20 includes a network port receiving module 21, a parsing module 22, and an MQTT sending module 23. The network port receiving module 21 is used to receive messages from slave 1. The parsing module 22 is used to parse the messages received by slave 1. The MQTT protocol module 11 converts the parsed messages into MQTT messages. The MQTT sending module 23 sends the converted MQTT messages to the MQTT processing module 30 through the MQTT bus.

[0051] The MQTT processing module 30 includes an MQTT analysis module 32 and an MQTT forwarding module 31. The MQTT analysis module 32 receives MQTT messages from the MQTT bus or cloud platform 4 and sends MQTT messages to the MQTT bus or cloud platform 4 through the MQTT forwarding module 31.

[0052] Furthermore, in order to back up and save MQTT format messages, the MQTT processing module 30 sends the parsed data to a dedicated database module, which receives and stores the MQTT message parsing data from the MQTT analysis module 32.

[0053] Furthermore, the communication module 33 also includes a receiving module, a parsing module 22, and an MQTT organization and sending module. The receiving module receives messages sent by the master station 5, the parsing module 22 parses the messages received by the receiving module, and the MQTT organization and sending module organizes the parsed messages into MQTT messages and sends them to the MQTT processing module 30 / network port module 20 via the MQTT bus.

[0054] Furthermore, it also includes a memory storage module for storing backup MQTT messages parsed by the MQTT receive parsing module 22 and messages parsed by the parsing module 22, which can synchronously store the parsed messages and MQTT messages.

[0055] Therefore, compared to existing technologies, this invention, in order to transmit files more quickly and meet the timely file request requirements of the power distribution master station 5, uses the MQTT protocol for file transmission. In field applications, the integrated communication unit and the protection and control unit are divided into master 3 and slave 1 modes. Slave 1 needs to synchronize all newly added files that meet the format requirements to master 3. Master 3 can collect all files from slave 1 and interact with master station 5. This invention is compatible with existing MQTT protocols, ensuring that devices supporting the standard MQTT protocol can also be connected normally. Each slave 1 has an MQTT connection with master 3 as a channel for synchronization requests, thereby enabling master 3 to achieve synchronous communication between slave 1 through forwarding and transparent transmission.

[0056] In addition, the distribution terminal based on MQTT file synchronization technology can complete the access of serial port devices of various protocol types through the network port module 20, MQTT processing module 30 and communication module 33 contained in the terminal system. It can convert the Modbus protocol message of slave 1 into the MQTT protocol format commonly used in the Internet of Things and forward it to the cloud platform 4 or master station 5, thus completing the collection and transmission of information.

[0057] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0058] The above embodiments are merely preferred embodiments of the present invention and should not be construed as limiting the scope of protection of the present invention. Any non-substantial changes and substitutions made by those skilled in the art based on the present invention shall fall within the scope of protection claimed by the present invention.

Claims

1. A communication method for a distribution network terminal based on MQTT file synchronization technology, characterized in that, Includes the following steps: The integrated communication unit and the protection and control unit are divided into master and slave units, and multiple slave units establish MQTT communication with the master unit. The slave device continuously scans the directory for newly added files. When the slave device detects a newly added file, it determines whether the format of the newly added file meets the transmission requirements. If so, it sends a file request and sends a command. Determine whether a request to send an acknowledgment command has been received. If so, enter the file sending state. After each frame is sent, the slave waits for the master to send a numbered acknowledgment frame. After the slave receives the numbered acknowledgment frame, if the acknowledgment frame number is correct and the file sending is not yet complete, it continues to send the next frame. If the number confirmation frame times out, the previous frame is retransmitted. If a transmission error command is received, the transmission error state is entered. When the file transfer data is sent to the last frame, a file end request command is sent. Enter the file end request process, complete the packaging and sending of the file end request message, and after the file end request message is successfully sent, enter the waiting state for the end request reply to complete the file transfer; When sending a file request command, the host checks the list of received commands in real time to determine whether it has received the file request command. If so, it enters the file sequence number command state and replies with a number message acknowledgment frame for each file sequence number received. Determine if a file end request command has been received; if so, send a file end confirmation frame. The conditions for determining whether the format of the newly added file meets the transmission requirements include: judging the name of the newly added file; if the name of the newly added file in the directory is a preset file format, then the file is added to the transmission list. The preset file formats are .cfg and .dat, where .cfg and .dat are a set of waveform recording files; Once it is determined that the format of the newly added file meets the transmission requirements, the file name and the data in the file are parsed. When the file name is transmitted, it is the first data packet with a sequence number of 1. When the data in the file is transmitted, the sequence number of the first packet is 1+1, the sequence number of the second packet is 1+2, and so on, until the data transmission is complete. When entering the file sending state, the slave device first sends the first packet of data, which is the file name. If the master device does not reply with an acknowledgment frame for the first packet of data, the slave device will not send the second packet of data. If no acknowledgment frame is received from the master device within the predetermined time, the slave device will resend the packet of data. If the slave device receives an acknowledgment frame for the first data packet sent by the master device, the slave device sends the second data packet and then waits for an acknowledgment frame for the second data packet from the master device. If no acknowledgment frame for the second data packet is received, the slave device times out and retransmits. If an acknowledgment frame for the second data packet is received, the slave device sends the third data packet, and so on, until the data transmission is complete.

2. A distribution network terminal based on MQTT file synchronization technology, characterized in that, The distribution network terminal is used in the communication method of the distribution network terminal based on MQTT file synchronization technology as described in claim 1, wherein the distribution network terminal includes: The system includes a master unit and a slave unit. The slave unit includes a network port module with an MQTT conversion module. The master unit includes an MQTT processing module and a communication module. The MQTT processing module transmits MQTT messages with the network port module via an MQTT bus. The communication module transmits MQTT messages with the MQTT processing module via an MQTT bus. The MQTT processing module can send MQTT messages to the cloud platform via the MQTT protocol, and can also receive MQTT messages from the cloud platform via the MQTT protocol. The communication module can organize the MQTT messages into a suitable message format and send them to the master station, and can also receive messages from the master station.

3. The distribution network terminal according to claim 2, characterized in that: The MQTT conversion module includes an MQTT protocol module and an MQTT parsing module. The network port module includes a network port receiving module, a parsing module, and an MQTT sending module. The network port receiving module is used to receive messages from the slave device. The parsing module is used to parse the messages received by the slave device. The MQTT protocol module converts the parsed messages into MQTT messages. The MQTT sending module sends the converted MQTT messages to the MQTT processing module via the MQTT bus.

4. The distribution network terminal according to claim 3, characterized in that: The MQTT processing module includes an MQTT analysis module and an MQTT forwarding module. The MQTT analysis module receives MQTT messages from the MQTT bus or cloud platform and sends MQTT messages to the MQTT bus or cloud platform through the MQTT forwarding module.

Citation Information

Patent Citations

  • Big data transmission method and system

    CN110995697A

  • Power distribution Internet of Things system based on MQTT protocol

    CN111953733A

  • Internet of Things file transmission method based on mqtt protocol

    CN112118296A

  • A method and method for data transmission

    CN1964348A