Range-Based Localization of a Wireless Sensor Network for Internet of Things Using Received Signal Strength Indicator and the Most Valuable Player Algorithm

: The localization of the nodes in wireless sensor networks is essential in establishing effective communication among different devices connected, within the Internet of Things. This paper proposes a novel method to accurately determine the position and distance of the wireless sensors linked in a local network. The method utilizes the signal strength received at the target node to identify its location in the localized grid system. The Most Valuable Player Algorithm is used to solve the localization problem. Initially, the algorithm is implemented on four test cases with a varying number of sensor nodes to display its robustness under different network occupancies. Afterward, the study is extended to incorporate actual readings from both indoor and outdoor environments. The results display higher accuracy in the localization of unknown sensor nodes than previously reported.


Introduction
In the realm of networking and communication, wireless sensor networks (WSN) play a pivotal role in establishing connections among disparate devices situated at distant locations. Usually, hundreds of wireless sensors share a network to communicate useful information with each other. Therefore, WSNs are becoming crucial, supported by increasing trends of digitalization [1]. This lays down the cornerstone of the concept of the Internet of Things (IoT), which is considered to be the next step in a digital society, whereby, multi-purpose devices share a networking platform to communicate with each other in a common language [2,3]. Throughout a WSN, sensor nodes are continuously transmitting and receiving the information from the base station and are widely used in the secured networks serving military, healthcare, environment monitoring, and smart home systems [4]. These applications often require localizing the node by determining both the distance and coordinates from a known node or router. The purpose of ascertaining the location of a specific node location is to track the information route while managing and optimizing network latency. Therefore, the unavailability of localization data ends up in the deteriorated performance and control of WSN for a specific application.
In the process of localization, the position of the node with the unknown or consistently changing position (target node) is determined by utilizing the signals from nearby reference nodes, usually referred to as anchors. The localization technique aims to determine the coordinate vectors of the target node. Therefore, the localization technique is carried out in two steps: (i) Estimating the distance of the target node from the reference node; (ii) determining geographical coordinates using the estimated distance and avenue for future research of how it may be applied to other similar problems. It applies a two-fold technique to localize the target sensor node. First, the relationship between RSSI and distance from reference to target node is ascertained by developing a nonlinear regression model. In the second stage, MVPA is used to convert the distance data into (x, y) coordinates of a 2-dimensional plane. Four test cases with a different number of nodes reflecting variable network occupancy are studied. The results obtained using MVPA are compared with renowned classical techniques, whereby the proposed approach outperforms other techniques in terms of accuracy and parametric dependence. Mean square error sees a reduction by a factor of 10 for case 3, and case 4 when contrasted with the second-best performing algorithm, reflecting the superiority of MVPA. To demonstrate the improvement on a real-world example, the experimental set-up of [23] is reused followed by comparative discussion indicating higher coordinate estimation accuracy with MVPA than other contemporary algorithms. The remainder of this paper is organized as follows. The proposed approach is described in Section 2. The simulation tests along with the experimental study are combined in Section 3. Finally, conclusions are drawn in Section 4.

A. Description
Very often a WSN, consisting of several nodes, is dispersed in a geographical area. However, in some applications, the location (the x and y coordinates in 2d) of these nodes called target is needed. Along with these target nodes, usually, there are some reference nodes with known locations or coordinates. In this work, routers play the role of reference nodes while end device nodes play the role of target nodes. Therefore, the objective of the proposed approach is to find the location of target nodes (x and y coordinates) based on the distance estimation (estimated from RSSI) knowing the locations of the reference nodes.
The flowchart of the proposed approach is given in Figure 1. It starts by estimating the distances of different target nodes with respect to the reference nodes based on measured RSSI. Measurements are carried out with the loop-infinite option to cater to infinite packet transmission [23]. If P t represents the transmitted power and P L (d) denotes the path loss power at distance d in dBm, then RSSI is given by: Here, P L (d) can be represented by Log-Normal Shadowing Model (LNSM) in terms of path loss at a known point d 0 , P L (d 0 ), path loss exponent, n, and zero-mean Gaussian random variable with σ standard deviation, X σ , as below: Combining (1) and (2) relates RSSI, in dBm with the distance between the nodes.
The nonlinear regression model is used to estimate the distances from (3). Once all distances are obtained using regression, it is pertinent to use a systematic way to provide all distances to the algorithm. The matrix, named DistanceRT, combines all distances in a closed-form. Hence, it becomes easier for the algorithm to perform matrix operations Technologies 2021, 9, 42 4 of 19 making the approach speed efficient. All distances, denoted by, d ij , between the reference node i and the target node j, are restructured in a matrix as follows: In (4), n is the number of target nodes and m is the number of reference nodes. The nonlinear regression model is used to estimate the distances from (3). Once all distances are obtained using regression, it is pertinent to use a systematic way to provide all distances to the algorithm. The matrix, named , combines all distances in a closed-form. Hence, it becomes easier for the algorithm to perform matrix operations making the approach speed efficient. All distances, denoted by, , between the reference node and the target node , are restructured in a matrix as follows: In (4), is the number of target nodes and is the number of reference nodes. After that, the MVPA is used to optimize the problem at hand. In other words, the MVPA is used to determine the location ( and coordinates) of target nodes by mini- After that, the MVPA is used to optimize the problem at hand. In other words, the MVPA is used to determine the location (x and y coordinates) of target nodes by minimizing the following objective function: where d ij is the Euclidian distance between reference node i and target node j estimated using RSSI and d ij is the Euclidian distance between reference node i and target node j calculated using the MVPA and it is expressed as follows: where x i and y i are the location of the target node i to be calculated by the optimization process (i.e., design variables). The objective function can be simplified in a more compact form as follows: A matrix containing all possible connection distances, d ij , of a specific WSN form a solution set. Several of such solutions form a single team and then similar teams compete together based on the objective function of (7), as detailed in Algorithm 1 in the next section. The number of teams, number of players, and number of fixtures are hyperparameters of the algorithm and are usually chosen during the execution phase of the algorithm by trial-and-error.

B. Most Valuable Player Algorithm (MVPA)
A. General description MVPA is one of the newest modern optimization algorithms [24]. It is inspired by sports competitions. It is applied to various fields with always excellent results. In [24] it was applied to a set of mathematical functions and compared with 13 optimization algorithms in terms of overall success to find the global optimum and the number of functions evaluations; it was found to be the best one. In [25], a comparative study was carried out between modern optimization algorithms inspired by sports events including the MVPA. The MVPA was ranked first for unimodal problems and equally ranked first with two other algorithms for multimodal problems. In [26], it was applied in the field of electromagnetics. In [27] it was used for efficient energy management in a microgrid with intermittent renewable energy and storage sources. In [28] the MVPA was applied to solve the direction overcurrent relays coordination problem. In [29] a binary version of the MVPA was developed and implemented to optimize wind farm layouts considering obstacles. In [30] an improved version of the MVPA by doubling the training mechanism was proposed and compared with other optimization algorithms for engineering design problems. In [31] an enhanced version of the MVPA was proposed and applied to the optimal power flow problem.
The pseudocode of the MVPA used in this paper is given in Algorithm 1. The MVPA starts by generating a random population of players in a given search space (Line 3 in Algorithm 1). Then for a certain number of fixtures, these players will compete collectively (in teams to win the league championship) and individually to win the trophy of the best player called in some sports like basketball the Most Valuable Player (MVP). This competition (lines 5 to 15 in Algorithm 1) will improve the skills of the players until the optimization problem at hand is solved. In other words, the solutions are improved iteratively by minimizing the objective function of Equation (5). Other steps are added to the MVPA to improve its performance like the application of greediness and application of elitism in addition to the diversification of players. More details about the MVPA can be found in [24].
B. Context description In the previous section, we have described the MVPA in its general form. The MVPA is used in this paper to solve the optimization problem of estimating the locations of target nodes formulated in the previous sections. To do so, some random locations (also called solutions and using the MVPA terminology called players and teams) are first generated in the initialization phase. Here it is worth mentioning that a solution is represented by a vector of x i and y i of all target nodes. Therefore, if there are N target nodes any solution is represented by a vector of 2 × N values. For instance, if there are three target nodes a solution is represented as follows: where: (x 1 , y 1 ), (x 2 , y 2 ), and (x 3 , y 3 ) are the coordinates of target node #1, targe node #2, and targe node #3, respectively. After that, these solutions move inside the search space of the problem in hand until the best locations are found (using the MVPA terminology this is achieved in the competition phase where the aim is to improve the solutions). Other numerical stages and phases are then performed on the solutions to improve them as aforesaid. This process is iterative, i.e., the process is repeated until a termination criterion is fulfilled (using the MVPA terminology the algorithm iterates MaxNFix times). In the end, the best solution called the MVP is given as the output. In our case, the best solution will be the best locations for all the target nodes. TEAM i = Select the team number i from the league's teams 7 TEAM j = Randomly select another team j from the league's teams where j = i if TEAM i wins against TEAM j 10 Check if there are players outside the search space 15 end for 16 Application of greediness 17 Application of elitism 18 Diversification 19 end for

