Localization Approach Based on Ray-Tracing Simulations and Fingerprinting Techniques for Indoor–Outdoor Scenarios

The increase of the technology related to radio localization and the exponential rise in the data traffic demanded requires a large number of base stations to be installed. This increase in the base stations density also causes a sharp rise in energy consumption of cellular networks. Consequently, energy saving and cost reduction is a significant factor for network operators in the development of future localization networks. In this paper, a localization method based on ray-tracing and fingerprinting techniques is presented. Simulation tools based on high frequencies are used to characterize the channel propagation and to obtain the ray-tracing data. Moreover, the fingerprinting technique requires a costly initial learning phase for cell fingerprint generation (radio-map). To estimate the localization of mobile stations, this paper compares power levels and delay between rays as cost function with different distance metrics. The experimental results show that greater accuracy can be obtained in the location process using the delay between rays as a cost function and the Mahalanobis distance as a metric instead of traditional methods based on power levels and the Euclidean distance. The proposed method appears well suited for localization systems applied to indoor and outdoor scenarios and avoids large and costly measurement campaigns.


Introduction
Localization is an important aspect of GPS-alternative positioning systems and has considerable importance in general communications areas [1]. The development of new radio access standards prompted the exploration of new techniques to improve the location accuracy, which is based on the signals available from the wireless devices that comprise these standards [2][3][4][5][6]. In this communication, the problem of the indoor location, which is based on the signals available in the wireless devices that comprise Wi-Fi and Wi-Max networks within the broadband wireless systems, is presented [7][8][9][10]. The location process employs a fingerprinting technique that operates with the relationship between the levels of power and/or relative delays between signals due to the multipath by reflections effect [11]. By comparing other techniques, such as the angle of arrival (AOA) or time of arrival (TOA), which presents several limitations due to multipath effects and non-line of sight (N-LOS), implementation of the fingerprinting technique is relatively easy [12]. In traditional indoor location systems based on Wi-Fi networks, the Euclidean distance between the radio frequency (RF) power levels of the received signals and the RF levels stored in a database (radio-map) is employed as a metric in the location process [13]. Due to an increase in new broadband networks (UWB), for example, Wi-Max, the exploration of new techniques is necessary to improve the location accuracy using alternative detection methods based on the relative delays of available signals in the observing points, which are 1.
Fingerprinting technique

Time of Arrival
In the technique of location by time of arrival (ToA), the distance between a mobile and an antenna is directly proportional to the propagation time [16]. To determine the position in 2D, the measurements made with the ToA technique must be made with respect to at least three reference points. By geometric calculations (technique known as lateration), the points of intersection in the ToA circles are obtained, the propagation time in one direction is measured and the distance between the transmitter and the receiving unit is calculated [17].

Time Difference of Arrival
The idea of the time difference of arrival (TDoA) technique is to determine the relative position of the mobile by examining the time difference in which the different signals reach the receiver instead of obtaining the absolute time of arrival. For each TDoA measurement, the transmitter must resolve a hyperboloid between the two units of measurement [18].

Angle of Arrival
The angle of arrival (AoA) technique, which is also referred to as the direction of arrival (DoA), uses multi-array antennas to determine the angle of arrival of the incoming signal from the mobile target via spatial diversity of the antennas [19,20].
In the AoA technique, the estimation of the target mobile can be obtained by intersecting pairs of line angles, which are each formed by a circle of radius from the base station to the target mobile [21,22].

Received Signal. Strength (RSS)
The RSS detection method is based on the loss of power that the signal experiences in the propagation medium as the power of the signal in the free space decays with the square of the distance. This method applies the received signal strength indicator (RSSI) parameter, which collects the power with which the signal from the target mobile to be located arrives at the receiving station [23][24][25]. The distance between the target mobile and the base stations can be calculated using the RSSI value considering the losses in the propagation. Due to the various shadows and multipath effects in indoor environments, path-loss models are not always available. In addition, the parameters of the model directly depend on the scenario. The accuracy of this technique can be increased using the RSSI measurements in areas around the base stations or multiple measurements from several base stations [26,27].

Hybrid. Techniques
Implementation of a hybrid system that combines AoA and ToA [28,29], in which ToA forms a circle to which it cuts a straight AoA line, is possible and offers greater accuracy and a shorter response time [30]. Another possible solution is to combine ToA and TDoA. With this system, the deficiencies of the TDoA technique in NLOS environments are improved [31]. AoA and TDoA have also been combined to improve accuracy and limit multipath effects, which enables locating only with two base stations via the intersection of the straight line and the hyperbola of the AoA and TDoA measurements [32,33]. Some techniques combine measures of time and power [34].

Fingerprinting Techniques
In recent years, location-based services (LBS) have proliferated; however, the main challenge is to determine the locations of mobile terminals within a certain accuracy.
As we have indicated, traditional localization techniques based on radio frequency are subjected to strong fluctuations in a signal due to the NLOS between transmitters-receivers and other causes, such as the multipath effect, which produces variations in the information of the parameter RSSI applied as a pattern in the localization process.
To avoid these signal fluctuations, an increase in the number of access points in the scenario is possible to minimize the cases of NLOS. This idea served as the basis for introducing the fingerprinting technique, which consists of comparing the available power levels in a set of points, as fingerprints, in known positions with those obtained in the target mobiles to be located when they are excited by the same antennas. The final position of the mobile is determined by assigning the coordinates of the fingerprint of the shortest distance in the scenario.
The fingerprinting technique is a deterministic localization method that is divided into two phases: 1.
Off-line phase: It constitutes the calibration phase in which a database or radio-map is generated with the power measurements obtained on the mesh fingerprinting when excited by the antennas of the environment.

2.
On-line phase: it constitutes the testing phase; a significant number of mobile stations are randomly located within the coverage area of the radio-map to obtain the corresponding power measurements when excited by the same antennas.
The vector with the values of the different RSSI measurements obtained in a certain position of the mesh is referred to as the location of the fingerprinting in this point. The estimation of the location is obtained by an algorithm that computes the distance between a fingerprint and a target. In most cases, the Euclidean distance, although other distance metrics can be employed (refer to Section 3.1), between the RSS values in the target mobiles (on-line phase) and the RSS values of each fingerprint stored in the radio-map (off-line phase) is computed. The coordinates associated with the fingerprint that provides the shortest distance metric are utilized as the final position for the target mobile ( Figure 1). The most common application of this method is the location in indoor environments [35][36][37]. In Ref. [38], the properties of the RSSI signal are analysed. In Ref. [39], a study is presented with the estimation of the expected error using this technique. In Ref. [40], a study of channel modelling is presented. In Ref. [41], an improvement of the algorithm is presented using interpolation with neighbouring fingerprints (K-NN).
For outdoor applications, we identify a classic study in Ref. [42]. Using fingerprinting outside the Wi-Max standard, a localization proposal is presented in Ref. [43]. Conversely, in Ref. [44], the fingerprinting technique is presented as a complement to the external location when the GPS signal is degraded or not available.
One of the largest problems with this technique used for outdoor locations is the large number of fingerprints that is needed in the off-line phase of the algorithm to obtain the required accuracy. In Refs. [45,46], clustering techniques are proposed to minimize this impact. In Ref. [47], hyperbolic techniques are employed to optimize the changes in the environment in the off-line phase.
As one of the main problems is the variability of the radio signal [48], learning techniques are proposed in Ref. [49] to predict the fluctuations in the signal. Similarly, Ref. [50] introduces neural networks that enable modelling of the channel.
Additionally, several studies expand the possibilities of the fingerprinting technique, which is primarily employed with Wi-Fi, to other standards and applications. In Ref. [51], a neural network on UWB is introduced. Other standards include ZIGBEE in Ref. [52] and RFID in Ref. [53]. In Ref. [54], the fingerprinting technique is combined with a Kalman filter to estimate trajectories in indoor environments.

Summary
This section presents a comparison of several figures of merit, such as, cost, precision, energy efficiency, and complexity, related with the techniques previously presented. As can be seen in Table  1, the fingerprinting algorithm combined with the hybrid detection method (in our study, power level and ray-delay) present the best results. The most common application of this method is the location in indoor environments [35][36][37]. In Ref. [38], the properties of the RSSI signal are analysed. In Ref. [39], a study is presented with the estimation of the expected error using this technique. In Ref. [40], a study of channel modelling is presented. In Ref. [41], an improvement of the algorithm is presented using interpolation with neighbouring fingerprints (K-NN).
For outdoor applications, we identify a classic study in Ref. [42]. Using fingerprinting outside the Wi-Max standard, a localization proposal is presented in Ref. [43]. Conversely, in Ref. [44], the fingerprinting technique is presented as a complement to the external location when the GPS signal is degraded or not available.
One of the largest problems with this technique used for outdoor locations is the large number of fingerprints that is needed in the off-line phase of the algorithm to obtain the required accuracy. In Refs. [45,46], clustering techniques are proposed to minimize this impact. In Ref. [47], hyperbolic techniques are employed to optimize the changes in the environment in the off-line phase.
As one of the main problems is the variability of the radio signal [48], learning techniques are proposed in Ref. [49] to predict the fluctuations in the signal. Similarly, Ref. [50] introduces neural networks that enable modelling of the channel.
Additionally, several studies expand the possibilities of the fingerprinting technique, which is primarily employed with Wi-Fi, to other standards and applications. In Ref. [51], a neural network on UWB is introduced. Other standards include ZIGBEE in Ref. [52] and RFID in Ref. [53]. In Ref. [54], the fingerprinting technique is combined with a Kalman filter to estimate trajectories in indoor environments.

Summary
This section presents a comparison of several figures of merit, such as, cost, precision, energy efficiency, and complexity, related with the techniques previously presented. As can be seen in Table 1, the fingerprinting algorithm combined with the hybrid detection method (in our study, power level and ray-delay) present the best results.

Novel Localization Techniques
In this section, the localization techniques developed in this study are presented. Although these techniques are based on the fingerprinting method, instead of using the RSSI information of the received power detected in each fingerprint, information about the relative delay between two rays due to multipath effects is employed. The final objective is to increase the accuracy of a location in hybrid indoor-outdoor scenarios, where existing localization solutions do not guarantee adequate accuracy or coverage [55][56][57].
First, different distance metrics that are proposed to match the off-line and on-line phases of the fingerprinting technique are introduced. Second, different detection techniques that are used as cost functions are detailed. Last, additional techniques that improve the localization accuracy are presented.

Distance Metrics
A distance metric is a key component that is utilized by the fingerprinting technique in the localization process [58]. Exploration of different similarity measures is important to determine the best distance metric that minimizes the positioning average error. Four metrics have been implemented to explore improving the location accuracy. The vector of sample F denotes the data from the fingerprints (radio-map), vector of sample T denotes the data from the target mobiles, and N is the number of antennas available in the scenario.
In the Euclidean distance Equation (1), the mobile station will have more confidence in the fingerprint radio map if the distance is smaller. A more moderate approach is obtained with the Manhattan distance Equation (2) using the sum of the absolute differences rather than their squares as the total measure of dissimilarity. In the Bray-Curtis Equation (3) distance, the numerator signifies the difference, and the denominator normalizes the difference. For the Mahalanobis distance Equation (4), the (F-T)' term denotes the (F-T) transpose vector, and the Cov term denotes the covariance matrix, where the retrieval performance is sensitive to the scenario topology. The idea is to find the coordinates of (x i , y i ) T that minimize the distance to (x i , y i ) F : Energies 2019, 12, 2943 6 of 23

Cost Function Based on RSSI
When the detection method employed in the fingerprinting technique is based on power levels, the distribution of RSSI is obtained from each fingerprint and each access point available in the scenario. Figure 2 shows a distribution of the power levels due to all fingerprints in a generic scenario. It shows the power level (in dBm units) in each fingerprint available in the radio-map. The level of power depends on the position of the fingerprint with respect to each AP, and hence, of the scenario. Lower values of power mean that a specific fingerprint is not seen by all APs. Conversely, higher values of power mean that the fingerprint is seen by most APs (an accumulative function is used to add to each fingerprint the values of power received by each AP). The map of power is unique, it is the information that identifies each fingerprint, and is used in the cost function represented by Equation (5).

Cost Function Based on RSSI
When the detection method employed in the fingerprinting technique is based on power levels, the distribution of RSSI is obtained from each fingerprint and each access point available in the scenario. Figure 2 shows a distribution of the power levels due to all fingerprints in a generic scenario. It shows the power level (in dBm units) in each fingerprint available in the radio-map. The level of power depends on the position of the fingerprint with respect to each AP, and hence, of the scenario. Lower values of power mean that a specific fingerprint is not seen by all APs. Conversely, higher values of power mean that the fingerprint is seen by most APs (an accumulative function is used to add to each fingerprint the values of power received by each AP). The map of power is unique, it is the information that identifies each fingerprint, and is used in the cost function represented by Equation (5). For example, using the Euclidean Distance as a metric, the cost function measures the distance based on power levels (in dBm units) between each fingerprint ( ( , ) ) and each target mobile ( ( , ) ) and for each antenna (N) available in the scenario Equation (5).

Cost Function Based on Relative Ray-Delay
When the detection method used in the fingerprinting technique is based on the relative raydelay, the Time Delay Ray (TDR) profile is obtained from each fingerprint and each access point available in the scenario. This detection method is based on the information provided by the raytracing due to the different effects: direct ray, reflected ray, diffracted ray, and any combination of them. Figure 3 shows an example of a ray-delay profile obtained in one fingerprint of the scenario. For example, using the Euclidean Distance as a metric, the cost function measures the distance based on power levels (in dBm units) between each fingerprint (RSS(x, y) F ) and each target mobile (RSS(x, y) T ) and for each antenna (N) available in the scenario Equation (5).

Cost Function Based on Relative Ray-Delay
When the detection method used in the fingerprinting technique is based on the relative ray-delay, the Time Delay Ray (TDR) profile is obtained from each fingerprint and each access point available in the scenario. This detection method is based on the information provided by the ray-tracing due to the different effects: direct ray, reflected ray, diffracted ray, and any combination of them. Figure 3 shows an example of a ray-delay profile obtained in one fingerprint of the scenario.
This figure represents the arrival time and the power of each ray due to the different effects. The first ray to arrive is the direct ray between the AP and the receiver, the others, that arrive more delayed, are due to reflections, diffractions, double reflections, etc.; produced by the different obstacles present in the scenario. The TDR is the delay of each ray with respect to the first or the direct ray.
If the Euclidean Distance is used as a metric, the cost function measures the distance based on the ray-tracing profile (in nanoseconds units) between each fingerprint (TDR(x, y) F ) and each target Energies 2019, 12, 2943 7 of 23 mobile (TDR(x, y) T ), considering E as the number of ray-tracing effects and N as the number of access points (AP) in the scenario Equation (6).
Energies 2019, 12, x FOR PEER REVIEW 7 of 23 Figure 3. Relative delays and levels between rays due to ray-tracing effects.
This figure represents the arrival time and the power of each ray due to the different effects. The first ray to arrive is the direct ray between the AP and the receiver, the others, that arrive more delayed, are due to reflections, diffractions, double reflections, etc.; produced by the different obstacles present in the scenario. The TDR is the delay of each ray with respect to the first or the direct ray.
If the Euclidean Distance is used as a metric, the cost function measures the distance based on the ray-tracing profile (in nanoseconds units) between each fingerprint ( ( , ) ) and each target mobile ( ( , ) ), considering E as the number of ray-tracing effects and N as the number of access points (AP) in the scenario Equation (6).

Hybrid. Detection
An alternative detection method consists in using both the power levels and the relative delays between two rays in a hybrid manner. The µ parameter was used to consider power levels or raydelays. By applying this method in the Euclidean distance metric (Equation (8)), if the value of µ = 0.25 is already set (it was set to 0.25 by experimentation), we perform a hybrid detection between power levels and relative ray-delays. In this case, more weight is assigned to detection by ray-delays in fingerprints whose power level is at least four times below the power level of the corresponding mobile with respect to the same access point. Equation (7) can be easily extended to the remaining metrics.
The localization technique has been implemented by a novel detection algorithm that combines the profile of the relative ray-delay obtained from ray-tracing due to multi-path effects with different distances employed as the metric. Figure 4 shows the pseudo-code of the algorithm used for hybrid detection. The algorithm first obtains the map of effects for both targets and fingerprints. Due to the multipath effects of the raytracing, only fingerprints and targets with the same map of effects (reflections, diffractions, and its combinations) are considered. If the map of effects is different, then the fingerprint is not considered

Hybrid. Detection
An alternative detection method consists in using both the power levels and the relative delays between two rays in a hybrid manner. The µ parameter was used to consider power levels or ray-delays. By applying this method in the Euclidean distance metric (Equation (8)), if the value of µ = 0.25 is already set (it was set to 0.25 by experimentation), we perform a hybrid detection between power levels and relative ray-delays. In this case, more weight is assigned to detection by ray-delays in fingerprints whose power level is at least four times below the power level of the corresponding mobile with respect to the same access point. Equation (7) can be easily extended to the remaining metrics.
The localization technique has been implemented by a novel detection algorithm that combines the profile of the relative ray-delay obtained from ray-tracing due to multi-path effects with different distances employed as the metric. Figure 4 shows the pseudo-code of the algorithm used for hybrid detection. The algorithm first obtains the map of effects for both targets and fingerprints. Due to the multipath effects of the ray-tracing, only fingerprints and targets with the same map of effects (reflections, diffractions, and its combinations) are considered. If the map of effects is different, then the fingerprint is not considered and the next is processed. When a fingerprint and a target have the same map of effects, and for all the antennas used in the simulations, the algorithm computes the vector of metrics from a specific target to each fingerprint. If the algorithm reaches the last fingerprint, then it finds the minimal distance between the target and all the fingerprints and uses the coordinates of that fingerprint as position of the target. Finally, the algorithm repeats the process for the rest of the targets. target to each fingerprint. If the algorithm reaches the last fingerprint, then it finds the minimal distance between the target and all the fingerprints and uses the coordinates of that fingerprint as position of the target. Finally, the algorithm repeats the process for the rest of the targets.

Interpolation
As an interpolation technique, we propose the K-Nearest Neighbours (K-NN) algorithm that considers the nearest k neighbours, instead of a single neighbour by assigning the majority category of the set of K neighbours. The interpolation technique is applied in the on-line phase of the fingerprinting technique by seeking the k-fingerprints that are closest to the target mobile based on the error information obtained when applying the corresponding distance metric.
In addition, a pre-filter removes incoherent values from the radiomap when a specific transmitter is not seen at all (out of range or defective). In these cases, an interpolation with neighbouring values is applied. Figure 5 shows the concept of interpolation over four random fingerprints, and Equation (8) represents the mathematical concept, where N is the number of fingerprints employed in the interpolation process, and is the value of the distance between the mobile to be located and the j-

Interpolation
As an interpolation technique, we propose the K-Nearest Neighbours (K-NN) algorithm that considers the nearest k neighbours, instead of a single neighbour by assigning the majority category of the set of K neighbours. The interpolation technique is applied in the on-line phase of the fingerprinting technique by seeking the k-fingerprints that are closest to the target mobile based on the error information obtained when applying the corresponding distance metric.
In addition, a pre-filter removes incoherent values from the radiomap when a specific transmitter is not seen at all (out of range or defective). In these cases, an interpolation with neighbouring values is applied. Figure 5 shows the concept of interpolation over four random fingerprints, and Equation (8) represents the mathematical concept, where N is the number of fingerprints employed in the interpolation process, and X j is the value of the distance between the mobile to be located and the Energies 2019, 12, 2943 9 of 23 j-fingerprint. OldPosition refers to the (x, y, x) coordinates of the target before the interpolation, and NewPosition refers to the new target coordinates after the interpolation.
Energies 2019, 12, x FOR PEER REVIEW 9 of 23 fingerprint. OldPosition refers to the (x, y, x) coordinates of the target before the interpolation, and NewPosition refers to the new target coordinates after the interpolation.

Ray-Tracing Theory
Powerful electromagnetic simulation tools, which are capable of accurately reproducing the values of radioelectric signals that would be obtained in the real case, have been developed. NewFasant [59] is a tool that simulates antennas on board platforms, such as satellites and aircrafts, and radio wave propagation in urban and indoor scenarios [60][61][62]. This software has been developed by the Electromagnetic Computational group of the Alcala University and is based on asymptotic techniques, such as physical optics, combined with the Physical Theory of Diffraction (PO/PTD) and Geometrical Optics (GO) with the Uniform Theory of Diffraction (UTD) [63,64].
The NewFasant programme can be applied to different electromagnetic problems: study of the propagation in outdoor/indoor environments, mobile communications, radar cross-section of complex structures, electromagnetic compatibility, analysis and design of antennas, and radiation patterns of antennas on board complex structures.
Given a source point (transmitter antenna), the ray-tracing technique determines the number of rays that arise to a given observation point. To achieve this goal, possible reflections and diffractions in the environment are considered. In addition, a detailed description of the environment is important for a precise calculation of the rays involved in the propagation model. The geometrical information uses Non-Uniform Rational Bezier Splines (NURBS) surfaces. To obtain the ray-tracing paths between a source and a destination, two steps exists: 1. Obtain all points that define the ray-path (reflection and diffraction points). 2. Discard the rays occluded by any part of the geometry to perform the shadowing test. Figure 6 shows an example of ray-tracing in a complex scenario. This area is an area of Terminal 4 of the Adolfo-Suarez Barajas Airport in Madrid. A parked airplane is placed beside a finger, an antenna is placed in front of the aircraft, and an observation point is placed in front of the antenna. The NewFasant software computes all rays generated from the antenna to the receiver.
In Figure 6, the antenna is the red dot. The observation point of black colour is the point that can be seen in front of the plane. The colour of the rays depends on the effect: yellow is the double reflection and the other colours correspond to other effects (reflection, reflection-diffraction, etc.).

