ANFIS-based Indoor localization and Tracking in Wireless Sensor Networking

: Localizing wireless sensor networks poses a persistent challenge in accurately determining sensor node locations based on known anchor node positions, especially when nodes move between different locations. Conventional techniques like Trilateration, relying on Received Signal Strength Indicators (RSSIs), frequently employed in Wireless Sensor Networks (WSNs), serve the purpose of localizing and tracking moving targets. However, the inherent nonlinear relationship between RSSI and distance often leads to substantial errors in localization estimations. This paper introduces an innovative approach by proposing the utilization of an Adaptive Neural Fuzzy Inference System (ANFIS) as a departure from the conventional RSSI-based method. This ANFIS-based approach aims to initially estimate the locations of single moving targets in a 2-D WSN setup. Subsequently, these initial estimates undergo further refinement within an Unscented Kalman Filter (UKF). The results demonstrate the superior performance of the proposed algorithms in tracking targets, showcasing high accuracy levels within a few centimeters is evident from the mean localization errors for standard RSSI, ANFIS, and ANFIS+UKF, that the ANFIS+UKF framework can handle real-time target tracking issues in WSN utilizing RSSI (5.657, 0.805, and 0.068, respectively). By contrast, the proposed method offers an impressive improvement of 98.797% over the standard RSSI method.


INTRODUCTION
WSNs are comprised of hundreds, or thousands of wireless nodes scattered across a geographic area in an ad hoc manner (Burhanuddin et al, 2018).These nodes work together to detect different kinds of physical events, and the collected data is processed to yield the desired results.A crucial role of sensor networks is to gather and transmit data to a destination, making it imperative to accurately determine the location of this data (Shalaby et al, 2017).This vital information can be acquired through localization techniques in wireless sensor networks (WSNs), which involve methods to pinpoint the precise positions of sensor nodes.
Indoor localization presents distinct challenges compared to outdoor GPS-based methods.Classic GPS technique is quite helpful when used outdoors, but because structures and other obstructions block radio signals, it is useless indoors, with high cost, and energy consumption (Molla et al, 2023;Din et al, 2018).The existing localization methods can be divided into three main categories: range-free (Khelifi et al, 2019), rangebased (Alrajeh et al, 2013)), and AI-based (Ali et al, 2021).Calculating the angles or distances between an unknown node and the network's known nodes is crucial when trying to pinpoint where it is to other nodes.This approach called the range-based method (Gharghan et al, 2016), such as angle of arrival, time of arrival, time difference of arrival (Ge et al, 2019), received signal strength indicator (RSSI) (Le et al, 2020), and global positioning system (GPS) ( Piras and Cina, 2010).incontrast, The distances or angles between nodes do not need to be estimated when using range-free localization techniques.The range-free method offers cost-effectiveness but suffers from reduced accuracy in estimating where sensor nodes are located.On another hand, localization approaches for numerous applications divided into ANN, PSO, Fuzzy Logic, ANN-PSO, and GA are a few examples of AI-based using received signal strength (RSS) data to forecast the location of a target node inside a WSN.
Despite being often employed for target localization and tracking, RSSI field measurements are susceptible to high levels of noise and fluctuations, particularly in challenging indoor RF environments.Significant localization mistakes are caused by the difficulties faced by RSS-based L&T systems, which include indoor interference, multipath fading, noise, and different obstructions (Ingabire et al, 2021).Due to its simplicity of use, trilateration, a straightforward method for target L&T, is extensively used.However, because of the ambiguities in RSSI measurements or the dynamic nature of interior surroundings, it frequently has low localization accuracy.The erratic nature of RSS measurements frequently has an impact on the precision of trilateration (Molla et al, 2023).Contrarily, ANFIS algorithms offer advantages over trilateration in more dynamic indoor environments with reflections, interference, and obstructions which is more accurate and reliable target localization.As the gathered RSSI are nonlinear data, it is appropriate for our purpose.The wellknown ANFIS method for evolving self-organizing neurofuzzy systems has several useful applications.Therefore, in this research, we adopted the use of ANFIS to overcome the weaknesses of the traditional method.After obtaining the estimated coordinates, enhance these location approximations by employing the Unscented Kalman filter (UKF) to attain enhanced results.
The key outcome of the research is an ANFIS-based L&T model was proposed to address the dynamicity issue in both indoor environments and RSSI measurements.At the same RSSI measurements, it was contrasted with a trilaterationbased L&T method.Here, three and six RSSI measurements, respectively, were input into the proposed ANFIS-based method and the trilateration.In addition, the target location estimates obtained from the proposed ANFIS scheme were refined further by passing them through a UKF.The suggested frameworks were assessed in comparison to trilateration and plain ANFIS-based methods.The ANFIS + UKF-based method is the most advanced of these giving the target location estimate with the least amount of error.

