CN111162871B - Data transmission method and system based on LoRa - Google Patents
Data transmission method and system based on LoRa Download PDFInfo
- Publication number
- CN111162871B CN111162871B CN201911284782.5A CN201911284782A CN111162871B CN 111162871 B CN111162871 B CN 111162871B CN 201911284782 A CN201911284782 A CN 201911284782A CN 111162871 B CN111162871 B CN 111162871B
- Authority
- CN
- China
- Prior art keywords
- data
- node
- sent
- server
- length
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/0001—Systems modifying transmission characteristics according to link quality, e.g. power backoff
- H04L1/0002—Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission rate
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/0001—Systems modifying transmission characteristics according to link quality, e.g. power backoff
- H04L1/0006—Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission format
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/0078—Avoidance of errors by organising the transmitted data in a format specifically designed to deal with errors, e.g. location
- H04L1/0079—Formats for control data
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W28/00—Network traffic management; Network resource management
- H04W28/02—Traffic management, e.g. flow control or congestion control
- H04W28/06—Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information
- H04W28/065—Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information using assembly or disassembly of packets
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Quality & Reliability (AREA)
- Mobile Radio Communication Systems (AREA)
- Communication Control (AREA)
Abstract
The invention discloses a data transmission method and system based on LoRa. When the length of original data to be sent by a node is greater than the maximum length which can be carried by the current Data Rate (DR), the node calculates the length of the data to be sent this time by using the current DR of the node, and packetizes the data which are not successfully sent in the original data according to the calculated data length and sequentially sends the data to a server; in the sending process, if the node does not receive the acknowledgement response of the server for acknowledging the receipt of the data sent by the node, the node retransmits the data sent last time, when the acknowledgement response of the server is not received and the retransmission times exceed a threshold value, the node actively reduces DR, calculates the length of the data to be sent this time according to the reduced DR, and packetizes the data which are not sent in the original data according to the calculated data length and sequentially sends the data to the server.
Description
Technical Field
The invention relates to a data transmission method and system based on LoRa, and belongs to the field of LoRa data transmission.
Background
The overall name of LoRa is Long Range (Long distance), which is a low power consumption, Long distance wireless standard for local area networks. The LoRa is one of LPWAN communication technologies, and is an ultra-long-distance wireless transmission scheme based on spread spectrum technology adopted and popularized by Semtech corporation in the united states. In order to maximally ensure lower power consumption and longer-distance communication transmission, LoRa will reduce the Data Rate (DR), so that only ten or fewer bytes of data can be transmitted in one communication. However, sometimes the length of data that the node needs to send is larger than the maximum length that the DR can carry, in which case the node cannot send the complete data, which may result in a failure to send.
Therefore, there is a demand for packet transmission of data so that data can be successfully transmitted while ensuring a communication transmission distance. However, the common data packetization method uses a fixed byte packetization length, and this method will have various problems in the LoRa field.
Firstly, the problem of energy consumption is that the fixed packet length is bound to select a shorter packet length as the fixed packet length for successfully transmitting each packetized data, but the shorter packet length means a lower data rate, and the LoRa device tends to increase energy consumption if the data rate is lower, so that the battery is consumed up too quickly, and the cost is increased by replacing or charging the battery.
Secondly the duty cycle will increase. The duty cycle is defined as the ratio of the time T1 for the node to transmit the LoRa data to the transmission period T. For example: the requirement of the law and regulation on the duty ratio of the 470 frequency band is not more than 1%, and it takes 10ms for a node to transmit a group of data by using a certain channel of the frequency band, so that the transmission period of the node is T1. The node can send data again after the end of the period, that is, T1-10ms, then, according to the requirement of the duty ratio, 10ms/T1< 1%, that is, T1> -1000 ms, it needs to wait at least 1000ms-10 ms-990 ms before sending again. If other higher data rates can be used, the time for transmitting data will be shorter, so that the duty cycle can be reduced without changing the transmission period T1. On the contrary, if a data rate that is a little lower is used, the time for transmitting data will become longer, so that the duty ratio must be increased with the transmission period T1 unchanged. Unless the transmission period T1 is extended, i.e., the waiting time is extended. However, extending the wait time is not always acceptable.
Disclosure of Invention
The invention aims to provide a data transmission method and system based on LoRa to reduce energy consumption and duty ratio as much as possible.
The invention discloses a data transmission method based on LoRa, which is characterized by comprising the following steps: step S1, when the length of the original data to be sent by the node is larger than the maximum length that the current Data Rate (DR) can bear, the node sends a packet-packaging request to the server; step S2, the node receives the response of the server; step S3, the node uses the node current DR to calculate the length of the data to be sent this time, and carries out sub-packaging on the data which is not successfully sent in the original data according to the calculated data length; step S4, the node sends the first packetized data in the data which has not been successfully sent to the server; step S5, if the node receives a confirmation response from the server to confirm that the data sent by the node is received, and the original data is completely sent to the server, the sending of the original data is finished this time; if the node receives a confirmation response of the server for confirming that the data sent by the node is received and the original data is not completely sent to the server, the step S3 is executed; if the node does not receive the acknowledgement response of the server for acknowledging receipt of the data sent by the node, the node retransmits the data sent last time, and when the acknowledgement response of the server is not received and the number of retransmissions exceeds a threshold, the node actively decreases DR, calculates the length of the data to be sent this time according to the decreased DR, packetizes the data that has not been sent in the original data according to the calculated data length, and proceeds to step S5.
Optionally, the step S3 of the node calculating the length of the data to be sent this time by using the current DR of the node includes: the node checks whether its own DR is modified; the node calculates the length of data to be transmitted this time using the node current DR checked and confirmed in step S22.
Optionally, in step S3, the calculated data length is calculated by determining a maximum number of bytes that can be sent according to the current DR of the node, and the calculated data length does not exceed a value obtained by subtracting the number 1 from the maximum number of bytes.
Optionally, in step S4, when the node transmits the first packetized data of the unsuccessfully transmitted data to the server, the first packetized data of the unsuccessfully transmitted data is assembled in such a manner that the sequence number of the first packetized data of the unsuccessfully transmitted data and the first packetized data of the unsuccessfully transmitted data are assembled together and transmitted to the server by the node in a single data transmission process; the sequence number is equal to the number of times the currently successfully transmitted packetized data is added to the value of the initial number, which represents the sequence number of the first successfully transmitted packetized data.
The invention also provides a node, which is characterized in that: the node is used for sending a sub-packet request to a server when the length of original data to be sent by the node is larger than the maximum length which can be carried by the current Data Rate (DR); the node is also used for receiving the response of the server; the node is also used for calculating the length of data to be sent this time by using the current DR of the node, packetizing the unsuccessfully sent data in the original data according to the calculated data length, and sending the first packetized data in the unsuccessfully sent data to the server until the original data are all sent to the server; the node is also used for receiving an acknowledgement response of the server for acknowledging the reception of the data sent by the node; and if the node does not receive the acknowledgement response of the server for acknowledging the reception of the data transmitted by the node, retransmitting the data transmitted last time by the node, actively reducing the DR by the node when the acknowledgement response of the server is not received and the retransmission frequency exceeds a threshold value, calculating the length of the data to be transmitted this time according to the reduced DR, packetizing the data which is not transmitted in the original data according to the calculated data length, and retransmitting the data.
Optionally, the calculating, by the node, the length of the data to be sent this time by using the current DR of the node includes: the node checks whether its own DR is modified; the node calculates the length of the data to be transmitted this time using the node current DR confirmed after the check.
Optionally, the calculated data length is calculated by determining a maximum number of bytes that can be sent according to the current DR of the node, and the calculated data length does not exceed a value obtained by subtracting the number 1 from the maximum number of bytes.
Optionally, when the node sends the first packetized data of the unsuccessfully sent data to the server, the first packetized data of the unsuccessfully sent data is assembled in such a manner that the sequence number of the first packetized data of the unsuccessfully sent data and the first packetized data of the unsuccessfully sent data are assembled together and sent to the server by the node in a single data sending process; the sequence number is equal to the number of times the packet data has been successfully transmitted currently plus the value of the initial sequence number, which represents the sequence number of the packet data that was successfully transmitted for the first time.
The present invention also provides a computer storage medium characterized in that the computer storage medium stores a program for implementing any one of the methods described above when the program is executed by a computer.
The invention also provides a data transmission system based on LoRa, which is characterized by comprising a server and any node.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
Fig. 1 is a flow chart of a data transmission method based on LoRa according to the present invention.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
Referring to fig. 1, fig. 1 is a flow chart of a data transmission method based on LoRa according to the present invention. The invention discloses a data transmission method based on LoRa, which comprises the following steps:
step S1: when the length of original data to be sent by a node is larger than the maximum length which can be carried by the current Data Rate (DR), the node sends a packetization request to a server.
The original data refers to current data to be transmitted by nodes which are not packetized yet. The node judges whether the current DR can bear all data lengths before sending data, and sends the current data in a subpackage mode when the DR cannot bear the current data length. The node needs to send a packet request to the server in advance, and informs the server that the data sent by the server is packet data.
For example, assuming that the maximum number of bytes that the node can send at the current DR is 11, and the node is to send data with a length of 36 bytes, then the length of 11 bytes that the current DR can carry is smaller than the length of 36 bytes that the node is to send, so the node needs to send a packetization request to the server in advance, and notify the server that the data sent subsequently is packetized data.
The packetization request may also include a total length of the original data. For example, the packetization format header of the packetization request may be that the first five bytes represent that packetization is required, and the sixth and seventh bytes represent the length of data to be transmitted. For example, the packetization format header of the packetization request may be 0x73, 0x70, 0x6c, 0x6a, 0x74, 0x24, 0x 00. Where 0x24, 0x00 represents the total length of original data to be transmitted. The network order is 0x24, and the host order is 36 in the conversion of 0x 00.
Step S2: and the node receives the response of the server.
When the server receives a subpackage request sent by the node, the server acquires the request of the node for subpackaging according to the information of the subpackage format header of the subpackage request. The server responds to the node after receiving the subpackage request sent by the node.
The response mechanism of the server may also include preparing to begin receiving packetized data for the node. The server converts the sixth and seventh bytes of the packet format header, such as 0x24 and 0x00, into a host sequence, and plans to receive the 36-byte data packet of the node, and a first variable is used for indicating the total data length to be sent by the node at the server side, such as named node _ all _ data. After receiving the packet request of the node, the server stores the data sent by the node in sequence until the node sends all the data.
Preferably, the method further includes step S22: the node checks whether its DR is modified.
The LoRa server side is provided with a strategy called ADR (adaptive Data rate), and the server can dynamically adjust DR of the node according to some wireless signal values of the node. Therefore, the node's own DR is likely to be modified by the server during transmission of data.
In addition, there may also be modification of the node's own DR caused by manual setting of the node's own DR.
Therefore, it is preferable to check whether the DR itself is modified before packetizing and transmitting data.
Step S3: and the node calculates the length of the data to be sent at this time by using the current DR of the node, and packetizes the data which is not successfully sent in the original data according to the calculated data length.
The calculated data length may be calculated by determining the maximum number of bytes that can be sent according to the current DR of the node, and the calculated data length may not exceed the maximum number of bytes minus a number 1. If step S3 is provided, the current DR is the DR of the current node confirmed through step S3.
The reason why the number 1 needs to be reduced is that the packet sequence number of the packet data needs to be included in the transmitted packet data. For example, assuming that the current DR level of the node is 0, the number of bytes that the current DR can carry is 11 bytes. Then, since one byte, for example, the first byte, needs to be reserved to represent the current packet sequence number, the length that can be used to transmit the data separated from the original data packet is at most 11 bytes that can be carried by the current DR minus 1 byte occupied by the current packet sequence number, that is, at most 10 bytes in the original data can be transmitted.
And the nodes divide the data packets according to the calculated data length according to the data sequence, and sequentially transmit the data packets, wherein the specific operation of subpackaging is to transmit the data with the calculated data length each time. For example, according to the above example, only 10 bytes of valid data can be transmitted at a time, because the first byte is to transmit the current packet sequence number, the sequence number starts from 0, and the 2 nd to 11 th bytes carry valid data. The effective data to be sent by the node at this time is the packetized data with the first order in the packetized data.
The node may not packetize all the unsuccessfully transmitted data, but only extract the data with the calculated data length in byte order from the unsuccessfully transmitted data to serve as valid data to be transmitted.
The data to be sent by the node at this time comprises the effective data to be sent and the data packet sequence number. For example, in the first packet data sent by the node this time, the first byte is 0, which indicates that the first packet data is currently sent, and the content of the next 10 bytes is the content to be sent by the node.
The step S3 of the node calculating the length of the data to be sent this time by using the node current DR may further include: the node checks whether the DR of the node is modified; the node calculates the length of data to be transmitted this time using the node current DR confirmed after the check in step S22.
Step S4: the node transmits the first packetized data of the data which is not successfully transmitted to the server.
The node sends the data which is packaged into packets to the server in sequence under the condition of the current DR of the node, namely the data sent to the server by the node at the time is the first data which is packaged into packets in the data which is not sent successfully.
Step S5: if the node receives a confirmation response of the server for confirming the reception of the data sent by the node and all the original data are sent to the server, the sending of the original data is finished; if the node receives a confirmation response of the server for confirming that the data sent by the node is received and the original data is not completely sent to the server, the step S3 is executed; if the node does not receive the acknowledgement response of the server for acknowledging the reception of the data sent by the node, the node retransmits the data sent last time, and when the acknowledgement response of the server is not received and the number of retransmissions exceeds a threshold, the node actively decreases DR, calculates the length of the data to be sent this time according to the decreased DR, packetizes the data that has not been sent in the original data according to the calculated data length, and proceeds to step S5.
The server receives the data packets of the nodes, firstly sends responses to the nodes, and then sequentially combines the data of the nodes according to the serial numbers of the data packets. When the sequence number of the data packet is equal to the last received node data packet, the description is repeated data. The reason for the duplicate data may be that the node did not receive a response from the server. If the node does not receive the response of the server once or more times and the times do not exceed the threshold, the node still repeatedly transmits the previous data according to the previous DR, and the retransmitted data are the same as the previous data. However, if the node does not receive the response of the server many times and the number of times exceeds the threshold, the node will actively decrease DR, then reassemble the data and transmit the data, the sequence number of the data packet transmitted this time is still the same as the sequence number of the data packet transmitted last time, but because the DR is decreased, the length of data that can be carried by DR each time after decreasing is shorter than the length of data that can be carried by DR that has not been decreased before, and therefore, the data packet of this time may have a shorter data length than the data length of the data packet transmitted before, and if the server actually receives the data packet although the previous node does not receive the response of the server, the server needs to discard the saved data corresponding to the data packet of the last time and restore the data packet received this time. Therefore, in order to avoid errors, in any case, as long as the sequence number of the data packet is equal to the node data packet received last time, the server needs to discard the stored data corresponding to the last data packet and re-store the data packet received this time, so as to ensure that the finally stored data is accurate. In the data receiving process, the server also judges whether the currently received total node data is equal to the total length of the original data, when the total data length of the received nodes is equal to the total length of the original data, the fact that the nodes have sent all data is indicated, and the server can process the data of the nodes; and when the total data length of the received nodes is smaller than the total length of the original data, continuing to wait for receiving the node data. And after the node sends the last packet of data, the server processes all the received data.
The server may not sequentially combine the data of the nodes in order after receiving the data each time, but may sequentially combine the data of the nodes after waiting until all the data are received.
By the sub-packaging strategy, data with a length longer than that of data borne by the current DR can be sent in batches, the DR of the node can be fully utilized, and the data can be sent as fast as possible, so that the occupied time of sending the data is reduced, the duty ratio is reduced, and the waiting time does not need to be prolonged. Moreover, the packetizing strategy can packetize and transmit data by using DR as high as possible, so that the data transmission rate is guaranteed to be higher on average, energy consumption is reduced as much as possible, the service life of the battery is prolonged, the frequency of replacing or charging the battery is reduced, and the cost of a user can be reduced better.
The invention also provides a node, which is used for sending a sub-packet request to a server when the length of the original data to be sent by the node is greater than the maximum length which can be carried by the current Data Rate (DR); the node is also used for receiving the response of the server; the node is also used for calculating the length of data to be sent this time by using the current DR of the node, packetizing the unsuccessfully sent data in the original data according to the calculated data length, and sending the first packetized data in the unsuccessfully sent data to the server until the original data are all sent to the server; the node is also used for receiving an acknowledgement response of the server for acknowledging the reception of the data sent by the node; and if the node does not receive the acknowledgement response of the server for acknowledging the reception of the data transmitted by the node, retransmitting the data transmitted last time by the node, actively reducing the DR when the acknowledgement response of the server is not received and the retransmission frequency exceeds a threshold value, calculating the length of the data to be transmitted this time according to the reduced DR, packetizing the data which is not transmitted in the original data according to the calculated data length, and retransmitting the data.
The original data refers to current data to be sent by nodes which are not packetized yet. The node judges whether the current DR can bear all data lengths before sending data, and sends the current data in a subpackage mode when the DR cannot bear the current data length. The node needs to send a packet request to the server in advance, and informs the server that the data sent by the server is packet data.
For example, assuming that the maximum number of bytes that the node can send at the current DR is 11, and the node is to send data with a length of 36 bytes, then the length of 11 bytes that the current DR can carry is smaller than the length of 36 bytes that the node is to send, so the node needs to send a packetization request to the server in advance, and notify the server that the data sent subsequently is packetized data.
The packetization request may also include a total length of the original data. For example, the packetization format header of the packetization request may be that the first five bytes represent the packetization required, and the sixth and seventh bytes represent the length of data to be transmitted. For example, the packetization format header of the packetization request may be 0x73, 0x70, 0x6c, 0x6a, 0x74, 0x24, 0x 00. Where 0x24, 0x00 represents the total length of original data to be transmitted. The network order is 0x24, and the host order is 36 for 0x 00.
When the server receives the subpackage request sent by the node, the server acquires the request of the node for subpackage according to the information of the subpackage format header of the subpackage request. The server responds to the node after receiving the subpackage request sent by the node. The node is used for receiving the response of the server.
The response mechanism of the server may also include preparing to begin receiving packetized data for the node. The server converts the sixth and seventh bytes of the packet format header, such as 0x24 and 0x00, into a host sequence, and plans to receive the 36-byte data packet of the node, and a first variable is used for indicating the total data length to be sent by the node at the server side, such as named node _ all _ data. After receiving the sub-package request of the node, the server stores the data sent by the node in sequence until the node sends all the data.
Preferably, the node is further configured to check whether its DR is modified.
The LoRa server side is provided with a strategy called ADR (adaptive Data rate), and the server can dynamically adjust DR of the node according to some wireless signal values of the node. Therefore, the node's own DR is likely to be modified by the server during transmission of data.
In addition, there may be modification of the node self DR caused by manual setting of the node self DR.
Therefore, it is preferable to check whether the DR of itself is modified before packetizing and transmitting data.
The node is also used for calculating the length of the data to be sent at this time by using the current DR of the node, and packetizing the data which is not successfully sent in the original data according to the calculated data length.
The calculated data length may be calculated by determining a maximum number of bytes that can be sent according to the current DR of the node, where the calculated data length does not exceed a value obtained by subtracting a number 1 from the maximum number of bytes to the maximum. If step S3 is provided, the current DR is the DR of the current node confirmed through step S3.
The reason why the number 1 needs to be reduced is that the packet sequence number of the packet data needs to be included in the transmitted packet data. For example, assuming that the current DR level of the node is 0, the number of bytes that the current DR can carry is 11 bytes. Then, since one byte, for example, the first byte, needs to be reserved to represent the current packet sequence number, the length that can be used to transmit the data separated from the original data packet is at most 11 bytes that can be carried by the current DR minus 1 byte occupied by the current packet sequence number, that is, at most 10 bytes in the original data can be transmitted.
And the nodes divide the data packets according to the calculated data length according to the data sequence, and sequentially transmit the data packets, wherein the specific operation of subpackaging is to transmit the data with the calculated data length every time. For example, according to the above example, only 10 bytes of valid data can be sent at a time because the first byte is to send the current packet sequence number, which starts from 0 and the 2 nd to 11 th bytes carry valid data. The effective data to be sent by the node at this time is the packetized data with the sequence in the first bit in the above packetized data.
The node may not packetize all the unsuccessfully transmitted data, but only extract the data with the calculated data length in byte order from the unsuccessfully transmitted data to serve as the valid data to be transmitted.
The data to be sent by the node at this time comprises the effective data to be sent and the data packet sequence number. For example, in the first packet data sent by the node this time, the first byte is 0, which indicates that the first packet data is currently sent, and the content of the next 10 bytes is the content to be sent by the node.
The node calculating the length of the data to be sent this time by using the node current DR may further include: the node checks whether the DR of the node is modified; the node calculates the length of the data to be transmitted this time using the node current DR confirmed after the check.
The node is further configured to send the first packetized data of the data that has not been successfully sent to the server. The node sends the packetized data to the server in sequence under the condition of the current DR of the node, namely the data sent to the server by the node at this time is the first packetized data in the unsuccessfully sent data.
The node is further configured to, when transmitting the first packetized data of the unsuccessfully transmitted data to the server, assemble the sequence number of the first packetized data of the unsuccessfully transmitted data and the first packetized data of the unsuccessfully transmitted data together in a manner that the node transmits the data to the server in a single data transmission process; the sequence number is equal to the number of times the packet data has been successfully transmitted currently plus the value of the initial sequence number, which represents the sequence number of the packet data that was successfully transmitted for the first time.
The server receives the data packet of the node, firstly sends a response to the node, and then sequentially combines the data of the node according to the sequence number of the data packet. When the sequence number of the data packet is equal to the last received node data packet, the description is repeated data. The reason for the duplicate data may be that the node did not receive a response from the server. If the node does not receive the response of the server for one time or more times and the times do not exceed the threshold value, the node repeatedly transmits the previous data according to the previous DR, and the retransmitted data are the same as the previous data. However, if the node does not receive the response of the server many times and the number of times exceeds the threshold, the node will actively decrease DR, then reassemble the data and transmit the data, the sequence number of the data packet transmitted this time is still the same as the sequence number of the data packet transmitted last time, but because the DR is decreased, the length of data that can be carried by DR each time after decreasing is shorter than the length of data that can be carried by DR that has not been decreased before, and therefore, the data packet of this time may have a shorter data length than the data length of the data packet transmitted before, and if the server actually receives the data packet although the previous node does not receive the response of the server, the server needs to discard the saved data corresponding to the data packet of the last time and restore the data packet received this time. Therefore, in order to avoid errors, in any case, as long as the sequence number of the data packet is equal to the node data packet received last time, the server needs to discard the stored data corresponding to the last data packet and re-store the data packet received this time, so as to ensure that the finally stored data is accurate. In the data receiving process, the server also judges whether the currently received total node data is equal to the total length of the original data, when the total data length of the received nodes is equal to the total length of the original data, the total data is sent by the nodes, and the server can process the data of the nodes; and when the total data length of the received nodes is smaller than the total length of the original data, continuing to wait for receiving the node data. And after the node sends the last packet of data, the server processes all the received data.
The server may not sequentially combine the data of the nodes in sequence after receiving the data each time, but may combine the data of the nodes in sequence after waiting for all the data to be received.
The node can send data with a length longer than the data length which can be borne by the current DR in batches, and can also make full use of the DR of the node to send the data as fast as possible, so that the occupied time of sending the data is reduced, the duty ratio is reduced, and the waiting time does not need to be prolonged. Moreover, since the nodes can packetize and transmit data as much as possible by using DR as high as possible, the data transmission rate can be guaranteed to be higher on average, so that energy consumption is reduced as much as possible, the service life of the battery is prolonged, the frequency of replacing or charging the battery is reduced, and a user can be helped to reduce cost better.
The invention also provides a data transmission system based on the LoRa, which comprises the server and the nodes provided by the content.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory or a random access memory.
The foregoing shows and describes the general principles, principal features and advantages of the invention. It should be understood by those skilled in the art that the present invention is not limited to the above-described embodiments, and that various changes and modifications may be made to the present invention, which fall within the scope of the present invention as claimed.
Claims (6)
1. A data transmission method based on LoRa is characterized by comprising the following steps:
step S1, when the length of the original data to be sent by the node is larger than the maximum length that the current Data Rate (DR) can bear, the node sends a packet-packaging request to the server; the packetization request comprises a total length of the original data;
step S2, the node receives the response of the server;
step S3, the node uses the node current DR to calculate the length of the data to be sent this time, and carries out sub-packaging on the data which is not successfully sent in the original data according to the calculated data length; the step S3 of the node calculating the length of the data to be sent this time using the node current DR includes: the node checks whether its own DR is modified; the node calculates the length of the data to be sent at this time by using the current DR of the node confirmed after the check;
step S4, the node sends the first packetized data in the unsuccessfully sent data to the server;
in step S4, when the node transmits the first packetized data of the unsuccessfully transmitted data to the server, the first packetized data of the unsuccessfully transmitted data is assembled in such a manner that the sequence number of the first packetized data of the unsuccessfully transmitted data and the first packetized data of the unsuccessfully transmitted data are assembled together and transmitted to the server by the node in a single data transmission process; the sequence number is equal to the number of times of the current successfully transmitted packet data plus the value of an initial sequence number, wherein the initial sequence number represents the sequence number of the first successfully transmitted packet data;
step S5, if the node receives a confirmation response from the server to confirm that the data sent by the node is received, and the original data is completely sent to the server, the sending of the original data is finished this time; if the node receives a confirmation response of the server for confirming that the data sent by the node is received and the original data is not completely sent to the server, the step S3 is executed; if the node does not receive the acknowledgement response of the server for acknowledging the reception of the data sent by the node, the node retransmits the data sent last time, and when the acknowledgement response of the server is not received and the number of retransmissions exceeds a threshold, the node actively decreases DR, calculates the length of the data to be sent this time according to the decreased DR, packetizes the data that has not been sent in the original data according to the calculated data length, and proceeds to step S4.
2. The method of claim 1, wherein in step S3, the calculated data length is calculated according to the maximum number of bytes that the node can send according to the current DR acknowledgement, and the calculated data length does not exceed the maximum number of bytes minus the number 1.
3. A node, characterized by:
the node is used for sending a packet request to a server when the length of original data to be sent by the node is larger than the maximum length which can be borne by the current Data Rate (DR); the packetization request comprises a total length of the original data;
the node is also used for receiving the response of the server;
the node is also used for calculating the length of data to be sent this time by using the current DR of the node, packetizing the unsuccessfully sent data in the original data according to the calculated data length, and sending the first packetized data in the unsuccessfully sent data to the server until the original data are all sent to the server; the node is also used for receiving an acknowledgement response of the server for acknowledging the reception of the data sent by the node;
the node uses the node current DR to calculate the length of the data to be sent at this time, and the method comprises the following steps: the node checks whether its own DR is modified; the node calculates the length of the data to be sent at this time by using the current DR of the node confirmed after the check;
when the node transmits the first sub-packet data in the unsuccessfully transmitted data to the server, the first sub-packet data in the unsuccessfully transmitted data is assembled in a manner that the sequence number of the first sub-packet data in the unsuccessfully transmitted data and the first sub-packet data in the unsuccessfully transmitted data are assembled together and transmitted to the server by the node in a single data transmission process; the sequence number is equal to the number of times of the current successfully transmitted packet data plus the value of an initial sequence number, wherein the initial sequence number represents the sequence number of the first successfully transmitted packet data;
and if the node does not receive the acknowledgement response of the server for acknowledging the reception of the data transmitted by the node, retransmitting the data transmitted last time by the node, actively reducing the DR by the node when the acknowledgement response of the server is not received and the retransmission frequency exceeds a threshold value, calculating the length of the data to be transmitted this time according to the reduced DR, packetizing the data which is not transmitted in the original data according to the calculated data length, and retransmitting the data.
4. A node as claimed in claim 3, wherein the calculated data length is calculated by not exceeding the maximum number of bytes minus the number 1, depending on the maximum number of bytes that the node can send for the current DR acknowledgement.
5. A computer storage medium characterized in that it stores a program for implementing the method of claim 1 or 2 when executed by a computer.
6. An LoRa-based data transmission system, wherein the LoRa-based data transmission system comprises a server and the node according to claim 3 or 4.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911284782.5A CN111162871B (en) | 2019-12-13 | 2019-12-13 | Data transmission method and system based on LoRa |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201911284782.5A CN111162871B (en) | 2019-12-13 | 2019-12-13 | Data transmission method and system based on LoRa |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111162871A CN111162871A (en) | 2020-05-15 |
| CN111162871B true CN111162871B (en) | 2022-07-26 |
Family
ID=70557068
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201911284782.5A Active CN111162871B (en) | 2019-12-13 | 2019-12-13 | Data transmission method and system based on LoRa |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111162871B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN114020304A (en) * | 2022-01-06 | 2022-02-08 | 杭州字节信息技术有限公司 | LoRaWan-based OTA implementation method, terminal device and computer storage medium |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106385303A (en) * | 2016-08-30 | 2017-02-08 | 中兴长天信息技术(南昌)有限公司 | Adaptive information rate adjusting method of LORA wireless transmission system for Internet of Things (IoT) |
| CN108900433A (en) * | 2018-05-25 | 2018-11-27 | 北京星网锐捷网络技术有限公司 | A kind of method, terminal and server for transmitting lora message |
| KR101926276B1 (en) * | 2017-12-13 | 2018-12-06 | 전자부품연구원 | Internet of Things network managing methed for managing large scale facilities based on LoRaWAN and Internet of Things network server and terminal applying the same |
| CN110401962A (en) * | 2019-08-13 | 2019-11-01 | 翱捷科技(深圳)有限公司 | The LoRaWAN system and method for adjust automatically data message length |
-
2019
- 2019-12-13 CN CN201911284782.5A patent/CN111162871B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106385303A (en) * | 2016-08-30 | 2017-02-08 | 中兴长天信息技术(南昌)有限公司 | Adaptive information rate adjusting method of LORA wireless transmission system for Internet of Things (IoT) |
| KR101926276B1 (en) * | 2017-12-13 | 2018-12-06 | 전자부품연구원 | Internet of Things network managing methed for managing large scale facilities based on LoRaWAN and Internet of Things network server and terminal applying the same |
| CN108900433A (en) * | 2018-05-25 | 2018-11-27 | 北京星网锐捷网络技术有限公司 | A kind of method, terminal and server for transmitting lora message |
| CN110401962A (en) * | 2019-08-13 | 2019-11-01 | 翱捷科技(深圳)有限公司 | The LoRaWAN system and method for adjust automatically data message length |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111162871A (en) | 2020-05-15 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| RU2434337C1 (en) | Method for sending status information in mobile communication system and mobile communication system receiver | |
| EP3410623B1 (en) | Method for sending status information in mobile telecommunications system and receiver of mobile telecommunications | |
| US7283814B2 (en) | Method and apparatus for scheduling transmissions in wireless data networks | |
| US7058085B2 (en) | Method and apparatus for transmitting data over a network within a specified time limit | |
| CN100411458C (en) | Differentiation of Quality of Service in Wireless Networks | |
| US9173210B2 (en) | Method for uplink transmission of radio link control layer and evolved node B | |
| US20020141353A1 (en) | Method and device for improving a data throughput | |
| US20080101290A1 (en) | Apparatus for Arq Controlling in Wireless Portable Internet System and Method Thereof | |
| US8089868B2 (en) | Wireless communication apparatus and wireless communication method using variable transmission rate | |
| CN101517996A (en) | Method and apparatus for reducing the likelihood of deadlock in a wireless communication system | |
| EP2920903A1 (en) | Multicast rate control | |
| US8238236B2 (en) | Method for reporting reception result of packets in mobile communication system | |
| US7729665B2 (en) | Down-link data transmission and receiving system and method of ARQ in wireless communication system | |
| US9026878B2 (en) | Apparatus and method for fast retransmission in a power line communication network | |
| EP3490182B1 (en) | Hybrid automatic repeat request method and system | |
| CN112088508B (en) | Communication method, device, terminal and readable storage medium of wireless local area network | |
| CN111162871B (en) | Data transmission method and system based on LoRa | |
| US20030103483A1 (en) | Adaptive radio link protocol (RLP) to improve performance of TCP in wireless environment for cdmaone and cdma2000 systems | |
| WO2018082554A1 (en) | Method and device for dynamically feeding back harq-ack | |
| CN114285800A (en) | Congestion adjustment method and device for TCP data flow | |
| US20090257377A1 (en) | Reducing buffer size for repeat transmission protocols | |
| US20070195813A1 (en) | Multicast packet transmitting method of wireless network | |
| WO2011020307A1 (en) | Harq failure indication method, harq failure indication data frame and service node b thereof | |
| US7613191B2 (en) | Packet transmission method of wireless network | |
| WO2011015058A1 (en) | System and method for packet data transmission |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |