Input: |
1. N= number of CRBAN nodes |
2. kopt= number of desired clusters |
3. Ethreshold = Threshold Energy |
4. dthreshold = Threshold distance = √(dfs/dmp) |
Output: |
1. Optimum number of initial centroids |
2. Set of k optimum clusters |
Steps: |
1. Compute the distance from the center to each node. |
2. Arrange the nodes according to the distance computed in step 1. |
3. Partition the sorted nodes into kopt sets. |
4. In each set the middle point is the initial centroid. |
5. This node at the centroid is the initial CH. |
6. Repeat |
7. Based on Euclidean distance the remaining nodes join their nearest CH. |
8. Centroid Formula to Calculate the Centroid of Each Cluster |
|
9. Allocate an ID number to each cluster node, with a smaller ID number to nodes closer to the cluster's initial CH. |
10. For all selected CHs, |
Check if (Eresidual ≥ Ethreshold) |
Then the node remains as CH; otherwise the next lower ID node is selected as a new CH. |
End if |
End for |
11. The network broadcasts information about newly elected CHs |
12. Until the CHs are no longer changed. |
13. Coordinators send data packets to their CHs. |
14. Calculate the distance between each CH and BS (dBS), |
If dBS<dthreshold then CH communicates directly with the BS. |
Otherwise CH selects the nearest neighbor CH which satisfies the condition dBS<dthreshold to communicate to the BS |
End if |