Application and Results
To validate the proposed approach both simulation and actual test cases are investigated. Initially, four simulation-based cases are investigated and discussed. Then, the real-time experimental study is presented and discussed. Furthermore, a comparison study is carried out with the established metaheuristic techniques to proclaim the superior performance of the proposed technique. The comparisons are drawn with Biogeography-Based Optimization (BBO), Differential Evolution (DE), Particle Swarm Optimization (PSO), and Genetic Algorithm (GA). The four selected comparing algorithms are among the most wellknown optimization metaheuristics. PSO is a population-based stochastic optimization method developed by Eberhart and Kennedy in 1995. It is inspired by the social behavior of bird flocking or fish schooling [32,33]. GA is the most famous global optimization method, and it is based on Darwin's theory about evolution. DE was initially developed by Kenneth V. Price and R. Storn in 1995 while trying to solve the Chebyshev polynomial-fitting problem [34]. It stems from the genetic annealing algorithm which was also developed by Kenneth V. Price [35]. The BBO is an optimization algorithm inspired by biogeography [36].
Furthermore, a fifth optimization algorithm called Sequential Quadratic Programming (SQP) is also used for comparison. SQP is one of the most performant methods for the numerical solution of constrained nonlinear optimization problems. Unlike the other methods used in this paper (i.e., the metaheuristics) which are based on a random search, this method is deterministic and gives always the same results starting from the same point.

Case 1: Illustrative Case
This first case is an illustrative one used to explain the developed approach rather than to assess its performance.
Let us assume that we have three reference nodes located at (2,4), (8,8), and (2,8) along with five target nodes located at (4,2), (8,4), (4,6), (4,8), and (2,9) as shown in Figure 2. Using the proposed approach first the distances between reference nodes and target nodes are estimated as follows: methods used in this paper (i.e., the metaheuristics) which are based on a random search, this method is deterministic and gives always the same results starting from the same point.

Case 1: Illustrative Case
This first case is an illustrative one used to explain the developed approach rather than to assess its performance.
Then the MVPA solves the optimization problem to calculate ( 1 , 1 ) , ( 2 , 2 ), ( 3 , 3 ), ( 4 , 4 ), and ( 5 , 5 ) while minimizing the objective function given by Equation (7). The results (i.e., the coordinates ( , )) along with the mean squared errors (MSE) obtained using MVPA and the other five algorithms are tabulated in Table 1. It can be seen from this table that the MVPA along with the SQP were able to calculate the actual coordinates of all target nodes with an accuracy of less than 5 cm (tolerance on estimation error). However, all the remaining algorithms have found some difficulties and made some mistakes to calculate the coordinates of the target nodes as highlighted in soft red in Table 1. The evolution of the objective function is sketched in Figure 3. It can be seen from this figure that the MVPA has the best convergence among all other algorithms. As explained before, in this subsection we assume that these distances are estimated using RSSI.
Then the MVPA solves the optimization problem to calculate (x 1 , y 1 ), (x 2 , y 2 ), (x 3 , y 3 ), (x 4 , y 4 ), and (x 5 , y 5 ) while minimizing the objective function given by Equation (7). The results (i.e., the coordinates (x i , y i )) along with the mean squared errors (MSE) obtained using MVPA and the other five algorithms are tabulated in Table 1. It can be seen from this table that the MVPA along with the SQP were able to calculate the actual coordinates of all target nodes with an accuracy of less than 5 cm (tolerance on estimation error). However, all the remaining algorithms have found some difficulties and made some mistakes to calculate the coordinates of the target nodes as highlighted in soft red in Table 1. The evolution of the objective function is sketched in Figure 4. It can be seen from this figure that the MVPA has the best convergence among all other algorithms.

