A LoRaWAN Access Technology Based on Channel Adaptive Adjustment

: Low-power wide area network (LPWAN) has developed rapidly in recent years and is widely used in various Internet of Things (IoT) services. In order to reduce cost and power consumption, wide coverage, LPWAN tends to use simple channel access control protocols, such as the Aloha protocol. This protocol is simple with poor extension capability. In high-density environment, Aloha protocol will lead to low channel utilization, prolonged access and high conflict probability. Therefore, in order to solve the above problems, we propose an enhanced channel access control mechanism based on the existing LoRaWAN protocol, that is, a dynamic listening backoff mechanism. We combine the improved “listen first and then talk” (LBT) mechanism with the current state of the channel to adaptively adjust the size of the backoff window. The theoretical analysis and simulation results show that the proposed mechanism have a better performance than the existing mechanism, it can reduce conflicts in dense environments. By comparison, the packet transmission success rate is increased by 17%.

LoRa's scalability and capacity has always been a hot topic for scholars in this field. Adelantado et al. [3] discussed lora's capacity and network size. They observed that when at low duty cycle, throughput is limited by collision, and when at high duty cycle, throughput is due to ETSI's maximum duty cycle rule is limited. In order to improve the scalability of lora, M. O. Farooq et al. proposed a pre-transmission delay (DBT) protocol based on LoRaWAN network [4]. The protocol proposes a method of delaying packet transmission. The protocol assumes that in the LoRaWAN network, the node is assigned a sequence ID, and the protocol uses the node ID to calculate the time the node must wait before transmitting its data frame. The results show a certain increase in the rate of packet delivery.
Kouvelas et al. [5] developed the P-CSMA protocol on the NS-3, which uses different persistent values to perceive the channel to send packets. Hidden devices are considered to display results on a small LoRaWAN network. Congduc Pham [6] combined the sensing mechanism of the Carrier Sense Multiple Access (CSMA) protocol with lora's Channel Activity Detection (CAD) to implement an innovative long-distance image sensor node, albeit with some delay. However, the ability to limit conflicts in dense scenes is reduced. [7] combines the LoRaWAN protocol with the binary exponential back-off algorithm and uses probability analysis for mathematical modeling. The simulation results show that the improved protocol has a significant improvement in the network transmission success rate, but at the same time the network average delay has also increased accordingly. In [8], in order to solve the problem of excessive collision probability in data collision avoidance algorithm (ALOHA) in LoRaWAN, the CDMA idea is introduced, and an improved data collision avoidance algorithm (CD-ALOHA) is introduced. Compared with other algorithms, it further increases the network channel throughput and reduces the average time delay of data transmission. But there is no consider energy consumption problem. In [9], the delay backoff method is adopted on LoRaWAN to avoid transmission collisions. The collision is reduced but the content competition window (CW) value remains unchanged. As a result, the backoff time is insufficient when the network traffic is large, and the network traffic is too small. Long, low backoff efficiency. In summary, we can see that almost all papers only consider performance aspects, and do not consider energy consumption, however, energy consumption is crucial in many applications. Therefore, for LoRaWAN, we need a mechanism that can reduce collisions and improve channel utilization while not increasing energy consumption in a dense environment.
In this paper, we study the scalability of LoRaWAN channel access technology,break the limitation of duty cycle, and propose to add a sensing mechanism for detecting whether the channel is idle. We also propose an adaptive channel access mechanism using the above sensing technology, which effectively reduces data collisions in dense environments, improves packet transmission success rate, and optimizes channel utilization.
The rest of this paper is organized as follows: Section second describes the physical layer of LoRaWAN and the channel access mechanism. The third section describes the RA-CSMA mechanism proposed in this paper. The fourth section compares the simulation results of the proposed protocol. The fifth section summarizes this paper.

LoRaWAN
LoRaWAN adopts a Star-of-Stars topology. As shown in Fig. 1, the network generally includes multiple end nodes, multiple lora base stations (Gateway), and a public server (Network Server). All nodes in the network are independent, there is no link between the nodes, and any node in any application communicates directly with one or more lora base stations.

