# Performance Evaluation of a Mesh-Topology LoRa Network
## 5 Proposed Approach: LoRaMesh
### LoRa-Mesh MAC
#### 5.1.2 Up-Link Scheduling Procedure  
The up-link procedure in the research is a rule-based approach, with a fixed up-link schedule. The up-link schedule is determined at the network start. In this approach, we assume the routing mechanism as a global view of the path loss between all nodes in the network. The routing mechanism and proposed routing information distribution mechanism will be discussed in Sections 5.2 and 5.3, accordingly.  
All child nodes are assigned an up-link time slot, with the aim of decreasing the packet collision probability. The duration of the up-link time slot is based on the slowest DR and maximum packet size transmitted in the network. This time slot duration is kept fixed. The total up-link time will be determined by the network server and will depend on the max allowed child-nodes per parent routing node, the transmission slot duration, and the maximum number of hops in the network. The total up-link time will limit the throughput and up-link latency of the network. Minimising the total up-link time should be one of the major priorities of the routing and transmission parameter selection mechanisms.  
Two children nodes from two different parent nodes will be allowed to transmit simultaneously, as we rely on spatial diversity, frequency diversity, semi-orthogonal spreading factors, and the capture effect to minimise the packet loss probability.  
Figure 3: Beacon frame dissemination proposed methods performance. (**a**) Time diverse beacon frame dissemination performance. (**b**) Beacon frame dissemination without time diversity performance.  
The up-link time slot assignment mechanism first assigns a transmission time slot to edge nodes, which are assigned to the furthest transmission hop in the network. Nodes are assigned time slots to allow sequential transmissions to their respective parent node. See the pseudo code Algorithm 1 for an overview of the procedure. The parent node schedules a reception window at the selected up-link time, with the predetermined SF and centre frequency.  
```
nodes[]= index(of all nodes in the network) for\(i=0\) to nodes.lengthdo if(\(nodes[i].HopNumber==MaxHopNo\))then nodes\([i].TxSlotTime=SlotDuration*nodes[i].parent.NoRxSlots nodes[i].parent.appendRxSlot(nodes[i].TxSlotTime)\) endif endfor
```  
**Algorithm 1** Algorithm for assigning up-link slots for edge nodes  
Nodes that are assigned to any number of transmission hops, other than the maximum amount, follow Algorithm 2's up-link time-slot assignment mechanism. This is similar to Algorithm 1, with the addition of adding a mechanism to re-transmit the received packets. It is important to note that an additional delay is required between the transmission of packets to adhere to the duty-cycle limitations of the ISM band.  
```
nodes[]= index(of all nodes in the network) for\(i=0\) to nodes.lengthdo if(\(nodes[i].HopNumber==CurrentHopNo\))then nodes\([i].TxSlotTime=SlotDuration*nodes[i].parent.NoRxSlots nodes[i].parent.appendRxSlot(nodes[i].TxSlotTime)\) for\(i=0\) to nodes.childNodes.lengthdo nodes\([i].ReTxSlotTime=nodes[i].TxSlotTime+SlotDuration*100*(i+1)\) nodes\([i].parent.appendRxSlot(nodes[i].ReTxSlotTime)\) endfor endif endfor
```  
**Algorithm 2** Algorithm for assigning up-link slots for relay nodes  
In addition to the up-link time-slot algorithms defined above, the up-link frequency, up-link slot time and duration, up-link DR, transmitter location, and receiver location are logged per transmission in the network. This information is used in the in multi-hop parameter selection mechanism, described in Section 5.4, to optimise the performance of the network.