Case 2
In this case, 25 nodes are generated randomly in a given space of 50 m × 50 m among these 25 nodes, 5 nodes are considered as reference nodes (i.e., their location is known and the distances from these nodes to the remaining target nodes are also known). This case is represented in Figure 3, where red and blue circles represent reference and target nodes, respectively. In this case, 25 nodes are generated randomly in a given space of 50 m × 50 m among these 25 nodes, 5 nodes are considered as reference nodes (i.e., their location is known and the distances from these nodes to the remaining target nodes are also known). This case is represented in Figure 4, where red and blue circles represent reference and target nodes, respectively.  The obtained results along with the MSE for this case are tabulated in Table 2. From this table, the proposed approach using the MVPA was able to find all the locations of target nodes within a small range compared with the actual coordinates. However, the remaining algorithms have struggled to find the desired locations as highlighted in the table. From the curves plotted in Figure 5, it can be noticed that the MVPA converges to the lowest value of the objective function.      this table, the proposed approach using the MVPA was able to find all the locations of target nodes within a small range compared with the actual coordinates. However, the remaining algorithms have struggled to find the desired locations as highlighted in the table. From the curves plotted in Figure 5, it can be noticed that the MVPA converges to the lowest value of the objective function.  In this case, the number of nodes is increased to 50. Among these nodes, 10 nodes are considered reference nodes. This case is represented in Figure 6.

Case 3
In this case, the number of nodes is increased to 50. Among these nodes, 10 nodes are considered reference nodes. This case is represented in Figure 6. The obtained results along with the MSE for this case are tabulated in Table 3. It can be seen from this table that the MVPA was able to find the coordinates of all target points with good accuracy (less than 5 cm) except for two locations; at the same time, the remaining algorithms have struggled to do so. Moreover, the objective function minimized over the iterations is sketched in Figure 7.  The obtained results along with the MSE for this case are tabulated in Table 3. It can be seen from this table that the MVPA was able to find the coordinates of all target points with good accuracy (less than 5 cm) except for two locations; at the same time, the remaining algorithms have struggled to do so. Moreover, the objective function minimized over the iterations is sketched in Figure 7.

Case 4
In this case, the number of nodes is 50 nodes in a space of 100 m × 100 m. Among these nodes, 5 nodes only are considered as reference nodes. This case is represented in Figure 8. Compared to the previous case a smaller number of reference nodes and a wider space are considered here. This will test the efficiency and robustness of the MVPA.
This case, which is the hardest case to solve because of the low number of reference points and the high number of target points, is solved using MVPA and the results are tabulated in Table 4. It can be seen that the MVPA is by far the best algorithm in estimating the coordinates of target nodes compared to the remaining algorithms. It has estimated five nodes with less accuracy than 5 cm whereas other algorithms have shown low accuracy for most of the cases, or rather have wrongly estimated the location of a few nodes. The curves of the evolution of the objective function are sketched in Figure 9.

Case 4
In this case, the number of nodes is 50 nodes in a space of 100 m × 100 m. Among these nodes, 5 nodes only are considered as reference nodes. This case is represented in Figure 8. Compared to the previous case a smaller number of reference nodes and a wider space are considered here. This will test the efficiency and robustness of the MVPA.  Looking at Figures 5, 7 and 9, it can be noticed that although the BBO has a quick speed of convergence, the MVPA converges to a better final solution. This statement is This case, which is the hardest case to solve because of the low number of reference points and the high number of target points, is solved using MVPA and the results are tabulated in Table 4. It can be seen that the MVPA is by far the best algorithm in estimating the coordinates of target nodes compared to the remaining algorithms. It has estimated five nodes with less accuracy than 5 cm whereas other algorithms have shown low accuracy for most of the cases, or rather have wrongly estimated the location of a few nodes. The curves of the evolution of the objective function are sketched in Figure 9.   Looking at Figures 5, 7 and 9, it can be noticed that although the BBO has a quick speed of convergence, the MVPA converges to a better final solution. This statement is confirmed by the results tabulated in Tables 1-3 where the MSEs obtained using MVPA are lower than the ones obtained using all the comparing algorithms including the BBO in all cases.  Looking at Figures 5, 7 and 9, it can be noticed that although the BBO has a quick speed of convergence, the MVPA converges to a better final solution. This statement is confirmed by the results tabulated in Tables 1-3 where the MSEs obtained using MVPA are lower than the ones obtained using all the comparing algorithms including the BBO in all cases.

