WSN Nodes Localization by Hybrid Optimization

Total downloads: 6

This MATLAB code solves the WSN nodes localization problem with the novel hybrid optimization method. The proposed method is able to attain the localization accuracy upto 95.8% which is 13.5% higher than the previous approach.

This repository contains:

  • MATLAB code for Congestion Management

Note: We don’t support to copy this code for your academic submission. This is to ease your pain to start writing code from scratch. We suggest modifying the code for your work. The Optimization algorithms are quite dynamic, so we don’t claim the same improved results in every trial.

 Discuss Code


Nodes Localization Introduction

Wireless sensor nodes have been very useful and able to attract a large community of researchers who are working on to solve their issues. In case of unusual disaster or locations where a man can’t go, sensors are thrown by some means like form air or drones and to bring those sensors in network communication, their locations must be known. GPS can also be attached to each sensor but it will be very costly and also GPS consumes a lot of power, so the sensor node will exhaust soon. So unknown node localization is an important part of WSN research.

Our work is focused on developing the MATLAB code for node localization. To know the locations, some nodes’ positions must be known or it can be said only a few nodes with higher battery capacity must have GPS installed. An unknown node can be located by measuring the distance by received signal strength index (RSSI) which is fine-tuned by heuristic optimization algorithms.  We focused on grey wolf optimization (GWO) for this purpose but it suffers from the behavior of falling into local minima. The research paper on WSN localization using GWO can be read here. So the finely tuned distance of unknown localized nodes by this method can’t be reliable. So we introduced a hybrid method which overcomes the weakness of GWO and gives it the strength of global optimization. We used the cuckoo search optimization algorithm along with the GWO. CS updates the best three solutions of GWO which are alpha_wolf, beta_wolf, gamma_golf.

The MATLAB code for hybrid GWO and CS is already publicly shared on our website. The code can be downloaded from here.

Hybrid Grey Wolf and Cuckoo Search Optimization

Node localization using GWO-CS

To location the location of unknown nodes in WSN, we are fine-tuning the location considered by the RSSI method. All nodes are categorized into three categories: anchor nodes, reference nodes, and unlocalized nodes. Anchor nodes are those nodes whose position is known to the base station, those unlocalized nodes whose positions are determined by the algorithm are reference nodes and can take part in locating the other un-localized nodes. The hybrid method finds the location of sensor nodes optimally and compares the distance with the actual one. The minimum is the error, better is the position. The GWO-CS and node localization are two isolated systems but their dependency can be depicted as in figure 4.1. These collectively form a feedback loop. The module of GWO-CS gets the relative error of distance of nodes in the input and gives the updated nodes’ positions to the WSN module.

There are two tuning variables for each unlocalized node in the area which represents the x and y co-ordinates of the node. These tuning variables are the positions of wolves and updated by hybrid optimization to find a node with minimal distance from the actual location. The error must be minimum.

WSN Module

There is a constraint in the WSN module, only that node can be localized which is in range of at least three anchor nodes. If the node is not in range of three anchor nodes, either that is dropped or a new position is assigned to that node. The distance of that un-localized nodes is calculated from all anchor nodes in the vicinity and relative difference of the sum of measured distance and the sum of calculated distance (RSSI method) is observed which is passed back to optimization module.

If any un-localized node is localized then it acts as a reference node and helps the anchor nodes to find out the other nodes’ position as anchor nodes.

Optimization Module

The relative error is feedback to hybrid optimization for each wolf in each iteration. The minimum error position wolf is determined by comparing it in the group and that corresponding wolf is assigned as leader of the group along with two other wolves with lesser fitness value and assigned and beta and gamma wolf. These three optimal positions for the present node which is termed as the wolf inside optimization module is again updated by cuckoo method


We analyzed the results of the proposed approach for three different sensor areas. The nodes are deployed in different sensor areas as

Nodes Localization in WSN
Localized nodes by GWO optimization
Nodes Localization in WSN-free-thesis
Localized nodes with hybrid GWOCS optimization

The collective analysis for the mean localization error in these three different geographical areas follows the convention that it is higher for the large area and so is the number of localized nodes. The comparative figure is shown below.

Comparative analysis of proposed solution in node localization in three different scenarios
Comparative analysis of the proposed solution in node localization in three different scenarios

We have analyzed that 100-meter square area is giving optimal results for minimum node localization error and number of detected anchor nodes. For 100 square meter area, the 80 anchor nodes have the best result as we have a total of 200 nodes and out of those nodes 120 nodes are at unknown positions, and our method is able to localize 115 nodes out of those, which means 95.8% nodes are localized which is 13.8% more than GWO results. A comparative analysis for the percentage of localized nodes will be the conclusion and a bar chart is shown in the figure  for it.

Comparative analysis of number of localized nodes for 100 square meter geographical region.
Comparative analysis of the number of localized nodes for 100 square meters geographical region.

Other MATLAB codes related to WSN can be reviewed here




There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.