# An Efficient Scalable Scheduling MAC Protocol for Underwater Sensor Networks +
## 5 Efficient Depth-Based MAC Protocol
### Scheduling Phase  
Using the information stored in the neighbouring table, \(N_{t}\), during the first phase, every node in the network needs to reserve a unique slot for itself to use during the third phase for data transmission. It needs to know which slots are reserved by its one-hop neighbouring nodes to adjust its wakeup time as well. Hence, the goal of the second phase is to schedule the wakeup and sleep times at each node. A depth based timer is used to prioritise nodes when reserving a slot. This allows a node located in a deeper area to reserve a slot sooner than its above neighbouring nodes. The value of this timer at each node is given by  
\[T_{sch}=\left(\frac{2M_{Depth}}{M_{Depth}+N_{Depth}}\times T_{Delay}\right)-T_{ Delay}, \tag{2}\]  
where \(M_{Depth}\) is the depth of the network area and \(N_{Depth}\) is a node depth in the network. \(T_{Delay}\) is the length of the scheduling phase that is a predefined fixed value, set at the deployment time based on the application requirements. The value of \(T_{Delay}\) depends also on the density of the nodes in an underwater area. It should be long enough to avoid collisions between neighbouring nodes, which are vertically very close to each other, during the scheduling phase. It is set to a small value for sparse and shallow scenarios and set to large values for deep and dense networks. Either way, the length of this phase is smaller than that of the third phase by a few order of magnitude. In order to synchronise all sensor nodes to begin and end at the same time, the length of the scheduling phase should be fixed. As an example shown in Figure 2, the depth of nodes A, B, and C are assumed to be 500 m, 450 m, and 420 m, respectively. The network depth is 500 m and \(T_{Delay}\) is set as 30 s. Using Equation (2), the scheduling time of node A, B, and C can be calculated as 0, 1.579, and 2.609 s, respectively. It shows that Equation (2) can prioritise sensor nodes based on their depth and the difference between their transmission times is long enough to avoid any overlapping. A node before broadcasting its schedule packet, \(S_{p}\), extracts the neighbouring nodes with lower depth than itself from \(N_{t}\) and place them in depth priority list, _DPL_, in order of their depths. Thereafter, each node broadcasts its \(S_{p}\) to its neighbouring nodes using depth-based timer. The \(S_{p}\) includes the reserved sender slot and its _DPL_. Upon receiving a \(S_{p}\), every node compares its \(N_{t}\) with the received _DPL_ to detect the hidden nodes, and also updates the reserved slots list based on the received \(S_{p}.slot\). This procedure is continuously executed by nodes in order of their depths and all nodes gradually reserve their own transmission slots while also informing their neighbouring nodes about that. Algorithm 1 shows how a node reserves a slot and provide other neighbouring nodes with some information including its reserved slot and a list of some of its neighbouring nodes. By the end of the scheduling phase, all sensor nodes are guaranteed to be scheduled. The scheduling phase is started by the nodes at the bottom of the water and ended by the nodes on the water surface. If the nodes on the surface are scheduled within \(T_{Delay}\), it means that all other nodes located below are already scheduled. For example, if a sensor node is placed at the water surface with the depth 0, based on Equation (2), the node is scheduled at \(T_{Delay}\), which is still within the duration of the scheduling phase. ```
1:procedureSchedule Packet
2:if depth-based timer is expired then
3:\(S_{p}\) : a new schedule packet
4:\(S_{p}.slot\leftarrow\) Slot-Selection \((N_{t}\), Reserved-slots)
5: update \(T_{wake-up}\) based on \(S_{p}.slot\)
6:\(S_{p}.\textit{DPL}\leftarrow\{one-hop\ neighbours\ with\ lower\ depth\ ordered\ by\ their\ depth\}\)
7:\(S_{p}.ID\gets N.ID\)
8: Broadcast\(S_{p}\)
9:endif
10:endprocedure
11:procedureReceiveSchedulePacket \((S_{p})\)
12:if\(S_{p}\) received then
13: update \(N\).