# Collision Avoidance Resource Allocation for LoRaWAN
## 5 Experimentation and Performance Results
### System Model and Simulation Setup  
With the aim of assessing the effectiveness of our modified LoRaWAN MAC layer, we have implemented our proposal in a MATLAB-based dynamic simulator. Next we explain the main assumptions that we have considered for the implementation:  
* End-devices are fixed. Figure 5: CARA flowchart. Figure 6: Border effect between time windows. Each more transmits frames with a 24-byte payload in non-acknowledged mode and meets the duty cycle restriction for the EU68-870 MHz ISM band (<1%). * For a successful transmission, no other device can transmit in the same resource block while the transmitter sends the frame and waits for a possible ACK during both the first and the second RX windows. Otherwise, a collision occurs. Since the duration time of each reception window is usually \(T_{pramble}\) and the time to open each reception window is one second, this time can be calculated as \(T_{device}=T_{frame}+2\times T_{preamble}+2\) s. In the worst case, with SF12, this means that \(T_{device}=2.62\times T_{frame}\). This is shown in Figure 7.
* We assume that there is a traffic source with an infinite number of devices that collectively form an independent Poisson source with an aggregate mean packet generation rate of \(\lambda\) packets/s [17]. The interarrival time between the transmissions of each device is independent and exponentially distributed. We can denote the \(RB_{n,k}\) offered traffic as G \((RB_{n,k})=\lambda(RB_{n,k})\cdot T_{device}\). * The probability that an arbitrary scheduled packet in a specific channel is successfully transmitted, can be calculated with Equation (8). Since LoRaWAN employs several channels (or RBs in the case of CARA), the system throughput can be computed as the addition of the total throughput for each RB (Equation (9)). \[P_{s}=\frac{\#succeedpackets}{\#(succeedpackets+collidedpackets)}\] (8) \[S_{total}=\sum_{n=1}^{N}\sum_{k=1}^{K}S(RB_{n,k})=\sum_{n=1}^{N}\sum_{k=1}^{K} G(RB_{n,k})\cdot P_{s}(RB_{n,k}).\] (9)
* Table 2 includes relevant parameters that have been considered in the simulation. In order to apply this novel resource block allocation scheme in realistic scenarios, a propagation model has been implemented assuming an urban environment called \"Macro Cell Propagation Model\", which is based on [18; 19]. The signal power that the gateway receives from each mode is calculated with the following expression:  
\[S_{RX}(dBm)=S_{TX}(dBm)+G_{TX}(dBi)+G_{RX}(dBi)-L_{prop}(dB)-X_{\sigma}(dB), \tag{10}\] \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Value** \\ \hline BW & 125 KHz \\ Code Rate & 4/5 \\ Payload Size & 25 Bytes \\ Preamble length & 8 symbols \\ SFs & (7–12) \\ Simulation time & 1 h \\ Frequency band & 868 MHz \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Simulation parameters. Figure 7: \(T_{device}\) scheme. where :  
\[- S_{TX}\]  
is the signal power that a more transmits (usually 14 dBm). \[- G_{TX}\]  
and refer to the transmitter and receiver antenna gains, respectively. \[- L_{propagation}\]  
represents the urban environment path loss assuming that all the building heights are similar [19] and is calculated according to Equation (11). \(Dh_{b}\) and \(R\) are the gateway height in meters and the distance between the end-device and the gateway in kilometers, respectively. \(f\) is the operating frequency in MHz (in our case we assume 868 MHz). A log-normally distributed shadowing with a standard deviation of 10 dB is also added (\(X_{\sigma}\)). \[L=40\cdot(1-4\cdot 10^{-3}\cdot Dh_{b})\cdot\log_{10}(R)-18\log_{10}(Dh_{b})+2 1\cdot\log_{10}(f)+80 dB. \tag{11}\]  
The considered scenario consists of a gateway located in the origin of coordinates. Motes have been positioned in a randomly manner following a uniform distribution around the aforementioned gateway. The resource block allocation is carried out taking into account the information in Table 3. According to the strength of the signal received by the gateway, it will assign a more robust SF, such as SF10, SF11 or SF12, when the signal is weak.