## 4 the Proposed Secure Multicast Routing Protocol: DLSMR
### The Proposed Clustering Protocol: Top-down Particle Swarm Optimization (TD-PSO)
#### 4.2.2 The Proposed Clustering Protocol: TD-PSO  
The proposed TD-PSO protocol considers node position, node speed, node direction, and remaining energy to form the clusters and elect the cluster head. Figure 3 illustrates the flowchart of the proposed TD-PSO clustering protocol. Figure 1: The basic concepts of the proposed DLSMR protocol. Figure 2: The basic concepts of the TD-PSO-based clustering protocol. The procedure of forming a cluster and electing the cluster head can be explained as follows:  
* **Step 0: Initialization** The nodes turn on and operate independently when the simulation starts. Then, go to **step 1**. * **Step 1: Dissemination of Node Information** Each flying node \(f_{k}\) periodically estimates its information such as speed, position, direction, and remaining energy. Then, \(f_{k}\) generates and broadcasts information (INFO) packets to its neighbor UAV nodes. The INFO packet contains the following fields: \[\langle\texttt{Type},\texttt{S}_{\texttt{ID}},\texttt{D}_{\texttt{ID}}, \texttt{E},\texttt{U}_{\texttt{type}}\rangle\]  
Figure 3: The flowchart of the proposed TD-PSO-based clustering protocol. where Type represents packet type, \(S_{\text{ID}}\) represents source node ID, \(D_{\text{ID}}\) represents destination node ID, E represents the remaining energy of each node, and \(U_{\text{type}}\) represents the type of node (0 is G, 1 is F). Then, go to **step 2**. * If ground node \(g_{l}\) receives an INFO packet, then it drops the packet; go to **step 4**. Otherwise, go to **step 4**. * **Step 2: Election of Cluster Head** In order to support strong connectivity, the cluster head is selected by the most remaining energy among the candidate flying nodes, which mathematically can be expressed as \[f_{k}^{*}=\arg\max_{f_{k}\in\mathbf{NB}_{k}^{*}\cup\{f_{k}\}}\{\mathbb{E}_{k}\}.\] (3)
* If \(f_{k}=f_{k}^{*}\), the node \(f_{k}\) becomes the cluster head; go to **step 3**. * Otherwise, wait to receive the CHI packet and go to **step 4**. * **Step 3: Dissemination of Cluster Head Information** The node \(f_{k}\) becomes the cluster head, then generates and broadcasts the CHI packet to be announced to its neighbor nodes. The CHI packet contains the following fields: \[\langle\texttt{Type},S_{\text{ID}},D_{\text{ID}},\texttt{Pos},\texttt{Dir}, \texttt{S},\texttt{E},\texttt{U}_{\text{type}}\rangle\] where Type represents packet type, \(S_{\text{ID}}\) represents the source node ID, \(D_{\text{ID}}\) represents the destination node ID, Pos represents the node's position, Dir represents the direction of the node, S represents the speed of the node, E represents the remaining energy of the node, and \(U_{\text{type}}\) represents the type of the node (0 is G, 1 is F). * If \(f_{k^{\prime}}\in\mathcal{F}\backslash\{f_{k}\}\) receive two or more CHI packets, then go to **step 5**. * Otherwise, go to **step 4**. * **Step 4: Decision of Member Node** When ground node \(g_{l}\) receives two or more CHI packets, \(g_{l}\) will decide which cluster head follows by calculating the cost function of the cluster head candidate. The ground node will select the cluster head candidate with the largest cost value.