II. RELATED WORKS
The localization of sensor nodes in WSNs has recently attracted a lot of concern in academic research.An ANFISusing robot was created.This robot utilized an extended Kalman filter (EKF) to adjust the RSSI values of a ZigBee wireless protocol and was able to locate itself in a dangerous outside environment.Its localization accuracy ranged from 2 to 10 meters based on its location to the stationary sensor nodes Palipana et al, (2012).WSN objects were located in an indoor environment using a fuzzy inference system approach based on fingerprints and a multi-nearest neighbor scheme (Oussalah et al, 2015).The technique reduced computation costs while increasing localization accuracy.This study's overall localization accuracy was 0.43 m.
According to Abdou et al (2016), to improve indoor localization accuracy, the author developed a Support Vector Regression (SVR) and Affinity propagation indoor localization system that takes into account the direction of mobile devices.To decrease the computational cost, affinity propagation was used.To prevent selecting the incorrect cluster during the online matching stage, many matching strategies were employed.Additionally, the strong APs approach was utilized to lessen weak APs and their effects and to lower the size of the training input space.The experimental results have demonstrated that SVR improves indoor localization accuracy due to its capacity to generalize, particularly with a limited number of training data.The disadvantage of Affinity Propagation is that you are not required to predetermine the number of clusters, even if this can occasionally be useful.This may also be a drawback because the method may generate an unanticipated or unsatisfactory number of clusters.
Gharghan et al (2016), the author's proposed two soft computing localization methods for WSNs in this research.
The two methods, ANN and ANFIS concentrate on a rangebased localization approach that measures the RSSI from the three ZigBee anchor nodes that are dispersed across the track cycling field.Calculating the distance is the aim of soft computing techniques.The indoor area is 36*34 and 780 samples of the three anchor nodes' RSSI values were gathered is utilized for training, testing, and validating ANFIS to calculate the distance to the coach.A total of 780 samples of the three anchor nodes' RSSI values were collected where the average localization error produced with ANFIS is 1.42 m.
Due to the instability of RSS, the positioning system based on it is susceptible to interference from the outside world, so the authors provide a better indoor localization method based on the GRNN and RSSI to address this issue.An enhanced average filter is suggested in the raw data processing module to stabilize and reliably handle the raw data.The positioning result is then revised using an enhanced weighted centroid localization algorithm (IWCLA) based on maximum likelihood estimation (MLE).To achieve better application and higher positioning accuracy, an enhanced GRNN localization method is suggested, taking into account the dynamic and complicated interior environment (Xu et al, 2016).
In the study (Jondhale et al, 2016), to tackle the complexities posed by dynamic RF channels and the nonlinear system dynamics inherent in indoor Localization and Tracking (L&T) of mobile targets, this study introduces an improved architecture referred to as the Trilateration Centroid Generalized Regression Neural Network (TCGRNN).Solving the challenge of indoor L&T for mobile targets necessitates addressing the issues arising from dynamic RF channels and nonlinear system dynamics.During simulations, the parameter representing the normal random variable in the LNSM path loss model is systematically varied from 3 to 9 dB in 3 dB increments to simulate the uncertainty associated with RSSI measurement noise.Despite the good results, the calculations were complicated by finding the coordinates using the Trilateration and Centroid methods and adding them to the RSSI as inputs to GRNN.
In lieu of the traditional RSSI-based approach, this study Tariq and Al-Mejibli, (2023) suggested a fusion technique termed PSO-GRNN to increase the sensor nodes' capacity to predict location and target tracking with better accuracy.The RSSI values can be used by the GRNN method as start data to determine the target node's location and trace it.The spread constant (σ) is a crucial part of the GRNN design.The ideal GRNN spread constant value is found using the PSO approach.The hybrid tracking algorithm PSO-GRNN beat the traditional LNSM approach and yielded remarkable outcomes.By comparing the suggested approach to the traditional RSSI, a significant 87.58% gain can be achieved.

