# Clustering for Lifetime Enhancement in Wireless Sensor Networks
## 3 Advanced Clustering Approach
### Clustering Efficiency: Analysis Study
However, in the basic manner, we have a number of nodes distributed randomly in the area sending their collected packets individually. Therefore, firstly, we obtain a cluster where all nodes are completely connected, then we simulate them in the two different manners. In this case, the max distance between any two nodes should be equal to or less than 20. Therefore, a node could not be a distance of more than 10 m from the center of a circle that surrounds the cluster's nodes, as shown in Figure 2.  
Figure 1: Standard topology for WSNs. Also, the second parameter is the distance between the CH and the BS, which varies from one node to another, which gives a variation of each node to be CH. Therefore, the nodes take turns as the CH for each round of simulation. In this part, we have two cases: each round, a new node takes its chance randomly but cannot take another chance until all nodes perform their role as CH because they all have the same number of members/neighbors. Then, the second case considers the variation in the distance to the BS because nodes differ in their sending distance, which makes them consume different amounts of energy. This causes distant nodes to use up their batteries before closer ones. In the first case, we have 10 nodes, each of which takes one often turns. The CH's role and the rest of the nine roles are managed by the CM. Equation (8) represents the energy consumed by a node for each ten rounds (i.e., one turn as CH and nine of them as CMs). However, Equation (9) gives the formula of the cluster nodes sending their packets individually. \[E\left(d_{2 BS},\;d_{2 CH},\;10\;rounds\right)=\;E_{CH}(d_{2 BS})\;+\;\sum_{i=1}^{i =9}E_{CM}(d_{2 CHi}) \tag{8}\]  
where:  
\(E\) represents the energy consumed by a node in ten rounds, one as CH and nine as CMs. \(E_{CH}\) defines the consumed energy of a node as CH. \(d_{2 BS}\) is the distance between the CH node and the BS. \(d_{2 CH}\) is the distance between the CM node and the current round's ith CH. \[E_{n}(d_{2 BS},\;10\;rounds)=\;10.E_{Tx}(d_{2 BS}) \tag{9}\]  
where:  
\(E_{n}\) represents the energy consumed by a node in ten rounds, sending its data individually to the BS. Figure 3 represents the consumed energy using either clustering or nodes sending their data individually. It is obvious that if nodes send their collected data individually, it is significantly better than collaborating in a cluster, at least for the range of 1 to 141 m  
Figure 2: Cluster architecture where all nodes are in the range. distance to the BS. This leads us to the next question: What is the efficiency of using clustering to minimize consumed energy and, in other words, to prolong the WSN lifetime? Could it be that when each node sends its data individually, there is a significant difference in the times when the first, middle, and last nodes die? Additionally, the clustering approach may result in the highest FDN value compared to individual data transmission, which could be beneficial for our WSN. This is especially important considering that the WSN lifetime is typically defined by the death of the first node. To calculate the lifetime of a node within a cluster, we must first determine the number of neighboring nodes and the average distance between a node and its neighbors. Based on the LEACH protocol, the optimal cluster density is ten nodes--one CH and nine CMs. The average distance, considering the energy consumed by nodes to send a packet within a range of 1 to 20 m, is approximately 14 m. Figure 3 shows the cluster's lifetime for nodes with an initial energy of 0.5 joules using two different approaches. The distance to the BS remains within the range of 1 to 141 m.  
According to Figure 4, we can conclude that clustering alone is not the most efficient method throughout the entire operation to minimize energy consumption and extend the lifetime of a WSN.