Research Article

Heuristic Localization Algorithm with a Novel Error Control Mechanism for Wireless Sensor Networks with Few Anchor Nodes

Algorithm 1

Initialization phase for anchor nodes.
Input: Number of initial Pseudo-anchor n_init
Define: HopInfo Packet HIP = {ID, position, hopInfo}
     NeighborInfo Packet NIP = {ID1,⋯, IDn_init}
     Neighbor RSSI List NRL = [IDi, RSSIi]
     Neighbor Distance List NDL = [IDi, di]
Procedures:
1: send an HIP
2: while not time up:
3: if received an HIP:
4:  parse the HIP to obtain ID, position, hopInfo
5:  obtain the RSSI
6:  ifhopInfo is equal to 1:
7:   append [ID, RSSI] to NRL
8:   reset the timer
9:  else:
10:   pass
11: end while
12: fori from 1 to sizeof(NRL):
13: estimate di based on RSSIi by Eq. (1)
14: append [IDi, di] to NDL
15: endfor
16: sort NDL by di in ascending
17: if sizeof (NDL) > n_init:
18: set NIP equal to the first n_init IDs in NDL
19: else:
20: set NIP equal to the IDs in NDL
21: send an NIP