# Combined Use of LoRaWAN Medium Access Control Protocols for IoT Applications
## 3 LoRaWAN Background  
LoRaWAN defines a system architecture to wirelessly connect battery-operated devices distributed over a large area. The LoRaWAN specification [32] also includes a protocol stack optimized to provide support for low-cost, mobile, and bidirectional communications for IoT applications. The LoRaWAN topology, shown in Figure 1, consists of a star-of-stars that includes several LoRaWAN end-devices, some gateways (GWs), and a network server (NS). Communication between the end-devices and the NS is bidirectional and goes through the GWs. In particular, the end-devices exchange messages with the GWs through single-hop LoRa transmissions, while each GW communicates with the NS via an IP connection. GWs relay messages from the end-devices to the NS (uplink) and vice versa (downlink). Note that a given uplink (UL) message is sent by an end-device to the NS through one or more GWs. Conversely, a downlink (DL) message is sent by the NS to a single end-device through only one GW. LoRaWAN builds on LoRa [33], a spread spectrum modulation technique derived from Chirp Spread Spectrum (CSS) technology. The LoRa modulation allows the configuration of multiple parameters [63] that have an impact on communication performance in terms of bit rate, coverage, energy consumption, and robustness to interference or noise. The  
Figure 1: The LoRaWAN topology. main LoRa parameters are the carrier frequency (CF), bandwidth (BW), spreading factor (SF), coding rate (CR), and transmission power (TP). In a LoRaWAN network, the time required by a message transmission using specific LoRa parameters is called the time on air (ToA) and is calculated through the Equation (1) provided in [64],  
\[ToA=\frac{2^{SF}}{BW}\left[NP+4.25+SW+max\left(\left[\frac{8 PL-4 SF+28+16 CRC-20 IH }{4(SF-2 DE)}\right](\mathcal{X}+4),0\right)\right] \tag{1}\]  
where  
* _NP_: number of preamble symbols. * _SW_: the length of the synchronization word. * _PL_: the size of the physical payload in bytes. * _CRC_: a Boolean flag relevant to the presence of the cyclic redundancy check (CRC). * _IH_: a Boolean flag relevant to the presence of the physical header. * _DE_: a Boolean flag relevant to the data rate optimization status. * _X_: the value of the \(X\) parameter in formula \(CR=\frac{4}{4+X}\). LoRa parameters can assume multiple values based on the region in which the LoRaWAN devices operate, according to [36]. By configuring these parameters, it is possible to tune the bit rate, coverage, and energy consumption. For example, as discussed in [65; 66], increasing SF expands coverage but reduces the bit rate by approximately half, thus almost doubling ToA and energy consumption. According to [67; 68] the SFs are quasi-orthogonal, and therefore, simultaneous transmissions that use different SFs on the same channel are not totally immune to each other. However, in case the signal-to-interference ratio (SIR) of the received messages exceeds the isolation threshold specified in [67], the messages can be correctly decoded. The LoRaWAN Adaptive Data Rate (ADR) algorithm [69] allows the use of the highest possible bit rate to prolong the battery life of the end-device. In this way, each end-device can individually set its bit rate and TP. If ADR is enabled, the NS is in charge of managing the bit rate and TP of the end-devices using defined LoRaWAN MAC commands; otherwise, each end-device individually manages its bit rate and TP. Note that the mobile end-devices commonly disable the ADR mechanism, especially when the radio channel attenuation varies quickly, as the NS would not be able to efficiently handle the runtime configuration of their bit rate and TP. In LoRaWAN, three different classes of end-devices, i.e., Class A, B and C, are defined. Class A (All) end-devices enable bidirectional communications while maintaining low energy consumption.