# Arithmetic Optimization AOMDV Routing Protocol for FANETs
## 3 AO-AOMDV Routing Protocol
### Fitness Function  
This paper proposes a solution that optimizes routes using an arithmetic optimization algorithm. In the beginning, this paper introduces a new fitness function based on three components as follows. The first component considers the link holding time between nodes. The second component considers the residual energy of the nodes, and the third component considers the congestion degree of the nodes. * Link Holding Time: Assuming that the drone node can obtain its current location and speed information by receiving GPS signals, the communication duration between two nodes can be predicted based on the current location and speed information of the nodes. The model for predicting the keep-alive time is as follows: \[HT_{MN}=\frac{\sqrt{\alpha R^{2}-\beta}}{\alpha}\] (1) where \(R\) represents the communication range of a node. The coordinates of node M are \((x_{1},y_{1},z_{1})\), and its velocities along the axes are \((v_{1x},v_{1y},v_{1z})\). The coordinates of node N are \((x_{2},y_{2},z_{2})\), and its velocities along the axes are \((v_{2x},v_{2y},v_{2z})\). Let \(a=x_{2}-x_{1},b=v_{2x}-v_{1x},c=y_{2}-y_{1},d=v_{2y}-v_{1y},e=z_{2}-z_{1},f=v_ {2z}-v_{1z}\), \(\alpha=b^{2}+d^{2}+f^{2},\beta=(ad-bc)^{2}+(af-be)^{2}+(ed-cf)^{2}\). * Residual Energy: When the MANETs' nodes communicate wirelessly with each other, there are many factors that affect their energy consumption rate. Among these, the most critical factor is the operating mode of the WiFi device. Under different operating modes, the wireless channel between nodes has different physical layer states, which correspond to different antenna reception and transmission powers. Taking the IEEE 802.11 physical layer and MAC layer interaction protocol, which is the most commonly used in networking, as an example, the energy consumption of a node's wireless communication is mainly determined by the six states defined by the 802.11 protocol. Different device states correspond to different working currents. Therefore, the energy consumed by a wireless network card within a certain working time can be expressed as Equation (2). \[E_{0}= \sum_{i=1}^{6}(P_{\text{Status}_{i}}\times T_{\text{Status}_{i}})\] (2) \[= U\times\sum_{i=1}^{6}(I_{\text{Status}_{i}}\times T_{\text{Status }_{i}})\] when \(i=1\sim 6\), \(Status_{i}\) can be one of the following states: IDLE, CCA BUSY (clear channel assessment busy), Tx, Rx, Switching, or Sleep. \(P_{\text{Status}_{i}}\) and \(I_{\text{Status}_{i}}\) represent the power and current consumption corresponding to each Statusi state, respectively. \(U\) is the rated voltage for the wireless network card. \(T_{\text{Status}_{i}}\) is the total time that the wireless network card stays in the \(Status_{i}\) state during the time interval \(T_{0}\). \[T_{0}=\sum_{i=1}^{6}T_{Status_{i}}\] (3) The node calculates its remaining energy at time \(t\) using the following equation: \[E_{current}=E_{initial}-E_{0}\] (4) where \(E_{initial}\) represents the initial energy of the node. * Congestion Degree: Congestion can cause increased network delays, packet loss, and energy consumption. To address this problem, this paper proposes a congestion detection method: using the ratio of the number of packets cached in the MAC layer interface queue to the maximum length of the interface queue as a measure of the current node load. The formula for calculating the current payload congestion degree, denoted as \(C_{payload}\), of node \(j\) on path \(i\) is as follows:  
\[C_{payload}=Q_{c}/Q_{l} \tag{5}\]  
where \(Q_{c}\) represents the number of packets cached in the MAC layer interface queue of node \(j\), and \(Q_{l}\) represents the maximum number of packets that the MAC layer interface queue of node \(j\) can accommodate the length of the interface queue. The length of the interface queue is the maximum packet length set for each node's buffer, and its value is fixed.