# Experiencing LoRa Network Establishment on a Smart Energy Campus Testbed
## 5 Experiments for LoRa MAC
### Impact of Back-Off Algorithm on LoRa  
The aim of the fourth experiment is to examine how a back-off algorithm affects LoRa MAC performance. To this end, we configure the parameters that are shown in Table 6 (Exp.D) and described in this subsection. This experiment especially focuses on two parameters: the number of continuous sensing counts and a contention window (CW) algorithm. Neither parameter is defined in the LoRa regional parameters and regulations. When sensing a channel in use, a node with LBT hops to another channel, randomly selected out of 7 available ones, and again senses the new channel's condition. When all the channels are unavailable, the node continuously jumps over the channels until the occupation of a channel is released, which enables data transmission. At the same time, this situation, however, can worsen MAC performance because more transmission attempts intensify the competition for medium access. It is needed to limit the number of sensing counts. To scrutinize this behavior in LoRa, the experiment increases the number of continuous sensing counts from 0 to 10. A sensing count of 0 means that the node does not run LBT; that is, it starts transmitting data immediately without sensing. Another problem arises when multiple nodes are waiting for the same channel to be released. As soon as the channel is released, several nodes attempt to transmit data simultaneously; data from two or more nodes lead to collisions. To mitigate this problem, most medium access control techniques introduce a back-off time based on a CW, which has not yet been applied to LoRa. This experiment run with three different CW algorithms. First, a fixed CW uses a fixed-size congestion window in which a maximum contention window (\(CW_{max}\)) is fixed. Then, a node selects a random time from 0 s to \(CW_{max}\) for which it backs off before transmitting data. Initially, \(CW_{max}\) is set to 4 s, which is the maximum transmission time allowed by the regulations. Next, an exponential CW dynamically changes \(CW_{max}\) by using network feedback. It initially sets \(CW_{max}\) to 4 s and increases the \(CW_{max}\) value by a factor of 2 as the count of sensing trials at a node increases. The node randomly selects the back-off time in the CW range. Lastly, a ToA CW is the same as a fixed CW except that each node sets its own \(CW_{max}\) according to its SF vale. A node with SF 12 sets \(CW_{max}\) to 4 s, which is equal to the maximum time-on-air time at SF 12. In this way, a node with SF 7 sets \(CW_{max}\) to 1 s. The node randomly selects the back-off time in the CW range. With the initial settings, our first experiment reveals that the PDR results remain the same for all numbers of sensing counts and for all algorithms. A careful investigation reveals that the initial \(CW_{max}\) of 4 s is too long. Moreover, having 7 available channels allows nodes to find an empty channel easily without sensing more than two consecutive times. To resolve the issue, we adjust the number of available channels from 7 to 3 and varied \(CW_{max}\) from 10 ms to 800 ms with a 10 ms interval. For the ToA CW, \(CW_{max}\) at each node was set to the real time-on-air time with 32 bytes of payload length given its SF value. In this way, the nodes with SF 7, 8, 9, and 12 set the value of \(CW_{max}\) to 66 ms, 123 ms, 226 ms, and 1428 ms, respectively. Figures 18 and 19 illustrate the experimental results for a \(CW_{max}\) of 10 ms and 20 ms. We omit the results for the cases with a \(CW_{max}\) of longer than 20 ms because they do not show meaningful differences in performance. The left, middle, and right graphs in the figures show the results of fixed CW, exponential CW, and ToA CW algorithms, respectively. The performance at higher SF nodes (10-12) does not change meaningfully with the increasing number of sensing counts. It is also not affected by the CW size.