# Collision Avoidance Resource Allocation for LoRaWAN
## 3 Technical Overview of LoRa/LoRaWAN  
The physical layer of a LoRaWAN network is called LoRa. LoRa is a chirp spread spectrum based modulation developed by Cycleo in 2009 and acquired by Semtech in 2012. An advantage of the LoRa modulation is the low complexity of the receiver design due to the equivalent offsets in timing and frequency between the transmitter and the receiver. The data signal is modulated onto a chirp signal that increases or decreases its frequency with time. The chirp rate defines the spectral bandwidth (\(BW\)) of a LoRa signal, meaning that for example, a spectral \(BW\) of 125 kHz corresponds to a chip rate of 125,000 chips/s. Assuming a fixed \(BW\), the data rate can change depending on the employed spreading factor (\(SF\)). \(SF\) (which varies between 7 and 12) is the number of raw bits carried per symbol. Thus, the data rate \(R_{b}\) is calculated as follows:  
\[R_{b}=SF\times\left(\frac{BW}{2^{SF}}\right)\times\left(\frac{4}{4+CR}\right), \tag{1}\]  
where the first term is the spreading factor, the second term corresponds to \(R_{s}\) or symbol rate (symbols/s) and the third term depends on the coding rate (\(CR\)) (The LoRa modulation includes a FEC (Forward Error Correction) scheme in order to find and correct erroneous bits by adding redundancy in the code, improving the robustness of the transmitted signal [12]. \(CR\) is the Code Rate and its values can vary between 1 and 4). Thus, assuming fixed BW and coding rate, the data rate decreases as the \(SF\) increases. The information is then transmitted following the packet format defined in Figure 1.  
The Time on Air (\(ToA\)) or the duration of the packet transmission is given by the sum of the preamble and payload duration:  
\[T_{packet}=ToA=T_{preamble}+T_{payload}. \tag{2}\]  
The preamble is common to all modern configurations. Its duration is given by the following expression:  
\[T_{preamble}=(n_{preamble}+4.25)T_{sym}. \tag{3}\]  
Figure 1: LoRa packet format. where \(n_{preamble}\) is the number of programmed preamble symbols and \(T_{sym}\) is the symbol duration which can be defined as the necessary time to send \(2^{SF}\) chips at the chip rate. \(T_{sym}\) is calculated with Equation (4). \[T_{sym}=\frac{2^{SF}}{BW}. \tag{4}\]  
The payload duration is given by Equation (5). The \(payloadSymbolNb\) is defined as the number of symbols that form the header and the packet payload and it is calculated with Equation (6), where \(PL\) is the payload length, \(H\) is equal to 0 when the explicit mode of the header is enabled and 1 otherwise (When explicit mode is disabled, the header is removed because the properties of its fields are fixed.) and \(DE\) corresponds with the low data rate optimization in order to increase the robustness of the LoRa link at low data rates, so that, it is enabled for \(SF\geq 11\). \[T_{payload}=payloadSymNb\times T_{sym} \tag{5}\]  
\[payloadSymNb=8+max(ceil\left(\frac{8 PL-4 SF+28+16-20H+1}{4(SF-2 DE)}\right),0). \tag{6}\]  
Table 1 presents a data rate configuration assuming a 125 kHz bandwidth and the default LoRaWAN Code Rate (4/5). The bit rate increases and the \(ToA\) decreases as the \(SF\) is decremented. The LoRaWAN open standard defines the network architecture and describes the communication protocol to allow the connection between each entity of the network. The protocol and network architecture have a big influence on determining the battery lifetime of a node, the network capacity, the security, and the variety of applications that can be served by the network [13]. A typical LoRaWAN network (see Figure 2) consists on a star-of-stars topology where one or more gateways (concentrators) relay download and upload traffic between a variety of end-nodes (that may be either mobile or mounted at a fixed location) and a central network server respectively. The network server manages the traffic between each end-device and the associated application server.