Skip to main content
. 2019 Jan 29;19(3):561. doi: 10.3390/s19030561
Algorithm 2 Clustering based on minimum separation distance enforcement between CHs.
procedure WSN clustering
    inputs:
    N={n1,n2,,nk} % N: set of live nodes %
    ranged % d: minimum forced distance %
    p % p: Percentage of live nodes to become CHs %
    dcCeiling(p×count(N)) % dc: number of the desired CHs %
    outputs:
    CH={CH1,CH2,,CHdc} % set of CHs %
    C={C1,C2,,Cdc} % set of clusters %
    steps:
    1) For each node niN, if the distance from ni to the closest already selected CH is less than d, then calculate each of the fuzzy input variables: Energy, BS_Distance, Density, Compaction AVG_Energy.
    2) Calculate the fuzzy output variable chance for each niN based on the linguistic variables using the proposed fuzzy inference system
    3) Select ni with the highest chance value among the nodes located away from any pre-selected CH by the distance d
    4) Repeat Steps 1–4 until reaching dc
    5) Form clusters, C={C1,C2,,Cdc}, by joining each niN to the closest CHrCH
end procedure