{'fraction_non_alphanumeric': 0.02070358837485172, 'fraction_numerical': 0.004633748517200474, 'mean_word_length': 4.9861311439032505, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Proposal for a Localization System for an IoT Ecosystem

: In the last decade, positioning using wireless signals has gained a lot of attention since it could open new opportunities for service providers. Localization is important, especially in indoor environments, where the widely used global navigation satellite systems (GNSS) signals suffer from high signal attenuation and multipath propagation, resulting in poor accuracy or a loss of positioning service. Moreover, in an Internet of things (IoT) environment, the implementation of GNSS receivers into devices may result in higher demands on battery capacity, as well as increased cost of the hardware itself. Therefore, alternative localization systems that are based on wireless signals for the communication of IoT devices are gaining a lot of attention. In this paper, we provide a design of an IoT localization system, which consists of multiple localization modules that can be utilized for the positioning of IoT devices that are connected thru various wireless technologies. The proposed system can currently perform localization based on received signals from LoRaWAN, ZigBee, Wi-Fi, UWB and cellular technologies. The implemented pedestrian dead reckoning algorithm can process the data measured by a mobile device that is equipped with inertial sensors to construct a radio map and thus help with the deployment of the positioning services based on a ﬁngerprinting approach.


Introduction
In recent years, a lot of research has been focused on novel smart solutions for smarter cities, smart transport and Industry 4.0 [1,2]. Most of these solutions rely on a vast amount of data that are collected by sensors and devices connected to the Internet, which is sometimes referred to as the Internet of everything (IoE) or the Internet of things (IoT) [3]. The connection of a large number of sensors and devices can be realized using heterogeneous wireless technologies since IoT devices may have different requirements on bandwidth and energy consumption [4,5].
There is a large number of different IoT applications and services; however, some of them require positioning information that is linked to the data from devices in order to be meaningful for the service provided to the user.
The positioning information can be easily extracted from the global navigation satellite systems (GNSS) receiver; however, the implementation of such a receiver into the device not only increases its price but also has a negative impact on energy consumption. Moreover, if devices are deployed in dense urban or indoor environments, both the availability and reliability of GNSS-based positioning are very low due to signal blockage and strong multipath propagation [6]. Therefore, alternative solutions for position estimation have been intensively studied in the last couple of years.
Various technologies have attracted attention in the area of position estimation, including camera-based systems with image processing [7], measurements of magnetic field fluctuations [8], the use of inertial measurements units implemented in devices [9] and the use of radio signals [10][11][12]. The advantage of using radio signals for positioning is

•
Proposal of an integrated localization system that is capable of handling positioning requests from IoT nodes in both indoor and outdoor environments. • Proposal of a system that supports a multi-RAT approach and automatically selects the most suitable positioning module for the given IoT device based on parameters of localization data that are delivered to the positioning system.
The operation of the system was tested in both indoor and outdoor environments using multiple RAT technologies as a proof of concept. The rest of the paper is organized as follows: related work in multi-RAT positioning systems and implemented algorithms are reviewed in Section 2; in Section 3, the integrated localization system for IoT is proposed; and in Section 4, the localization results that were achieved for heterogeneous wireless technologies are presented.

IoT Localization Systems
With the recent deployment of IoT solutions in smart cities and smart building applications, the localization of IoT nodes has attracted a lot of attention within the research community. The majority of research was oriented toward localization using dedicated IoT technologies, including LoRaWAN, Sigfox and NB-IoT. However, these technologies allow for only limited localization accuracy due to the constraints of a narrow band and low-power design of the IoT communication technologies.
Most of the localization systems for IoT environments were based on data from a single communication technology, for example, RFID [14], WiFi [15], or LoRaWAN [16]. Among all the narrow-band IoT technologies, the LoRaWAN seems to attract the most attention [17], which may be due to the relatively easy deployment of gateways in the unlicensed frequency band.
On the other hand, the use of the multi-RAT approach to build IoT devices was proposed to improve localization accuracy [18]. This will allow for the device to use multiple narrowband IoT technologies, namely, LoRaWAN and NB-IoT, to transfer the data; moreover, it can also help to improve the energy efficiency of IoT devices [19]. On the other hand, the cost of IoT devices will increase due to the variety of hardware modules that are required by multiple implemented communication technologies.
Bonafini et al. proposed a multi-RAT approach with the integration of GPS, UWB and LoRaWAN modules into IoT devices [4] to improve the localization accuracy. However, this approach also requires the deployment of UWB anchors in the areas where the position should be estimated. The system estimates the position using measurements from the UWB, which are communicated to the server using LoRaWAN. Therefore, IoT devices support multiple RAT technologies; however, position estimates are provided by a single technology.
In [20], a localization approach for devices with single-chip multi-RAT implementation was proposed. The advantage is that the cost of the devices is not increased significantly. The proposed approach can use data from multiple implemented narrow-band technologies to estimate the position of IoT nodes using fingerprinting, proximity or ranging. However, the system only deals with low-power narrow-band wireless technologies.
The benefit of multi-RAT technology for localization was also highlighted in [21], where architecture for indoor localization using multiple wireless technologies, i.e., ZigBee and UWB, was described. The system can achieve reasonably good accuracy in indoor environments. However, deployment costs are high since both UWB and ZigBee technologies have a limited range. Moreover, their large-scale deployment in outdoor environments would not be cost-effective.
The overview of localization systems is presented in Table 1, which shows the supported wireless technologies, the performance of the localization systems presented by the authors in their studies and an overview of wireless technologies supported by the localization systems.  From the overview of recent work in multi-RAT localization presented above, it is clear that multi-RAT localization is of high interest in the research community. However, most of the previously proposed approaches are not designed to provide positioning estimates for heterogeneous technologies, including cellular and narrow-band technologies, as well as multiple technologies with a limited range, which are widely used for communication in an indoor environment.
In our work, we proposed an integrated localization system, which is capable of handling positioning requests from IoT nodes in both indoor and outdoor environments using heterogeneous technologies. The proposed solution supports a multi-RAT approach and automatically selects the most suitable positioning module for the given IoT device based on the parameters of the localization data that are delivered to the positioning system.

Implemented Algorithms
Since we deal with multi-RAT localization in the proposed integrated localization system, it was necessary to implement multiple localization algorithms in order to provide position estimation that was suitable for each given wireless technology. The selection of the localization solution is based on qualitative parameters of the data provided by the node or the network, as well as on the data stored in the databases of the localization server.
The databases on the localization server store information about the reference node positions, the parameters required for the position estimation using lateration and information about the radio map for technologies that are used in combination with fingerprinting localization approach. The implemented algorithms can be divided into three categories: lateration, fingerprinting and pedestrian dead reckoning (PDR).

Distance-Based-Lateration Algorithms
The implemented localization algorithms based on lateration can be divided into trilateration and multilateration. The main difference is in the number of reference nodes that are used to calculate the position estimates. In the trilateration algorithms, only three reference nodes are used, which is the minimum number that is required for position estimation in 2D space.
The implemented trilateration algorithm is a geometry-based algorithm that estimates the position of the mobile node based on the intersection of circles that are given by the position of the reference node and distance estimated from signal parameters, i.e., received signal strength (RSS) and time of arrival (ToA). The position estimate can be calculated using the following system of equations: where [P x , P y ] represents the estimated 2D coordinates of the mobile node, [x i , y i ] represents the coordinates of the ith reference node (i.e., ith transmitter) and d i represents the estimated distance between the mobile node and the ith reference node [24].
On the other hand, in a multilateration algorithm, the number of reference nodes can be higher, which can help to improve the positioning accuracy. We implemented a simple min-max localization algorithm. The min-max algorithm approximates the circles with squares and thus has significantly reduced computation complexity. Moreover, improved localization accuracy can be achieved due to the fact that more reference nodes can be used to estimate the position. The min-max localization algorithm estimates the area with the position of the mobile node as follows: In this case, the coordinates of the mobile node can be estimated as the center of the square area defined by the algorithm.

Distance-Free-Fingerprinting Algorithms
The fingerprinting localization algorithms represent the second category implemented in the system. The advantage of these algorithms is that there is no need for information about reference nodes in the area, i.e., the position of transmitters, transmitted power, etc. Therefore, signals from transmitters that already exist in the area can be used; this is referred to as signals of opportunity.
On the other hand, the drawback of the fingerprinting localization approach is the need for calibration measurements that need to be stored in the radio map. The radio map consists of measurements that are performed at known positions and are stored at the localization server. The position estimation is performed by comparison of the radio map with signals that are detected by the mobile device.
The fingerprinting localization can be considered to be a classification problem. Lately, a large number of classification methods based on machine learning approaches have emerged; however, not all of these solutions are scalable since the training phase of the algorithm needs to be performed after a new localization area is included. More traditionally used are deterministic algorithms, which are based on the assumption that signal parameters can be directly linked to the position of the mobile node. Therefore, it is possible to estimate the position of the mobile node by comparing the signal characteristics.
In our system, we implemented deterministic algorithms based on the nearest neighbor (NN) and rank-based fingerprinting (RBF) algorithms. The position of the mobile device can be estimated using the following equation: where P x , P y is the position estimate, ω j is the weight assigned to the jth reference point (calibration point) in the radio map database, γ j represents the position of the jth reference point in the radio map database and n is the number of reference points stored in the radio map.
In the traditional NN-based algorithms, the weights are assigned based on a comparison of the RSS samples measured by the mobile node with RSS samples stored in the radio map. The most traditional approach is to use the Euclidean distance to calculate the difference between the samples and use the inverted value of the distance as a weight. However, it was shown that other distance measures can be successfully used to estimate a position.
In the case when the estimator takes into account just the position with the highest weight and sets other weights to 0, the algorithm is referred to as the NN algorithm. In the case when positions with the k highest weights are used to estimate the position, we refer to this as the weighted k-nearest neighbor (WKNN) algorithm.
It is expected that the WKNN algorithm will provide better positioning results since it allows for estimating a position anywhere in the localization area, while the NN algorithm only allows for position estimates at discrete points where calibration measurements were performed. Thus, the NN algorithm has a lower resolution and higher systematic error, which can be reduced by increasing the map density. On the other hand, to increase the map density, it is necessary to perform more calibration measurements, which increases the cost of the system deployment.
The implemented RBF localization algorithm does not use a direct comparison of signal parameters like it does in NN-based algorithms. However, a comparison of rank vectors is used to set the weights for individual reference points. This approach helps to reduce the impact of device heterogeneity. The heterogeneity of mobile devices has a negative impact on the accuracy of fingerprinting localization systems since heterogeneous device parameters (i.e., parameters of antenna, chipset, software, etc.) can affect RSS values that are reported by the device to the localization system.

Inertial Positioning-Dead Reckoning Algorithms
The last implemented localization algorithm was based on pedestrian dead reckoning (PDR) and can be used to estimate the position of the mobile node using data from the implemented inertial measurement unit (IMU). Lately, a lot of research has been oriented toward positioning using data from low-cost IMUs [25]. Previously, we described the implementation of PDR with a particle filter [26], as well as its possible use for dynamic radio map creation [27], which is the main reason for the implementation of PDR into the integrated localization system. Using this method, it is possible to extend the coverage area of the implemented fingerprinting localization in the system without time-consuming and labor-intensive measurements.
The implemented particle filter PDR (PF-PDR) algorithm uses data from the IMU to estimate the path of the mobile node, which is attached to a moving person. The processes in the implemented PDR algorithm can be divided into three steps. In the first step, the algorithm for the step detection is used; in the second step, the heading of the movement is estimated; and in the third step, information about the area is used by the particle filter to improve the accuracy of the position estimates. Figure 1 shows the block diagram of the PF-PDR algorithm that was implemented in the integrated localization system. The second task of the PDR algorithm is to estimate the heading of the movement. This can be performed by integrating the angular velocity provided by the gyroscope and can be defined as follows:

Map informaiton Particle filter
Step detection

Heading angle estimation
Position estimation As mentioned above, the first task of PF-PDR is to detect the steps of the person carrying the mobile node [28]. The step detection is performed based on the data from the accelerometer that is implemented in the IMU. In this process, it is important to accurately estimate the vertical component of the acceleration since it includes significant patterns for step detection. However, this may not be a trivial task when low-cost accelerometers are used. In such a situation, it is possible to use the norm of the acceleration given by: where g is gravitational acceleration; a x , a y and a z stand for the measured acceleration in the x-, yand z-axes of the accelerometer, respectively [29]. When the norm is used for step detection, multiple approaches are possible, including peak detection, frequency analysis and zero-crossing detection. In our implementation, we used the zero-crossing detection method to achieve high accuracy of the PDR algorithm. However, we used a fixed step length of 0.75 m in our approach, which gave us reasonably accurate results thanks to the implemented particle filter; the results of the initial testing were presented in [26].
The second task of the PDR algorithm is to estimate the heading of the movement. This can be performed by integrating the angular velocity provided by the gyroscope and can be defined as follows: where ω x , ω y and ω z are the angular rotations measured for each axis in the body frame of the IMU. Then, the direction cosine matrix C, which represents the attitude of the IMU in 3D space, can be calculated as: cos θ cos Ψ cos θ sin Ψ − sin θ sin ϕ sin θ cos Ψ − cos ϕ sin Ψ sin ϕ sin θ sin Ψ + cos ϕ cos Ψ sin ϕ cos θ cos ϕ sin θ cos Ψ + sin ϕ sin Ψ cos ϕ sin θ sin Ψ − sin ϕ sin Ψ cos ϕ cos θ   , (6) where ϕ, θ and Ψ represent the Euler angles, e.g., the roll, pitch and yaw. In order to track the orientation of the IMU, the rotation matrix has to be regularly updated. The updated matrix C(t + ∆t) is given as follows: where ∆t is the sampling interval, I is a 3-by-3 identity matrix, σ = |∆tω b | and Then, it is possible to calculate the yaw angle Ψ from the updated rotation matrix, which represents the heading of the node: In this case, only the elements C 2,1 and C 1,1 are used to extract information about the yaw angle, i.e., the heading of the node in the x-y plane. This can be done because the PDR algorithm works in 2D space; therefore, pitch and roll angles are not considered.
The last step of the PDR algorithm is to estimate the position of the mobile node using: where P x k and P y k represent the position in the x-axis and y-axis in a step k, which, in our case, represent the inputs to the particle filter; l k stands for the step length, i.e., the distance traveled by the device; and Ψ k represents the heading angle of step k. Bayesian filters are widely used to achieve the optimal combination of data from multiple sources; however, these filters only work well with linear models. Unfortunately, the localization process is nonlinear, thus, an approximation of the Bayesian filter has to be implemented. One of the most popular approximations is a particle filter, where posterior distribution is approximated using particles. In the case of position estimation, the positions of particles can be combined with the information about the area in the map-matching process [30].
The operation of the particle filter can be divided into prediction and update steps. During the prediction step, a certain number of particles N with positions x (p) , where p = 1, . . . , N, is generated from the initial distribution in a time step t: where y 1...t−1 stands for the measurements in the time step before t. It is assumed that the states (i.e., positions of particles) establish a Markov model, where the current state x t depends solely on the previous state x t−1 .
During the update phase, it is necessary to recalculate the weights according to the likelihood of observation; then, the weights are defined as follows: where w p i represents the updated weights, w p i−1 stands for the weights from the previous time step, p y t x t−1 stands for the state transition density and q x (p) t x (p) t−1 , y i represents the importance density. After each update, the weights have to be normalized. During the operation of the particle filters, just a few particles will be assigned all calculated weights. Over time, the propagation of particles with low weights has a negative impact on the posterior distribution, which is commonly referred to as degradation. In order to avoid degradation, resampling of the particles is required [31]. The implemented solution performed resampling when the number of active particles was less than N/5.

Proposal of Integrated Localization System
The integrated localization system for the IoT ecosystem was developed in order to provide positioning services for mobile nodes that are connected to the IoT. The system was proposed to provide location estimates for nodes using heterogeneous communication technologies for their operation in the IoT environment. Since IoT devices can currently be connected via cellular networks, including GSM and LTE; low-power wide-area networks (LPWAN), i.e., LoRaWAN and Sigfox; personal area wireless networks, such as ZigBee, Bluetooth and UWB; or local area wireless networks represented by Wi-Fi.
Each of these wireless technologies requires a different approach for position estimation due to differences in the deployment of transmitters in the area, capabilities of the devices or parameters of the physical channel, i.e., bandwidth, attenuation and noise characteristics. Therefore, the proposed localization system has to automatically choose from the available localization algorithms.
The architecture of the proposed integrated localization system is depicted in Figure 2. The integrated location server (ILS) is the gateway to the localization services from the IoT network. The ILS provides access to the localization service and handles the positioning data that is collected either by the network or by the IoT device, which does not have prior information about the position. Localization requests are processed by the integrated decision algorithm, which takes into account the parameters of measurements and additional information stored in the database server in order to select an optimal localization algorithm. The information about the estimated position is provided to a location-based service. The mobile device does not have information about the position estimates unless it is required by the location-based service.
Electronics 2021, 10, x FOR PEER REVIEW 9 of 19 The architecture of the proposed integrated localization system is depicted in Figure  2. The integrated location server (ILS) is the gateway to the localization services from the IoT network. The ILS provides access to the localization service and handles the positioning data that is collected either by the network or by the IoT device, which does not have prior information about the position. Localization requests are processed by the integrated decision algorithm, which takes into account the parameters of measurements and additional information stored in the database server in order to select an optimal localization algorithm. The information about the estimated position is provided to a location-based service. The mobile device does not have information about the position estimates unless it is required by the location-based service. compare data about transmitters from IoT server and radio map 12: if transmitters are in radio map database then 13: check radio map density and parameters 14: select suitable algorithm and 15: estimate position using fingerprinting algorithm 16: end if The pseudocode of the proposed integrated decision algorithm is shown in Algorithm 1. The algorithm handles the data that is received by the IoT server and decides what localization solution should be used based on the received data.
In the first step, the algorithm analyzes the data that is received by the IoT server and extracts information that will be used to calculate the position estimate. In the case when the received data includes data from IMU measurements and measurements from wireless networks, the data are processed by the PF-PDR algorithm. The algorithm estimates the track of the mobile node and links RSS measurements from the wireless network to the estimated position. The implementation does not have to run in real time; therefore, the IMU data can be sent with a delay. We currently do not assume the use of IMU data for real-time device localization, but only for the generation of a dynamic radio map. The RSS measurements with associated positions can then be used to update the radio map that is used for localization. The radio map update is performed by the map fusion algorithm, which will add the data to the radio map and perform radio map optimization, i.e., the merging of reference points in the radio map in a case when the physical distance or RSS values are very similar. More details on the PF-PDR algorithm and map fusion algorithm can be found in [27].
On the other hand, if the data that is received by the IoT server include only measurements from wireless technology, the algorithm will first check whether the data are from the UWB system. Localization using UWB signals results in high accuracy position estimates thanks to accurate signal propagation time measurements; therefore, UWB localization is preferred over other wireless technologies.
When the received data do not include IMU nor UWB measurements, the algorithm continues with checking whether the received data are compatible with the radio map. This step is required to estimate the position using the fingerprinting localization framework since this approach can provide better results in a multipath environment compared to lateration algorithms.

Algorithm 1 Integrated decision algorithm
INPUT: data received by the IoT server, radio map and reference nodes database OUTPUT: position estimate 1: begin 2: extract data form IoT server for localization 3: if data from both IMU and wireless technology were received then 4: run PF-PDR algorithm to estimate position of mobile node 5: run map fusion algorithm to update radio map database 6: else if data only from wireless technology are received then 7: if data from UWB is received then 8: use lateration algorithm to estimate position 9: else 10: load data from radio map database 11: compare data about transmitters from IoT server and radio map 12: if transmitters are in radio map database then 13 In the case when there is overlap between the data received by the server and data stored in the radio map, the fingerprinting positioning algorithm is selected based on the properties of the radio map. One of the main issues is that the density of the reference points in the radio map affects the performance of the algorithms. Therefore, in the case when the radio map density is low, a simple NN algorithm is chosen. In contrast, with an increased density of reference points, it seems to be more suitable to use algorithms that estimate the position using multiple reference points, such as WKNN or RBF algorithms. Out of these two algorithms, RBF is preferred since it can provide better localization accuracy when heterogeneous devices are used in the system [32]. The fingerprinting localization is preferred over lateration-based localization based on the assumption that fingerprinting localization can provide more stable and accurate results in harsh propagation conditions since its accuracy depends mainly on the radio map density and the number of transmitters in the area. On the other hand, the performance of lateration may be affected by the accuracy of the propagation model and the geometry, i.e., the placement of reference nodes and the localized node.
On the other hand, when the message that is received by the IoT server does not include data about the transmitters that are included in the radio map database, the lateration approach is selected. In this case, a position estimation comparison of measurements with the database of reference nodes is required in order to find the data that are required for the lateration algorithms. It is important to note here that the lateration algorithms can provide reasonably good results in some cases; however, it requires information about the position of reference nodes and data to estimate the distance to these nodes. In the case of RSS measurements, it is necessary to have information about the radiated power, and in the case of ToA and time difference of arrival (TDoA) measurements, there is a need for synchronization between nodes in the network.
In this step, reference nodes with signals with power below RSS_threshold are removed from the measurements since using extremely low power signals may have a negative impact on the accuracy of the distance and position estimates. The RSS_threshold is defined individually for each technology and is set to 20 dB above the sensitivity of the receiver.
Based on the comparison with the data in the reference nodes database and filtering out signals below RSS_threshold, either multilateration or trilateration algorithm can be chosen to estimate the position of the mobile node. In the case where more than three nodes are detected, the implemented multilateration min-max algorithm is preferred, as it has an advantage in low computational complexity, even when the number of reference nodes is higher. Moreover, it can achieve better accuracy thanks to the larger number of reference nodes that are used for the position estimation. On the other hand, a trilateration algorithm can achieve better results in cases when the distances between the reference nodes and mobile IoT devices are underestimated.
Currently, the integrated localization system can handle positioning using Wi-Fi and GSM signals in combination with fingerprinting localization, as well as positioning using UWB, ZigBee and LoRa technologies, in combination with lateration algorithms. The positioning in indoor or outdoor environments is possible. In the case of fingerprinting, the decision about the indoor or outdoor environment is given based on information from the radio map, which includes positions of reference (calibration) points that may be defined in WGS84 for the outdoor environment or local coordinate system for the indoor environment. Similarly, for lateration-based positioning, the decision can be made based on the positions of the reference nodes (transmitters). The positions of the nodes that are installed in the indoor environment should be defined in local coordinates, while the positions of transmitters that are outdoors are usually defined in WGS84 coordinates.

Experimental Setup and Achieved Results
In order to demonstrate the feasibility of the proposed localization system and validation of its performance, multiple tests with different communication technologies were performed. It is important to note here that different technologies were tested under different conditions due to the specific use cases for each communication technology. The tests were performed to demonstrate the concept of the proposed solution and are not aimed directly at the comparison of accuracy and performance of individual positioning algorithms and solutions.

Experimental Setup
The experimental scenarios were aimed at both indoor and outdoor environments. In the indoor environment, the functionality of the system was performed with UWB, Wi-Fi and ZigBee technologies since these can provide accuracies that are feasible for indoor positioning. Each technology was tested using a different setup since different deployment scenarios are expected for these technologies.
The UWB technology was tested in a gymnasium since this represents an open space indoor environment where LoS propagation conditions may be achieved. This scenario can represent IoT applications that are related to sports tracking and industrial applications. The UWB positioning was performed in LoS conditions since UWB signals do not penetrate through the walls. The localization area of 624 m 2 was covered by six UWB access points. The UWB network was based on devices with a DW1000 chip from DecaWave.
On the other hand, Wi-Fi and ZigBee technologies were tested in office spaces with mixed LoS and NLoS conditions since both technologies can penetrate through walls and provide signal coverage in more complex indoor environments. For the Wi-Fi positioning, existing APs that were used to provide internet connection were utilized for testing purposes. The radio maps that were used in the tests, shown in Figure 3, were created at the localization area with the size of 980 m 2 , which consisted of corridors, office spaces, meeting rooms and laboratories. In the classical static radio map, the RSS measurements were collected at reference points that were placed on a grid with a distance of 2 m. While the dynamic radio map was built using the implemented PF-PDR function and had a much lower density of the reference points, in this case, only 66 reference points were generated using the implemented PF-PDR algorithm (red dots in Figure 3). The sampling rate of the IMU data that was used to generate the dynamic radio map was 100 Hz since the Wi-Fi connection allowed for transferring relatively large amounts of data. The RSS measurements were performed once every 5 s since we needed to collect the data at different positions in the area. The data from the IMU was sent to the server each second since PF-PDR was not used to estimate the position of the mobile node in real time. In the experiments, smartphones were used to collect the data; however, nodes that are based on NodeMCU, Raspberry Pi or other development boards can be used as well. The Wi-Fibased localization used the fingerprinting framework to estimate the position; therefore, smartphones were used to measure the data for both the static and dynamic radio maps and to perform the localization.
do not penetrate through the walls. The localization area of 624 m was covered by six UWB access points. The UWB network was based on devices with a DW1000 chip from DecaWave.
On the other hand, Wi-Fi and ZigBee technologies were tested in office spaces with mixed LoS and NLoS conditions since both technologies can penetrate through walls and provide signal coverage in more complex indoor environments. For the Wi-Fi positioning, existing APs that were used to provide internet connection were utilized for testing purposes. The radio maps that were used in the tests, shown in Figure 3, were created at the localization area with the size of 980 m 2 , which consisted of corridors, office spaces, meeting rooms and laboratories. In the classical static radio map, the RSS measurements were collected at reference points that were placed on a grid with a distance of 2 m. While the dynamic radio map was built using the implemented PF-PDR function and had a much lower density of the reference points, in this case, only 66 reference points were generated using the implemented PF-PDR algorithm (red dots in Figure 3). The sampling rate of the IMU data that was used to generate the dynamic radio map was 100 Hz since the Wi-Fi connection allowed for transferring relatively large amounts of data. The RSS measurements were performed once every 5 s since we needed to collect the data at different positions in the area. The data from the IMU was sent to the server each second since PF-PDR was not used to estimate the position of the mobile node in real time. In the experiments, smartphones were used to collect the data; however, nodes that are based on NodeMCU, Raspberry Pi or other development boards can be used as well. The Wi-Fibased localization used the fingerprinting framework to estimate the position; therefore, smartphones were used to measure the data for both the static and dynamic radio maps and to perform the localization. The ZigBee network covered a smaller area than the Wi-Fi network since the infrastructure of ZigBee is not so widespread. The network was set up using Telegesis ETRX357 ZigBee modules and consisted of three nodes, while the network covered four rooms with an area of 70 m 2 with NLoS propagation conditions. Since ZigBee signals were not available in large areas and the positioning was performed using a lateration algorithm. A similar setup was used for the outdoor environment. The localization area in the outdoor environment was 120 m 2 and the main difference was in the propagation conditions since in the outdoor environment, the tests using the ZigBee technology were performed mostly in LoS conditions.
In the outdoor environment, LoRaWAN and GSM technologies were considered since these technologies can provide large coverage areas. In this case, IoT modules that were based on Arduino with GSM and LoRa shield were used respectively. The GSM- The ZigBee network covered a smaller area than the Wi-Fi network since the infrastructure of ZigBee is not so widespread. The network was set up using Telegesis ETRX357 ZigBee modules and consisted of three nodes, while the network covered four rooms with an area of 70 m 2 with NLoS propagation conditions. Since ZigBee signals were not available in large areas and the positioning was performed using a lateration algorithm. A similar setup was used for the outdoor environment. The localization area in the outdoor environment was 120 m 2 and the main difference was in the propagation conditions since in the outdoor environment, the tests using the ZigBee technology were performed mostly in LoS conditions.
In the outdoor environment, LoRaWAN and GSM technologies were considered since these technologies can provide large coverage areas. In this case, IoT modules that were based on Arduino with GSM and LoRa shield were used respectively. The GSMbased localization utilizes the fingerprinting framework since it is not quite possible to get accurate information about the position of GSM base stations. The radio map for GSMbased positioning consisted of 2000 reference points that covered urban and suburban environments and mixed LoS and NLoS propagation conditions.
On the other hand, with LoRa technology, we deployed four gateways based on raspberry Pi and an iC880A-SPI LoRaWAN concentrator. Since we deployed our own gateways, we knew their exact positions and thus positioning based on lateration was possible. The covered area, which was considered as an area inside the quadrangle defined by positions of gateways, was 1.25 km 2 and consisted of suburban and rural environments with mixed LoS and NLoS signal propagation conditions.
Since in the case of lateration-based algorithms, it is necessary to estimate the distance from the RSS measurements, the propagation model parameters were estimated from the empirical measurements. For the distance estimation, the log-distance model was used, where the model can be expressed as follows: where P RX (d) (in dB) stands for the RSS reported by the receiver at distance d; d 0 represents the reference distance, which was set to 1 m; and n is the power decay index (in dB). From the empirical measurements, it was necessary to estimate P RX (d 0 ) and n for each wireless technology and environment. The estimated parameters that were achieved using least-square fitting of the mean RSS values of measured data are presented in Table 2. An example of the data collected for ZigBee in the indoor environment and the resulting propagation function is shown in Figure 4. The fitting was performed to minimize the square error between the resulting model (black curve) and average RSS values (red dots) for individual distances. The figure also shows different values of RSS for each distance since multiple measurements were performed in order to reduce the impact of multipath propagation on the RSS.

Achieved Results
In the first step, the localization syst.00em was tested in an indoor environment using measurements of Wi-Fi signals. The localization was performed using three different fingerprinting algorithms and on two different radio maps. The results using both radio maps in combination with three localization algorithms can be found in Figure 5.
From the figure, it can be seen that the implemented localization algorithms were affected by the density of the radio map that was used to estimate the position. It is clear From the figure, it can be seen that the variance of the RSS grew with the distance. Moreover, it is clear that with the increased distance, the curve of the log-distance model became flatter; therefore, the same fluctuations in RSS resulted in a higher error of the distance estimate. Therefore, the signals with extremely low RSS were not considered by the positioning server.

Achieved Results
In the first step, the localization system was tested in an indoor environment using measurements of Wi-Fi signals. The localization was performed using three different fingerprinting algorithms and on two different radio maps. The results using both radio maps in combination with three localization algorithms can be found in Figure 5.  From the figure, it can be seen that the implemented localization algorithms were affected by the density of the radio map that was used to estimate the position. It is clear that when a dynamic radio map with a low density of reference points was used, the best results were achieved by the NN algorithm. On the other hand, when a static map was used, the NN algorithm achieved the lowest median error; however, the localization results were inconsistent and there were position estimates with significantly higher localization errors. On the other hand, the WKNN and RBF algorithms, which both use multiple reference points to estimate the position of the mobile node, provided much more consistent results than the NN algorithm when the static radio map was used.
Therefore, the radio map density was taken into account in the decision algorithm when the fingerprinting positioning system was chosen to estimate the position of the mobile device.
The second group of tests was aimed at the performance of PAN technologies that can be used for communication in an IoT environment. In the tests, we focused on both the lowrate PAN represented by ZigBee and high-rate PAN represented by UWB technology. It is important to note that positioning in these technologies is based on different measurements. While ZigBee positioning is based on RSS measurements on fixed ZigBee nodes, the UWB positioning is based on TDoA measurements since the wide frequency band allows for accurate time measurements.
Taking this fact into account, it is necessary to stress the fact that setting up a ZigBee communication system with positioning capability is simpler than setting up the system based on UWB. The achieved localization results for PAN technologies are depicted in Figure 6.  On the other hand, ZigBee localization was able to achieve a localization error with a median value close to 1.5 m in an indoor environment and below 1.5 m in an outdoor environment using RSS measurements and a trilateration algorithm. The difference was caused mainly by the fact that in the indoor environment, signals at some reference nodes could be attenuated by walls due to NLoS signal propagation. In the indoor environment, the signal can be attenuated by walls and other obstacles. This cannot be taken into account in the path loss model since it is not possible to determine how many walls or obstacles were between the mobile node and the reference node.
In the outdoor environment, long-range communication technologies are widely used for the connectivity of IoT devices; therefore, the localization tests were performed From the figure, it can be seen that the localization accuracy that was achieved by the UWB had a median error that was slightly above 0.5 m. This was thanks to the precise time measurements that were available in the UWB communication system. On the other hand, to set up a system with such high accuracy, it is necessary to ensure tight time synchronization of the reference nodes and line of sight signal propagation.
On the other hand, ZigBee localization was able to achieve a localization error with a median value close to 1.5 m in an indoor environment and below 1.5 m in an outdoor environment using RSS measurements and a trilateration algorithm. The difference was caused mainly by the fact that in the indoor environment, signals at some reference nodes could be attenuated by walls due to NLoS signal propagation. In the indoor environment, the signal can be attenuated by walls and other obstacles. This cannot be taken into account in the path loss model since it is not possible to determine how many walls or obstacles were between the mobile node and the reference node.
In the outdoor environment, long-range communication technologies are widely used for the connectivity of IoT devices; therefore, the localization tests were performed with GSM and LoRaWAN technologies. The GSM network was operated in a licensed band and service providers do not usually share the positions of their base stations; therefore, GSM positioning can only be implemented using fingerprinting, where information about positions of transmitters is not required.
On the other hand, LoRaWAN operates in the ISM band; thus, it is open for the deployment of gateways. Therefore, it was possible to deploy gateways at known positions and use these gateways for localization using lateration.
The localization results in an outdoor environment that were achieved for both GSM and LoRaWAN communication technologies are presented in Figure 7.
information about positions of transmitters is not required.
On the other hand, LoRaWAN operates in the ISM band; thus, it is open for the deployment of gateways. Therefore, it was possible to deploy gateways at known positions and use these gateways for localization using lateration.
The localization results in an outdoor environment that were achieved for both GSM and LoRaWAN communication technologies are presented in Figure 7. It can be seen that the multilateration min-max algorithm can provide position estimates with higher accuracy; however, it is important to note that it may have a slightly lower success rate caused by the underestimation of ranges between transmitters and receivers and it works best when data from more than three reference nodes are available. Moreover, it is important to note that the results for LoRa were achieved just from a single RSS measurement since LoRaWAN technology has strict rules defining transmission intervals. On the other hand, trilateration using LoRaWAN achieved similar accuracy to fingerprinting using GSM signals.
The low accuracy of the system for both LoRaWAN and GSM technologies was because both technologies use relatively low-frequency bands that are not significantly attenuated and, thus, can provide high coverage. On the other hand, this causes a small difference in the RSS samples measured at different positions, resulting in higher localization errors. Moreover, with LoRaWAN, it is not possible to perform multiple measurements of the RSS to reduce the impact of RSS fluctuations.
The comparison of the achieved accuracy for all supported positioning solutions is summarized in Table 3. It can be seen that the multilateration min-max algorithm can provide position estimates with higher accuracy; however, it is important to note that it may have a slightly lower success rate caused by the underestimation of ranges between transmitters and receivers and it works best when data from more than three reference nodes are available. Moreover, it is important to note that the results for LoRa were achieved just from a single RSS measurement since LoRaWAN technology has strict rules defining transmission intervals. On the other hand, trilateration using LoRaWAN achieved similar accuracy to fingerprinting using GSM signals.
The low accuracy of the system for both LoRaWAN and GSM technologies was because both technologies use relatively low-frequency bands that are not significantly attenuated and, thus, can provide high coverage. On the other hand, this causes a small difference in the RSS samples measured at different positions, resulting in higher localization errors. Moreover, with LoRaWAN, it is not possible to perform multiple measurements of the RSS to reduce the impact of RSS fluctuations.
The comparison of the achieved accuracy for all supported positioning solutions is summarized in Table 3.
From the achieved results, it is clear that in the indoor environment, the best positioning accuracy was achieved by using PAN networks. Both UWB and ZigBee technologies achieved better accuracy than Wi-Fi; however, it is important to note that the use of these technologies requires the deployment of a new network infrastructure. The Wi-Fi-based positioning achieved higher localization errors compared to ZigBee, although working in the same frequency band, which is not in line with the assumption that fingerprinting localization will outperform lateration-based positioning algorithms.
However, it is important to note here that only 19 Wi-Fi APs were detected in the localization area and, at some points, the RSS from only three or four APs were measured; thus, the localization accuracy that was achieved by the fingerprinting algorithms was not very high. On the other hand, in the case of ZigBee positioning, most of the position estimates were performed under good geometrical conditions, i.e., the node was placed in an area between reference nodes. This, in combination with an accurate propagation model, resulted in high localization accuracy. It is important to note here that the localization results that were achieved by ZigBee may be significantly lower when the placement of nodes is not optimal and the propagation model is not well fitted, which may be the case in more complex testing scenarios. Moreover, the advantage of Wi-Fi is that it can utilize the existing network architecture; thus, the deployment costs are much lower. In the outdoor environment, the best accuracy was achieved by ZigBee thanks to the limited radio range and thus higher received signal. The use of ZigBee in the outdoor environment was therefore limited since it could not provide connectivity in large areas. On the other hand, when GSM and LoRaWAN technologies were used for localization, the achieved localization accuracies were very similar. This was because both technologies used signals in frequency bands, i.e., 868 MHz for LoRaWAN and 900 MHz for GSM. The localization accuracy when using wireless technologies depends on the signal propagation conditions. The signals from these technologies can penetrate through obstacles quite well; thus, transmitters can cover relatively large areas, resulting in a lower RSS. Since path loss has a logarithmic dependency on a distance, the same signal fluctuations will cause higher position estimation errors at longer distances. Therefore, both technologies achieved relatively low localization accuracy even though different localization algorithms were used.

Conclusions
In this study, an integrated localization system for IoT devices was proposed. The proposed system could provide position estimates of IoT nodes connected using heterogeneous wireless networks. The architecture of the proposed system was presented and the functionalities of the implemented algorithms were described.
The testing of the system was performed in both outdoor and indoor environments using multiple wireless technologies to connect nodes to the IoT. We showed that the system works with different wireless technologies. The tests were performed just to demonstrate the concept and functionalities of the system. From the achieved results, it is clear that different wireless technologies achieved different accuracies, which were given by the characteristics of the wireless channels on given frequencies and limitations that were introduced by the bandwidth and waveforms of signals. Moreover, the implemented algorithms could also impact the accuracy and it was possible to improve the accuracy by selecting an optimal localization algorithm for the given set of measurements.
In future work, novel positioning algorithms for individual technologies will be developed and tested in order to improve the positioning accuracy for individual wireless technologies. Moreover, novel measurements may be used, for example, TDoA measurements have potential in LoRaWAN localization. However, it requires the implementation of GNSS receivers into the gateways in order to achieve highly precise time synchronization. Future work will include the preparation of datasets for multi-RAT localization, including measurements from multiple communication technologies that are collected under complex scenarios. Funding: This work was partially supported by the Slovak VEGA grant agency, project no. 1/0626/19, "Research of mobile objects localization in IoT environment", and Operational Programme Integrated Infrastructure: Independent research and development of technological kits based on wearable electronics products, as tools for raising hygienic standards in a society exposed to the virus causing the COVID-19 disease, ITMS code 313011ASK8, co-funded by the European Regional Development Fund.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author. The data are not publicly available due to privacy restrictions.