# Resource Allocation to Massive Internet of Things in LoRaWANs
## 1 Introduction  
A long-range wide area network (LoRaWAN) is a wireless technology designed for low-power wide area networks [1]. Owing to its long range, low power, low cost, and open business model, it is widely adopted as one of the alternatives for the internet of things (IoT). The IoT comprises an enormous number of end devices (EDs) scattered over a wide geographical area, thus creating a high-density and large-scale environment. Recently, both academia and industry have been attracted to LoRaWANs because of their recent developments and applicability in the IoT environment. An LoRaWAN defines the media access control (MAC) protocol and architecture for layer two communication. At the same time, LoRa specifies the physical layer using chirp spread spectrum (CSS) modulation for long-range and low-energy communication. In a massive IoT network, EDs serve various applications subject to different constraints, i.e., length of a packet, network delay, data rate (DR), acknowledgment delay, reliability, throughput, etc. To increase the spatial diversity of the applications, LoRaWAN uses three types of ED classes: \(A\), \(B\), and \(C\). The class \(A\) EDs have very high energy efficiency and provide bi-directional communication using ALOHA; they, however, support only unicast communication. In class \(A\), an ED opens a receive window (RW) for the downlink (DL) to receive an acknowledgment (ACK) confirmation from a network server (NS) after a confirmed uplink (UL) transmission. Class \(B\) EDs are battery powered and provide bi-directional communication. These devices support unicast and multicast transmissions;furthermore, they have more RWs than class \(A\) EDs. The class \(B\) EDs are synchronized by a beacon frame transmitted from the GW. On the other hand, class \(C\) EDs use more power than class \(A\) and \(B\) as they listen to the channel all the time. To improve the spectral efficiency and enhance the capacity of the network, LoRaWAN uses six spreading factors (SFs) with CSS modulation. The allocation of SFs to the EDs affects the transmission success, i.e., a higher SF allocation induces a long-distance coverage. At the same time, it indicates a lower DR and higher time-on-air (ToA). These EDs randomly select a channel for UL transmissions using ALOHA. Owing to the use of ALOHA, the LoRaWAN suffers from packet collision caused by the same SF over the same channel (intra-SF interference) or different SF over the same channel (inter-SF interference), thus resulting in a high packet loss. In a confirmed mode, this packet loss forces ED retransmissions, where each ED increments its SF each time two successive retransmissions fail [1,2]. It is assumed that the retransmission failure occurs owing to poor connections; hence, a higher SF is expected to increase the packet success ratio, because it enhances the receiver sensitivity [3]. However, after a high SF is assigned, the ToA of the ED packet increases, and the collision probability of ED packets increases drastically. Because many EDs switch to higher SFs, it causes an avalanche effect [4]. To overcome this effect in the network, we propose a scheme called the channel-adaptive SF recovery that increments or decrements the SF based on the retransmission of the ED packets in the network. Moreover, to overcome the impact of intra- or inter-SF interference in the LoRaWAN network, some of the approaches allocate SF according to the distances from the GW in unconfirmed mode [4, 5, 6, 7]. These SF allocation schemes are mainly based on the fixed-width SF rings (also known as ring-based approaches) such as equal distance-based [4], GW sensitivity-based [5,6], and signal-to-noise ratio (SNR)-based [7]. Such ring-based approaches can perform better in an unconfirmed mode, where no DL ACK message is required from the GW. On the other hand, in the confirmed mode, each packet is acknowledged with a DL message.