# Cognitive Routing in Software-Defined Underwater Acoustic Networks
## 3 Proposed Cognitive Acoustic Software-Defined Underwater Network
The source then selects the relay node that has the minimum transmission delay from among all the neighboring nodes. As in our previous work [22], the transmission delay (s) is calculated as follows: \[TD_{ij}^{ch}=\Bigg{(}\frac{L_{s}}{r_{ij}^{ch}}+GD_{ij}\Bigg{)}\hat{N}_{ij}^{ Hop}\] (1) where \(i\) is the source node, \(j\) is any node among the \(N\) sensor nodes within transmission range of \(i\), and \(ch\) shows a common idle channel from among \(M\) channels; \(L_{s}\) is the packet size (bits); \(r_{ij}^{ch}\) is the data rate (bits/s) of link \((i,j)\), defined as \(r_{ij}^{ch}=C_{ij}^{ch}=\int_{f_{ji}^{ch}}^{f_{ch}^{ch}}\log_{2}(1+\frac{S(f)}{ N(f)})df\), where \(C_{ij}^{ch}\) is the capacity of the common idle channel between the two communicating nodes as assumed elsewhere [26], \(f_{h}\) and \(f_{l}\) are upper and lower frequencies of each channel, respectively, and \(S(f)\) in dB re \(\mu\) Pa is the power spectral density of the transmitted signal. If there is more than one common channel between two communicating nodes, then the querying node selects the one with highest data rate. \(GD_{ij}\) is the propagation delay (s), defined as \(GD_{ij}=\frac{D_{ij}}{q(z,s,T)}\); \(D_{ij}=\sqrt{(x_{i}-x_{j})^{2}+(y_{i}-y_{j})^{2}}\) (m) where \((x,y)\) represents a 2D network; \(\hat{N}_{ij}^{Hop}=max\Bigg{(}\frac{D_{i,MC}}{<D_{ij}>_{i,MC}},1\Bigg{)}\), in which \(<D_{ij}>_{i,MC}\) is the projection of distance \(D_{ij}\) on the line connecting the source to the MC. One might think the MC is not the target of the source if an LC finds a route to the destination in its flow table. The reason for calculating this projection with respect to the MC is to minimize the transmission delay in reaching a controller in order to improve overall network performance. This will also reduce the number of hops by selecting the nodes farthest from the source/querying node. Another reason is the calculation of depth; it is more reasonable to identify surface depth than to estimate the depth of a moving AUV. Among all the neighboring sensor nodes within transmission range of the source node, the source selects the one that has the minimum \(TD\) to reach any gateway. Therefore, the best relay node is calculated as: \[min(TD_{1},TD_{2},...,TD_{N})\] (2) where \(N\) is the total number of neighboring nodes within transmission range of the source node. In so doing, the source node selects the relay node hop-by-hop, and finally reaches the gateway. As this is a cognitive routing scheme, several gateways help the network to make stable links,thereby reducing the delay. Two nodes can only communicate if they have consensus about a common idle channel. Therefore, the gateway set increases the chances that there is a single gateway available to make a stable link. The gateway stores the information until it establishes a link with the AUV. If a relay node finds itself within transmission range of the AUV, it will send the packet directly to the AUV. Once a link is established with an LC, the LC checks its flow table for a route to the destination. If the LC does not find a route to the destination, it sends the request packet to the MC to find the best stable route to the destination. Case 2: _Source within transmission range_  
When a source is within transmission range of an LC, it directly sends a request packet to the LC; otherwise, it finds a gateway from set \(G\). The LC checks in its flow table for a route to the destination, and sends a reply message if it has the best route to the destination. If it does not find a match, it forwards the request packet to the MC. Once the message reaches the controller, the LC/MC estimates the best stable route to the destination in the following manner.