# Clustering for Lifetime Enhancement in Wireless Sensor Networks
## 3 Advanced Clustering Approach
### Clustering Efficiency: Analysis Study
Clustering is effective for nodes located at distances greater than approximately 75 m, as indicated in the graphs in Figure 3. Additionally, the distance between nodes has a relatively minor impact on the WSN's lifetime. The three graphs show variations in performance only during the first 50 rounds, which is minimal compared to the significant impact of the distance to the BS. Up to this point, we have not tested the impact of cluster density. In other words, when using clustering, the optimal cluster density is not always achieved. It is possible to work with clusters that have either lower or higher densities. Our reference remains the optimal cluster density proposed by the authors of the LEACH protocol, which serves as the foundation for over 22,100 research papers in the field. Figure 3: Consumed energy using clustering vs. individual sending to the BS. To understand the effect of the number of neighbors on a node's lifetime, we first calculate the energy required to serve a neighbor. This includes the energy needed to receive a packet and aggregate it, either with the packet from the CH or with packets from all the nodes in the cluster. Equation (10) represents the energy required when a new node joins the cluster. \[E_{j}=E_{Rx}+E_{DA} \tag{10}\]  
where:  
\(E_{j}\) represents the energy consumed by a CH for each neighbor that joins its cluster. To assess the impact of the number of neighbors on the lifetime of a CH, we first consider that the role of the CH varies based on the CH selection process. In this study, we assume that the CH role is distributed equally among nodes, meaning each node has an equal chance of becoming a CH depending on the cluster's density. For example, if a cluster consists of 10 nodes, each node should ideally serve as a CH once and as a CM nine times. Consequently, the energy consumed by a node within a cluster is represented by Equation (11):  
\[E_{CH}(d_{2 BS},N_{n})=\frac{1}{(N_{n}+1)}E_{Tx}(d_{2 BS})+(N_{n}).E_{Rx}+(N_{n}+ 1).E_{DA} \tag{11}\]  
where:  
\(E_{CH}\) is the energy consumed by a node as a CH. \(N_{n}\) is the number of neighbors. Equation (12) illustrates the percentage impact of a CH serving a single neighboring node. Figure 2.0  
where:  
\(P\) represents the percentage of energy consumed by a CH when serving a new neighboring node. Figure 2.1 Comparison of node lifetime using a clustered approach versus individual sending. Figure 5 illustrates the proportion of energy consumed for receiving and aggregating packets from one, two, and three neighbors relative to the total energy consumed by a CH at varying distances from its BS, ranging from 1 to 141 m (depicted by the blue graph). The red graph represents the proportion of energy consumed for transmitting packets relative to the total energy consumed by the CH over the same distance range. The selected number of neighbors for this comparison--1, 2, and 3--was intentional for the purpose of the analysis. From Figure 5, we can conclude that the energy required to receive and aggregate a packet remains high until the distance is approximately 83 m when the cluster consists of only two nodes. For a cluster density of three nodes, this high energy consumption persists until a distance of 123 m. When the cluster density increases to four nodes, the high-energy portion extends beyond the diameter of the area (141 m), reaching approximately 149 m. This is why we chose cluster sizes of 1, 2, and 3 nodes--because once the node serves three neighbors, the energy consumption remains higher until the distance exceeds the diameter of the area. What happens if the cluster density exceeds three nodes? This implies that using a clustering approach in a standard area of 100 m by 100 m with a base station (BS) located in the center is not advisable. The maximum distance to the BS is 70.71 m, which is less than 83 m. In other words, even when using clusters composed of just two nodes, a distance larger than 83 m is needed.