LoRa Physical Layer
The lora physical layer is based on Chirp spread-spectrum modulation technology and provides the low sensitivity required for long communication ranges [10]. Communication between the terminal device and the gateway can occur simultaneously on multiple frequency channels. Each terminal device can transmit its packet using a specific spreading factor (SF). According to lora's data sheet, the SF range is {6, 7, 8, 9, 10, 11, 12}. For a given SF, a higher SF value has a longer communication range. Typical values for bandwidth (BW) in the ISM 868 and 915 MHz bands are 125, 250 and 500 kHz. Sensitivity ranges from -125 dBm for bandwidth, -136 dBm for SF 12 to 500 kHz for bandwidth, and -111 dBm for SF 6. Coding rate(CR)is Other parameters in the above equation include the number n preamble of preambles, payload PAYLOAD, cyclic redundancy check CRC, implicit header mode H, when there is a header, H=0, otherwise H=1, low data rate optimization DE When the low data rate is enabled, DE=1, and vice versa is 0 [11].

LoRaWAN Terminal Type
LoRaWAN envisions three types of terminal devices, called Class A (for all lora devices), Class B (with beacon functionality), and Class C (for continuous monitoring), each of which is associated with a different LoRaWAN operating mode [12].
Class A devices define the default functional mode of the lora network and must be mandatory for all lora devices. In a class A network, the transmission is always initiated by the terminal device in a completely asynchronous manner. After each uplink transmission, the terminal device will open two receive windows waiting for commands or data packets returned by the network server. The second window opens on different subbands to increase the flexibility for channel fluctuations. The size of the time the transmission window is opened is generally based on the transmission requirements and will have some floating (ALOHA-type) depending on the time base. The transmission mode of the class A network is a relatively power-saving transmission mode. It only needs to open the receiving window for a period of time after the upload to receive the information sent by the network server. If the server wants to send a message to the terminal node, it must wait until the downstream window opened when the device uploads the message. Class A terminal equipment needs to be sent first to receive, and then the transmission and reception processes alternate. The terminal can receive and process the data sent back by the network server only after sending the data. Class A networks are primarily used for monitoring applications where the data generated by the terminal equipment must be collected by the control station.
Class B devices distinguish between uplink and downlink transmissions. The Class B network allows the terminal node to have more reception time. It not only has the function of the Class A network, but also can open the receiving window at the specified time. In order to enable the terminal node to open the receiving window at a specified time, it will receive the synchronization signal sent by the gateway, and this signal also makes the gateway know that the terminal device is listening.
Class C devices have no strict requirements for energy constraints (e.g., can be connected to the grid), so the receive window can be kept open. A terminal device of a Class C network has an almost always-on receiving window, which is only turned off when data is transmitted. In contrast, Class C networks consume more power, but can guarantee the minimum data latency between the endpoint and the network server.

Channel Access Technology
The access process of Class A devices specified in the LoRaWAN protocol is shown in Fig. 2: The LoRaWAN gateway supports multi-channel communication, which is called the primary channel for transmitting data, and the downlink channel for the gateway to send frames. When the terminal needs to send data, the terminal randomly selects the channel and the spreading factor to transmit, and does not monitor the channel. After the data is sent, the terminal will open 2 receiving windows. The first receiving window is located on the primary channel, and is used to receive the Rx1 frame replied by the gateway, and is enabled after the data is sent by RxDelay1, where RxDelay1 is configurable, and the default is 1 s. The second receive window is located on the downstream channel and is turned on after the first window is turned on for 1 second. The size of the two receiving windows is not fixed, but must be greater than the receiving time of the preamble, because in the lora technology, the receiving end first detects the preamble, and only after receiving the preamble, it considers that there is data transmission. In addition, when the terminal successfully receives the Rx1 frame in the first window, the second receiving window will not be opened. This mechanism increases the communication overhead of the gateway on the downlink channel, but can reduce the energy loss of the terminal due to repeated transmission.
When the terminal does not successfully receive the Rx acknowledgement frame in both receive windows, a retransmission will be triggered. The terminal randomly waits for a timeout and randomly selects the channel and spreading factor for retransmission. The retraction time window of the retransmission is not strictly defined, but generally the default is 1-3 s, that is, the window size is 2 s [13].
In the LoRaWAN protocol, the maximum number of retransmissions of a frame can be artificially set, but up to 7 times. After the maximum number of retransmissions, the MAC layer will return an error code to the application layer.
However, the main impact on the performance of the lora network is the parameters of the lora physical layer and the operation of the LoRaWAN. However, the LoRaWAN technology works in the ISM band. The limitation of the ETSI on the sub-band duty cycle seems to be a key factor limiting the network scale. When the device follows the duty cycle mechanism, although the collision is reduced, the channel utilization is also reduced, and the network delay is increased. Among them is the time when the channel is unavailable in one transmission period, and ToA is the air transmission time of the packet, which is the duty ratio. This means that when the duty cycle is 1%, if the terminal needs 1s to transmit data, it will wait at least 99 s before the next transmission.

