# LoRaWAN Behaviour Analysis through Dataset Traffic Investigation
## 4 LoRaWAN Analysis
### Gateway Radio Indicators  
The goal of the first analysis is to analyse the behaviour of the two radio indicators Received Signal Strength Indicator (\(RSSI\)) and Spreading Factor (\(SF\)). By studying the behaviour of these parameters, we can understand the performance as observed at the gateway level. The \(RSSI\) represents, in dBm, the received signal power. This value can be used as a measurement of the quality of the signal received by the gateway. The \(RSSI\) reported in LoED is the one measured at the gateway and it represents the strength of the signal received by the gateway for the uplink messages. The Spreading Factor (\(SF\)) controls the chirp rate of an end-device in a LoRaWAN, and, thus, controls the speed of data transmission. The \(SF\) can be managed by the NS dynamically with the Adaptive Data Rate (ADR) protocol together with the ED, or it can be arbitrarily set by the ED. Lower spreading factors mean faster chirps and, therefore, a higher data transmission rate. For every increase in spreading factor, the chirp sweep rate is halved and so also the data transmission rate is halved. Moreover, the higher the \(SF\), the higher the probability of a successful reception of a packet by a gateway. \begin{table}
\begin{tabular}{c c} \hline \hline
**mtype** & **Message Type** \\ \hline
000 & Join request \\
001 & Join accept \\
110 & Rejoin request \\
010 & Unconfirmed data-up \\
100 & Confirmed data-up \\
011 & Unconfirmed data-down \\
101 & Confirmed data-down \\
111 & Proprietary \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Table reporting all _mtype_ fields foreseen by LoRaWAN with their related message type. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Message Type** & **Total Number of Packets** & **Number of Distinct Packets** \\ \hline Join request & 246,272 & 170,476 \\ Rejoin request & 27,576 & 26,561 \\ Join-Accept & 20,971 & 20,660 \\ Confirmed data-up & 664,474 & 441,742 \\ Unconfirmed data-up & 7,441,505 & 4,776,723 \\ Confirmed data-down & 63,216 & 32,537 \\ Unconfirmed data-down & 24,140 & 23,989 \\ Proprietary & 30,206 & 29,539 \\ Unknown & 2,744,641 & 2,744,641 \\
**Total** & **11,263,001** & **8,266,868** \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Number of packets contained in LoED dataset grouped by message type. In the centre column it is reported the total number of packets including the duplicates, while on the right it is reported the number without duplicates. Table 4 shows the \(SF\) with the resulting bit rate. In order to analyse the behaviour of \(RSSI\) and \(SF\) values of the gateway in LoED we split the packets by the receiving gateway and for each sub-set we store the values of \(RSSI\) and \(SF\) for each packet. In Figures 6 and 7, the histograms of \(RSSI\) and \(SF\) per gateway are reported, respectively. Both values are measured at the gateway level. By looking at Figure 7, we can observe how the majority of the LoRa packets assume a low value of \(SF\), around 7 or 8. This is due to achieve the maximum data rate, to use less network resources and to be as energy efficient as possible. With gateways GW8 or GW9 we can observe a large component of packets assuming \(SF=12\). This observation is coherent with the geographical placement of such gateways. Indeed, they are placed on top of tall buildings with no obstacles around them, this enables the reception of packets sent by distant ED, which set their \(SF\) high in order for their packets to be received. Regarding the plots in Figure 6, they shown how the \(RSSI\) behaviour is different for each gateway. The three gateways GW1, GW2, and GW3, that correspond to the three plots of Figure 6 have a dense and well defined \(RSSI\) distribution with an average of around \(-110\) dBm and with an exponentially decaying tail of higher \(RSSI\) values. The same reasoning could be applied to GW8 and GW9, although with a less well-defined distribution. All these gateways are deployed on top of buildings without having lots of obstacles.