# Dynamic Layered Dual-Cluster Heads Routing Algorithm Based on Krill Herd Optimization in UWSNs
## 4 Simulation  
In the experiment, the UWSN's node deployment process is simulated using MATLAB (Natick, MA, USA) based on the background of Xixi Wetland water environment monitoring. During the simulation, the target water area (length \(\times\) width \(\times\) depth) is set to (150 \(\times\) 150 \(\times\) 150) m\({}^{3}\). At the initial time, 200 nodes are randomly distributed in the monitored water area, and the position of the sink node is (75, 75, 75). In the MATLAB simulation environment, the performance of the DC-KH algorithm is verified. Table 1 shows the parameters used in the simulation experiment. Figure 2 shows the DC-PSO and DC-KH algorithms with the number of rounds for increasing the cluster head node energy consumption changes. The graph particularly shows that, in each round of operation, the DC-KH algorithm cluster head consumption is always less than the DC-PSO \begin{table}
\begin{tabular}{c c} \hline
**Parameter** & **Value** \\ \hline Initial energy (\(l\)) & 0.5 \\ Data packet & 4000 \\ Control packet & 100 \\ Iteration & 5 TDMA \\ Moving speed \(\delta\) (m/s) & 1 \\ Energy diffusion factor \(k\) & 1.5 \\ Communication radius \(\mathrm{R_{t}}\) & 30 \\ \(\alpha\) & 0.3 \\ \(\beta\) & 0.5 \\ \(f\) (kHz) & 10 \\ \(\tau\) & 0.4 \\ \(\epsilon\) & 0.6 \\ \(D^{max}\) (m/s) & 0.005 \\ \(t\) (s) & 8 \\ \(l_{max}\) & 10 \\ \hline \end{tabular}
\end{table} 
Table 1: Simulation parameters. algorithm. The reason is the fact that the DC-KH algorithm uses non-uniform clustering and the dynamic hierarchical mechanism based on the krill swarm optimization algorithm to select the master cluster heads and vice cluster heads. It avoids the repeated selection of nodes as the cluster head, and it improves the early energy utilization rate. Compared with the DC-PSO algorithm, the reasonable selection of the vice-cluster head decreases the partial burden of the master cluster head. In addition, a suitable multi hops routing path is selected by considering the communication overhead and energy consumption of the sub-cluster head. This process can help reduce the energy consumption of the cluster head effectively. In sum, the DC-KH algorithm cluster head energy consumption is lower than DC-PSO. Figures 3 and 4, respectively illustrate the DC-PSO and DC-KH algorithms in the master cluster head and vice-cluster head energy consumption changes with the increase in the number of rounds. The graphs particularly show that regardless of the number of changes, the energy consumption of the master cluster heads and vice-cluster heads of the DC-KH algorithm is less than that of the DC-PSO algorithm. Krill swarm optimization method is adopted in the DC-KH algorithm to select the suitable master cluster heads and vice-cluster heads. The master cluster head collects the data. The vice cluster head reduces the energy burden of the master cluster head. Then, it transmits information to the sink node through a single hop or multi hops. The krill swarm optimization method using the Lagrange model can make the node orient to a high likelihood region. It is conducive to the choice of the master cluster heads and vice-cluster heads. Additionally, it reduces the energy consumption of master cluster heads and vice-cluster heads. Figure 3: Energy consumption comparison chart of the main-cluster head. Figure 2: Energy consumption comparison chart of cluster head. Figure 5 shows the number of nodes for increasing the number of changes in the network in the DC-PSO and DC-KH algorithms. In this paper, the life cycle is defined as the time from the network operation to the node failure \"death.\" As shown in the figure, the life cycle of the DC-KH algorithm is longer than that of the DC-PSO algorithm. The reason is that the node in a different network running round number is selected as the optimal candidate cluster head repeatedly in DC-PSO. It leads to the rapid energy consumption of cluster head nodes, so nodes are susceptible to premature death. To compensate for this shortcoming, the DC-KH algorithm uses a dynamic hierarchical mechanism.