With the rapid development of wireless communication technology, electronic technology and computing technology, wireless sensor networks is a new means to get information, and widely used. The main function of wireless sensor networks is to process the useful datas collected by sensor nodes and transmit those data using wireless communication network to a computer to detect of sensor network coverage area. In many applications of sensor network, the position of sensor node plays a vital role in the entire application, such as sensor network is used in fire alarm, when a sensor node of sensor network sends out a fire alarm through wireless network to the Fire Department, it must also inform the its position, so Fire Department can take measures as soon as possible based on the provided position information, and the information provided by sensor networks is useful information.This paper integrats the advantage of weighted centroid localization algorithm and DV-Hop localization algorithm, nextly makes up for their deficiencies. The algorithm put forward in thesis firstly partitions beacon nodes by virtual grids, then locates sensor nodes using centroid location algorithm or DV-Hop localization algorithm based on the number of beacon nodes in virtual grid. When the number of beacon nodes in a virtual grid reachs the threshold, the algorithm uses centroid localization algorithm to locate the node in the virtual grid, otherwise, it uses DV-Hop localization algorithm to locate the node in the virtual grid.Beasuse of the low accuracy of weighted centroid algorithm caused by the low ratio and uneven distribution beacon nodes, the paper devides weighted centroid location algorithm into two stages, in the first phase of is to form the centroid region using weighted centroid location algorithm, in the second stage, unknown node uses weighted centroid localization algorithm in centroid region, such improvements of weighted centroid localization algorithm in applications can take to better results.Through analyzing the orientation of when DV-Hop localization algorithm locates the nodes, it can be found that localization error of DV-Hop localization algorithm is mainly due to the calculation error of hop-size, so improvement program is proposed in the paper to make the location of node using DV-Hop localization Algorithm more precise. Finally, the algorithm proposes in article is tested by Matlab, compared with the algorithm of Bai J al. [27], both in the situtation that the total number of nodes is fixed, the ratio of beacon nodes is variable, and the situtation that the percentage of beacon nodes is fixed, the total number of nodes is variable, the proposed algorithm reduces the localization error and increases the positioning accuracy. |