The remaining nodes, after hearing clusterhead advertisements, determine their closest clusterhead on the basis of received signal strengths of multiple clusterheads. Once all the clusters are set, clusterheads collect, aggregate, and forward data to the sink. The clusters are formed based on the following steps. Nodes broadcast their association requests to the clusterhead, which has the shortest distance to them. In these broadcasts, the nodes also send their residual energy levels and their locations to the respective clusterheads.
Step1: Node i receives ch_adv from ch1 and ch2
Step2: Computes distance d(i-ch1) and d(i-ch2) based on signal strength using
sqrt(sqrt(Pt * Gt * Gr * (hr * hr * ht * ht) / Pr));
If ( d(i-ch1) < d(i-ch2))
Send join_req to ch1
Send join_req to ch2