# LaRaWAN Metering Infrastructure Planning in Smart Cities
## 4 New Proposals and Results
### Spreading Factor Optimization  
Paper [41] analyzed the impact of adding new clusters (resulting in new gateways) on the power efficiency of LoRaWANs. As the number of gateways increased, the distances shortened, leading to an increase in SNR, causing the ADR algorithm to recommend smaller values for the transmit power \(P_{t}\) and \(SF\) factor. However, [42] showed that the ADR technique has a long convergence time and is not able to adapt to changing link conditions, sometimes requiring several hours to several days to reach a reliable and energy-efficient communication state. Given the one-time approach in infrastructure planning and the additional energy consumption resulting from bidirectional communication in ADR, it seems important to plan the deployment of metering nodes and such settings to minimize both SF and the number of gateways. This approach presents the _SFArrangement_ Algorithm 1. ```
Parameters:\(n,K,SF,RSSI=f(SF)\). 1: Determine the deployment of end nodes by transforming the geographic coordinates to a Cartesian system. 2: Determine the deployment of LoRaWAN gateways based on the K-means algorithm. 3: Starting with \(SF=7\), determine the received signal power at each end node according to the propagation model. 4: Assign nodes for which \(RSSI<max(RSSI_{SF7})\rightarrow\) with \(SF=7\). 5: If there are nodes in the cluster that do not meet the above condition, increase the SF to 8 and assign to nodes that meet the condition \(RSSI<max(RSSI_{SF8})\rightarrow\) with \(SF=8\). 6: Increase SF sequentially until it reaches 12. 7: Termination condition: all nodes have been assigned SF values or the step for \(SF=12\) has been performed. ```  
**Algorithm 1** SFArrangement  
The algorithm determines the so-called _coverage ratio_, defined as the ratio of the number of metering nodes in range of the gateway (whose range allows transmission to the gateway) to the number of all nodes in the metering network. Figure 4 shows visualizations of the network for different parameters and different stages of the algorithm obtaining the same coverage factor with nodes spread over a \(10\times 10\) km area. The circles indicate the maximum radio coverage for successive values of the spreading factor (SF = 7... 11). The calculation of the maximum radio range is based on the sensitivity of the widely used Semtech SX1276 radio module for different 868 MHz bandwidths (Table 2) and the transformation of COST-231 Hata radio loss model used (Formula (2)) for different BW and SF parameters. The accuracy and desirability of the adopted radio loss model has been demonstrated in the literature, and field tests of node coverage confirm these results [43; 44]. According to Figure 5, the maximum range is 2500 m for \(SF=7\) and 6350 m for \(SF=12\) (at \(BW=125\) kHz). It is worth noting that as the SF increases, the measurement nodes may remain in range of more gateways and reduce the transmission efficiency within these gateways due to a higher probability of collisions. By knowing the radio parameters of each node, it is possible to determine the transmission airtime based on the length of the messages sent and, as a result, the energy efficiency of the entire system [41]. The results shown in Figure 6 show the dependence of the coverage ratio on both the SF and the number of gateways used. The study was conducted for a wide number of measurement nodes \(N\) (from 100 to 2000). A coverage factor was determined for a random distribution of nodes for 100 instances. The use of high SF values (11 and 12) only seems justified when the installation of new gateways is not possible (for \(K=2,3\)). Then, however, the energy efficiency and the transmission restrictions imposed by _The Things Networks_ recommendations (fair use policy) make the solution ineffective [45]. A coverage ratio of 1 can already be achieved at \(SF=10\) for \(K=4,5\). Further increases in the number of gateways in a given area are not justified.