Channel Access Technology Based on Improved CSMA
Farooq et al. compared four different channel access control protocols, including the Pure Aloha (PA) protocol in LoRaWAN, the pre-transmission delay protocol, random frequency hopping, and carrier sense multiple access protocol (CSMA). The results show that CSMA is scalable and performs best in terms of reliability, throughput and power consumption. However, many known random access methods of CSMA-CA used in 802.11 networks require an increase in the wake-up operation cycle, which will result in an increase in energy consumption, which is contrary to the energy saving goal of the lora device. This makes the design of new access methods particularly difficult. As a first step to improving LoRaWAN, we hope to enhance channel transmission without affecting energy consumption. The CSMA principle includes the test channel, which is used to detect whether the channel is used by another transmission before attempting to transmit the data packet. This principle is also known as the "listen first and then talk" (LBT) principle [14]. In the ETSI rule: If there is no LBT, the device needs to limit its duty cycle to 0.1% or 1%. Therefore, if the device applies the CSMA principle, the limit is released, so the device can use a higher duty cycle, which helps increase throughput and greater network capacity. So we use LoRa's own channel activity detection technology to implement the LBT principle, and in order to further reduce the collision rate, we use RA-CSMA to extend CSMA.

Channel Activity Detection Technology CAD
With the application of spread spectrum modulation technology, it is very important to determine whether the channel is occupied. It is necessary to determine whether the channel has other signals already used, and the signal may be lower than the noise signal of the receiver. In this case, it is not feasible to use RSSI. Therefore, lora uses a channel activity detector (CAD) to detect other signals. In CAD mode, the chip quickly scans the band to detect if there is a lora preamble. If it detects activity on that channel, that is, captures the symbol associated with the success, it will give an interrupt with the Channel Activity Detected flag.
The accuracy of detection during CAD is very important. Semtech used the SX1261 to evaluate the performance of CAD [15]. CAD reliability is rapidly reduced when the communication distance increases [6] and the single lora symbol error detection rate is very high, so we need to detect multiple lora symbols to make CAD reliable. Reference [15] shows that by using BW to detect two symbols of SF 7 and four symbols of SF 9-11, the false detection rate is kept below 2%, which can make CAD more efficient, or at a long distance, in ToA Increase or decrease the amount of CAD during the period to ensure at least 1 successful CAD to detect ongoing transfers.

