Introduction

The growth of the Internet of Things (IoT) has revolutionized the digital world. IoT has changed the way people live by transforming everything into smart systems [1]. Wireless Sensor Network (WSN) is an important part of IoT [2]. This is a network of multiple sensor nodes used to monitor the events of the physical world, digitize them and send information to the systems or end-users [3]. WSN is used in a number of applications of smart cities, healthcare systems, intelligent transportation systems, disaster management, military surveillance, etc. [4,5,6,7,8].

Most of these applications require the location of sensor nodes to be known. This is necessary to understand the location of observed events and to act on them [9]. Consider the case of the military surveillance application. Here, WSN is formed by dropping sensor nodes from an aerial vehicle like a helicopter or drone in the region of interest. These nodes track enemy movements using the attached sensors and send the sensed information to a base station located in a remote place. The data at the base station is further analyzed to take necessary actions. Similarly, in the applications of intelligent transportation systems, WSN is formed by deploying sensor nodes on either side of highways. Sensors attached to nodes monitor traffic congestions and send this information to the traffic control system for automatic controlling of traffic. In all the above-discussed applications, the collected information is useful only when the location of the occurrence of events is known. By knowing the accurate location of enemy vehicles or traffic congestion, necessary actions can be taken automatically. But, in these applications, the location information of sensor nodes is unknown as they are deployed randomly. Placing the sensors in pre-determined locations is not always possible, especially in large-scale applications with harsh and unreachable areas of interest [10].

One way to get the location of randomly placed sensor nodes in large networks is by using satellite navigation systems like Global Positioning System (GPS). But, equipping every sensor node with these systems increases the energy consumption, size, and cost of the nodes. Also, location estimations of these systems are not accurate in the indoor environment and dense urban areas [11,12,13]. Hence, to overcome this problem, several localization methods are derived to estimate the location of sensor nodes in a WSN.

The localization algorithms use few location-aware sensor nodes that are called reference nodes and apply different methods to estimate the proximity between location unknown nodes and location-aware reference nodes [14]. The obtained proximity measures are further processed using different algorithms such as convex algorithm [15], optimized distance [16], swarm intelligence algorithms [17], Hessian regularization regression [18], self localization protocol [19], deep neural network [20], sine cosine algorithm [21]. A convex algorithm based localization method is developed in [15] to estimate the locations of unknown nodes in WSN used in real time monitoring of uranium tailings reservoir. Here, the distances between the unknown nodes and reference nodes are obtained using the time difference of arrival method and then, the convex location algorithm is used to reduce the region of the unknown nodes and to estimate the coordinates of unknown nodes. An optimized distance range free localization algorithm reported in [16] limits the use of hop size and hop count to approximate nearly a straight line distance between a known and an unknown node without additional hardware and without increasing extra communication. Then, linear optimization is used for the location estimation of nodes. A squared error norm of residual fitting error matrix cost function for mixed source localization is reported in [17]. The proposed cost function is optimized using particle swarm optimization, whale optimization, and grey wolf optimization algorithms to obtain accurate localization. Another localization algorithm is reported in [18] using Received Signal Strength (RSS) measurements. The locations of nodes are then estimated using Hessian regularization regression. Self localization protocol based localization method is a distributed and collaborative positioning algorithm that is developed by exploiting the connectivity information among neighbors at one hop [19]. A deep neural network based localization method is reported in [20] which explores the correlation between the RSS data and the node placement to estimate accurate locations. A localization algorithm considering the sensor motion effect using time delay and Doppler frequency shift measurements are reported in [22]. These localization methods can be classified as range-based localization and range-free localization [23, 24]. Range-based localization algorithms use radio signal characteristics such as RSS, Time of Arrival (TOA), Angle of Arrival (AOA) to estimate the distance between nodes [25,26,27]. Range-free localization algorithms use only connectivity information among nodes to estimate the distance between them. These types of algorithms are more suitable for large-scale WSN because they do not need any additional hardware on sensor nodes to measure the radio signal characteristics [23]. Hence, they can be readily used in existing sensor nodes. Several range-free localization algorithms are available in the literature. Most popular among these are hop-based techniques and centroid-based techniques [28]. Hop-based techniques make use of hop lengths to reference nodes from sensor nodes for location estimation, whereas centroid-based techniques use connectivity to immediate neighbor nodes for location estimation.

