## 4 Proposed Scheme
### Cluster-Head Rotation
\[d_{ij}=\sqrt{\left(x_{i}-x_{j}\right)^{2}+\left(y_{i}-y_{j}\right)^{2}+\left(z _{i}-z_{j}\right)^{2}}\]  
where '\(d_{ij}\)' represents the Euclidean distance of every \(ith\) node from each \(jth\) node as shown in Figure 5.  
Let '\(\mathbf{D}\)' be the array containing the pairwise distances between each node in the cluster, represented as:  
\[\mathbf{D}_{(i,j)}= \begin{bmatrix}d_{11}&d_{12}&\dots&d_{1n}\\ d_{21}&d_{22}&\dots&d_{1n}\\ \vdots&\vdots&\ddots&\vdots\\ d_{m1}&d_{m2}&\dots&d_{mn}\end{bmatrix} \]  
Figure 4: Variation in residual energy of nodes in a WSN with multi-parameter heterogeneity and role rotation; (**a**) Heterogeneous nodes with fixed roles; (**b**) Heterogeneous nodes with uncoordinated role rotation; (**c**) Heterogeneous nodes with coordinated role rotation. Based on the distance in the array '\(\mathbf{D}\)', the base station (BS) calculates the anticipated energy consumption for the transmission between each node:  
\[e_{ij}=\left\{ \begin{aligned} & T_{i}\cdot E_{ELEC}+T_{i}\cdot\varepsilon_{fs} \big{(}d_{ij}\big{)}^{2},\;d_{ij}<d_{o}\\ & T_{i}\cdot E_{ELEC}+T_{i}\cdot\varepsilon_{mp}\big{(}d_{ij} \big{)}^{4},\;d_{ij}\geq d_{o}\end{aligned} \right\}\]  
where \(d_{o}\) is the threshold distance, calculated as:  
\[d_{o}=\sqrt{\frac{\varepsilon_{fs}}{\varepsilon_{mp}}}\]  
Let '\(\mathbf{E}\)' represents the array containing the anticipated energy consumption for transmission between each node pair. \[E_{(i,j)}= \begin{bmatrix}e_{11}&e_{12}&\dots&e_{1n}\\ e_{21}&e_{22}&\dots&e_{1n}\\ \vdots&\vdots&\ddots&\vdots\\ e_{n1}&e_{n2}&\dots&e_{nn}\end{bmatrix} \]  
Then, the total anticipated energy consumption of the nodes in a cluster while the \(Jth\) node is assumed as CH is computed in the next step. \[E_{T}(j)=\sum_{i=1}^{n}e_{ij}\]  
The average anticipated energy consumption when the \(Jth\) node is CH is given by:  
\[E_{avg}(j)=\frac{\sum_{i=1}^{m}e_{ij}}{n}\]  
Thus, the set of candidate cluster heads can be determined by sorting the total energy consumption values:  
\[\mathfrak{E}=sort(E_{T})=\{\epsilon_{1},\epsilon_{2},\epsilon_{3},\dots, \epsilon_{n}\}\]  
The index of \(\epsilon_{i}\) in the original unsorted set \(E_{T}\) can be found as:  
\[index(\epsilon_{i},E_{T})=\mathcal{J}\]  
where:  
* \(\epsilon_{i}\) is an element in the sorted set \(\mathfrak{E}\);
* \(E_{T}\) is the original unsorted set;
* \(\mathcal{J}\) represents the index of \(\epsilon_{i}\) in the original unsorted set \(E_{T}\). Figure 5: Pairwise—distance calculations between each node. Let \(\mathbb{E}\) be the set of residual energies for each node:  
\[\mathbb{E}=\{v_{1},e_{2},e_{3},\ldots,e_{n}\}\]  
Thus, the index of the node with the minimum residual energy is computed as:  
\[index_{min}(\mathbb{E})=\mathfrak{i}\]  
A node continues to act as the CH until its residual energy drops below the mean of the residual energies. The \(ith\) node is assigned as the CH:  
\[A=\mathpzc{J}(\mathfrak{i}),\text{ for }\mathfrak{i}=1,2,3\ldots n\]  
So, while \(E_{(\mathfrak{i},A)}\leq E_{avg}(A)\) & \(E(A)\geq\alpha\times\max(\mathbb{E})\), the node with index \(\mathfrak{A}\) continues to serve as the cluster head. In this condition '\(\alpha\)' denotes the re-clustering factor and allows for tuning the frequency of re-clustering according to the required stability. Figure 6 presents the flowchart detailing the main steps in the proposed cluster-head rotation method. The smart sensor nodes in the WSN execute the operations outlined in Algorithms 1 and 2 at regular intervals. During typical operation, non-CH nodes conduct sensing operations and transmit their data to the CH node, as depicted in Algorithm 1. Figure 6: Flow chart of proposed cluster-head rotation scheme.