# A Secure Communication in IoT Enabled Underwater and Wireless Sensor Network for Smart Cities
## 3 System Model
### Dynamic Topology Discovery Algorithm  
TBRL is a positioned aware routing protocol. To obtain nodes' position; initially, we assume that the X axis of each node is unknown and Y axis is equal to the depth of water. Due to the continuous flow of water, the X axis of each node changes its position frequently when compared to its Y axis. Further, the oceanic environment depth (Y axis) calculation is far easier as compared to the width (X  
Figure 1: Flow Chart of Time Based Reliable Link (TBRL).  
axis) calculation. Multiple sinks that are placed at equal distance and random deployment of nodes are shown in Figure 2. Furthermore, special mobility as per the area of network has been assigned to each sink from its initial point to the last point and that last point is the initial point of the next sink. Sink nodes move from their initial point to another point by calculating their movement towards X axis. Because of the horizontal movement of sink nodes, the Y axis is always zero and it cannot be updated. Therefore, distance always changes in X direction.  
X axis is stored in a Location Packet (LP) and sends the constant value of X axis vertically. In this way, nodes become well aware of their X axis location in the network. Nodes determining location process are also depicted in Figure 3. Sink Node 1 (SN1) has an initial location (0,0), it will send LP downward by taking the X axis 0 and increasing the value of Y axis. If a node receives LP, it will update its X axis location that was unknown to it at the time of deployment. Similarly, SN1 sends LP at different X axis and updates the location of downward node. SN1 can move from 0 to 300 m, which goes back to its initial point after reaching a final point.  
Other approaches to find the horizontal distance are not suited in this environment. At same depth level, the distance would be smaller or larger; therefore, Pythagoras theorem and angle based side calculation mechanism did not perform well in such a harsh environment. Algorithm 1 is proposed instead of GPS. Because of the moment of water, nodes move from 1 to 4 m/s and that movement  
Figure 3: Assigning X axis Location.  
Figure 2: Finding X axis Location.  
\[L=1.74*\pi*h \tag{15}\]  
Putting the value of \(L\) into Equation (4).  
\[H=\frac{\frac{1}{2}*h}{\sqrt[4]{\frac{8*\pi*h}{1.74*\pi*h}}} \tag{16}\]  
\[H=\frac{\frac{1}{2}*h}{\sqrt[4]{4.5}} \tag{17}\]  
\[H=\frac{\frac{1}{2}*h}{1.45} \tag{18}\]  
After simplifying, \(H\) becomes  
\[H=0.34*h \tag{19}\]  
Put the vale of \(H\) and \(C\) into Equation (3), \(\lambda\) is calculated as:  
\[\lambda=\frac{0.34*h*\sqrt{gh}}{2h} \tag{20}\]  
\[\lambda=0.17*\sqrt{gh} \tag{21}\]  
After the deployment of nodes, sink nodes can move from their predefined to next position with the help of Algorithm 1. With the help of sink nodes, each node discovers its approximate X axis location, whereas the Y axis of each node is measured through the depth of water in an underwater environment. Here, \(g\) is the gravitational force, \(p\_time\) is the previous time when topology is changed, \(x\) and \(y\) present the x and y axis of node, \(\lambda\) shows the wave length, _speed_ presents the water speed at current depth level, _time_ determines the time of last modification with respect to the current time, and this helps us to calculate the current location of a node. Because waves move in a circular shape and circle covers \(0^{\circ}\) to \(360^{\circ}\). Each circle's center point is the origin of quadrant and it covers all four quadrants; therefore, speed is divided by 4. This algorithm helps us to find the approximate change of node movement either in forward or backward direction. After calculating waves speed at current depth level and time elapsed, we find a certain node movement while using step \(11\) of Algorithm 1.