# UAV Charging Station Placement in Opportunistic Networks
## 5 Proposed Approach  
The simulation starts off with each charging station having at least one UAV ready to take off. The UAV departs the charging station towards a random spot on the map section under study. At the center of the chosen spot, the UAV starts a spiral scan with a random spiral radius. The spiral radius is the maximum distance between the center of the spiral and the end of the last turn (curve) of the spiral. If the maximum spiral radius has been reached or the distance between the UAV and the center of the spiral exceeded the mapped area, the UAV first stops at that point on the air and then proceeds to another random spot to perform another spiral scan. At any given moment, if the UAV barely has enough battery to reach the closest charging station, the UAV cancels its current cruising trip and immediately hits the nearest charging station. The UAV stays 30 s at the charging station for either battery replacement or charging, after which takes off again for another spiral scanning trip. The spiral used in our approach is the Archimedes spiral. Archimedes spiral is a special case of the Archimedean spirals, named after the Greek mathematician [PERSON]. It is defined as the space made over time by a point moving outward from a fixed central point with a constant speed along a line that rotates with constant angular velocity. An Archimedes spiral can be described with polar coordinates by the equation,  
\[r=a\theta \tag{5}\]  
where \(r\) is the length of the radius from the center of the spiral, \(a\) is a constant that affects the distance between each turn of the spiral, changing \(a\) controls the distance between loops, and \(\theta\) is the amount of angular rotation of the spiral. The distance between successive turns of the spiral is constant and equals \(2\pi a\). If \(\theta\) is measured in radians, then the equivalent parametric equations for the Archimedes spiral are,  
\[x(\theta) =a\theta\cos(\theta)+x_{initial} \tag{6}\] \[y(\theta) =a\theta\sin(\theta)+y_{initial} \tag{7}\]  
As UAVs perform spiral scans on the opportunistic network, the spiral pattern is selected as scanning a small area will be possible with a spiral by adjusting \(d\) (density) and \(R\) (maximum radius) parameters of the spiral which is shown in Figure 2. What is interesting about the Archimedes spiral is that the density of the spiral (\(d\)) stays constant unlike other spirals, such as the Fibonacci (Golden) spiral, where density(\(d\)) increases in every turn. The density of the spiral is the distance between two consecutive arcs, while the maximum radius of the spiral is the distance between the center of the spiral and the end of the largest arc. For our application case, the density parameter (\(d\)) is set to 200. The maximum communication distance between nodes and UAVs is around 223 m. In that case, if the spiral density is 200 m, at least 2 encounters can be completed with a stable node on the ground. The maximum radius of the spiral is set to 400 m.  
UAVs do not request any location information or private information from either the nodes or the other UAVs. The packet exchange between nodes and UAVs is minimal so that an encounter time between nodes and UAVs can be sufficient enough to obtain an efficient packet exchange. The UAVs have a GPS or a location sensor as they travel around the locations determined dynamically. As a result, the UAVs can be added or removed from the environment for maintenance or different purposes. The locations of the charging stations are determined according to three different techniques, namely, K-means clustering, density-based spatial clustering of applications with noise (DBSCAN), and at random. In addition to the aforementioned clustering techniques, three routing protocols are used in our study: Epidemic, Spray and Wait, and State-Based Campus Routing (SCR). The next two sections explain the clustering techniques and the routing protocols used. The charging station locations are determined as follows.