Research Article

Development and Performance Evaluation of a New Energy-Efficient Double Cluster-Head Routing (EEDCR) Protocol for Wireless Sensor Networks

Algorithm 4

Cluster formation.
Input: CN_ADV, CNH_ADV, SN_ID, RSSI (SN_ID)
Output: Formation of cluster
Var: RSSI (SN_ID), CNselecteda, CNHselectedCN, CNMbr, CNHMbr
Begin
   RSSI(SN_ID) =;
   CNselecteda = CNHselected=;
   CNMbr=CNHMbr=
//Node ‘a’ receives CN_ADV message from node b: where aCN and b
CN_ADV:< CN_ADV, SN_IDb>;
RSSI(a) RSSI(a)
//Node ‘a' selects the node only with maximum RSS as in its CN after//obtaining all CN_ADV.
CNselecteda
Send info (CN_JOIN, SN_IDa, SN_IDcn);
//Send a request to enter to the CN.
//Node ‘q’ sends the following information to node ‘p’:
// ‘p’ is the CN of one cluster and ‘q’ is the CN of another cluster
CNH_ADV:< CNH_ADV, SN_IDq>;
RSSI(p) RSSI(p)
//Node ‘p' selects the node with the maximum RSS as in its CNH after//obtaining all CNH_ADV.
CNHSelectedp
Send info (CNH_JOIN, SN_IDp, SN_IDcnh);
//Join request will be send to the CNH
//The below mentioned packet is received by node a from node b: in which// aCN and b
CN_JOIN: <CN_JOIN, idb, SN_IDcn>
If (SN_IDa == SN_IDcn) then
CNMbr(a) CNMbr(a)
Node p transfers the CNHMbr(p) to BS after obtaining all CNH_JOIN.
The timeline should be broadcast to CN
   Else
   Packet drop;
   End if
The packet is received by node p from node q, whereas p is the CN of one cluster and q is the CN of another cluster.
   CNH_JOIN: <CNH_JOIN, SN_IDq, SN_IDcnh>
   If (SN_IDp == SN_IDcnh) then
      Begin
      CNHMbr(p) CNHMbr(p) ;
Node p transfers the CNHMbr(p) to BS after obtaining the CNH_JOIN. The CN should be informed of the time slot schedule.
End
   Else
      Packet drop;
   End if
End