1: if (Eint(m)>0 &rmod(1/p)≠0) then

2: r ¬random(0,1) and compute T(m);

3: if (r < T(m)) then

4: CCH{m}=TRUE; node n be a nominate for CH

5: else

6: CCH{m}=FALSE; node n not be a candidate CH

7: end if

8: end if

9: SendToBS(IDi, (xi,yi), CCH(i)) All nodes send messages to BS;

10: Eres(n) ¬All nodes remaining energy updated;

11: BTN(p) ¬BS broadcasts a message back to all nodes;