# Performance Evaluation of UAV-Enabled LoRa Networks for Disaster Management Applications
## 3 Proposed UAV Topology Control Algorithm
### Connection Recovery and Maintenance (CRM)  
Even though attractive forces already provide a cohesion mechanism that helps to keep all the members of the swarm in a compact formation, in a system like UAV-enabled LoRa network clustering is difficult to avoid. Disconnections might be caused by a series of factors, like variable environmental conditions or simply by a UAV or a group of UAVs that goes too far from nearby UAVs due to a particularly strong attractive force. In these circumstances, some mechanisms need to be integrated into the system to recover the connectivity with the UAV formation and therefore with the BS. When the connection to the BS is recovered, a connection maintenance procedure must be triggered to avoid further disconnections. More specifically, three mobility behaviors are implemented in the system:  
1. VSF mobility Network Recovery Mobility (NRM)  
Stationary Mobility (SM)  
The selection of the right mobility is based on the value of two parameters: _pause_ and _persist_. The _pause_ parameter is a positive integer number that specifies the number of \(\Delta T\) time intervals during which the UAV must remain stationary. When a connection with the BS is re-established thanks to the NRM, the SM is activated and kept active until, after _pause_\(\times\)\(\Delta T\) time intervals, the _pause_ parameter reaches the value zero. This mechanism has the purpose of keeping the UAV in a stable position for some time and avoid further disconnections. The value of _pause_ is given as  
\[pause=\lfloor P_{\max}\times\frac{R_{\max}}{D_{BS}}\rfloor, \tag{5}\]  
where \(P_{max}\) is the maximum number of _pause_ intervals, \(R_{max}\) is the maximum range of the drone and DBS is the current distance from the BS. \(R_{max}\) is progressively computed by resorting to the position information periodically exchanged with the neighboring UAVs. The above expression assigns a more conservative behavior to drones that are closer to the BS and, therefore, the ones that are more likely to cause the disconnection of a big part of the network. On the contrary, peripheral UAVs can move more freely, since it is less likely that their disconnection causes the partition of other parts of the network. The _pause_ parameter is ignored only in one circumstance, that is when the load parameter is zero. This parameter measures the number of relayed packets during a time window of fixed length \(t_{load}\) and it can, therefore, be used to select those UAVs that have been inactive for some time. Since those UAVs are not useful for the operation of the system, they can keep moving according to the VSF mobility without the constraints imposed by the CRM algorithm. The _persist_ parameter is an integer number expressing the number of \(\Delta T\) time intervals during which the drone must keep using the VSF mobility even if a connection to the BS is not available. This behavior is necessary to relax the conditions that trigger the NRM, in the hope that a path to the BS can be re-established thanks to the rearrangement of other UAVs, typically located closer to the BS. In the present work, the _persist_ parameter is set according to the following expression  
\[persist=\lfloor\frac{(hops-1)D_{BS}}{R_{\max}}\rfloor, \tag{6}\]  
where hops are the number of hops that were separating the UAV from the BS the last time the path was active. The above expression allows peripheral UAVs to be dragged by VSF forces for a longer time, even if a path to the BS is not available. On the contrary, UAVs closer to the BS is less tolerant of disconnections and try to recover a connection sooner than their peripheral counterparts. In normal circumstances, _persist_ is decremented by one unit at each time step, until zero is reached. However, there is a situation in which the _persist_ counter is updated differently. It is possible that a group of UAVs, covering almost the same set of GNs, gets separated from the rest of the swarm. The typical _persist_ behavior would not, in this case, exploit the redundant UAVs to recover the connectivity.