# Optimal Data Collection Time in LoRa Networks--A Time-Slotted Approach
## 3 The Problem of Bulk Data Collection
### Data Collection Using Pure and Slotted Aloha MAC
Figure 1: Interfering zone (dark colour) of a node located at distance \(x\) from the gateway placed at the center of the disk (intra-Spreading Factor (SF) interference). SF are potential interferers and the minimum success probability \(P_{f}^{min}\) is then equal to \(p_{f}^{min}=e^{-2T_{f}\theta N_{f}}\). As the transmission rate of the nodes decreases, the success probability increases, but so does the data collection time. This means that there is a certain (maximum) transmission rate \(\theta_{max}\) that satisfies a minimum success probability for all the nodes in the network. The question that arises is: how long is the data collection time given this rate and the desired minimum allowed success probability? In order to answer this question, we formulate the following optimisation problem:  
\[\max\theta, \tag{2}\]  
subject to:  
\[\sum_{k=\rho}^{pkt}\binom{pkt}{k}\left(P_{f}^{min}\right)^{k}\left(1-P_{f}^{ min}\right)^{pkt-k}\geq P_{given}, \tag{3}\]  
\[P_{f}^{min} =e^{-2T_{f}\theta N_{f}}, \tag{4}\] \[\theta T_{f} \leq C. \tag{5}\]  
Equation (3) requires that the probability of \"at least \(\rho\) packets (i.e., \(\rho\in\mathcal{N}^{*},\rho\leq pkt\)) are successfully delivered\" is greater than or equal to a given value \(P_{given}\), and \(pktN_{f}\) is large enough. Equation (5) guarantees that the duty cycle constraint \(C\) is not exceeded (if there is no duty cycle restriction then \(C=1\), for example, in 2.4 GHz LoRa). We must note that in presence of a slotted-Aloha protocol, the vulnerability period reduces from \(2T_{f}\) to \(T_{f}\). Thus, Equation (4) can be modified accordingly. The solution of the optimisation problem gives the theoretical upper bound for the transmission rate (i.e., \(\theta_{max}\)) and, hence, the lower bound for the required data collection time. The example of Figure 2 depicts the theoretical data collection time for a scenario with 100 to 1000 nodes and a minimum transmission success probability of 0.9. All nodes use a 100-byte packet size, transmit 100 packets, and reach the gateway with SF7. We can observe that the data collection may take several hours even for low node numbers. This is because the data collection time depends on the packet rate \(\theta\) which is computed by solving the aforementioned optimization problem. As the number of nodes increases, the number of collisions increase as well. That means that \(\theta\) has to be increased considerably in order to make transmissions sparser and, thus, reduce the number of collisions. It is obvious from this analysis that an Aloha MAC (Pure or Slotted) cannot achieve a reliable bulk data collection in a reasonable period of time. We should mention that optimally assigning SFs such that the probability of delivery is maximised, can alleviate the problem of collisions [17]. However, even in this case the data collection time remains very long. Figure 2: Theoretical average data collection time (\(pkt/\theta\)) of an Aloha and Slotted-Aloha LoRa MAC for different node populations, \(pkt=100\), and 100-bytes packet size. At least 90% packet success rate of all the nodes is guaranteed.