Ray-Tracing Theory
Powerful electromagnetic simulation tools, which are capable of accurately reproducing the values of radioelectric signals that would be obtained in the real case, have been developed. NewFasant [59] is a tool that simulates antennas on board platforms, such as satellites and aircrafts, and radio wave propagation in urban and indoor scenarios [60][61][62]. This software has been developed by the Electromagnetic Computational group of the Alcala University and is based on asymptotic techniques, such as physical optics, combined with the Physical Theory of Diffraction (PO/PTD) and Geometrical Optics (GO) with the Uniform Theory of Diffraction (UTD) [63,64].
The NewFasant programme can be applied to different electromagnetic problems: study of the propagation in outdoor/indoor environments, mobile communications, radar cross-section of complex structures, electromagnetic compatibility, analysis and design of antennas, and radiation patterns of antennas on board complex structures.
Given a source point (transmitter antenna), the ray-tracing technique determines the number of rays that arise to a given observation point. To achieve this goal, possible reflections and diffractions in the environment are considered. In addition, a detailed description of the environment is important for a precise calculation of the rays involved in the propagation model. The geometrical information uses Non-Uniform Rational Bezier Splines (NURBS) surfaces. To obtain the ray-tracing paths between a source and a destination, two steps exists: 1.
Obtain all points that define the ray-path (reflection and diffraction points).

2.
Discard the rays occluded by any part of the geometry to perform the shadowing test. Figure 6 shows an example of ray-tracing in a complex scenario. This area is an area of Terminal 4 of the Adolfo-Suarez Barajas Airport in Madrid. A parked airplane is placed beside a finger, an antenna is placed in front of the aircraft, and an observation point is placed in front of the antenna. The NewFasant software computes all rays generated from the antenna to the receiver.
In Figure 6, the antenna is the red dot. The observation point of black colour is the point that can be seen in front of the plane. The colour of the rays depends on the effect: yellow is the double reflection and the other colours correspond to other effects (reflection, reflection-diffraction, etc.). NewFasant provides associated information about each ray, such as the power level at the observation point (RSS), time of arrival (ToA) and direction of arrival (TDoA). Different ray-tracing effects (direct ray, reflected ray, and diffracted ray) and multiple combinations of them, such as the double reflections effect and reflection-diffraction effect, can be taken into account (Figure 7). With this information provided by NewFasant, the profile of the relative delays between rays (as shown in Figure 3) can be obtained, and the localization cost function can be computed according to expression 7. The computational cost associated with ray tracing is very high but speeding algorithms, such as Angular Z-buffer [65], can considerably reduce the computational time. This reduction enables the analysis of an excessive number of observation points in complex structures, such as an airport with parked aircrafts in a short period. Table 2 shows the computational cost obtained for different configurations of the number of antennas and number of reflections. NewFasant provides associated information about each ray, such as the power level at the observation point (RSS), time of arrival (ToA) and direction of arrival (TDoA). Different ray-tracing effects (direct ray, reflected ray, and diffracted ray) and multiple combinations of them, such as the double reflections effect and reflection-diffraction effect, can be taken into account (Figure 7). With this information provided by NewFasant, the profile of the relative delays between rays (as shown in Figure 3) can be obtained, and the localization cost function can be computed according to expression 7. NewFasant provides associated information about each ray, such as the power level at the observation point (RSS), time of arrival (ToA) and direction of arrival (TDoA). Different ray-tracing effects (direct ray, reflected ray, and diffracted ray) and multiple combinations of them, such as the double reflections effect and reflection-diffraction effect, can be taken into account (Figure 7). With this information provided by NewFasant, the profile of the relative delays between rays (as shown in Figure 3) can be obtained, and the localization cost function can be computed according to expression 7. The computational cost associated with ray tracing is very high but speeding algorithms, such as Angular Z-buffer [65], can considerably reduce the computational time. This reduction enables the analysis of an excessive number of observation points in complex structures, such as an airport with parked aircrafts in a short period. Table 2 shows the computational cost obtained for different configurations of the number of antennas and number of reflections. The computational cost associated with ray tracing is very high but speeding algorithms, such as Angular Z-buffer [65], can considerably reduce the computational time. This reduction enables the analysis of an excessive number of observation points in complex structures, such as an airport with parked aircrafts in a short period. Table 2 shows the computational cost obtained for different configurations of the number of antennas and number of reflections.