The localization techniques are used in different applications which require WSN to be deployed in different types of fields. Some applications like air quality monitoring systems require the deployment of sensor nodes in 2D plain fields, and some applications like military surveillance and intelligent transportation systems demand the deployment of nodes in anisotropic and irregular shaped 3-Dimensional (3D) fields. The localization of sensor nodes in different types of fields is a challenge [29]. The boundary condition of WSN in 3D fields becomes more complicated and the connectivity of the network can be more diverse compared to the 2D scenario [30]. Also, the anisotropy of fields results in the shortest path between nodes to be bent, causing inaccurate localization. Hence, it is important to analyze the impact of field characteristics on localization algorithms.

In this paper, we have reported a range-free localization algorithm called Range Reduction Based Localization (RRBL) for localization of nodes in 2D and 3D, isotropic and anisotropic fields. This algorithm uses the characteristics of hop-based and centroid methods for efficient localization of nodes under different scenarios. Performance is evaluated in fields of various shapes such as 2D square, 2D C shaped, 3D cube, 3D C shaped, and 3D mountain terrain. The effect of field characteristics on localization algorithms is analyzed by evaluating the error introduced to localization results when the field of deployment is changed from 2D to 3D and isotropic to anisotropic.

The rest of the paper is organized as follows. In Sect. 2, some of the existing localization algorithms are reviewed. Network model and network topology are discussed in Sect. 3. A brief description of different range-free localization algorithms is given in Sect. 4. A novel localization algorithm called RRBL is discussed in Sect. 5 and the results are analyzed in Sect. 6. Finally, Sect. 7 provides the conclusion and proposed future work.

1 Background and related work

There are several localization algorithms reported in the last two decades. A few of the early range-free localization algorithms are Centroid, DV-Hop, Approximate Point In Triangle and Multidimensional Scaling [31,32,33,34]. These localization algorithms were developed considering ideal network conditions. Many enhancements were reported on these algorithms for improving localization accuracy. A multi-hop localization algorithm with multisource information was reported in [23]. This is an error-compensation based node distance estimation that uses the information provided by the adjacent areas and nodes. A localization algorithm based on the weighted centroid localization technique, where the positions of unknown nodes were calculated using the fuzzy logic method was reported in [2]. An improved DV-Hop localization algorithm based on hybrid chaotic strategy was reported in [35]. Jian [36] reported a new DV-Hop localization algorithm based on half-measure weighted centroid. A new hop-based localization algorithm based on the probability property of the random distribution of wireless sensor network was reported in [37]. This algorithm reduced the error accumulation by control flooding and improved the positioning accuracy by using the jump distance correction method. A weighted centroid DV-Hop algorithm was reported in [5]. Here, factors such as the number of anchors, communication radius, and nearest anchor were considered to determine the location of unknown nodes. A modified DV-Hop algorithm using Teaching Learning Based Optimization was reported in [25]. Here, location errors caused by collinear anchor nodes are reduced using the concept of collinearity. Further, Teaching Learning Based Optimization is used to enhance localization accuracy. These localization algorithms were developed with the motivation of improving localization accuracy. But, these algorithms have assumed ideal fields for the deployment of sensor nodes. Localization algorithms were evaluated in 2D square experimental areas.

Many applications demand the deployment of sensor nodes at different types of fields. Realistic fields of interest are not always a plain field. Though a few algorithms like DisLoc [30], MSVR Based [38] have considered 3D anisotropic fields for the analysis of localization algorithms, most of the developed algorithms have assumed ideal field dimensions. In this paper, we have introduced a localization algorithm that can be used to localize nodes in any type of field.

2 Network model

We have considered a WSN comprising of N static sensor nodes randomly distributed in various fields of interest. Every sensor node is assumed to have a unique identification denoted by \(N_1\), \(N_2\),..., \(N_N\). Among these, K sensor nodes are assumed to know their locations and are used as reference nodes. Other N-K nodes are location unaware nodes and their locations need to be estimated with the help of reference nodes. These sensor nodes communicate with each other to form an ad-hoc network.

Radio Irregularity Model (RIM):

The communication range of a node depends on the transmission power of the sensor node and the environment of communication. Signals transmitted from nodes are attenuated by environmental factors. The transmitted signals from nodes undergo reflection, refraction, and attenuation by the environment during signal propagation. Propagated radio signals exhibit a continuous variation with incremental changes in direction. This characteristic of the radio signal is modeled using RIM, which was established based on data from real sensor devices [39]. This model uses a parameter called Degree of Irregularity (DOI) which is defined as the maximum path loss percentage variation per unit degree change in the direction of radio propagation [39]. Signal propagation in WSN is represented using the RIM model as follows:

$$\begin{aligned}&\textit{Received signal strength = Transmission power - } \nonumber \\&\quad \textit{DOI adjusted Path loss + Fading} \end{aligned}$$
(1)

where DOI adjusted path loss \(=\) Path loss \(\times \) \(K_\theta \). \(K_\theta \) is a coefficient to represent the difference in path loss in different directions.

We have

$$\begin{aligned} K_\theta = {\left\{ \begin{array}{ll} 1 \textit{ if } \theta =0. \\ K_{\theta -1} \pm Rand \times DOI \textit{ if } \theta \in \{1,2,3,\cdots ,359\}. \end{array}\right. }\nonumber \\ \end{aligned}$$
(2)

Rand in Eq. (2) is a random number which is found to fit Weibull distribution [39]. When the DOI is at 0, the communication range is a perfect circle/sphere. Let \(CR-0_i\) denote the communication range of node i at DOI=0. As the DOI value increases, the communication range becomes more and more irregular. The communication range of a node at different DOI is shown in Fig. 1.

Fig. 1
figure 1

Communication range a DOI = 0 b DOI = 0.05

Heterogeneity Network is considered to be heterogeneous with sensor nodes having different transmission powers. In practical cases, the transmission power of any two sensor nodes can differ due to their different battery status, hardware differences and different specifications followed by manufacturer [39, 40]. This results in different coverage ranges of nodes.

Network Topology Different applications of WSN demand deployment of nodes in different fields. For example, in smart city applications, sensor nodes need to be deployed in various industrial or commercial buildings of different shapes and sizes. In military surveillance applications or disaster management applications like forest fire detection, the field of deployment can be a forest area with multiple hills, valleys, and lakes. In all the above cases, the field of interest where WSN needs to be formed is irregular and 3D. But most of the existing research has restricted the analysis of localization algorithms to regular shaped 2D fields.

To ensure that the reported localization algorithm works smoothly in different types of fields, we have considered multiple realistic fields. A square-shaped field with multiple hills and valleys is considered to represent the application of military surveillance. Here, nodes are deployed on the surface of mountain terrain as shown in Fig. 2a. To represent the application of a smart city where nodes are deployed in buildings of different shapes, as shown in Fig. 2b, a 3D-C shaped deployment field is considered. Another 3D deployment field of cubic shape is considered to represent isotropic 3D fields which is shown in Fig. 2c.

Fig. 2
figure 2

Deployment of location unknown sensor nodes and reference nodes in a mountain terrain b 3D C shaped field c 3D cubic field

Localization algorithms are also tested in 2D isotropic and anisotropic fields. A 2D square field and a C-shaped field are considered to represent the deployment of nodes in plain ground. This is shown in Fig. 3.

Fig. 3
figure 3

Deployment of location unknown sensor nodes and reference nodes in a 2D square field b 2D C shaped field

Anisotropy and irregularities in the fields affect the distance measurements between nodes and thus degrade the accuracy of localization algorithms [41, 42]. Therefore, the localization algorithms are evaluated in these fields to eliminate the influence of field elements on localization accuracies.

3 Range-free localization methods

Range-free localization methods are the simplest localization techniques that are most suitable for WSN with limited battery power and computational resources. Unlike range-based methods which make use of RSSI, TOA, AOA measurements for distance estimations, range-free methods make use of only connectivity information among nodes. There are mainly hop-based localization methods and centroid-based localization methods. In this section, we have discussed a few state-of-the-art hop-based and centroid-based localization techniques.

3.1 Hop-based localization methods

These methods make use of a few location-known reference nodes, the number of hops to reference nodes from sensor nodes, and average hop length to estimate their locations in the network.

DV-Hop is a classic hop-based localization algorithm that has attracted more attention from researchers due to its simplicity, stability, feasibility and less hardware requirement [25]. DV-Hop is a range-free localization algorithm that estimates locations of unknown nodes by making use of few location-aware reference nodes [32, 43, 44]. In the first step of this algorithm, all reference nodes broadcast their location information to their neighbor nodes with the hop count set to one. Every neighbor node on receiving this information stores reference node location and hop count to reference node. Then they increment the hop count value and broadcast reference node location and new hop count information to their neighbor nodes. This process is continued till every node has a minimum hop count value to every other reference node and there are no new neighbor nodes to be updated with this information.

In the second step, reference nodes measure the average per-hop distance as the ratio of the sum of distances with other reference nodes to the total number of hop counts. In the next step, using the average hop distance and number of hop counts to reference nodes, every node measures its approximate distance to reference nodes.

In the last stage, coordinates of unknown target nodes are estimated using the least-squares solution [45].

Least squares solution: Let there be K reference nodes with coordinates \((x_i, y_i, z_i)\) where \(i = 1, 2, ..., k\). Let \((x_u, y_u, z_u)\) be the location of a location unknown sensor node which needs to be estimated. Let \(d_{ui}\) be the estimated distance from \(i^{th}\) reference node to this location unknown node at \((x_u, y_u, z_u)\). The distance equations between k reference nodes and location unknown node can be written as shown here.

$$\begin{aligned}&(x_u-x_{1})^2 + (y_u-y_{1})^2 + (z_u-z_{1})^2 = d_{u1}^2 \\&(x_u-x_{2})^2 + (y_u-y_{2})^2 + (z_u-z_{2})^2 = d_{u2}^2 \\&. \\&. \\&. \\&(x_u-x_{k})^2 + (y_u-y_{k})^2 + (z_u-z_{k})^2 = d_{uk}^2 \end{aligned}$$

This can be represented in matrix form as

$$\begin{aligned} AX=B \end{aligned}$$
(3)

where

$$\begin{aligned} \tiny A= & {} \begin{bmatrix} -2(x_1 - x_k)&{}-2(y_1 - y_k)&{}-2(z_1 - z_k)\\ .\\ .\\ .\\ -2(x_{k-1} - x_k)&{}-2(y_{k-1} - y_k)&{}-2(z_{k-1} - z_k)\\ \end{bmatrix}, \\ X= & {} \begin{bmatrix} x_u\\ y_u\\ z_u\\ \end{bmatrix} \end{aligned}$$

and

$$\begin{aligned} b= & {} \begin{bmatrix} d_{u1}^2-d_{uk}^2-(x_1^2-x_k^2)-(y_1^2-y_k^2)-(z_1^2-z_k^2)\\ .\\ .\\ .\\ d_{u(k-1)}^2-d_{uk}^2-(x_{k-1}^2-x_k^2)-(y_{k-1}^2-y_k^2)-(z_{k-1}^2-z_k^2)\\ \end{bmatrix} \end{aligned}$$

The least squared solution can be obtained as in Eq. (4).

$$\begin{aligned} {\hat{X}}=(A^T A)^{-1} A^T b \end{aligned}$$
(4)

DV-maxHop [46] is another hop-based localization method that makes use of a control parameter to reduce the errors in distance estimations. In practical cases, there exist obstructions in the fields which cause detoured paths among nodes. These detoured paths alter the minimum hop counts among nodes and hence introduce errors in distance estimations. To overcome this problem, the DV-maxHop algorithm uses a control parameter to filter out hop count information from farther reference nodes. Only the closer reference nodes are used and the locations are estimated similar to the DV-Hop algorithm. Consider a WSN with 4 reference nodes denoted as \(N_1\), \(N_2\), \(N_3\) and \(N_4\). If the control parameter is chosen as 3, sensor node \(N_s\) uses only reference nodes \(N_1\), \(N_2\), and \(N_3\) which are within 3 hop lengths. The reference node \(N_4\) which is at 5 hop lengths away from \(N_s\) is not used for localizing \(N_s\). This is illustrated in Fig. 4.

Fig. 4
figure 4

Hop-based localization

Weighted DV-Hop [47] is another hop-based localization method that uses a weight function inversely proportional to the hop length. Instead of filtering out farther reference nodes, this algorithm gives a lower weight to farther reference nodes and a higher weight to closer reference nodes.

3.2 Centroid-based localization methods

These algorithms assume that sensor nodes are uniformly surrounded by reference nodes. Hence, they localize unknown nodes as the centroid of neighboring reference nodes. The traditional Centroid algorithm [31] consists of two steps. In the first step, reference nodes broadcast their location information to all other nodes which are in their communication range. In the second step, every unknown node estimates its location in the network as the arithmetic mean of the coordinates of all the received reference nodes’ location information. As illustrated in Fig. 5, node \(N_s\) is within the communication range of reference nodes \(N_2\), \(N_3\) and \(N_4\). Hence, \(N_s\) receives the location information from reference nodes \(N_2\), \(N_3\) and \(N_4\). Then, \(N_s\) estimates its location as arithmetic mean of coordinates of reference nodes \(N_2\), \(N_3\) and \(N_4\) as shown in Eq. (5).

Fig. 5
figure 5

Centroid-based localization

$$\begin{aligned} x_s=\sum \limits ^4_{i=2} x_i \text { , } y_s=\sum \limits ^4_{i=2} y_i \text { and } z_s=\sum \limits ^4_{i=2} z_i \end{aligned}$$
(5)

Few other centroid-based localization methods are WCL [48] and EWCL [5]. These algorithms use weights to give more priority to closer reference nodes and less priority to farther reference nodes. WCL uses a weight of 1/hop count. Hence a farther reference node will have a higher hop count and lower weight whereas a closer reference node will have a smaller hop count and higher weight. EWCL uses a threshold hop value and only reference nodes within this threshold hop value are considered. It uses a weight value defined as a function of hop count, average hop distance of its nearest node, and communication radius.

Most of these algorithms are developed by assuming homogeneous WSN in isotropic 2D fields. But, in reality, WSN can be heterogeneous and fields of deployment are 3D and anisotropic. Hence, to bridge this gap, we have developed a range reduction based localization technique that considers the heterogeneity of nodes and improves localization accuracy in both 2D and 3D fields. We have also done a comparative analysis of the behavior of these algorithms when the field of deployment is changed from 2D to 3D and isotropic to anisotropic.

4 RRBL algorithm

In this section, we describe the steps of the RRBL algorithm. This algorithm uses the properties of both centroid and hop-based methods to overcome the influence of field irregularities and heterogeneity in the network.

Phase 1: This step is similar to DV-Hop. But, instead of broadcasting hop counts, every reference node broadcasts its expected communication radius \(CR-0_i\) at DOI=0 along with location information. Nodes can know the expected communication radius from their transmission power using log normal path loss model [42]. The neighbor nodes store the received information, add their \(CR-0\) to the received value and broadcast it again. This is continued till every node in the network has information on the location of reference nodes and the minimum value of the sum of \(CR-0\) required to reach each reference node.

Next, every reference node measures the Average Distance (AD) in the network as in Eq. (6).

$$\begin{aligned} AD_i=\frac{\sum \limits ^k_{j=1} d_{ij}}{\sum \limits ^k_{j=1} CR-0_{ij}}, i \ne j \end{aligned}$$
(6)

where \(AD_i\) is average distance for reference node i and \(d_{ij}\) is the distance from reference node i to j. The measured AD is then broadcast to other nodes in the network.

Phase 2: Every unknown node localizes itself independently from the obtained data in phase 1. It first identifies the neighboring reference nodes in its close proximity using a threshold CR-0 value. We have chosen threshold value as the maximum CR-0 in the network. If the number of neighbor nodes within the threshold CR-0 is more than 3, location is estimated using range reduction method described here. For an unknown node j, let the neighbors within threshold CR-0 distance be \(R_1,R_2,...R_c\) with location \((x_1,y_1,z_1)\), \((x_2,y_2,z_2)\), ..., \((x_c,y_c,z_c)\).

Initialize the range for \((x_j,y_j,z_j)\) as in Eq. (7).

$$\begin{aligned} x_{jmin}= & {} x_1 - (CR-0_{1j} \times AD_1) \nonumber \\ x_{jmax}= & {} x_1 + (CR-0_{1j} \times AD_1)\nonumber \\ y_{jmin}= & {} y_1 - (CR-0_{1j} \times AD_1) \nonumber \\ y_{jmax}= & {} y_1 + (CR-0_{1j} \times AD_1) \nonumber \\ z_{jmin}= & {} z_1 - (CR-0_{1j} \times AD_1) \nonumber \\ z_{jmax}= & {} z_1 + (CR-0_{1j} \times AD_1) \end{aligned}$$
(7)

The initialized range are then updated using other neighbors \(R_2\) to \(R_c\).

For i = 2 to c,

$$\begin{aligned} x_{jmin-new}= & {} max(x_{jmin-old}, x_i-(CR-0_{ij} \times AD_i)) \nonumber \\ x_{jmax-new}= & {} min(x_{jmax-old}, x_i+(CR-0_{ij} \times AD_i)) \nonumber \\ y_{jmin-new}= & {} max(y_{jmin-old}, y_i-(CR-0_{ij} \times AD_i)) \nonumber \\ y_{jmax-new}= & {} min(y_{jmax-old}, y_i+(CR-0_{ij} \times AD_i)) \nonumber \\ z_{jmin-new}= & {} max(z_{jmin-old}, z_i-(CR-0_{ij} \times AD_i)) \nonumber \\ z_{jmax-new}= & {} min(z_{jmax-old}, z_i+(CR-0_{ij} \times AD_i)) \nonumber \\ \end{aligned}$$
(8)

Locations for node j is estimated as follows.

$$\begin{aligned} x_j= & {} \frac{(x_{jmin} + x_{jmax})}{2} \nonumber \\ y_j= & {} \frac{(y_{jmin} + y_{jmax})}{2} \nonumber \\ z_j= & {} \frac{(z_{jmin} + z_{jmax})}{2} \end{aligned}$$
(9)

For localization, phase 2 requires at least a few neighbors within the threshold communication range. If the neighbor count is very low, locations are estimated as described in phase 3.

Phase 3: This step uses all the neighbors and distance to each reference node from the unknown node is measured as in Eq. (10).

$$\begin{aligned} d_{ui}=CR-0_{ui} \times AD_i \end{aligned}$$
(10)

Using these approximated distance values, location is estimated from the least squares method as in Eq. (4).

figure c

5 Results and discussion

In this section, the reported localization algorithm is evaluated under various scenarios. The results are compared with other localization algorithms such as DV-Hop [32], DV-maxHop [46], Weighted DV-Hop [47], Centroid [31], WCL [48] and EWCL [5]. These algorithms are selected as a combination of classic and latest hop-based and centroid-based methods. The algorithms are evaluated in different types of fields namely 3D cubic field, 3D C shaped field, 3D mountain terrain, 2D square field, and 2D C shaped field. These fields are chosen as a combination of 2D and 3D, isotropic and anisotropic fields to eliminate the effect of field type on the performance of the algorithm. Fields are assumed to have a path loss factor of 4. A heterogeneous set of sensor nodes with transmission powers varying from -5dBm to -15dBm are deployed in these fields. Random deployment of WSN is simulated using MATLAB R2018a. The localization results are evaluated using Localization Error (LE) which is defined as below [49].

$$\begin{aligned} LE=\frac{\sum \limits _{i=1}^{N-K}\sqrt{(x_{i,est}-x_{i})^2+(y_{i,est}-y_{i})^2+(z_{i,est}-z_{i})^2}}{R \times (N-K)}\nonumber \\ \end{aligned}$$
(11)

where \((x_{i,est}, y_{i,est}, z_{i,est})\) is the estimated co-ordinate of \(i^{th}\) node, \((x_i, y_i, z_i)\) is the actual co-ordinate of \(i^{th}\) node and R is the average communication radius of nodes. N and K are number of sensor nodes and reference nodes respectively.

5.1 Effect of dimensionality

The influence of dimensionality is evaluated by comparing the localization results in the 2D square field with 3D cubic field and 2D C shaped field with 3D C shaped field. For this, 400 sensor nodes are deployed in these fields with additional \(10\%-20\%\) reference nodes. The area/volume of every field is maintained at \(45000m^2/45000m^3\). A uniform node density of \(0.01/m^2\) in 2D fields and \(0.01/m^3\) in 3D fields is maintained in all the fields. Results obtained from different localization algorithms are shown in Figs. 6 and 7.

Fig. 6
figure 6

Effect of dimensionality on a Cubic field b C shaped field at 10% reference node ratio

Fig. 7
figure 7

Effect of dimensionality on a Cubic field b C shaped field at 20% reference node ratio

Figures 6 and 7 show the comparison of LE for different algorithms in 2D and 3D fields. The proposed RRBL algorithm has shown an improvement of 29% in 3D fields and 27% in 2D fields at 10% reference node density and 35% in 3D fields and 12% in 2D fields at 20% reference node density when compared with EWCL. All the localization algorithms show improved localization accuracies in 3D fields than in 2D fields. This is because the coverage area of a 3D node is higher than that of a 2D node. Hence, at common node density, 3D fields have more connectivity than 2D fields. But, due to this, the run time of the algorithms increases in 3D fields than in 2D fields. This is shown in Tables 1,  2 and  3. Here, the run time to localize a single node using DV-Hop, EWCL, and RRBL localization algorithms is compared in 2D and 3D fields. Irrespective of the shape of the field, with an increase in reference node ratio, the run time of all the localization algorithms in 3D fields increases rapidly than in 2D fields.

Table 1 Run time (s) comparison of DV-Hop algorithm
Table 2 Run time comparison of EWCL algorithm
Table 3 Run time comparison of RRBL algorithm

5.2 Effect of anisotropy

The influence of anisotropy is studied by comparing the localization results in anisotropic fields with isotropic fields. Various localization algorithms are evaluated in 2D and 3D fields. Localization results in a 2D C-shaped field are compared with its corresponding 2D regular field i.e., 2D square field. Similarly, localization results of 3D mountain terrain field and 3D C shaped field are compared with 3D cubic field. All the algorithms show increased errors in anisotropic fields. While the error is higher in traditional algorithms, the reported RRBL shows better performance in the presence of field anisotropy. Results obtained from different localization algorithms are shown in Fig. 8. Figure 8a shows the comparison of LE in 2D fields and Fig. 8b shows the comparison of LE in 3D fields. RRBL has shown an improvement of 26% in 2D fields and 32% in 3D fields when compared with the other best performing algorithm, EWCL.

Fig. 8
figure 8

Effect of anisotropy in a 2D fields b 3D fields

5.3 Effect of heterogeneity

The effect of different topologies on localization algorithms is evaluated at different levels of heterogeneity. A heterogeneous network is formed by three sets of sensor nodes with different transmission powers. The transmission powers of these nodes are varied and the effect of deviation in sending power on the performance of the RRBL localization algorithm is evaluated. Table 4 shows the transmission power of different sets of sensor nodes used in the experiment.

Table 4 Heterogeneous set of sensor nodes

Figure 9 shows the performance of the RRBL algorithm in terms of LE for a heterogeneous network of sensor nodes. Increasing variance in sending power generally degrades the performance of localization algorithms. But, in this algorithm, the effect of deviation in sending power on localization algorithms is reduced. When the heterogeneity is increased from 0 to 5, there was no degradation in the performance of RRBL. Further increase in heterogeneity to 10 deteriorated the performance of the localization algorithm by 17%.

5.4 Effect of node density

The performance of the reported algorithm is tested for varying node densities in 2D and 3D fields. The number of nodes in the network is increased from 400 to 900 and the reference node ratio is maintained at 10%. The results are illustrated in Fig. 10. An increase in node density improved the performance of the algorithm. The rate of improvement was high at lower node densities and the change in LE was reduced at higher node densities.

9

Localization algorithms behave differently in different fields. Hence, by analyzing the results for just 2D fields, the results for 3D fields cannot be estimated. Similarly, by analyzing the results for isotropic fields, results for anisotropic fields cannot be estimated. Therefore, we have tested the reported localization algorithm RRBL at various anisotropic conditions, heterogeneity, and node densities. The results show improvement in the accuracy of localization.

Fig. 9
figure 9

Effect of heterogeneity on RRBL

Fig. 10
figure 10

Influence of node density on RRBL

6 Conclusion

In the present world of IoT, the WSN localization problem is gaining much importance. The accuracy of localization algorithms is a concern in irregular fields. Most of the existing algorithms in literature were developed to localize nodes in regular fields, whereas practical applications of WSN are irregular fields. To help in bridging this gap, we have reported a localization algorithm called RRBL. This algorithm utilizes the properties of both hop-based and centroid methods to improve the localization accuracy in various types of fields. In this algorithm, the nodes with a higher number of immediate neighbors are localized by identifying and reducing the range of probable location of unknown nodes. The nodes with a lower number of neighbors are localized using farther reference nodes from the least squares method. The results show improved localization accuracies when tested in various 2D and 3D fields of different shapes and heterogeneity. The algorithm has shown an improvement of 29% in 3D fields and 27% in 2D fields at 10% reference node density and 35% in 3D fields and 12% in 2D fields at 20% reference node density when compared with other localization algorithms. As future work, we plan to implement this algorithm on a real WSN to solve the localization problem. Also, we plan to study the effect of nonuniform node distribution on localization and the challenges of improving localization accuracy in those scenarios.