A. Log-Normal Shadowing Model
The RSSI measurements are primarily a result of specific propagation models.Presently, the most widely used propagation models include the free space model, the two-ray ground reflection model, and the log-normal shadowing model (LNSM) (Naseem et al, 2018).The free space and two-ray models offer deterministic predictions of received power based on distance, assuming an ideal circular relationship between the transmitter and receiver.In practice, received power at a given distance is subject to random variability due to multipath fading effects.Given its consideration of fading effects, the LNSM has gained broader acceptance within the research community (Mohammed, 2016).This study adopts the LNSM for its analysis.= ( ) − 10 ( / ) + (1) Represents the RSSI calculated at the transmitter's reference distance to the receiver node, which is set at a distance of 1 meter (d0).The variable is the path-loss exponent, which is described as the attenuation factor, while Xσ stands for a common random variable used to measure the impact of shadowing effects.The attenuation factor values usually range from 1 to 3 in outdoor settings and from 3 to 5 indoors (Zheng et al, 2016;Wojcicki et al, 2021;Bose et al, 2007).

B. ANFIS
Jang (1993), created ANFIS, a useful AI method that mimics human thought to solve ambiguous problems.Numerous studies (Gharghan et al, 2018) have used ANFIS to estimate node positions or distances within wireless sensor networks (WSNs).It functions as a simple data-learning technique by using fuzzy logic to convert inputs from linked neural network processing units into the intended output.Fuzzy inference and artificial neural networks (ANN) are combined to create ANFIS, which can handle complex nonlinear problems in a single framework.It operates as a proficient approximator by interpreting information between input and output variables as a series of if-then rules.ANFIS has been used in many previous studies ( Palipana et al, 2012;Oussalah et al, 2015;Gharghan et al, 2018) to calculate node positions or distances within WSNs.
Adaptable and fixed node types contain multiple nodes characterized by specific functions.Make up the network architecture used by ANFIS.The network's effectiveness mostly depends on these nodes' adjustable parameters.The network's learning rules call for modifying some parameters to reduce the difference between the expected and actual output.Three inputs and one output make up the ANFIS design, which is depicted in Figure 1 (Gharghan et al, 2018).Two rules that utilize the Takagi-Sugeno fuzzy inference approach can be examined to clarify the structure of the ANFIS: (3) In this context, 1, 2, 1, 2, 1, and 2 represent fuzzy sets related to the inputs , , and .The parameters , , , and are associated with the defuzzification layer.The output of the ANFIS model is indicated as f.The parameters in the IF part are termed precedent or premise parameters, while those in the THEN part is recognized as consequential parameters.Layer 1 (premise) and Layer 4 (consequent part) comprise adaptable nodes, while Layer 2 (product) and Layer 3 (normalization) consist of fixed nodes.Illustrated in Figure 1, the ANFIS model comprises five layers involving three inputs and one output, outlined in the subsequent steps (Gharghan et al, 2018).
Layer 1 (Fuzzification): Each node in this layer functions as an adaptive layer, producing membership grades according to the input vectors.The difference between two sigmoids ( ) is selected and set up twice for each input in this study.Eqn.(4) represents the output of this layer.= ( ) (4) Layer 2 (Product): The nodes that are associated with certain fuzzy rules in the Sugeno style make up the product layer.Nodes in this layer receive inputs from the associated fuzzification neurons and determine the rule they represent firing strength.As a result, this mechanism affects the output that neurons in layer three produce.= = ∏ ( ) (5) Where the output for any neuron i in the product layer is , and the layer input from layer 1 is represented by ( ).Layer 3 (Normalization): known as the normalization layer, is responsible for receiving input from all neurons in the product layer.This layer assesses the weighted firing strength of a specified rule.Within this layer, the output of a neuron is determined as such: In this context, signifies the input received and produced by the neuron from layer 2 to neuron layer 3.Meanwhile, represents the output of layer 3.
Layer 4 (Defuzzification): comprises adaptable nodes responsible for defuzzification.Neurons within this layer evaluate the weighted, calculated value of a particular rule as follows: Layer 5 (Summation): This layer's output is the model's overall output, which combines the outputs of all the previous layers.
= = ∑ (8) The learning process in ANFIS involves adjusting its parameters through a two-step learning algorithm that includes forward and backward passes.ANFIS utilizes a hybrid approach, combining gradient descent (GD) with least square (LSE) estimator techniques.Through this iterative process, the model trains its parameters to minimize the disparities between the desired and actual output.
During the forward pass of the learning algorithm, the outputs of nodes progress sequentially from Layer 1 to Layer 4. In Layer 4, consequent parameters are calculated using the least squares method.In the subsequent backward pass, error signals propagate backward, moving from the output layer back to the input layer.Within this phase, the GD algorithm is employed to adjust the premise parameters.This iterative process enables the neural network to learn and refine its parameter values to better align with the presented training data.

