Heat supply network equipment communication protocol design method based on LoRa technology
By designing a thermal network equipment communication protocol based on LoRa technology, the problems of low communication efficiency, high cost, fixed network nodes, low security and poor flexibility in the data acquisition and regulation of thermal network secondary network equipment are solved, and efficient, flexible and secure data acquisition and regulation effects are achieved.
Patent Information
- Application Number
- CN202411789602.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-03-21
AI Technical Summary
The data collection and regulation of existing thermal network secondary network equipment has problems such as low communication efficiency, high cost, fixed network nodes, low security and poor flexibility.
A thermal network equipment communication protocol based on LoRa technology was designed. By dividing network addresses into network numbers, group numbers and group address numbers, group communication improves efficiency; dividing communication channels into different functional groups to improve capacity; designing node networking and out-of-network processes to improve node flexibility; designing data type codes and data domains to improve regulation effect; solving LoRa gateway site selection problem through communication quality test frames; realizing node firmware upgrades through firmware upgrades; and using data encryption technology to improve network security.
It has realized large-scale network networking, improved communication efficiency and capacity, improved the flexibility of network nodes, enhanced regulation effect and security, and reduced network difficulty and cost.
Smart Images

Figure CN119676752A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data collection and regulation of heating network secondary network equipment, and in particular to a heating network equipment communication protocol design method based on LoRa technology. Background Art
[0002] The central heating system is an important part of urban infrastructure and plays an important role in improving the quality of life and environmental quality of urban residents. The pipe network of the heating system is roughly divided into primary pipe network and secondary pipe network based on the community heat exchange station; the secondary pipe network is referred to as the secondary network. The primary pipe network is from the thermal power plant to the community heat exchange station, and the secondary pipe network is from the heat exchange station to the terminal equipment. Among them, the terminal equipment is directly related to the user, and the control of it is directly related to the experience of the end user. The terminal equipment mainly refers to unit valves, household valves, heat meters and electricity meters, which are numerous and can reach tens of thousands. Data collection and control are very difficult. At present, there are three main ways to collect and control the secondary network equipment: connect each device through wired communication, and then gather them in the control room for unified management and control; use data transmission unit DTU to transmit the data of the terminal equipment to the cloud platform, and the platform will collect and control the data; use Internet of Things technology, such as long-range radio LoRa, to network the terminal equipment and then transmit it to the cloud platform, and the platform will collect and control the data.
[0003] Although the above methods can complete the collection and regulation of secondary network devices, they have exposed some significant limitations in application: using wired communication, it is necessary to wire each device separately, and it is necessary to complete the analysis of the communication protocol of each device on the server side, which is labor-intensive and costly, especially in transformation projects. When using DTU data transparent transmission, the server needs to coordinate the communication cycle of each DTU, and the communication efficiency is very low. When a large amount of uplink data arrives at the same time, the pressure on the server will increase sharply, resulting in the inability to respond to the device within the effective time. The device thinks that the data is lost and starts retransmission, and the communication load is further increased. In severe cases, it even causes the server to be unable to effectively regulate. Although the use of LoRa technology for network transparent transmission overcomes the disadvantages brought by wired, it also alleviates the communication efficiency problem of DTU to a certain extent. However, most of the existing LoRa modules use the same channel for communication. In the case of a large number of modules, there is serious mutual interference, which also limits the node capacity of the network. Secondly, the LoRa module uses plain text transmission, and security is not guaranteed at all. Thirdly, the LoRa module network requires a gateway, and the location of the gateway directly determines the quality of network node communication. The gateway composed of general LoRa modules cannot provide communication quality parameters, which makes networking difficult. The location can only be determined through multiple human experiments, which is inefficient and costly. Finally, once the existing LoRa modules are networked, the network nodes are fixed, and it is impossible to add or delete nodes, which has low flexibility. Summary of the invention
[0004] In order to overcome the shortcomings of the prior art, the purpose of the present invention is to provide a communication protocol design method for heating network equipment based on LoRa technology, which meets the requirements of large-scale network networking by dividing the network address into network number, group number and address number within the group, and improves communication efficiency through packet communication; improves communication capacity by dividing the communication channel into different functional groups; improves the flexibility of network nodes by designing the networking and denetworking processes of nodes; improves the regulation effect by designing data type codes and data domains; solves the LoRa gateway site selection problem and reduces the difficulty of networking by designing communication quality test frames; realizes firmware upgrade of nodes through the LoRa network by designing firmware upgrade frames; and improves network security by adopting data encryption technology.
[0005] To achieve the above object, the present invention provides the following solutions:
[0006] A method for designing a communication protocol for a heating network device based on LoRa technology, comprising:
[0007] Determine a preset communication channel and communication frame format; the communication channel includes: a polling channel, a control channel and a data channel; the communication frame format includes: an uplink data frame and a downlink data frame; the address of the uplink data frame indicates a source address; the address of the downlink data frame indicates a destination address; the addresses of the uplink data frame and the downlink data frame both include: a network number, a group number and a node address number; the uplink data frame and the downlink data frame both include: a data type code and a data field;
[0008] The communication process is divided into communication quality test, network access, communication test during operation, communication parameter query, data frame transmission, acquisition controller firmware upgrade and network exit based on Node-Key encryption;
[0009] When performing the communication quality test, a communication test command is sent to the target node through the gateway based on a unicast mode, a communication test response is sent to the gateway through the target node, and the gateway determines whether the target node meets the communication standard and determines the networking communication parameters according to the communication test response;
[0010] When the network access is performed, a network access command is sent to the target node through the control channel through the gateway in a unicast manner; when the target node receives the network access command, a network access response is sent to the gateway through the target node; when the gateway receives the network access response, a communication parameter setting command frame is sent to the target node through the gateway; when the target node parameter setting is completed, a communication parameter setting response frame is sent to the gateway through the target node; when the gateway receives the communication parameter setting response frame, a received response frame is sent to the target node through the gateway; when the target node receives the received response frame, the communication channel is switched; when the gateway does not receive the communication parameter setting response frame within a specified time period, the communication parameter setting command frame is resent to the target node; when the number of resending of the communication parameter setting command frame exceeds a set number, it is determined that the target node has given up the network access;
[0011] When the communication test is performed during the operation, the communication test command is sent to the target node through the gateway using the polling channel based on a unicast method. After the target node receives the communication test command, the communication test response is sent to the gateway through the target node, and the communication test response is uploaded to a preset tuning platform through the gateway.
[0012] When performing the communication parameter query, a communication parameter query command is sent to the target node through the gateway, and when the target node receives the communication parameter query command, a communication parameter response frame is sent to the gateway through the target node;
[0013] When the data frame transmission is performed, a polling command is sent to the target node through the gateway based on unicast or multicast mode. When the target node corresponding to the unicast receives the polling command, the polling data frame is sent to the gateway through the target node using an uplink polling channel. When several target nodes corresponding to the multicast receive the polling command, the polling data frame is sent to the gateway through all the target nodes using the uplink polling channel. When the gateway does not receive the polling data frame within a specified time, the polling command is sent repeatedly. When the number of repeated sending of the polling command exceeds a specified number, a communication failure is recorded through the gateway.
[0014] When performing the firmware upgrade of the acquisition controller, a firmware upgrade command frame is sent to the target node through the gateway. When the version number in the firmware upgrade command frame is inconsistent with the local version number, an update ready response frame is sent to the gateway through the target node. A firmware package total information frame is sent to the target node through the gateway. A total information response frame is sent to the gateway through the target node. A first package of firmware data frames, a first MD5 check code, and a firmware status query frame are sent to the target node in sequence through the gateway. The first package of firmware data frames is checked by the target node using the first MD5 check code to obtain a check result. The check result is sent to the gateway through the target node. When the check result is that there is no packet loss, the next package of firmware data frames and the next MD5 check code are continued to be sent. When the check result is a packet loss state, the firmware data frame and the MD5 check code corresponding to the check result are resent. After the gateway sends all firmware data frames to the target node, all firmware data frames are used by the target node to upgrade and an update completion response frame is sent to the gateway.
[0015] When the network exit is performed, a network exit command is sent to the target node through the gateway in a unicast manner, a network exit response frame is sent to the gateway, and the network exit command is used to control the target node to exit the network.
[0016] Preferably, the communication test response includes: RSSI, SNR and packet pickup rate.
[0017] Preferably, the prescribed duration is 3 minutes by default; the set number of times is 5 by default.
[0018] Preferably, the prescribed time is 3 seconds by default; the prescribed number of times is 3 times by default.
[0019] Preferably, the firmware upgrade command frame includes: a firmware version number, a firmware size, and a total number of data packets.
[0020] Preferably, the size of the first package firmware data frame is 2Kb.
[0021] Preferably, when the acquisition controller firmware is upgraded, it also includes:
[0022] When the target node is upgraded, the version number in the firmware upgrade command frame is written into a preset off-chip Flash.
[0023] The present invention discloses the following technical effects:
[0024] The invention provides a design method for a communication protocol of a heating network device based on the LoRa technology. By dividing a network address into a network number, a group number and an address number within a group, the defects of large communication efficiency, high workload and high cost of conventional technologies are solved, and a large-scale network networking function is realized; by dividing communication channels into different functional groups, the defect that a conventional system uses the same channel for communication is solved, and the communication capacity is improved; by designing the networking and de-networking processes of nodes, the defect that a conventional network node is fixedly set is solved, and functions such as adding, deleting and modifying nodes are realized; by designing a data type code and a data domain, the problem of complex regulation of conventional systems is solved, and the system regulation mode is improved; by designing a communication quality test frame, the problem of LoRa gateway site selection is solved, and the difficulty of networking is reduced; by designing a firmware upgrade frame, the defect that a conventional system cannot upgrade nodes is solved, and the nodes are upgraded to firmware through the LoRa network; by adopting data encryption technology, the problem of low security of conventional technologies is solved, and the network security is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0026] Figure 1 A schematic diagram of the design process of the communication protocol of the heating network equipment based on the LoRa technology provided by the embodiment of the present invention;
[0027] Figure 2 A schematic diagram of a communication quality test process provided by an embodiment of the present invention;
[0028] Figure 3 A schematic diagram of a network access process provided by an embodiment of the present invention;
[0029] Figure 4 A schematic diagram of a working state communication test flow provided by an embodiment of the present invention;
[0030] Figure 5 A schematic diagram of a communication parameter query process provided by an embodiment of the present invention;
[0031] Figure 6 A schematic diagram of the query and unicast setting process provided by an embodiment of the present invention;
[0032] Figure 7 A schematic diagram of a multicast process provided by an embodiment of the present invention;
[0033] Figure 8 A schematic diagram of a firmware update process provided by an embodiment of the present invention;
[0034] Fig. 9 A schematic diagram of a network exit response process provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] The purpose of the present invention is to provide a communication protocol design method for heating network equipment based on LoRa technology, which meets the requirements of large-scale network networking by dividing the network address into a network number, a group number and an address number within the group, and improves the communication efficiency through packet communication; improves the communication capacity by dividing the communication channel into different functional groups; improves the flexibility of network nodes by designing the networking and denetworking processes of nodes; improves the control effect by designing data type codes and data domains; solves the LoRa gateway site selection problem and reduces the difficulty of networking by designing a communication quality test frame; realizes the firmware upgrade of nodes through the LoRa network by designing a firmware upgrade frame; and improves network security by adopting data encryption technology.
[0037] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0038] Figure 1 The schematic diagram of the design process of the communication protocol of the heating network equipment based on the LoRa technology provided by the embodiment of the present invention is as follows: Figure 1 As shown, the present invention provides a method for designing a communication protocol for a heating network device based on LoRa technology, comprising:
[0039] Step 100: Determine a preset communication channel and communication frame format; the communication channel includes: a polling channel, a control channel and a data channel; the communication frame format includes: an uplink data frame and a downlink data frame; the address of the uplink data frame indicates a source address; the address of the downlink data frame indicates a destination address; the addresses of the uplink data frame and the downlink data frame both include: a network number, a group number and a node address number; the uplink data frame and the downlink data frame both include: a data type code and a data field;
[0040] Step 200: Divide the communication process into communication quality test, network access, communication test during operation, communication parameter query, data frame transmission, acquisition controller firmware upgrade and network exit based on Node-Key encryption;
[0041] When performing the communication quality test, a communication test command is sent to the target node through the gateway based on a unicast mode, a communication test response is sent to the gateway through the target node, and the gateway determines whether the target node meets the communication standard and determines the networking communication parameters according to the communication test response;
[0042] When the network access is performed, a network access command is sent to the target node through the control channel through the gateway in a unicast manner; when the target node receives the network access command, a network access response is sent to the gateway through the target node; when the gateway receives the network access response, a communication parameter setting command frame is sent to the target node through the gateway; when the target node parameter setting is completed, a communication parameter setting response frame is sent to the gateway through the target node; when the gateway receives the communication parameter setting response frame, a received response frame is sent to the target node through the gateway; when the target node receives the received response frame, the communication channel is switched; when the gateway does not receive the communication parameter setting response frame within a specified time period, the communication parameter setting command frame is resent to the target node; when the number of resending of the communication parameter setting command frame exceeds a set number, it is determined that the target node has given up the network access;
[0043] When the communication test is performed during the operation, the communication test command is sent to the target node through the gateway using the polling channel based on a unicast method. After the target node receives the communication test command, the communication test response is sent to the gateway through the target node, and the communication test response is uploaded to a preset tuning platform through the gateway.
[0044] When performing the communication parameter query, a communication parameter query command is sent to the target node through the gateway, and when the target node receives the communication parameter query command, a communication parameter response frame is sent to the gateway through the target node;
[0045] When the data frame transmission is performed, a polling command is sent to the target node through the gateway based on unicast or multicast mode. When the target node corresponding to the unicast receives the polling command, the polling data frame is sent to the gateway through the target node using an uplink polling channel. When several target nodes corresponding to the multicast receive the polling command, the polling data frame is sent to the gateway through all the target nodes using the uplink polling channel. When the gateway does not receive the polling data frame within a specified time, the polling command is sent repeatedly. When the number of repeated sending of the polling command exceeds a specified number, a communication failure is recorded through the gateway.
[0046] When performing the firmware upgrade of the acquisition controller, a firmware upgrade command frame is sent to the target node through the gateway. When the version number in the firmware upgrade command frame is inconsistent with the local version number, an update ready response frame is sent to the gateway through the target node. A firmware package total information frame is sent to the target node through the gateway. A total information response frame is sent to the gateway through the target node. A first package of firmware data frames, a first MD5 check code, and a firmware status query frame are sent to the target node in sequence through the gateway. The first package of firmware data frames is checked by the target node using the first MD5 check code to obtain a check result. The check result is sent to the gateway through the target node. When the check result is that there is no packet loss, the next package of firmware data frames and the next MD5 check code are continued to be sent. When the check result is a packet loss state, the firmware data frame and the MD5 check code corresponding to the check result are resent. After the gateway sends all firmware data frames to the target node, all firmware data frames are used by the target node to upgrade and an update completion response frame is sent to the gateway.
[0047] When the network exit is performed, a network exit command is sent to the target node through the gateway in a unicast manner, a network exit response frame is sent to the gateway, and the network exit command is used to control the target node to exit the network.
[0048] Specifically, the communication test response includes: RSSI (received signal strength indication), SNR (signal to noise ratio) and packet pickup rate.
[0049] Optionally, the prescribed duration defaults to 3 minutes; the set number of times defaults to 5 times.
[0050] Preferably, the prescribed time is 3 seconds by default; the prescribed number of times is 3 times by default.
[0051] Specifically, the firmware upgrade command frame includes: a firmware version number, a firmware size, and a total number of data packets.
[0052] Preferably, the size of the first package firmware data frame is 2Kb.
[0053] Furthermore, when the firmware of the acquisition controller is upgraded, it also includes:
[0054] When the target node is upgraded, the version number in the firmware upgrade command frame is written into a preset off-chip Flash.
[0055] Specifically, the communication channel is divided into polling channel, control channel and data channel according to different functions (refer to Table 1). Among them, the polling channel is used for collecting and controlling the device, the control channel is used for networking of the device, and the data channel is used for firmware upgrade of the device.
[0056] Table 1
[0057] Up Downside Remark 1 CN470_80_87 506.7 Polling Channel 2 CN470_88_95 508.3 Polling Channel 3 CN470_0_7 500.3 Polling Channel 4 CN470_78 506.3 Control Channel 5 CN470_79 506.5 Data Channel
[0058] The channel parameters are specified as shown in Table 2:
[0059] Table 2
[0060] Preamble CR Spreading Factor Transmit power Polling Channel 8 4 / 5 8-11 20dbm Control Channel 8 4 / 5 8-11 20dbm Data Channel 8 4 / 5 9-11 20dbm
[0061] Communication frame format, communication frames are divided into uplink and downlink, strictly abide by the format specified by LoRa PHY (maximum length 32 bytes), refer to Table 3:
[0062] Table 3
[0063]
[0064] Uplink data frame reference table 4:
[0065] Table 4
[0066] Preamble PHDR_CRC PHY PAYLOAD CRC
[0067] Downlink data frame reference table 5:
[0068] Table 5
[0069] Preamble PHDR PHDR_CRC PHY PAYLOAD CRC
[0070] N is not greater than 28. The payload length indicates the length of the frame payload (ie, the value of N), excluding the frame header (3B) and the payload length itself.
[0071] Preferably, the frame type, frame type (1B) description refers to Table 6:
[0072] Table 6
[0073]
[0074] Frame type field: distinguish different types of frames. Response request and response bit: whether this frame needs a response. If it is set to 1, it means it needs to be responded to. Then the receiver needs to set the response bit to 1 in the next data frame to be sent. If this bit is 0, it means no response is needed. The receiver sets the response bit to 0. Play mode bit: indicates whether this frame is unicast or multicast. When it is unicast, only nodes that match the unicast address will respond to this frame. If it is multicast, only nodes that match the group number will respond to this frame.
[0075] Specifically, the address (2B) indicates that the address of the uplink data frame represents the source address, and the address of the downlink data frame represents the destination address, refer to Table 7.
[0076] Table 7
[0077]
[0078] The network number is used to distinguish the networks managed by different gateways. Even if the data frames between different networks are received, they will not be identified and processed. The group number is used to distinguish the nodes of different groups in the same network. When the group number is 0, it means that this frame is broadcast to the entire network. The node address number is used to distinguish the nodes in the same group. When the address number is 0, it means that this frame is multicast to all nodes in the group.
[0079] Further, the payload length description indicates the length of the frame payload, excluding the frame header (3B) and the checksum (2B). The frame payload description (0 to NB) varies in format depending on the frame type, and is described below one by one.
[0080] Preferably, the gateway sends a network access command frame during the network configuration phase. The network access command frame is in unicast mode and is addressed by a unique node ID. See Table 8:
[0081] Table 8
[0082] Frame Type 1B 0x08 Network access command, response required, unicast mode address 2B 0xXXXX Set the node address Payload length 1B 0x06 Frame payload length load 6B 0xXXXXXXXXXXXXXXXX Node 48-bit ID number
[0083] Specifically, after receiving the network access command, the node will respond with a network access response frame. The network access response frame is unicast, and the node returns the set address, refer to Table 9:
[0084] Table 9
[0085] Frame Type 1B 0x1C Network access response, response required, unicast mode address 2B 0xXXXX Node Address Payload length 1B 0x06 Frame payload length load 6B 0xXXXXXXXXXXXXXXXX Node 48-bit ID number
[0086] Preferably, after receiving the network access response, the gateway will send a communication parameter setting frame to set the communication parameters and set the response bit to respond to the network access response frame of the node. This frame is unicast. Refer to Table 10:
[0087] Table 10
[0088]
[0089] Specifically, the communication parameter setting response, after receiving the communication parameter setting frame, the node responds with this frame, and this frame does not require a response. Refer to Table 11:
[0090] Table 11
[0091]
[0092] Furthermore, the communication parameter setting response data frame, after the gateway receives the communication parameter setting response data frame of the node, the node does not know whether the gateway has received it, and also does not know whether the node can modify its own LoRa communication parameters at this time. Therefore, after the gateway receives the communication parameter setting response data frame of the node, it should send another data frame to indicate that the gateway has received the response message at this time. After receiving the response of the communication parameter setting response data frame of the gateway, the node can modify its own LoRa parameters. The data frame definition refers to Table 12:
[0093] Table 12
[0094]
[0095] Preferably, the communication test command and the communication test command frame are used to test the communication quality of each node in the networking stage, so Node-Key encryption is adopted. Refer to Table 13:
[0096] Table 13
[0097]
[0098] Specifically, the communication test response frame is used to respond to the communication test command frame and is encrypted using Node-Key. Refer to Table 14:
[0099] Table 14
[0100]
[0101] Preferably, the communication parameter query command and the communication parameter query command frame are used by the gateway to query the communication parameters of the node after entering the network.
[0102] Table 15
[0103] Frame Type 1B 0x68 Communication parameter query frame, response required, unicast mode address 2B 0xXXXX Node Address Payload length 1B 0x00 Frame payload length load 0B
[0104] Specifically, the communication parameter query response is used to respond to the communication parameter query response, and no response is required. Refer to Table 16:
[0105] Table 16
[0106]
[0107] Specifically, the exit command is used to allow a node to exit from a group. Refer to Table 17:
[0108] Table 17
[0109] Frame Type 1B 0xA8 Communication parameter query frame, response required, unicast mode address 2B 0xXXXX Node Address Payload length 1B 0x00 Frame payload length load 0B
[0110] Preferably, after receiving the network exit command, the node replies with this frame and then waits for the network exit response data frame from the gateway.
[0111] Table 18
[0112] Frame Type 1B 0xBC Communication parameter query frame, response required, unicast mode address 2B 0xXXXX Node Address Payload length 1B 0x00 Frame payload length load 0B
[0113] Specifically, the response to the network exit command response is that the gateway receives the network exit response data frame sent by the node and sends a response data frame. The frame format definition refers to Table 19. After receiving the data frame, the node returns to the non-networked state, clears the assigned node address, key and registered valve information, and changes the LoRa communication parameters of the acquisition controller itself to the default values (CR-4 / 5, SF9, Power-20dbm).
[0114] Table 19
[0115]
[0116] Preferably, the polling data frame, the node uplink data frame includes the node working status, device working status, command response, etc. Refer to Table 20:
[0117] Table 20
[0118]
[0119]
[0120] Further, the specific meaning of each type code and data field refers to Table 21:
[0121] Table 21
[0122]
[0123]
[0124]
[0125] Specifically, the polling command and the node polling command frame mainly include control commands, query commands, etc., that is, there are unicast communications and multicast communications. Refer to Table 22:
[0126] Table 22
[0127]
[0128]
[0129] Further, the specific meaning of each type code and data field refers to Table 23:
[0130] Table 23
[0131]
[0132]
[0133]
[0134]
[0135] refer to Figure 2 , communication quality test. Before the networking and network deployment phase, the network communication quality needs to be tested. This test is completed through the pre-networking test process. The test is initiated by the gateway and completed through the control channel unicast using Node-Key encryption. After receiving the communication test command, the node returns the RSSI and SNR parameters of the downlink data for the gateway to judge the quality of communication. The gateway determines whether the node location is appropriate and the communication parameters during networking based on the pre-networking communication test and parameters such as RSSI, SNR and packet pickup rate.
[0136] refer to Figure 3 , the network access process. Network access is initiated by the gateway and is carried out in unicast mode. The network access command is sent through the control channel, and the node responds after receiving it. If no command is received, the node remains silent and listens to the networking channel. All communication frames are encrypted by Node-Key to ensure the security of the network. After the gateway receives the node's response to the network access command, it will send a communication parameter setting command frame to set the communication parameters of this node. After the node completes the reception of the parameter setting command frame, it will send a response frame to the gateway through the networking channel and parameters. After the gateway receives the node parameter setting response frame, it will send a command confirmation. At this time, if the node receives the command, it will modify the node's LoRa communication parameters to the new communication parameters and communicate on the new channel. If the gateway does not receive a response frame after sending the parameter setting again for more than the set time (default 3 minutes), it will resend the communication parameter setting command frame. If it exceeds the set number of times (default 5 times), it is considered that the node does not exist, and the network access is abandoned, and the network access process of the next node begins. The nodes that have completed networking will communicate according to the set communication parameters and will no longer use the control channel unless the engineering initialization operation is performed.
[0137] refer to Figure 4 , Communication test process during working. After the networking is completed, the communication quality of the gateway and the node can be tested irregularly. This test is completed through the communication test process in the working state. The test is initiated by the gateway (unicast) and completed through the polling channel using Net-Key encryption. After receiving the command, the node returns the RSSI and SNR parameters of the downlink data. The gateway counts the RSSI, SNR, packet pickup rate and other parameters during the communication process and uploads them to the tuning platform.
[0138] refer to Figure 5 , communication parameter query. During normal communication or after networking is completed, the gateway can query the communication parameters of the node. After receiving the query command, the node returns its own communication data.
[0139] refer to Figure 6 and Figure 7 , data frame transmission. The transmission of all data frames is actively initiated by the gateway on the polling channel, and there are two modes: unicast and multicast. The node does not actively send polling data frames. The unicast polling command needs to set the response request bit. The multicast polling command frame sets the response request bit as needed. After receiving the command, the node with the multicast address returns the corresponding data through the set uplink channel. The following figures are the flow charts of unicast and multicast respectively. When the downlink data frame needs to be responded, if the node does not respond within the specified time (default 3 seconds), the gateway will resend the frame. If the specified number of times is exceeded (more than 3 times), the gateway will record a communication failure.
[0140] refer to Figure 8, the firmware of the acquisition controller is upgraded. The firmware upgrade of the acquisition controller is completed through the polling channel transmission. The gateway first sends a firmware upgrade command frame, and the node detects whether the new version number is consistent with the current version number. If not, it sends a response to indicate that it is ready to upgrade; the gateway then sends a data frame of the firmware general information (firmware version number, size and total number of data packets) through the polling channel. After receiving it, the node sends a response message to indicate that it has received the firmware general information frame; then the gateway sends the first package (2Kb) of the firmware specific data frame, and the firmware data frame does not need to be replied. When the first package of firmware data frame is sent, the gateway sends the MD5 checksum of the current data packet, and then asks the acquisition controller whether the MD5 data frame is received. If the acquisition controller responds that the MD5 checksum frame is received, the gateway asks whether the current group of data packets is lost. If there is no packet loss, the next group of 2Kb data packets will be sent. If there is packet loss, the lost data frames will be resent. After resending all the lost data frames, it will ask again whether there is packet loss until the current group of data packets is complete and the MD5 checksum is correct (if the MD5 checksum fails, the current group of data packets will be resent); if the acquisition controller responds that the MD5 data frame is not received, the MD5 data frame will be resent and the above process will be repeated. After the gateway sends all the data packets and MD5 checksums, the controller receives all the data packets, checks the total number of data packets, the total number of bytes and the MD5. After that, it starts the upgrade and changes the flag to the updating state. After the upgrade is completed, the new version number is written to the off-chip Flash, and the App is jumped to run the new firmware. After the gateway inquires about the update status, it responds with a successful firmware upgrade command, thus completing the firmware upgrade of the controller. If a node cannot receive the firmware data frame after receiving the firmware upgrade command frame, or the firmware data verification fails, it sends a data error, prompting the gateway that the upgrade cannot be completed.
[0141] refer to Fig. 9 , exit the network. The gateway can use the exit command in the network to make the nodes that have joined the network exit the network. This command is unicast. After receiving it, the node exits the existing network and enters the state of waiting for networking.
[0142] The beneficial effects of the present invention are as follows:
[0143] The present invention meets the requirements of large-scale network networking by dividing the network address into a network number, a group number and an address number within the group, and improves the communication efficiency by group communication; improves the communication capacity by dividing the communication channel into different functional groups; improves the flexibility of network nodes by designing the networking and denetworking processes of nodes; improves the regulation effect by designing data type codes and data domains; solves the LoRa gateway site selection problem and reduces the difficulty of networking by designing a communication quality test frame; realizes the firmware upgrade of nodes through the LoRa network by designing a firmware upgrade frame; and improves network security by adopting data encryption technology.
[0144] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0145] The principles and implementation methods of the present invention are described in this article using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present invention. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A method for designing a communication protocol for a heating network device based on LoRa technology, characterized in that: include: Determine the preset communication channel and communication frame format; The communication channel includes: a polling channel, a control channel and a data channel; the communication frame format includes: an uplink data frame and a downlink data frame; the address of the uplink data frame indicates a source address; the address of the downlink data frame indicates a destination address; the addresses of the uplink data frame and the downlink data frame both include: a network number, a group number and a node address number; the uplink data frame and the downlink data frame both include: a data type code and a data field; The communication process is divided into communication quality test, network access, communication test during operation, communication parameter query, data frame transmission, acquisition controller firmware upgrade and network exit based on Node-Key encryption; When performing the communication quality test, a communication test command is sent to the target node through the gateway based on a unicast mode, a communication test response is sent to the gateway through the target node, and the gateway determines whether the target node meets the communication standard and determines the networking communication parameters according to the communication test response; When the network access is performed, a network access command is sent to the target node through the control channel through the gateway in a unicast manner; when the target node receives the network access command, a network access response is sent to the gateway through the target node; when the gateway receives the network access response, a communication parameter setting command frame is sent to the target node through the gateway; when the target node parameter setting is completed, a communication parameter setting response frame is sent to the gateway through the target node; when the gateway receives the communication parameter setting response frame, a received response frame is sent to the target node through the gateway; when the target node receives the received response frame, the communication channel is switched; when the gateway does not receive the communication parameter setting response frame within a specified time period, the communication parameter setting command frame is resent to the target node; when the number of resending of the communication parameter setting command frame exceeds a set number, it is determined that the target node has given up the network access; When the communication test is performed during the operation, the communication test command is sent to the target node through the gateway using the polling channel based on a unicast method. After the target node receives the communication test command, the communication test response is sent to the gateway through the target node, and the communication test response is uploaded to a preset tuning platform through the gateway. When performing the communication parameter query, a communication parameter query command is sent to the target node through the gateway, and when the target node receives the communication parameter query command, a communication parameter response frame is sent to the gateway through the target node; When the data frame transmission is performed, a polling command is sent to the target node through the gateway based on unicast or multicast mode. When the target node corresponding to the unicast receives the polling command, the polling data frame is sent to the gateway through the target node using an uplink polling channel. When several target nodes corresponding to the multicast receive the polling command, the polling data frame is sent to the gateway through all the target nodes using the uplink polling channel. When the gateway does not receive the polling data frame within a specified time, the polling command is sent repeatedly. When the number of repeated sending of the polling command exceeds a specified number, a communication failure is recorded through the gateway. When performing the firmware upgrade of the acquisition controller, a firmware upgrade command frame is sent to the target node through the gateway. When the version number in the firmware upgrade command frame is inconsistent with the local version number, an update ready response frame is sent to the gateway through the target node. A firmware package total information frame is sent to the target node through the gateway. A total information response frame is sent to the gateway through the target node. A first package of firmware data frames, a first MD5 check code, and a firmware status query frame are sent to the target node in sequence through the gateway. The first package of firmware data frames is checked by the target node using the first MD5 check code to obtain a check result. The check result is sent to the gateway through the target node. When the check result is that there is no packet loss, the next package of firmware data frames and the next MD5 check code are continued to be sent. When the check result is a packet loss state, the firmware data frame and the MD5 check code corresponding to the check result are resent. After the gateway sends all firmware data frames to the target node, all firmware data frames are used by the target node to upgrade and an update completion response frame is sent to the gateway. When the network exit is performed, a network exit command is sent to the target node through the gateway in a unicast manner, a network exit response frame is sent to the gateway, and the network exit command is used to control the target node to exit the network.
2. A method for designing a communication protocol for a heating network device based on LoRa technology according to claim 1, characterized in that: The communication test response includes: RSSI, SNR and packet pickup rate.
3. A method for designing a communication protocol for a heating network device based on LoRa technology according to claim 1, characterized in that: The default setting is 3 minutes for the specified duration and 5 times for the set number.
4. The method for designing a communication protocol for a heating network device based on LoRa technology according to claim 1, characterized in that: The default setting of the specified time is 3 seconds; the default setting of the specified number of times is 3 times.
5. The method for designing a communication protocol for a heating network device based on LoRa technology according to claim 1, characterized in that: The firmware upgrade command frame includes: firmware version number, firmware size and total number of data packets.
6. A method for designing a communication protocol for heating network equipment based on LoRa technology according to claim 1, characterized in that: The size of the first package firmware data frame is 2Kb.
7. The method for designing a communication protocol for a heating network device based on LoRa technology according to claim 1, characterized in that: When the firmware of the acquisition controller is upgraded, it also includes: When the target node is upgraded, the version number in the firmware upgrade command frame is written into a preset off-chip Flash.
