# Cloud-Assisted UAV Data Collection for Multiple Emerging Events in Distributed WSNs
## 3 Mathematical Model and Algorithm Analysis
### Parameter Design for the UAV  
In Section 3.3, we focused on the problem of searching the correlation cluster for emerging events from the ground WSN. In this section, we deal with the parameter optimization of the UAV while considering the characters of ground WSN. This approach can be divided into the following steps: (1) the UAV obtains the correlation of the sequence of flying over the WSN clusters according to Algorithm 1. Then the UAV flies over the clusters and establishes wireless links; (2) the size of thecluster data stored by cluster head is first obtained, and the UAV computes the length of time to hover; (3) in the third step, the UAV and WSN clusters finish the data communication.  
Meanwhile, for the UAV, we use \(V_{f}\) to indicate the velocity of flying and \(H\) to indicate the height of flying. The set \(G=\{g_{1}\), \(g_{2}\), \(g_{3}\),..., \(g_{k}\}\) indicates the ordering of the correlation clusters. The corresponding data set of the sizes of the cluster is given by \(D=\{d_{1}\), \(d_{2}\), \(d_{3}\),..., \(d_{k}\}\). Then, \(T_{s}=\{t_{1}\), \(t_{2}\),..., \(t_{k}\}\) denotes the set of stay times over the WSN cluster. It is easy to obtain the flying time \(T\), using the following calculations:  
\[t_{i}=\frac{d_{i}}{V_{n}} \tag{9}\]  
\[T=T_{f}+\sum\limits_{i=1}^{k}t_{i} \tag{10}\]  
where, \(T_{f}\) is flying time in seconds of the UAV and \(V_{n}\) is the wireless transmission speed. We assume that the size of the data of every correlated node is a constant \(D_{c}\). From this, Equation (9), can be approximated as:  
\[t_{i}=\frac{\beta_{i}\cdot D_{c}}{\tau_{i}\cdot V_{n}} \tag{11}\]  
Furthermore, we can derive the following properties: (1) the number of correlation clusters \(K\) is given by \(0<k<=n\); (2) the stay time of the UAV over the cluster is inversely proportional to its _event correlation coefficient_. The details of the approach are given in Algorithm 2 which describes the rules for obtaining the dynamic flying parameters of the UAV in the presence of an emerging event. UAV flies over the WSN cluster according to the correlation clusters matrix \(G\), and collect data wirelessly, as described in Steps 2-7. Meanwhile, from Steps 8-10, it uses the Equations (9) and (10) to compute the hovering time for UAV. Finally, UAV returns to its ground base station.  
```
0: Set of correlation clusters \(G=\{g_{1},g_{2},g_{3},\ldots,g_{k}\}\), \(V_{n}\), \(V_{f}\), \(D_{C}\).
0: Set of stay times over the WSN cluster \(T_{s}=\{t_{1},t_{2}\),..., \(t_{k}\}\).
1: Begin
2:for\(i\gets 1\) to \(\|G\|=k\)do
3: UAV flies over the WSN cluster \(g_{i}\)
4: Create a wireless link with the cluster head of the cluster \(g_{i}\)
5: Cluster head receives the correlation information from the sensor node
6: Send the \(d_{i}\) to UAV
7: UAV receives the \(d_{i}\), \(D\gets d_{i}\)
8:\(t_{i}=d_{i}/V_{n}\)   // Compute the stay over cluster time
9:\(T_{s}\gets t_{i}\)
10: Hover \(t_{i}\), and Begin communication
11: Finish data transmission
12: Fly to the next cluster
13:endfor
14: Fly to the ground base station
15:end
```  
**Algorithm 2** Compute the dynamic flying parameters and parameters for data transmission.