Validations and Results
The aim is to simulate various localization scenarios using the techniques described here, using powerful and precise ray tracing tools. First, we simulate typical indoor scenarios. Second, we conduct outdoor simulations in more complex environments.
The performance of any localization algorithm depends on the quality of the scenario under testing. For this reason, in each scenario, a complex CAD model of plane facets for the geometrical description of the environment was used to study the fast fading caused by multipath propagation and the interference between the different paths. Because the accuracy of the results depends on network geometry [66,67], different granularities (grid size) were used in the simulations. To evaluate the performance of each algorithm in the different tested scenarios, two statistical indicators, which will be applied to make comparisons, have been established. These indicators are the total average error (Av Error ), as an indicator of first order, and the typical deviation (Typ Dev ), as a second-order indicator. The results have been analysed in the MATLAB environment.

Indoor Scenarios
The indoor scenario that is analysed corresponds to a real section of the Polytechnic building in Madrid, Spain (Figure 8).

Validations and Results
The aim is to simulate various localization scenarios using the techniques described here, using powerful and precise ray tracing tools. First, we simulate typical indoor scenarios. Second, we conduct outdoor simulations in more complex environments.
The performance of any localization algorithm depends on the quality of the scenario under testing. For this reason, in each scenario, a complex CAD model of plane facets for the geometrical description of the environment was used to study the fast fading caused by multipath propagation and the interference between the different paths. Because the accuracy of the results depends on network geometry [66,67], different granularities (grid size) were used in the simulations. To evaluate the performance of each algorithm in the different tested scenarios, two statistical indicators, which will be applied to make comparisons, have been established. These indicators are the total average error ( ), as an indicator of first order, and the typical deviation ( ), as a second-order indicator. The results have been analysed in the MATLAB environment.

Indoor Scenarios
The indoor scenario that is analysed corresponds to a real section of the Polytechnic building in Madrid, Spain (Figure 8).  Indoor simulations are focused on the granularity of the scenario and the frequency. The goal is to evaluate the impact of the detection method (power, ray-delays and hybrid) for these variations. The Euclidean distance was employed as a metric. The results are shown in Figures 10 and 11.  Indoor simulations are focused on the granularity of the scenario and the frequency. The goal is to evaluate the impact of the detection method (power, ray-delays and hybrid) for these variations. The Euclidean distance was employed as a metric. The results are shown in Figures 10 and 11. Indoor simulations are focused on the granularity of the scenario and the frequency. The goal is to evaluate the impact of the detection method (power, ray-delays and hybrid) for these variations. The Euclidean distance was employed as a metric. The results are shown in Figures 10 and 11.  From Figure 10, we observe that when the granularity of the fingerprints used in the off-line phase (radio-map) increases, the error committed is reduced. This reduction is independent of the detection method used as a cost function in the localization algorithm, but this reduction of the error is more noticeable when the method used is by ray-delays or hybridization. On the other hand, the reduction obtained by using power levels is not significant. Figure 11 shows the same conclusions, but in this case, we also observe that the average error increases with the frequency. This is because the frequency is more than double (2.4 GHz versus 5.2 GHz) when comparing the Figure 11 with the Figure 10, or what is the same, the wavelength is less than half (0.057 m versus 0.125 m), what it means that the average error for the same grid resolution is increased (the power average error for a grid size of 36 × 36 m at 2.4 GHz was 1.98, similar to the 2.08 power average error for a grid size of 72 × 72 m at 5.2 GHz). In addition, the loss due to attenuation of the radio signal increases with the square of the power, which implies having a quarter of the power received with respect to the lower frequency band and contributing to the increase of the mentioned average error. Table 2 shows information about the error and deviation values.  From Figure 10, we observe that when the granularity of the fingerprints used in the off-line phase (radio-map) increases, the error committed is reduced. This reduction is independent of the detection method used as a cost function in the localization algorithm, but this reduction of the error is more noticeable when the method used is by ray-delays or hybridization. On the other hand, the reduction obtained by using power levels is not significant. Figure 11 shows the same conclusions, but in this case, we also observe that the average error increases with the frequency. This is because the frequency is more than double (2.4 GHz versus 5.2 GHz) when comparing the Figure 11 with the Figure 10, or what is the same, the wavelength is less than half (0.057 m versus 0.125 m), what it means that the average error for the same grid resolution is increased (the power average error for a grid size of 36 × 36 m at 2.4 GHz was 1.98, similar to the 2.08 power average error for a grid size of 72 × 72 m at 5.2 GHz). In addition, the loss due to attenuation of the radio signal increases with the square of the power, which implies having a quarter of the power received with respect to the lower frequency band and contributing to the increase of the mentioned average error. Table 3 shows information about the error and deviation values. As it can be seen, the detection method based on power levels presents more error in the localization than using hybrid or delay detection methods. The pure delay detection method reaches the best results, because hybrid detection uses power levels information in the cost function.
The impact of frequency is not very relevant. For the same granularity, it has no impact on the delay detection method but improves the accuracy when it increases for power and hybrid methods.
The last two columns reflect the average error rate, which is improved by comparing the hybrid detection versus power detection and detection by ray-delays against power detection.
According to these results, the hybrid detection obtains an improvement in the average error of 71.28% for a mesh of 72 × 72 m at 2.4 GHz, 75% for a mesh of 72 × 72 m at 5.