B. Real-Time Experimental Study
In [23] a real wireless network with three reference nodes and one target node (that can be moved to have multiple measurements) were studied. The target node and reference nodes are created using Zigbee series two modules, that were chosen for being less expensive and power-efficient [37,38]. As aforesaid, the reference nodes are acting as three routers whereas the target node acts as a device that receives signals from three transmitting devices (reference nodes) at any instant. A local coordinate system was established such that both x and y coordinates increase by half feet i.e., each integer in the coordinate system is representative of two feet (0.6096 m). The coordinates of the three reference nodes on a local coordinate system are (0,0), (6,0), and (3,8) for both indoor and outdoor settings as shown in [23].
The target node was relocated to ten independent positions as shown by the blue dots in Figure 10. The coordinates of these nodes along with the distances measured between reference nodes and target nodes, in meters, are tabulated in Table 5. The last column gives the average of the distances of the target node from all three nodes.    As aforesaid, to determine the coordinates of a real system, first, the distances are estimated from the measured RSSI using a nonlinear regression model and approximating that model on LNSM of Equation (3). Then the proposed MVPA is run to localize the coordinates of the local grid. RSSI is measured for each of the ten locations of the target node using range testing of the XCTU software (XCTU offers a convenient graphical interface where developers can deal with multiple Digi RF modules simultaneously. It is available in several platforms as an open-source application) [39]. The coordinates of the ten locations where the target node is kept are given in the first column of Table 5. At each location, ten values of RSSI are noted and their average RSSI is computed. The average RSSI of each location for both indoor and outdoor settings is shown in Figure 11. It can be noted that as the target node is moved far away from a specific reference node, the received RSSI is decreased. Moreover, the signal strength observed in the outdoor environment is less than that observed in the indoors. Based on these measurements, a nonlinear regression model is developed to estimate the distances from measured RSSI.
The relationship between RSSI and distance obtained using our nonlinear regression model for indoor experiments is expressed as follows: and therefore: 18.78 (12) The relationship between RSSI and distance obtained using our model for outdoor experiments is expressed as follows: and therefore: Comparing (10) and (12) with (3) reveals that the terms P t − P L (d 0 ) + X σ is equal to −23.671 (dBm) for the indoor case and −40.425 (dBm) for the outdoor case. However, the value of 10 n log 10 can be approximated to −18.78 (dBm) and −10.10 (dBm) for indoor and outdoor scenarios, respectively. Equations (10) and (12) are plotted in Figure 12a,b, respectively. It can be seen that the nonlinear curves approximate the best function such that the error function between the measured values and the approximated curve is minimized. −23.671 (dBm) for the indoor case and −40.425 (dBm) for the outdoor case. However, the value of 10 log 10 can be approximated to −18.78 (dBm) and −10.10 (dBm) for indoor and outdoor scenarios, respectively. Equations (10) and (12) are plotted in Figure 12a,b, respectively. It can be seen that the nonlinear curves approximate the best function such that the error function between the measured values and the approximated curve is minimized.

Coordinate Estimation Using MVPA
The distances estimated in the previous section for outdoor application are given to the MVPA algorithm to determine the coordinates of the target nodes. The results are displayed in Table 6. It can be seen from this table that the locations are well estimated, and the error is mainly due to the estimation of the distances from RSSI using the nonlinear regression model.

Coordinate Estimation Using MVPA
The distances estimated in the previous section for outdoor application are given to the MVPA algorithm to determine the coordinates of the target nodes. The results are displayed in Table 6. It can be seen from this table that the locations are well estimated, and the error is mainly due to the estimation of the distances from RSSI using the nonlinear regression model.   the geometrical coordinates in the local 2d space. The model is first implemented on four simulation-based test cases, where the results obtained from MVPA are compared with the contemporary techniques for benchmarking. Finally, the applicability of the proposed method is demonstrated on actual WSN in both indoor and outdoor environments. It is found that the proposed MVPA estimation method preceded by nonlinear regression has given good results for distance estimation and node localization. The approach is tested under rigorous simulation scenarios spanning a large area and equipped with a very low number of reference nodes. Even in the most constrained problem (case 4), the MSE in the x-coordinate of the proposed approach is 24 times less than the second-best approach (BBO). Similarly, for the y-coordinate, the MSE obtained with the proposed MVPA is 20 times less than that of the BBO approach, the second-best performer. Future directions can focus more on how to improve the estimation of distances based on RSSI using regression models or even Artificial Neural Networks (ANNs). Another future work can also be to test the developed approach for a network with obstacles like walls for example.