# An Energy-Aware Method for Selecting Cluster Heads in Wireless Sensor Networks
## 4 Simulations and Results  
In this part, in order to evaluate the performance of the proposed method, our method is compared with the BCDCP cluster-based protocol. It is worth mentioning that all of the experiments were performed 50 times on an Intel Core i7 CPU with 16.00 GB RAM running on Windows 10 implemented in MATLAB 2020a. In the following, first of all, we state the input parameters that are essential for the simulation. In our experiment, we considered 100 nodes in WSNs, where each node is assigned an initial energy of 0-2 joules and randomly distributed in a \(100\times 100\) square domain. In addition, the capacity of the buffer for each node is five packets, while the length of each packet is 512 bits, and the sending rate is 9.6 Kb/s. Furthermore, The location of the base station is \((200,100)\). Moreover, the mobility of the nodes is one of these modes, including 0 m/s, 1 m/s, or 3 m/s, and the direction of the nodes are considered random. In the AHP algorithm, according to the equations in Section 3.3, we have:  
\[A= \begin{bmatrix}1&\dfrac{1}{2}&\dfrac{3}{2}&3\\ 2&1&3&4\\ \dfrac{2}{3}&\dfrac{1}{3}&1&2\\ \dfrac{1}{3}&\dfrac{1}{4}&\dfrac{1}{2}&1\end{bmatrix} \]  
Figure 4: An overview of the Cluster Splitting Process (CSP) algorithm. The eigenvector is as below:  
\[W^{T}=\{0.291,0.486,0.121,0.101\} \tag{19}\]  
Each local load of the factors determines the distance to the centre, residual energy, nodes' mobility, and data queue length. It is clear that residual energy has the most priority, and data queue length has the least priority. We can calculate the eigenvalue and consistency ratio based on Equations (5) and (6). Therefore, the eigenvalue and consistency ratio are \(\lambda_{max}=4.1575\) and \(CR=0.0058<0.1\), respectively. Thus, matrix A is coherent. Similarly, four \(100\times 100\) matrices are created to compare pairwise all network nodes based on the four factors that we mentioned previously, and the eigenvector (\(4\times 100\) matrix) based on Equation (20) presents the load of each node for each factor. As a result, the total load based on Equations (8) and (9) is created, and all nodes are prioritized based on the degree of importance and whether each node can be a cluster head or not. \[W^{T}_{Total}=W\times W_{n_{i}}=[S_{1},S_{2},S_{3},S_{4},\ldots,S_{100}] \tag{20}\]  
where \(S_{i}\) is the priority of sensor \(i\) to be the cluster head. Therefore, if \(S_{i}\) has a greater value, the priority of sensor \(i\) is higher than the other sensors. Based on Equation (18), the optimal number of cluster heads is five (\(k=5\)), and we also consider this number for the first round of experiment. Thus, the base station selects the five nodes with the highest priority based on Equation (20), and the CSP algorithm is performed by utilizing these five nodes. Since we distribute the nodes randomly in the environment, the location of the nodes is different. Therefore, we execute the algorithm 50 times. In the first experiment, we compare the proposed method (AHP-CSP) and BCDCP by the number of alive nodes that remain in the network at 1600 rpm. Figure 5 illustrates the number of alive nodes, and as we can see, in 1010 rounds, all nodes in our proposed method are alive. However, the first node in BCDCP loses in 954 rounds. If we consider the network lifetime as the number of alive nodes, therefore, the network lifetime in our proposed method is more effective than BCDCP. In the second experiment, the total number of received messages by the base station was examined in 1600 rounds. As shown in Figure 6, the maximum number of messages in our proposed method is received by the base station in the 1000 th round (12,510 messages). Moreover, when the number of active nodes reduces, the received data also decrease. This process can be observed for the BCDCP method, but the maximum number of received messages by the base station occurs in the 954 th round (12,100 messages).