Outdoor Scenarios
The analysed outdoor geometry corresponds to a real section of parking area at the Adolfo-Suarez Madrid-Barajas International Airport ( Figure 12). As it can be seen, the detection method based on power levels presents more error in the localization than using hybrid or delay detection methods. The pure delay detection method reaches the best results, because hybrid detection uses power levels information in the cost function.
The impact of frequency is not very relevant. For the same granularity, it has no impact on the delay detection method but improves the accuracy when it increases for power and hybrid methods.
The last two columns reflect the average error rate, which is improved by comparing the hybrid detection versus power detection and detection by ray-delays against power detection.
According to these results, the hybrid detection obtains an improvement in the average error of 71.28% for a mesh of 72 × 72 m at 2.4 GHz, 75% for a mesh of 72 × 72 m at 5.

Outdoor Scenarios
The analysed outdoor geometry corresponds to a real section of parking area at the Adolfo-Suarez Madrid-Barajas International Airport ( Figure 12).
As part of the airport infrastructure, we propose enhancing the airport surveillance by providing several wireless access points in each boarding finger, which would be required to obtain the maximum coverage. Three different scenarios were analysed. In all cases, to estimate the accuracy of the algorithm, 100 target mobiles were randomly located: • Case 1: Grid size of 12 × 145 m In the first scenario, the simulation area was 12 × 145 m for a grid resolution (distance between fingerprints) of 1 m. In this area, 1740 fingerprints and 5 APs at 2.4 GHz were employed ( Figure 13).

•
Case 2: Grid size of 80 × 80 m In our second scenario, the simulation area was 80 × 80 m for a grid resolution (distance between fingerprints) of 1 m. In this area, 6400 fingerprints and 5 APs at 2.4 GHz were utilized ( Figure 14). In this final scenario, the simulation area was 200 × 120 me for a grid resolution (distance between fingerprints) of 1 m. In this area, 24,000 fingerprints and 5 APs at 2.4 GHz were employed ( Figure  15). As part of the airport infrastructure, we propose enhancing the airport surveillance by providing several wireless access points in each boarding finger, which would be required to obtain the maximum coverage.
Three different scenarios were analysed. In all cases, to estimate the accuracy of the algorithm, 100 target mobiles were randomly located: • Case 1: Grid size of 12 × 145 m In the first scenario, the simulation area was 12 × 145 m for a grid resolution (distance between fingerprints) of 1 m. In this area, 1740 fingerprints and 5 APs at 2.4 GHz were employed ( Figure 13).   The results obtained from the outdoor simulations scenarios that were previously described are shown. In this case, four distance metrics (Euclidean, Manhattan, Bray-Curtis and Mahalanobis) and two fingerprinting detection methods (power levels and relative ray-delay between rays) were compared. Figures 16-18 show the simulation results for all cases.
From Figure 16, we observe that if the relative delay between rays is used as a detection method, the average error decreases when comparing with the power level detection method. Moreover, if   The results obtained from the outdoor simulations scenarios that were previously described are shown. In this case, four distance metrics (Euclidean, Manhattan, Bray-Curtis and Mahalanobis) and two fingerprinting detection methods (power levels and relative ray-delay between rays) were compared. Figures 16-18 show the simulation results for all cases.
From Figure 16, we observe that if the relative delay between rays is used as a detection method, In this final scenario, the simulation area was 200 × 120 me for a grid resolution (distance between fingerprints) of 1 m. In this area, 24,000 fingerprints and 5 APs at 2.4 GHz were employed ( Figure 15).
The results obtained from the outdoor simulations scenarios that were previously described are shown. In this case, four distance metrics (Euclidean, Manhattan, Bray-Curtis and Mahalanobis) and two fingerprinting detection methods (power levels and relative ray-delay between rays) were compared. Figures 16-18 show the simulation results for all cases.  The results obtained from the outdoor simulations scenarios that were previously described are shown. In this case, four distance metrics (Euclidean, Manhattan, Bray-Curtis and Mahalanobis) and two fingerprinting detection methods (power levels and relative ray-delay between rays) were compared. Figures 16-18 show the simulation results for all cases.
From Figure 16, we observe that if the relative delay between rays is used as a detection method, the average error decreases when comparing with the power level detection method. Moreover, if Mahalanobis distance is selected as a metric, we obtain the best results in terms of localization error reduction. Figure 17 shows similar conclusions, but in this case, the average error decreases as the granularity of the radio map increases. From Figure 18, we can obtain similar conclusions. Table 3 shows detailed information about the mean error values obtained in the simulations.      From Figure 16, we observe that if the relative delay between rays is used as a detection method, the average error decreases when comparing with the power level detection method. Moreover, if Mahalanobis distance is selected as a metric, we obtain the best results in terms of localization error reduction. Figure 17 shows similar conclusions, but in this case, the average error decreases as the granularity of the radio map increases. From Figure 18, we can obtain similar conclusions. Table 4 shows detailed information about the mean error values obtained in the simulations. In Table 4, we can analyse the numeric values of mean error obtained after simulating each scenario. According to Figures 16-18, the first two columns correspond with the first scenario (grid size of 12 × 145 m), the next two columns with the second scenario (80 × 80 m), and the last two columns correspond with the third scenario (200 × 120 m). In each scenario, we represent the mean error obtained using two different detection methods in the cost function of the localization algorithm, power and ray-delays. We observe how the relative delay between rays used as a detection method provides lower mean error than using power levels.
As we confirmed for indoor scenarios, from outdoor scenarios we observe that the relative ray-delay detection method also provides the best localization results for all analysed cases, while the size of the grid is not decisive. Mahalanobis distance metric improves the accuracy, compared with Euclidean, Manhattan or Bray-Curtis, because the relations between all samples used in the scenario are represented in its covariance matrix.
It can also be observed that the location errors obtained in the two scenarios, indoor and outdoor, are similar. In both cases there are multiple obstacles, so much information is obtained about ray-tracing and therefore the TDR factor in each fingerprint is distinctive for each of them.

