# Optimal Data Collection Time in LoRa Networks--A Time-Slotted Approach
## 6 Evaluation and Discussion of the Results
### Simulation Setup  
We consider a square deployment area with a side of 1000 m length and a variable number of nodes that are randomly and uniformly scattered. We also consider a path-loss model that corresponds to a smart city scenario where the signal attenuates fast [6]. We compare the performance of the time-slotted scheduling heuristics, _Light_ and _Global_[11], with a Pure Aloha-based approach (denotes the standard LoRaWAN), with a Slotted-Aloha one, as well as with the optimal scheduling solution of Section 5 (for 10 to 50 nodes). For fair comparison (in the case of confirmed transmissions the Aloha approach presents a very high number of collisions), the uplink transmissions are unconfirmed, so no re-transmissions occur (however some experiments with confirmed transmissions are shown in Section 7). In the Aloha-based approaches, the nodes use the minimum reliable SF that allows them to reach the gateway, which actually demonstrates the standard Adaptive Data Rate (ADR) mechanism of LoRaWAN. We allow the nodes to periodically send data with the optimal rate \(\theta_{max}\) as derived by solving the optimisation problem in Equations (2)-(5) for both Pure and Slotted-Aloha cases. This optimization problem is solved using exhausting search as with [17]. In this way, we guarantee a packet delivery ratio of at least 90% for all nodes in the network. In Pure Aloha, each node transmits at a constant rate which may vary for a few seconds from transmission to transmission in order to avoid repeated collisions. In Slotted-Aloha, each node chooses randomly a slot to transmit; this slots changes at every transmission also to avoid repeated collisions. In collision-free approaches (i.e., scheduled ones), the maximum allowed data rate as this is dictated by the duty cycle rules and the scheduler is followed. All scheduling algorithms are implemented in the Perl programming language (the code is available at [[https://github.com/deltazita/offline-lora](https://github.com/deltazita/offline-lora)]([https://github.com/deltazita/offline-lora](https://github.com/deltazita/offline-lora)) (accessed on 3 February 2021)), taking into account the path-loss and fading of the signal and the capture effect at the gateway. The Aloha-based approaches are implemented in a LoRaWAN simulator (LoRaWAN simulator [[https://github.com/deltazita/LoRaWAN-SIM](https://github.com/deltazita/LoRaWAN-SIM)]([https://github.com/deltazita/LoRaWAN-SIM](https://github.com/deltazita/LoRaWAN-SIM)) (accessed on 3 February 2021)). ary 2021)) whose effectiveness and correctness have been verified by experiments [17]. The simulator has been adapted to the needs of the bulk data collection and inherits the following capabilities and features from the original simulator:  
* Multiple half-duplex gateways
* 1% radio duty cycle for uplink transmissions
* 1% or 10% radio duty cycle for downlink transmissions
* Two receive windows (RX1, RX2) for ACKs and commands
* Non-orthogonal SF transmissions
* Capture effect
* Path-loss signal attenuation model
* Multiple channels (however a single channel was used in this paper)
* Collision handling for both uplink + downlink transmissions
* Node energy consumption calculation (uplink + downlink)  
Table 2 shows the values used for the simulation parameters. The linear program was implemented in the Java programming language and solved using the IBM CPLEX solver 12.8 on a personal computer with Intel Core i7-5500U CPU, 2.40 GHz, 32 Gb RAM computer running the Linux Fedora operating system. The sensitivity of the solver's optimality gap has been set to \(1\times 10^{-7}\) to have enough precision to detect the optimal schedule length. Due to the complexity of the model, we have computed the optimal schedule only for network sizes between 10 to 50 nodes for fixed and variable node buffered data sizes. For the rest of the simulations, we vary the number of nodes from 100 to 1000 and we measure the data collection time, the packet delivery ratio (PDR), and the energy consumption of the nodes.