RA-CSMA Channel Access Technology
We consider a scenario with one gateway and N terminal device nodes. When the terminal i∈N has data to transmit, it randomly selects the communication channel Ci for communication. First, execute CAD to detect whether other terminal devices are transmitting on the channel, occupying the channel, that is, waiting for the Channel Activity Detected flag to be interrupted. The terminal device will start transmitting data only when the channel detects that there is no flag interrupt, that is, when the channel is idle at the moment. Otherwise, it will fall back and randomly enter the sleep state for a period of time, and then try to transmit again, with a random interval of k Time slot. The random value is a range. This range is adjusted according to the number of backoffs and the state of the current channel, so as to achieve the optimal backoff time. The overall access process is shown in Fig. 3.
In the above random backoff process, based on the traditional binary exponential backoff algorithm (BEB), we propose a traffic adaptive adjustment algorithm based on signal strength.  First set a threshold for the number of contention failures, the median value of the contention window, and a channel strength coefficient "ration". LoRaWan uses the spreading factor to indicate the number of symbols transmitted per information bit. The larger the spreading factor, the smaller the amount of transmitted data. In the case where the node is close to the gateway and the wireless signal is better, lorawan uses a lower spreading factor, the node's rate is higher, and a shorter competition window is given, so that the node with the better wireless signal can transmit data preferentially. The number of nodes waiting to send data at the same time is reduced, and the average waiting time of nodes and the number of channel detections are reduced. The backoff scenario is described below.
When the test fails: When the test is successful: Whenever terminal n wants to transmit data and channel detection is busy, the terminal node directly enters the retreat state, in which node n randomly selects CWi from [0, CW], and the backoff time is the product of CWi and TOA.
The entire process of the backoff algorithm is as follows: (1) When channel transmission failure is detected, the CW is increased at a rate of 2/ratio to quickly get out of the collision. When the number of detection failures exceeds the specified value, the node abandons the competition, indicating that the node is not within the communication range of the gateway, and the transmission fails.
(2) After the node accesses the channel and successfully transmits it, the CW is adjusted as follows: When the contention window is greater than or equal to CWmid, the channel is considered to be highly competitive at this time, and the CW value of the node is decremented by 1/2×ratio. When decremented to less than CWmid, the CW continues to linearly decrease by b/ratio. When the contention window is smaller than CWmid, it is considered that the channel competition tends to be gentle at this time, and the value of CW is linearly decremented by b/ratio, which reduces the frequent fluctuation of the contention window.

Results and Analysis
In this paper, we simulates a scenario with a gateway and up to 1000 terminal device nodes. The size of the scenario is a square area with a length of 2000 m. The terminal devices are randomly distributed around the gateway within the scene. The node periodically sends data frames randomly, and the simulation time is limited to 60000 s. The remaining parameters are listed in Tab. 1 below. Using the parameters in Tab. 1, we simulated three CSMA variant methods for test comparison, CSMA-CA using the traditional binary backoff algorithm in IEEE 802.11 protocol, and non-slot CSMA-CA in IEEE 802.15.4, and the RA-CSMA mechanism based on dynamic monitoring adaptive adjustment window is proposed.   Fig. 4, we can see that as the number of nodes increases, the collision collision of the channel increases, resulting in a decrease in the successful transmission rate of the data packet. When the number of nodes reaches 1000, the successful transmission rate is only 32%, and the method proposed in this paper can be kept at around 50%. It is proved that the mechanism proposed in this paper can maintain a certain successful transmission rate in a dense environment with a large number of nodes. Fig. 5 shows the success rate of the node receiving the ack response. When the node does not receive the ack response within a certain period of time, it determines that the node has not successfully sent, thus resending the data packet. According to this curve, it can be seen that within 60000 seconds, RA-CSMA mechanism can successfully transfer more data.
Considering the impact of energy consumption, this paper hopes that the number of channel detections can be reduced as much as possible in the new mechanism, because listening to a node will consume a relatively large amount of energy compared to waiting and sleeping. We can see in Fig. 6, when the number of 1000 nodes is reached, the IEEE 802.15.4 protocol CSMA-CA requires the highest number of intercepts, reaching 27 times. Compared with the CAMA-CA of IEEE 802.11 protocol and the CSMA-CA of IEEE 802.15.4 protocol, the new mechanism proposed in this paper is significantly lower than the other two while the number of nodes increases. Therefore, the method in this paper can achieve low energy consumption and improve channel utilization. Fig. 7 shows that in dense environments, node conflicts are significantly intensified. It is necessary to reduce channel conflicts and improve utilization. The RA-CSMA mechanism evaluates the current state of the channel and conducts appropriate backoffs, instead of blindly exponentially increasing and eliminating collision, so the mechanism proposed in this paper can use the channel more reasonably, thereby reducing collision packet loss of data.

Conclusion
In this paper, we study the channel access mechanism of LoRaWAN protocol and its defects, and study the technology of " listen first and then talk " based on CAD, and propose a back-off mechanism of dynamic monitoring, according to the current quality of the channel. Adjust the size of the backoff window adaptively. The results show that we improve the channel utilization in the case of sensing the channel. In the dense environment, the mechanism can effectively improve the transmission efficiency of the data packet and reduce the collision while avoiding the increase of energy consumption. Since the experiment in this article stays in the simulation environment, the next optimization strategy deployment will apply the improvement in the actual equipment.