# LoRa Resource Allocation Algorithm for Higher Data Rates
## 3 LRA Algorithm Framework
### Resource Allocation Algorithm  
Based on the achievable BR for a given payload size, the ToA related to each SF can be derived. Assume that packets with the equal payload of 240 bytes are to be successively transmitted. Figure 5 shows the transmission times of 240-byte packets using different SFs, with each block representing the time of a single packet. The gaps between the blocks are packet processing times (\(t_{u}\)). In this example, the transmission takes about 300 ms if SF = 9, while it only takes approximately 60 ms for SF = 7. SF = 6 is not considered in our algorithm due to its unavailability in some transceivers. As indicated by the green dashed lines, packets transferred using SF = 7 achieve better synchronization with packets transferred concurrently using SF = 9, compared to those using SF = 8 or SF = 10. Therefore, synchronous access of LC can be maintained by allocating different portions of data with equal packet sizes to the physical channels. The proposed algorithm assigns a specific number of data packets sequentially to the transmitters based on the amount of data they can send through the LC. As illustrated in Figure 5, while transmitting a single packet at SF = 9, it is possible to transmit three packets at SF = 7. However, by introducing a slight delay in packet processing, the system can transmit two packets at SF = 8 alongside three consecutive packets at SF = 7, contributing to a higher BR compared to other SF combinations. In other words, three out of five packets are sent by the transmitter with SF = 7 and two are sent by the one with SF = 8 per each round of parallel transmission. Thus, to maximize channel utilization and minimize the overall transmission time, the algorithm allocates 60% of the entire user data to SF = 7 and the remaining 40% to SF = 8. The pseudocode of the proposed algorithm is shown in Algorithm 1. ``` //Synchronized Resource Allocation Algorithm //For a logical channel that contains 2 physical channels with spreading //factors SF1 and SF2 and SF1 < SF2 //Assumptions: //All parameters (packet sizes, SFs, BW, CR, etc.) are provided by //the user //Variables m = size(input_byte_string); p = packet_size; N = floor(m/p) + 1; //number of all packets Delay; //delay time //Initialize: Set parameters for the transmitters Based on the measured ToAs (Figure 5) for SF1 and SF2, determine: n1 = number of all packets for SF1 n2 = number of all packets for SF2 (n2 = N - n1) //Loop until all packets are transmitted For (i = 1:N, i++) { Transmit using SF1; //to complete n1 packets Transmit using SF2; //to complete n2 packets //delay after each parallel transmission to allow packet processing //on the receiver Delay:

### SF Selection

SF represents the number of chips per chirp or symbol; thus, as the SF grows, the symbol duration increases. In other words, higher SF leads to lower BR and higher ToA. Therefore, maximum BR depends on the ToA, which is calculated based on the BW and SF, as shown in (7) [24]. \[ToA=\left(20.25+\left\lceil\frac{2 PL-SF+7}{SF}\right\rceil 5\right)\left(\frac{2^{ SF}}{B}\right) \tag{7}\]

ToA will be the lowest for all the SFs where BW is the highest. Table 1 shows the ToA for BWs 250 kHz and 500 kHZ when SF is varied, and the relative BR improvement (\(RBRI=1-BR_{i}/BR_{i+1}\)) between two consecutive SFs for the same BW. It also indicates that the ToA with BW = 250 kHz and SF = 7 is only 20.4 ms (12%), less than the ToA with BW = 500 kHz and SF = 8. This differs more (55% to 57%) for the same BW with different SF. Therefore, parallel transmission using 250 kHz and 500 kHz BW can be used for two consecutive SF values. However, it is not used in the proposed LRA algorithm to avoid data loss due to inter-channel interference, as further explained in Section 4. ### LRA Algorithm Data Rate

The actual data rate for the proposed LRA algorithm depends on the equivalent or total ToA for the parallel channels.