Discussion, Assumptions and Further Work
Using a ray-tracing dataset, the main multipath effects are a result of the built environment and other static objects, all of which are captured in the modelling. The dynamic effects from mobile scatterers can be addressed by identifying these components via identifying the Doppler shift and eliminating them when comparing against the ray-tracing data. This issue will be the subject of further research in this project.
A description of the impact of electromagnetic noise on our simulations at the results level is not available. In an airport, for instance, many users who operate phones, other purposes of WIFIs, and other uncontrolled signals share the same spectrum (such as Bluetooth). To expect our system to have excellent performance even in these contexts, a more detailed noised scenario will be modelled in future research.
Reflective objects (aircrafts) and a more complex environment were considered in the analysis. However, a more detailed environment, which refers to the density of the multipath, will be further implemented to obtain more multipath components with increased path delay.
The scheme is not dependent on the delay values but a relationship between delay and other parameters, such as the BS location at which these parameters are recorded and the frequency, were analysed. Thus, the purpose of training (radio map) is to establish a relationship among the supporting vectors.
Referring to mobile scatterers in the environment, the sensitivity of the approach with mobile scatterers is not currently known and requires further study; thus, this issue would be the subject of future research. Possibilities exist to mitigate the effects of mobile scatterers by identifying these components via identifying the Doppler shift and eliminating when comparing against the ray-tracing data. An analogy exists with radar processing in removing clutter in this case. Thus, further processing using similar techniques to remove multipath components as a result of moving scatterers will be the subject of further research. In our study, ultra-wide band (UWB) systems that can resolve individual multipath effects are assumed.
In the same manner, a similar assumption for AOA estimation with multi-antenna systems was supplied. Massive MIMO systems have a large number of APs that are assumed to be capable of super-resolution AOA estimation. Both these assumptions are related to current and emerging 5G technologies and will be a part of further studies.
Time delay estimators, including bandwidth and SNR, will be required. Super-res algorithms can be used to achieve timing resolutions below the reciprocal of the bandwidth.
The method of localization proposed in this study is being evaluated against traditional techniques (TOA and TDOA) with the same framework and data. Thus, any limitation in the accuracy of the ray-tracing impacts are relatively similar since they employ the same test data in terms of the time delay measurements. Note that only the first arriving paths are applied in the methodology.
Not modelling the error due to bandwidth limitations may be the correct approach, which enables us to isolate the errors due to the estimators and directly compare their performance. Including additional errors due to the assumed bandwidth limitation may mask the difference in performance or make the results bandwidth-specific.
In a second phase, we intend to make simulations with random mobile objects. In any case, small objects and people will present reflections of very low power, so we expect that main reflections will be due to large static objects.
Finally, because validation was only done on a simulation approach, no experiments have been performed. Real experiments will be obtained through a pre-processing step supported by DSPs (Digital Signal Processor) to model the channel through an IFFT (Inverse Fast Fourier Transform) to obtain the impulse response and the multipath effects from the power spectrum [68], and a post-processing phase where to implement our algorithms after collecting data from real APs nodes. In order to obtain the relative delays with enough resolution in the time domain, these APs must be Ultra-Wide Band (UWB) devices because of their great bandwidth [69,70].

Conclusions
In this study, alternative detection methods that can be employed in the fingerprinting technique for a mobile location have been presented. These methods facilitate the analysis and design of indoor/outdoor location services. Using the NewFasant simulation tool, we obtain indoor/outdoor coverage by a complete 3D model combined with powerful ray-tracing techniques. This approach is very useful for avoiding complex and expensive measure campaigns and performing the off-line phase of the fingerprinting technique in a quick and accurate manner.
The location algorithm computes the Euclidean distance and other proposed metrics between the power levels and ray-delay samples available in unknown positions of a mobile and each fingerprint stored in the database. This study applies the multipath effects due to ray-tracing as a competitive advantage. Thus, a comparative study has been conducted between three detection methods that utilize different information as a cost function: power levels, relative ray delays and a hybrid method. All algorithms were validated in indoor and outdoor scenarios using different granularities (grid size) and frequencies.
As a result of this study, we can conclude that the relative ray-delay detection technique, which presents better results in the indoor/outdoor location process than the power detection technique, is extensively applied in traditional Wi-Fi systems (based on the 802.11 standard). When information about certain fingerprints introduces ambiguities or errors in the localization using the powers levels, the hybrid detection method appears to be a suitable alternative. Due to the different effects caused by the ray-tracing, the proposed method uses the information about the relative ray-delay of the signals available in the fingerprints.
With respect to the metric, we conclude that conventional distance metrics, such as Euclidean or Manhattan, may not obtain the best location accuracy. The Mahalanobis distance metric improves the location accuracy when the geometry has irregularities that can been modelled among measures by the covariance matrix.
We can affirm that frequency does not have a significant impact on the accuracy of the results and that the grid size improves the results. Thus, the off-line phase of the fingerprinting technique can be carefully calibrated to obtain an optimized radio-map.