C. Learning ANFIS
In our study, we used the ANFIS editor toolbox in MATLAB.Before generating any output based on a set of RSSI values, the ANFIS needs training with a set of RSSI values along with their corresponding x-y coordinates, denoting the exact position of the target.We divided this dataset into two subsets: one for x coordinates along with their respective RSSI values and another for y coordinates with their corresponding RSSI values.These subsets were then separately provided to two distinct ANFIS systems.This separation was necessary as a single trained ANFIS system cannot produce two outputs, such as x and y coordinates, for a set of three RSSI values.Furthermore, we further divided the RSSI value dataset into training and validation datasets.These two sets of values were separately inputted into the system for training purposes and to verify and validate their accuracy.
The ANFIS model was initially trained using 880 sets of RSSI measurements along with their target coordinates x-y in an offline phase (Refer to Figure 2).After training, the model can process any new set of real-time RSSI measurements to predict the corresponding target location in an online

Symbol
Parameter] Value Table 1.The parameters of ANFIS and the LNSM.

Table 2. Comparison of localization error estimates with different ANFIS membership function numbers and types.
estimation phase.During this process, the ANFIS architecture scans the training dataset to find similar RSSI input vectors that closely resemble the new input.By identifying the closest match from the training set, the model determines the estimated target location based on that resemblance.

