# LoRa Resource Allocation Algorithm for Higher Data Rates
## 3 LRA Algorithm Framework
### Resource Allocation Algorithm
Total ToA, which is the sum of the travel times of all packets using different SFs, can be represented by (8):

\[ToA_{tx}=\sum_{m=1}^{3}\sum_{n=0}^{6}ToA_{m,n}=\sum_{m=1}^{3}\sum_{n=1}^{6}ToA _{m,0}(\alpha^{-n}\beta^{-m}) \tag{8}\] \begin{table}
\begin{tabular}{c c c c c c} \hline \multirow{2}{*}{**SF**} & \multicolumn{2}{c}{**BW = 500 kHz**} & \multicolumn{2}{c}{**BW = 250 kHz**} & \multirow{2}{*}{**RBRI (\%)**} \\ \cline{2-2} \cline{4-5}  & **ToA (ms)** & & & & **B (kbps)** \\ \hline
6 & 52.1 & 37.5 & 104.2 & 18.75 & 71 \\ \hline
7 & 92.2 & 21.87 & 184.4 & 10.935 & 75 \\ \hline
8 & 164.0 & 12.5 & 327.9 & 6.25 & 78 \\ \hline
9 & 292.1 & 7.03 & 584.2 & 3.515 & 80 \\ \hline
10 & 533.0 & 3.906 & 1066.0 & 1.953 & 82 \\ \hline
11 & 963.6 & 2.148 & 1927.2 & 1.074 & 83 \\ \hline
12 & 1804.3 & 1.172 & 3608.6 & 0.586 & - \\ \hline \end{tabular}
\end{table} 
Table 1: ToA values of a 240-byte packet for different BWs and SFs. Figure 5: ToA of burst transmission of 240 B packets over different SF with the same RF channel and BW. where \(m\) is the index of different BWs used in the range of 125 kHz to 500 kHz, and \(n\) is the index of different SF values used from 6 to 12. \(ToA_{m,0}\) is the ToA at SF = 6 for a specific BW. Table 1 shows that the ToA is the lowest at SF = 6 for a specific BW. The increment of the ToA for another SF is represented by \(\alpha\). The ToA increment for the same SF at a different BW is represented by \(\beta\). Figure 6 shows the variation in ToA for different SFs and BWs, from which we can determine the values of \(\alpha\) and \(\beta\), which vary for different SFs and BWs. However, these variations are minimal, about 10%. Therefore, an approximation is used where \(\alpha\) = 0.56 and \(\beta\) = 0.5. Burst data transmission using the proposed algorithm requires multiple LoRa packets to be transmitted sequentially. This packet sequence can transmit a data stream in multiple time slots, as performed in TDMA, due to the different ToAs at different SFs. The number of packets for a burst transmission may also induce further underutilization. This utilization can be maximized using odd or even SF values for the stream of data packets, which corresponds to either SF = 7 and SF = 9, and SF = 8 and SF = 10 being paired together. However, it depends on the data processing and the SPI communication time, which are almost fixed for all SFs. Therefore, odd or even paired SFs may not be the best choice for maximum resource utilization. For the burst transmission of multiple LoRa packets, the total burst transmission time \(T_{tx}\) includes the total ToA (\(ToA_{tx}\)) and the total processing time (\(T_{u}\)), as shown in (9). However, the number of packets (\(F\)) that need to be transferred will differ for different SFs in an LC. Considering the same processing time for all the SFs, \(ToA_{tx}\) and \(T_{u}\) can be rewritten as (10) and (11). From Figure 5, it can be shown that the synchronization loss will be the lowest when the ToA is the minimum time required for a packet, which is \(ToA_{n}-t_{u}\), and that the transmission time utilization can be expressed by (12). The lowest ToA occurs for the lowest SF used, which is seven for \(n\) = 1. Therefore, the synchronization loss can be minimized by using the smallest SF possible and transmitting the largest data segment using that SF. The effective BR of the proposed algorithm can be calculated using (13), using \(PL\) as the payload size in bits and \(T_{tx}\) in seconds. \(t_{u}\) is the delay time required for packet processing and reception at the receiver. \[T_{tx}=ToA_{tx}+T_{u} \tag{9}\]

\[ToA_{tx}=\sum_{m=1}^{3}\sum_{n=1}^{6}F_{m,n}ToA_{m,0}\left(\alpha^{-n}\beta^{- m}\right) \tag{10}\]

\[T_{u}=t_{u}\sum_{m=1}^{3}\sum_{n=1}^{6}F_{m,n} \tag{11}\]

Figure 6: Impact of changing BW and SF on ToA.