1: If (CH(j)=TRUE) then; repeat for all CH nodes 2: Receive(IDi, DataPkt) ; receive data from member nodes of that cluster j 3: Aggregate(IDj, DataPkt) 4: Synchronize datas within Cluster’s CHs. 5: TransToNh(IDj, AgDataPkt); transmit aggregated data to next hop towards base; 6: else 7: If (GWN(m)=TRUE) then ; gateway nodes 8: Receive(IDj, AgDataPkt) 9: InNetworkAggregation (IDj, AgDataPkt) ; In-network aggregation to remove the redundant message 10: TransToNh(IDj, AgDataPkt); transmit aggregated data to next hop towards base; 11: else 12: If (MyTimeSlot=TRUE) then; for non-CH nodes 13: TransToCH(IDi, DataPkt) ; transmit sensed data to CH within their time slot; 14: else 15: SleepMode(i)=TRUE ; node i at a sleep state 16: end if 17: end if 18: } ; one round is finished 19: END |