IV. SYSTEM DESIGN
The study examines a 100 m × 100 m Wireless Sensor Network (WSN) area with six anchor nodes (ANs) and one mobile target, as shown in Figure 3.The proposed ANFIS and ANFIS+UKF location estimate models require data from any three of the six deployed ANs to pinpoint the location of the moving target, while all ANs contributed measurements for the trilateration-based localization scheme.RSSI measurements gathered from the six ANs were labelled as RSSI1 to RSSI6.Essential simulation parameters for this investigation are outlined in Table 1.
It is possible to formulate the input vector Hi for the suggested ANFIS-based algorithms as follows each target location throughout its mobility at a certain time instance i: A variety of state mobility models have been previously detailed in the literature.In this study, we have selected a model that assumes constant velocity.The subsequent equations presented in this study delineate the motion of the mobile target.
For every input, three or five membership functions ( ) were used in the ANFIS training and testing stages (Model 1 and Model 2).Furthermore, eight different membership functions were taken into consideration within ANFIS: trapezoidal ( ), triangular ( ), Gaussian curve ( ), bell-shaped ( ), two-sided Gaussian curve ( 2pishaped curve ( ), product of two sigmoid ( ), and difference of two sigmoid ( ), to preserve consistency for the training and testing datasets, each simulation ran for 100 epochs.The goal of using a variety of membership function types and numbers was to find the best configurations that provide the lowest localization estimation errors.
The average localization error and root mean square error (RMSE), as shown below in Eqns.( 12) and ( 13), were the performance evaluation parameters employed in this work (Tariq and Al-Mejibli, 2023) Where E= − , and is the actual and estimation coordinate value for unknown nodes, respectively, and n represents the quantity of RSSI samples.
V. RESULTS AND DISCUSSIONS It makes sense that location estimates from different ANFIS-based models, using different types and numbers of membership functions would exhibit different levels of performance.Thus, it becomes a fascinating endeavour to study how various membership functions and their numbers affect indoor target localization in the suggested ANFIS-based framework.In this study, target localization was assessed using the suggested ANFIS-based model through 16 independent simulations carried out with the same system configuration.Table 2 provides a full summary of the simulation results.The study used several indicators to discriminate between the actual target trajectory and the position estimates derived from trilateration, ANFIS, and ANFIS+UKF.To evaluate the localization accuracy of the proposed ANFIS-based schemes and trilateration, using Eqn.( 13) and using Eqn.(12).The target trajectory in the specified indoor environment is represented in Figure 3, together with the estimated trajectories obtained from all the localization methods that were taken into consideration.RSSI (5.657,0.805,and 0.068,respectively).By contrast, the proposed method offers an impressive improvement of 98.797% over the standard RSSI method.(See Table 3).

Figure 2 :
Figure 2: Block Diagram of the proposed algorithm.

Figure 3 :
Figure 3: The real and predicted values obtained from Traditional RSSI, ANFIS, and ANFIS+UKF techniques.
The online localization phase uses three membership functions and the difference of two sigmoid types ( ) to process data within the same network parameters as the training phase.The target routes inferred by the ANFIS, ANFIS+UKF, and standard RSSI techniques are shown in Figure 3. Red squares indicate the true target position and black circles indicate anchor nodes.The estimated positions obtained from RSSI and ANFIS at a specific time instance i are indicated by the black and blue plus signs, respectively.The simulation results show that in terms of localization and tracking efficiency, the ANFIS+UKF-derived technique is superior to RSSI.The predicted positions of the ANFIS+UKF approach are indicated by the green triangle.It is evident from the mean localization errors for ANFIS, ANFIS+UKF, and standard RSSI that the ANFIS+UKF framework can handle real-time target tracking issues in WSN utilizing

Figures 4
Figures 4 and 5 illustrate the comparison of localization errors concerning x and y estimations utilizing the aforementioned techniques.Figure 6 demonstrates the average performance for both x and y estimates by considering the average of errors in these estimations.

Figure 7 :
Figure 7: CDF of the average location errors based on the RSSI, ANFIS, and ANFIS+UKF.

Table 3 . The algorithms' errors. Algorithm Avg. Localizatio n Error (M) Avg. RMSE in x-y Estimation(M)
Table2lists the predicted error for different types and numbers of ANFIS membership functions for indoor localization.The best localization error that results from selecting three membership functions for every input.Furthermore, the difference between two sigmoid types () is preferable to the other membership function.