Skip to main content
. 2018 Sep 28;18(10):3271. doi: 10.3390/s18103271
Algorithm 1 Algorithm for forwarding data packets
 Node i receives data_packet from node j
 Obtain prevnode_depth and currnode_depth
 Calculate distance relative to diff(SS_RSSI,RP_RSSI)
 Calculate RC(sender,receiver) corresponding to distance and diff(prevnode_depth,currnode_depth)
 SWITCH (packettype)
 CASE 1:
NeighborRequest
if node i is the preferable forwarder node of node j then
  send ack
end if
 Hold for next data packet
 END CASE
 CASE 2:
Ack
if node j is the preferable forwarder node of node i then
  up-to-date entry neighbor_tablemaking use of item (prevnode_depth,distance,tcurrent)
end if
 END CASE
 CASE 3:
DataPacket
 Move to the next step
 END CASE
 END SWITCH
if selected node i is not the preferable forwarder node of data_packet then
  Upgrade neighbor_table using item (prevnode_depth,tcurrent,distance)
  Drop data_packet
end if
if node i is the preferable forwarder node of data_packet then
  Obtain source ID, packet ID from data_packet
  if (source ID, packet ID) within the queue then
   Drop data_packet
  end if
  if the node is within the forwarding area then
   Move to the next step
  else
   Hold for the next data_packet
  end if
end if
 Find the next depthmin in neighbor_table
if neighbor_table is empty then
  Drop data_packet
end if
 Upgrade the depth in data_packet with currentnode_depth
 Add (source ID, packet ID) into the queue