## 4 MEMAC Algorithm Design
### Design and Implementation of Clustering Protocol
#### 4.3.2 PCH Selection

Node i determines whether user i is selected as PCH, according to the probability \(P_{a}^{i}\), calculated according to its own multipath information, \(R_{ii}\). The specific process is as follows: First, the node generates a random number, \(RANi\), through a random function, and then it judges whether the relation \(RANi<P_{a}^{i}\) is established. If it is, i selects the PCH strategy; otherwise, the NCH strategy is selected. Finally, all nodes elected as PCH form a set containing preselected cluster heads, \(S_{PCH}=\{PCH_{1},PCH_{2}\ldots PCH_{n}\}\). #### 4.3.3 CH Competition

In the formed \(S_{PCH}\) set, the optimal PCH is selected by estimating the energy consumption and the state of the global network. The specific process is as follows: First, each competing \(PCH_{i}\) broadcasts a short control packet, \(PCO_{i}\), which includes the node ID, the node identification \(PCH_{i}\), the priority of the node selected as CH, and the estimated total energy consumption of the network at this time. Here, when node i competes for the CH status, the total energy consumption of the entire cluster network can be estimated as follows:

\[\zeta_{i}=\mu\left(\mathbf{1}-\frac{C_{i}^{PCH}+\sum_{j=1,j\
eq i}^{N-1}C_{j} ^{on}}{NE}\right) \tag{29}\]

where N is the total number of nodes in the network, E is the initial energy of nodes, \(\mu\) is the weight coefficient, \(\zeta_{i}\) is the weight of the estimated residual energy consumption of the network, and the maximum distance in the whole cluster can be expressed as follows:

\[d_{\max}=\left(L^{2}+W^{2}+(1+g)^{2}R^{2}\right)^{\frac{1}{2}} \tag{30}\]

Then, when node i claims to be node CH, the time required to wait for confirmation from other nodes after broadcasting \(PCO_{i}\) packets can be calculated as follows:

\[T_{i}=\eta\frac{d_{max}}{v}(1-\zeta_{i}) \tag{31}\]

where v = 1500 m/s is the propagation speed of the underwater acoustic signal, and \(\eta\) is the time adjustment coefficient. It can be seen that, when the total residual energy weight, \(\zeta_{i}\), in the network is larger, the time required for node i to wait for all other member nodes to confirm that it is a CH node is shorter so as to ensure that the node with the most residual energy can compete and be elected as a CH node at the fastest speed. #### 4.3.4 CH Rotation

When the probability calculated via the formula is zero, CH rotation is required for this node. In this case, the conditions for CH rotation are set as follows:

\[\delta_{1}\left(\frac{E_{i}^{\mathrm{res}}}{E_{j}^{\max}}\right)+\delta_{2} \left(\frac{W_{i}}{W_{j}}\right)>1 \tag{32}\]

where \(\theta_{1}\) and \(\theta_{2}\) are the adjustment coefficients. When the above formula is established, it means that the sum of the specific gravity of another node, j, in the residual energy and flow begins to be greater than that of the current CH node, i; that is, node j is more suitable as the cluster head node. ## 5 Simulation and Performance Analysis

In this chapter, the simulation of the MEMAC algorithm proposed in this paper is carried out using the ns-3 simulator. The network scenario depicted in Figure 2 is used as an example of an area covered by a central node. where the nodes are systematically grouped into multiple clusters, with nodes of identical color signifying their affiliation to the same cluster. In this network area, Sink node is the central node, apart from the central node, the total number of nodes is set to 30. All nodes are randomly and uniformly distributed within a 6000 \(\times\) 6000 \(\times\) 6000 m three-dimensional space. The position coordinates of the central node at the seabed are (3000, 3000, 3000). Each node is equipped with its own node ID and location information, and a weight coefficient for node traffic ranging from 0 to 1 is included. The initial energy, \(E_{1}\), of the node is set to 100 nj/bit. The gradient control coefficient for the inter-cluster distance is set to g(0.5,1).