## 4 Cluster Sleep-Wake Scheduling Algorithm
### Cluster Sleep-Wake Scheduling Algorithm
#### 4.3.4 Description of the Algorithm  
Step 1: Initial node placement. Step 2: Select temporary control node. Each node broadcasts its own information table within the cluster and updates its information table based on the receiving message. Then, we select the partition unit within the cluster to make \(\frac{num}{NUM}\cdot\frac{\sum_{num}E_{residual}}{\sum_{NUM}E_{residual}}\) largest. Finally, the largest node of \(E_{residual}\) is found, making it the temporary control node of the cluster. Step 3: Select working node. According to the node's remaining energy \(E_{residual}\), the temporary control node locates the node with largest \(E_{residual}\) in each partition as the working node. Other sensors enter deep dormancy. Step 4: State conversion. The node is not always in deep dormancy; it presets a dormancy time \(T_{s}\) before dormancy. When it reaches the dormancy time, the sensor node automatically transitions from deep dormancy to a waiting state, awaiting the command from the temporary control node. Step 5: Temporary control node rotation. When \(E\leq\frac{c}{c+1}E_{residual}\), replace the temporary control nodes; then, return to Step 2. Step 6: Repeat the above steps until the node energy in the WSN is zero. The detailed algorithm is shown in Algorithm 1. ```
1:\(\lambda\): \(\lambda\):
```
0:\(ID_{0}\), \(E_{n}\),\(E_{residual}=E_{n}\), \(num=0\), \(NUM=0\), \(t_{max}=\frac{1}{c+1}\cdot\frac{E_{residual}}{E_{par}}\), remaining energy in the network \(E_{total}=0\);
0: Coverage rate \(C_{r}\), energy consumption \(E_{c}\), algorithm working time \(T_{total}\);
1: Calculate partition unit number \(ID_{1}\), to which it belongs from Equation (10);
2: Calculate cluster number \(ID_{2}\) to which it belongs from Equation (12);
3: Calculate node rand \(R_{rank}\) from Equations (13)-(15). Set the sensing radius accordingly;
4:while 1 do
5: Node in a waiting status, broadcasting message table in the cluster;
6:while not traversed all nodes in the cluster yet do
7: Find the same node of \(ID_{1}\), record the number of nodes;
8:\(num\gets num\);
9: Find the same node of \(ID_{2}\), record the number of nodes;
10:\(NUM\gets NUM\);
11:endwhile
12: Select the partition unit with the largest \(\frac{num}{NUM}\cdot\frac{E_{residual}}{\sum_{NUM}E_{residual}}\) within the cluster;
13: Select the node with the largest \(E_{residual}\) in the partition unit as the temporary control node;
14: Temporary control node finds node with largest \(E_{residual}\) in each partition as a working node;
15: Other remaining sensors enter deep dormancy;
16: Calculate coverage rate \(C_{r}\) and dormancy time \(T_{s}\);
17: Output \(C_{r}\);
18:while not traversed all dormancy node yet do
19:if\(t=T_{s}\)then
20: Node changes to waiting state;
21:endif
22:if\(E\leq\frac{c}{c+1}E_{residual}\)then
23: Covert temporary control node to ordinary node;
24: Update \(E_{residual}\gets E_{residual}\), \(t_{max}\gets t_{max}\);
25:endif
26:endwhile
27:while not traversed all nodes yet do
28: Calculate \(E_{total}=E_{total}+E\);
29:endif
30:if\(E_{total}=0\)then
31: break;
32:endif
33: Calculate \(E_{c}\);
34: Output \(E_{c}\), \(T_{total}\);
35:endwhile
36:Output \(T_{total}\). ```

**Algorithm 1** Cluster sleep-wake scheduling algorithm

## 5 Simulation and Analysis

In this paper, the cluster sleep-wake scheduling algorithm is compared with the most common random deployment algorithm and the redundant node sleep algorithm based on sensing contribution. It is proved that the cluster sleep-wake scheduling algorithm can improve network coverage and save energy consumption. In the simulation, we set the size of the target water to 100 m \(\times\) 100 m \(\times\) 100 m. At the same time, because the cluster sleep-wake scheduling algorithm and the redundant node sleep algorithm are used to solve the problem of redundant nodes in the sensor network, it is necessary to increase the node redundancy in the network during the simulation. Therefore, we randomly placed 300 nodes in the target waters.