# A Novel Adaptive Cluster Based Routing Protocol for Energy-Harvesting Wireless Sensor Networks
## 2 Adaptive Hierarchical-Clustering-Based Routing Protocol for EH-WSNs  
### Environment-Adaptive Hierarchical Clustering  
The hierarchical clustering (HC) algorithm is a fast-clustering algorithm proposed by [PERSON] et al. [34], which can independently accomplish agglomerative clustering according to node deployment. The clustering phase does not need the cluster head or the number of clusters to be appointed by human beings. In order to optimize the data transmission mode inside each cluster, the agglomerative HC algorithm is adopted and accomplishes a reasonable clustering after the deployment of the WSN nodes. Therefore, in the monitoring phase of WSNs, the data are received from the nodes to CHs and merged into the data packages. These data packages are sent to the base station by CHs, which indicates that the energy consumption of the CHs is greater than the other nodes inside the cluster. Utilization of the clustering algorithm can accomplish the optimization of data routing and guarantee high energy efficiency. However, the clustering process of the HC algorithm needs to be terminated according to human experience, otherwise all nodes merge into one cluster. The clustering results would determine the data routing of the distributed node cluster, thus influencing the energy consumption of WSNs. To reduce the participation of the human experience, an environment-adaptive hierarchical clustering algorithm is proposed in this paper. The clustering process is terminated according to the adaptive deployment of the nodes and accomplishes the spontaneous clustering of the WSN nodes. Assume that \(M\) nodes are optimally deployed in the positioning area, and the coordinates of nodes are fixed and known a priori. According to the theory of the aggregation hierarchical clustering algorithm, these \(M\) nodes would be regarded as the initial clusters:  
\[C_{i}=\{\mathbf{X}_{i}\},i\in\mathrm{M} \tag{1}\]  
where \(C_{i}\) represents the \(i\)th formed cluster. The largest Euclidean distance between any two clusters would be calculated and adopted as the clustering cost for each clustering iteration. Then, the two clusters with the closest distance would merge into a new cluster until the required number of clusters or the termination condition is reached. Assuming that, after several clustering process, the cluster \(C_{\mathrm{M+}a}\) contains \(\{\mathbf{X}_{i},\mathbf{X}_{j}\}\), and the cluster \(C_{M+b}\) contains \(\{\mathbf{X}_{k},\mathbf{X}_{l}\}\). Among all of the contained nodes, the \(\mathbf{X}_{i}\) and \(\mathbf{X}_{k}\) are the nodes that are farther apart. According to the definition of the largest distance between clusters in the HC algorithm, the largest distance \(D(C_{\mathrm{M+}a},C_{\mathrm{M+}b})\) between these two clusters can be depicted as (3). \[\mathrm{D}(C_{\mathrm{M+}a},C_{\mathrm{M+}b})=\mathrm{D}(\mathbf{X}_{i}, \mathbf{X}_{k}) \tag{2}\]  
where \(M+a\) and \(M+b\) represent the label of the clusters. In this paper, the largest distance between the deployed nodes \(D_{max}\) is selected and adjusted to serve as the clustering termination threshold \(T\). \[ \begin{split}\mathrm{T}=\sigma D_{max}\\ =&\sigma\mathrm{max}\bigg{\{}\sqrt{\left(\mathbf{X}_{ i}-\mathbf{X}_{j}\right)^{2}+\left(\mathbf{Y}_{i}-\mathbf{Y}_{j}\right)^{2}} \bigg{\}},i,j\in\mathrm{M},i\
eq j\end{split}  \tag{3}\]  
where \(\mathbf{X}_{i}=\left(\mathbf{X}_{i},\mathbf{Y}_{i}\right)\), \(\mathbf{X}_{j}=\left(\mathbf{X}_{j},\mathbf{Y}_{j}\right)\) denotes the coordinates of the \(i\)th and \(j\)th nodes, and \(\sigma\) represents the practical factor, which is defined as the ratio of distance between nodes within the confidence distance. A detailed description of \(\sigma\) is given here. Firstly, the confidence distance for reliable data transmission can be obtained in advance as \(D_{c}\) through the data transmission simulations in the practical target area.