## 5 Simulation
### MATLAB Simulation  
The MATLAB simulation platform was considered in this study for characterizing the behavior of the LoRaWAN network. A simulation model was developed in MATLAB for evaluating the effects of various parameters, such as SNR, bitrate, and SF. A sample LoRa testbed was developed on the MATLAB simulation platform. The simulation was implemented by considering the following features: a network with 10 to 100 nodes, one gateway, and one network server. The nodes were distributed both randomly and uniformly with a minimum period of 100 s. SF, transmission power, and gateway transmission power were defined as per the protocol. The SNR value was determined from the simulation result. We classified the simulation into cases as follows:  
Case I:  
LoRa trades the transmission and reception data rate for sensitivity within a given channel bandwidth. As shown in Table 3, LoRa implements an adaptive data rate by the utilization of orthogonal SFs. This allows the user to minimize the power consumption and optimize the network performance for a given bandwidth. The receiver maintains the mode of operation downlink, gate power at 27 dB, node sensitivity at \(-124\) dB, operating frequency at 868 MHz, antenna gain at 10 dB, and node noise and node antenna gain at 30 dB. After performing the simulation, the obtained results are presented in Table 4. The results indicate that a change in antenna height from 1 to 7 m leads to significant changes in the coverage area. Figure 10: LoRa simulation platform with simulation parameters. For the parameters, such as frequency of 868 MHz, node sensitivity of \(-124\) dBm, gateway node power of 10 dB, and antenna gain of 27 dB, a relationship between the height of gateway and node with range is plotted in Figure 11.  
The experimental data shown in Table 5 provides a brief overview of the correlation between the height of the gateway, the height of end nodes, and the range. During data reception at the receiver, the data were interpreted; the table's model signifies the downlink. The graph concludes that a constant link budget of 159 dBm range is directly proportional to the height of the end node and gateway. Thus, to achieve greater range coverage, it is considered that the end nodes should be mounted on cylindrical bars, as shown in Figure 11. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Mode** & **Gateway** & **End Node** & **Link Budget** & \\
**(Down Link)** & **Height** & **Height in** & **dBm** & **Range in Meter** \\ \hline Down Link & 1 & 1 & 159 & 932 \\ Down Link & 2 & 1 & 159 & 1318 \\ Down Link & 3 & 1 & 159 & 1614 \\ Down Link & 4 & 1 & 159 & 1683 \\ Down Link & 5 & 1 & 159 & 2083 \\ Down Link & 6 & 1 & 159 & 2282 \\ Down Link & 7 & 1 & 159 & 2465 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Range and link budget at node sensitivity—124 dBm. Figure 11: Gateway height versus range in meters. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**SF** & **Chirps** & **SNR** & **ToA** & **Data Ate** \\ \hline
7 & 128 & \(-8.5\) & 122 ms & 6345 bps \\
8 & 256 & \(-11\) & 189 ms & 4425 bps \\
9 & 512 & \(-15.48\) & 235 ms & 2118 bps \\
10 & 1024 & \(-18.5\) & 381 ms & 1233 bps \\
11 & 2048 & \(-15.48\) & 235 ms & 2118 bps \\
12 & 4096 & \(-18.5\) & 381 ms & 1233 bps \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Adaptive data rate of LoRa. Case II  
The establishment of the LoRa communication link significantly depends on the gateway height and the end node heights. Experimental data are presented in Table 5. Here the node sensitivity is \(-124\) dBm and the operating frequency is 868 MHz, and it can be observed that the signal coverage area changes in addition to the variation in heights of the gateway and end nodes. The end node height is 2 m from the ground.