# A Robust Routing Protocol in Cognitive Unmanned Aerial Vehicular Networks
## 4 Proposed Routing Protocol
### Cluster Formation
#### 4.4.1 Node Move-In
Designing efficient routing protocols for CRAHNs hinges on understanding network objectives. Addressing the aforementioned challenges is vital for creating robust protocols that prioritize stable paths and minimize delays. Our proposed RARE protocol tackles these challenges by selecting suitable nodes as Central Nodes (CNs) and Nearest Nodes (NNs), ensuring maximum route stability. The next section delves into the RARE protocol's delay-aware routing approach tailored for CRAHNs. ### Route Discovery and Selection Process

In this article, the routing protocol is proposed with the route discovery process, where the sending node explores all available routes to the destination node. When a node in our network wants to send packets to another node, it initiates the route discovery by broadcasting a route request message to its immediate neighbors. However, if the sender is a Cluster Member (CM), it directly sends the request to its Central Node (CN), which then broadcasts the request further. During route discovery, only Central Nodes (CNs) and Nearest Nodes (NNs) are actively involved, while intermediate CMs remain inactive. If a CM receives a route request, it ignores it unless it has the intended destination. CNs or NNs, on the other hand, relay the request to their neighbors until it reaches the destination node. When a relay node receives the request, it calculates switching, back-off, and queuing delays to determine the total link delay to communicate with the destination. It then forwards a route reply message containing the path delay and node IDs to the neighbor that previously broadcasted the request. This process continues until the sender node receives the reply. Using Equation (10) can be an equation for path Delay (\(\partial_{r}^{P}\)). \[\partial_{r}^{P}=\Sigma_{i,jP_{th}(s,d)}\partial^{D}P_{i,j} \tag{13}\]

Upon receiving the reply, the sender calculates the link delay and updates the Path array with the path delay and the complete path from the source to the destination. The sender selects the route with the least delay for message transmission. If multiple routes are available, the sender chooses the one with the lowest delay. If only one route is discovered, it is used for message transmission. This process continues until all possible paths from the sender to the destination are identified and stored in the Path array. Algorithm 5 describes a method for selecting the optimal route for data transmission between a source UAV and a destination UAV based on real-time measurements. These measurements include Current Node Resolution Factor (CNRF), Routing Efficiency (RE), and Routing Failure (RF) associated with each available path. By using the most up-to-date values of these metrics, the algorithm ensures efficient and reliable data transmission. ```
START: if\(UAV_{s}==CM\)then \(UAV_{s}\) forwards RREQ to \(CN_{s}\) \(CN_{s}\) broadcasts RREQ \(UAV_{s}\) broadcasts RREQ Path-Delay = 0 whileRREQdo \(UAV_{x}\) receives RREQ if\(UAV_{x}\
eq CM\)then if\(UAV_{d}\in UAV_{n}\)then \(UAV_{x}\) calculates Link-Delay using Equation (13)  Path-Delay = Path-Delay + Link-Delay \(UAV_{x}\) sends RREQ with Link-Delay and Path-Delay while\(UAV_{x}\
eq UAV_{s}\)do \(UAV_{x}\) calculates Link-Delay using Equation (13)  Path-Delay = Path-Delay + Link-Delay \(UAV_{x}\) sends RREQ with Link-Delay and Path-Delay to \(UAV_{n}\) becomes \(UAV_{k}\)  end;; if\(UAV_{x}==UAV_{s}\)then \(UAV_{s}\) calculates Link-Delay using Equation (13)  Path-Delay = Path-Delay + Link-Delay \(UAV_{s}\) stores Path with Path-Delay in Path  end;; else\(UAV_{x}\) broadcasts RREQ \(UAV_{n}\) becomes \(UAV_{k}\) end;; if\(Path\_size>1\)then  Select-route = Route-selection-Algorithm \(UAV_{s}\) sends messages to \(UAV_{d}\) using Selected-route else\(UAV_{s}\) sends messages to \(UAV_{d}\) using Path end;;
```
**Algorithm 5**Route Discovery Algorithm

In the event of a link failure during data transmission, the algorithm initiates a route discovery process to identify alternative pathways.