LoRaWAN adaptive rate adjustment method
Technical Field
The invention belongs to the technical field of Internet of things, and relates to an adaptive Rate Adjustment (ADR) method for LoRaWAN.
Background
LoRa is a low-power consumption internet of things technology provided by Semtech corporation, and is widely applied to the fields of wireless meter reading and the like. LoRaWAN adopts LoRa technique to construct low-power consumption wireless internet wide area network. The LoRaWAN terminal works under different rates (Data rates are abbreviated as DR) according to the network signal state, and the DR is divided into 6 levels of 0-5. The higher the DR, the higher the transmission rate, and the lower the sensitivity; conversely, the lower the DR, the smaller the transmission rate, and the higher the sensitivity. Since the network environment of the LoRaWAN terminal is not stable, the terminal needs to adjust the working DR to adapt to the change of the network environment.
The existing rate adjustment schemes issue a command to adjust the rate of the terminal according to the best signal in the latest n times of data uploaded by the terminal, so that the rate is adjusted upwards most of the time, the existing rate adjustment schemes are insensitive to the situation of poor network conditions, and the existing rate adjustment schemes cannot adjust in time. When the network situation becomes worse, the rate should be adjusted downward to ensure the transmission stability, and if the current rate adjustment strategy is adjusted according to the best signal in the latest n times of uploading data, the rate cannot be guaranteed to be adjusted to a low state immediately, so that the network cannot cope with the deterioration situation in time.
Disclosure of Invention
The invention aims to provide a LoRaWAN adaptive rate adjustment method, which is characterized in that when a terminal uploads data, the SNR mean value of the latest N (N > -3) pieces of data is calculated, the corresponding proper working rate is obtained according to the difference of the calculation results, and the rate adjustment is carried out on the command issued by the terminal. N is determined according to the actual network condition: when the fluctuation of the electromagnetic environment of the terminal is small, a larger value is taken; and when the environment of the terminal is severe and the fluctuation is large, N is properly small to deal with the environment with fast change.
In order to achieve the technical purpose and achieve the technical effect, the technical scheme specifically comprises the following steps:
a LoRaWAN self-adaptive rate adjustment method is characterized in that a terminal is in DR0 after being started, after data are uploaded for the first time, a LoRaWAN server determines the proper working rate according to the SNR value of the first piece of data according to the following rule, and issues a corresponding MAC instruction to enable the LoRaWAN server to perform rate switching:
when the SNR value is less than-17, the rate is 0;
when the SNR value is more than-17 and less than or equal to-14, the rate is 1;
when the SNR value is larger than-14 and smaller than or equal to-11, the rate is 2;
when the SNR value is more than-11 and less than or equal to-8, the rate is 3;
when the SNR value is more than-8 and less than or equal to-5, the rate is 4;
when the SNR value is more than-5, the rate is 5;
after uploading data for the second time, calculating SNR mean values of the first time and the second time and determining a working rate according to the mean values; if the rate is different from the rate determined after the data is uploaded for the first time, then N of the average SNR of uploading for N times calculated by adjusting the rate is taken as a smaller value; if it is the same as the first time, N takes a larger value.
And calculating the SNR mean value of the latest N times of uploaded data every time the terminal uploads the data, determining the working rate according to the same rule, transmitting an MAC instruction to the terminal if the rate changes, adjusting the working rate after the terminal receives the MAC instruction and responding, and considering that the transmission fails if the LoRaWAN server does not receive the response and repeatedly transmitting the MAC instruction until the response is received.
Further, if the terminal has rate adjustment during continuous M times of data uploading, the network environment changes violently, and the N value is properly reduced to cope with the situation; and if the terminal does not have the condition of rate adjustment when the data are uploaded for K times continuously, the N value is properly increased to deal with the network environment with gentle change.
The invention has the following beneficial effects:
1. has the function of adaptively adjusting the terminal speed.
2. The rate is adjusted according to the SNR mean value of the latest N times of uploading data, so that the change of the terminal network environment can be reflected more uniformly, and the method is more suitable for being used as a rate control strategy.
3. The N value used for calculating the SNR mean value is automatically adjusted according to the intensity of the network environment change, and the change of the network environment can be intelligently responded.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is further described in detail with reference to the following embodiments.
A LoRaWAN self-adaptive rate adjustment method is characterized in that a terminal is in DR0 after being started, after data are uploaded for the first time, a LoRaWAN server determines the proper working rate according to the SNR value of the first piece of data according to the following rule, and issues a corresponding MAC instruction to enable the LoRaWAN server to perform rate switching:
when the SNR value is less than-17, the rate is 0;
when the SNR value is more than-17 and less than or equal to-14, the rate is 1;
when the SNR value is larger than-14 and smaller than or equal to-11, the rate is 2;
when the SNR value is more than-11 and less than or equal to-8, the rate is 3;
when the SNR value is more than-8 and less than or equal to-5, the rate is 4;
when the SNR value is greater than-5, the rate is 5.
After uploading data for the second time, calculating the SNR mean value of the first time and the SNR mean value of the second time and determining the working rate according to the mean value. If the rate is different from the rate determined after the data is uploaded for the first time, the smaller value of N of the N times of uploading average SNR calculated by adjusting the rate later is 3; if it is the first time, N takes a larger value such as 6.
And calculating the SNR mean value of the latest N times of uploaded data every time the terminal uploads the data, determining the working rate according to the same rule, transmitting an MAC instruction to the terminal if the rate changes, adjusting the working rate after the terminal receives the MAC instruction and responding, and considering that the transmission fails if the LoRaWAN server does not receive the response and repeatedly transmitting the MAC instruction until the response is received.
If the terminal has the speed adjustment condition when uploading data for M times continuously, the change of the network environment is severe, and the N value is properly reduced to deal with the situation; and if the terminal does not have the condition of rate adjustment when the data are uploaded for K times continuously, the N value is properly increased to deal with the network environment with gentle change.
The following table is a detailed condition of the terminal data received after the adaptive rate adjustment algorithm of the present invention is implemented, as shown in table 1:
TABLE 1
The above description is only a preferred embodiment of the present invention, and the scope of the present invention is not limited thereto, and any simple modifications or equivalent substitutions of the technical solutions that can be obviously obtained by those skilled in the art within the technical scope of the present invention are within the scope of the present invention.