Pressure-Pair-Based Floor Localization System Using Barometric Sensors on Smartphones

As smartphone technology advances and its market penetration increases, indoor positioning for smartphone users is becoming an increasingly important issue. Floor localization is especially critical to indoor positioning techniques. Numerous research efforts have been proposed for improving the floor localization accuracy using information from barometers, accelerometers, Bluetooth Low Energy (BLE), and Wi-Fi signals. Despite these existing efforts, no approach has been able to determine what floor smartphone users are on with near 100% accuracy. To address this problem, we present a novel pressure-pair based method called FloorPair, which offers near 100% accurate floor localization. The rationale of FloorPair is to construct a relative pressure map using highly accurate relative pressure values from smartphones with two novel features: first, we marginalized the uncertainty from sensor drifts and unreliable absolute pressure values of barometers by paring the pressure values of two floors, and second, we maintained high accuracy over time by applying an iterative optimization method, making our method sustainable. We evaluated the validity of the FloorPair approach by conducting extensive field experiments in various types of buildings to show that FloorPair is an accurate and sustainable floor localization method.


Introduction
Ever since smartphones were equipped with barometers, starting in 2012, numerous research efforts on floor localization have tried to improve the accuracy of identifying a smartphone user's floor location in a multi-floor building. Most of those efforts have succeeded only in detecting floor changes or the number of floors changed instead of determining the exact floor number. This is due to barometer limitations, such as sensor drifts, temporal variations, and unreliable pressure readings. With recent advances in micro-electro-mechanical systems (MEMS) technology, however, modern MEMS barometers have low power consumption, low cost, and very high-performance sensors. Because of these beneficial characteristics, barometers are now found in an abundance of mobile devices, including smartphones and tablets.
Despite all these opportunities, the floor localization problem remains a big challenge, since no existing methods identify a floor number with near 100% accuracy-a critical requirement for various applications, such as emergency location service, worker location tracking service, and clinical monitoring applications.
To cope with this problem, our goal was to design and implement a novel floor localization method that is able to estimate the exact floor number on which a smartphone user is located. Concretely, we argue that it is important to rethink the floor localization framework by exploring a relative pressure map [1] to maximize accuracy. The relative pressure map is a one-dimensional array containing pressure differences between the reference floor and the other floors. Note that the reference floor may be the same as or different from the first (ground or entry) floor. If a building has one entry point on the first floor, the first floor will be the reference floor in most cases for small buildings. However, because most buildings have many entry points on multiple floors, the reference floor may not be the first floor or one of the entry floors. In this paper, we define the reference floor as a logical floor that plays the role of a reference point in a relative pressure map.
Once we build this relative pressure map, we are able to compute the exact floor number using the difference between the pressure of the reference floor and the current floor as an index into the relative pressure map. With these observations in mind, we present a pressure-pair-based floor localization method called FloorPair, which constructs a relative pressure map for a building and thus offers near 100% accuracy under various environmental conditions. Our contributions in this paper are: (1) We propose a novel pressure-pair-based approach called FloorPair for constructing a relative pressure map. FloorPair makes use of pressure pairs between the reference floor and other floors in a multi-floor building and thus aggregates those pairs into a list of pressure differences, i.e., a relative pressure map.
(2) We introduce the marginalization of sensor drifts and absolute pressure errors when computing pressure differences. With this marginalization of unreliable characteristics, we construct a relative pressure map.
(3) We present an iterative optimization method based on the framework of the EM (expectation and maximization) algorithm to track pressure changes due to weather conditions in real-time. Using this method, we eliminate accumulated errors over time and provide a reliable and sustainable floor localization service.
(4) Through extensive experiments, we show that FloorPair offers a near 100% accurate floor localization result, and is an alternative for critical applications, such as emergency location service, worker location tracking service, and clinical monitoring applications.
The rest of the paper is organized as follows: The next section gives an overview of the related work in floor localization using the barometer and our motivations. The following Section 3 presents the advancements in modern barometers and new application opportunities. Section 4 touches on the efficacy of the barometer for floor localization and describes our marginalization of sensor drifts and unreliable absolute pressure readings. In addition, this section describes how the design of our FloorPair method efficiently constructs a relative pressure map and how it maximizes floor localization accuracy. We present the performance results of FloorPair in Section 5 and finally present our conclusion and future work in Section 6.

Barometers in the Floor Localization Problem
After barometers started appearing in smartphones and tablets in 2012, Muralidharan et al. [1] analyzed their characteristics in smartphones, such as the Samsung Galaxy S4, Google Nexus 4, and Google Nexus 10. They observed that absolute pressure readings are unreliable indicators for floor localization, while the pressure differences between two floors are relatively consistent and steady measurements independent of time and location. Using these features, they proposed a method that determines whether the user has changed floors and that also estimates the number of floors changed. However, they concluded that it is hard to determine the actual floor number on which a user is located using the barometer. Banerjee et al. [2] proposed an unsupervised probabilistic learning method for floor localization, which combines the floor transition information with the WiFi-based localization method called Horus [3] to infer the current floor of a user and improve overall localization accuracy.
Their approach identifies only the number of floors changed, and depends on the accuracy of the Horus system to detect the floor number, which suffers from problems inherited from learning techniques.
Ye et al. [4] proposed a crowdsourcing-based floor localization method using barometers. This method built a barometer fingerprint map using crowdsourcing and did not require Wi-Fi infrastructure and wardriving of the entire building. However, this method requires as many encounters in an elevator as possible, which limits the effectiveness of the crowdsourcing. Moreover, this method's barometer reading clustering is based on timestamps, making this method impractical because, in reality, we cannot collect all barometer readings with all timestamps using crowdsourcing.
Some initial studies such as Skyloc [5], RADAR [6], and Place Lab [7] proposed a user location and tracking system using only radio frequency (RF) signals, while other studies [8][9][10] have started to fuse radio signals with barometers. None of these methods are applied to the floor localization problem because not all buildings have sufficient RF signals.
Ichikari et al. [11] proposed a method for estimating the floor level by decomposing the observed pressure into three components, i.e., device-specific offsets, environmental trends, and the altitude-dependent component. This method is similar to our method in that it is based on relative changes of atmospheric pressure values, but differs in that it utilizes beacons or Wi-Fi access points. Moreover, the accuracy of this method is dependent on the number of participants. Xu et al. [12] proposed a floor localization method that fuses inertial and barometric pressure measurements. However, this method required a special device mounted on the waist of a user, making this method impractical.

Detecting Users' Entrance into a Building
The detection of a user entering a building is critical to the floor localization problem. If we know the moment when a user enters a building, it means that we are able to acquire the current pressure on that floor and use it to construct a relative pressure map. Naïve approaches to detect users at a gate would be to use pre-installed sensors, such as Radio Frequency Identification (RFID), Bluetooth Low Energy (BLE) beacons, or Near-Field Communication (NFC). In [11], they obtained specific floor-level information from localization infrastructures, such as beacons and Wi-Fi access points (APs). Yi et al. [13] proposed a visualized signal image-based method for detecting users' entrance of a building. They used all signals that are received indoors and outdoors from smartphones by visualizing those signals in one signal image. Their proposed method constructs constellation images for specific indoor and outdoor locations and detects whether users are indoors or outdoors by learning the images with deep learning techniques. In this paper, we use this method for detecting a user's entrance at a floor and triggering the current pressure measurement on that floor.

Motivations
As described in the previous section, no previous approach has been able to detect the exact floor number on which users are located accurately enough to support critical applications. There are four main reasons for this: Firstly, the previous approaches did not determine the reference pressure because there was no method to detect users' entrance without pre-installed sensors. Second, let us assume that the barometric pressure at a gate in a building is the reference pressure, P ref . If we know P ref , we can easily calculate the altitude h of a smartphone user as h = (P ref − P cur )/0.12, where P cur is the barometer reading on the current floor and the value of 0.12 hPa is the pressure decrease when going up every 1 m in a vertical direction. If each floor has the same height of h 0 , we then know that the floor number is h/ h 0 . The problem here was that h 0 varies for different buildings. Third, the barometer reading P cur from a smartphone was not accurate because of sensor drift. The sensor drift for the same floor level and even for the same model of smartphone reached 2 hPa, which led to a floor localization error ranging up to five stories. Fourth, they did not handle temporal pressure variations due to weather conditions and time.
To address these problems, we propose a pressure-pair-based approach called FloorPair for constructing a relative pressure map. The FloorPair method collects a minimum number of pressure pairs between the reference floor and some specific floors and aggregates those pairs into a list of pressure differences, i.e., a relative pressure map. While constructing the relative pressure map, we marginalize the sensor drift and unreliable absolute pressure errors. Once we have the relative pressure map for a building, our iterative optimization method is run to track pressure changes over time due to weather conditions in real-time and thus makes our method reliable and sustainable.

High and Consistent Pressure Sensing Accuracy
To clearly show the improvement in pressure sensing accuracy of modern barometers, we present the noises from Samsung Galaxy Note 4, released in 2014 and LG V40, released in 2018. As shown in Figure 1, the barometer on the more recent smartphone produces low noise and thus has a lower standard deviation in pressure measurements, as shown in Table 1. marginalize the sensor drift and unreliable absolute pressure errors. Once we have the relative pressure map for a building, our iterative optimization method is run to track pressure changes over time due to weather conditions in real-time and thus makes our method reliable and sustainable.

High and Consistent Pressure Sensing Accuracy
To clearly show the improvement in pressure sensing accuracy of modern barometers, we present the noises from Samsung Galaxy Note 4, released in 2014 and LG V40, released in 2018. As shown in Figure 1, the barometer on the more recent smartphone produces low noise and thus has a lower standard deviation in pressure measurements, as shown in Table 1.

Constant Pressure Difference between Two Floors
In addition to their low noise characteristics, recent barometers have become more accurate in relative pressure values. Although recent barometers still suffer from sensor drift and unreliable absolute pressure measurements, the difference of the barometer readings between any two floors has become more constant.
To demonstrate this characteristic, we conducted experiments in a university building, the Hi-Tech Center at Inha University, with four smartphones under high and low pressure conditions. Specifically, the smartphones used in the experiment were the LG V40, V10, and two Samsung Note 5s. We used two Note 5s to show that there are non-negligible errors in pressure readings, even from two devices of the same company and model. The building has 15 stories whose heights are 5 m for the basement floor, 4.5 m for the ground floor, and 3.9 m from the second floor to the 15th floor.
As shown in Table 2 and Figure 2, the pressure differences are steady and in-sync across different devices and different weather conditions. In order to clearly show this characteristic, we present the differences between two floors and their standard deviations in Table 3.

Constant Pressure Difference between Two Floors
In addition to their low noise characteristics, recent barometers have become more accurate in relative pressure values. Although recent barometers still suffer from sensor drift and unreliable absolute pressure measurements, the difference of the barometer readings between any two floors has become more constant.
To demonstrate this characteristic, we conducted experiments in a university building, the Hi-Tech Center at Inha University, with four smartphones under high and low pressure conditions. Specifically, the smartphones used in the experiment were the LG V40, V10, and two Samsung Note 5s. We used two Note 5s to show that there are non-negligible errors in pressure readings, even from two devices of the same company and model. The building has 15 stories whose heights are 5 m for the basement floor, 4.5 m for the ground floor, and 3.9 m from the second floor to the 15th floor.
As shown in Table 2 and Figure 2, the pressure differences are steady and in-sync across different devices and different weather conditions. In order to clearly show this characteristic, we present the differences between two floors and their standard deviations in Table 3.    Dev.

Challenges for Constructing a Relative Pressure Map
Even though modern barometers show the advancements described in the previous subsections, the barometers on recent smartphones still have the problem of sensor drift, which is a key challenge in constructing a relative pressure map. To clarify this characteristic, we took pressure readings at the same place and time using the LG V40, V10, and two Samsung Note 5s, as shown in Figure 3. We can see that the four devices display four different pressure values and also that the maximum difference is 1.4 hPa, which may result in a floor localization error ranging up to four stories in a typical building.

Challenges for Constructing a Relative Pressure Map
Even though modern barometers show the advancements described in the previous subsections, the barometers on recent smartphones still have the problem of sensor drift, which is a key challenge in constructing a relative pressure map. To clarify this characteristic, we took pressure readings at the same place and time using the LG V40, V10, and two Samsung Note 5s, as shown in Figure 3. We can see that the four devices display four different pressure values and also that the maximum difference is 1.4 hPa, which may result in a floor localization error ranging up to four stories in a typical building. Through Figure 3, we can observe that the barometers still have an inherent drift from the real atmospheric pressure and that the drift varies even between two devices of the same company and model. In addition, Figure 3 shows that the absolute pressure measured by modern barometers is still unreliable. This unreliable characteristic of absolute pressure is also seen in Figure 2. Hence, to make use of the barometer pressure readings, it is important to calibrate sensor drift and absolute pressure readings. Based on these observations, we develop a novel algorithm to marginalize these two uncertainties and thus construct a relative pressure map, as will be described in Section 4.

Design and Implementation of FloorPair
In this section, we describe a pressure pair based floor localization called FloorPair, which aims to determine the exact floor number on which smartphone users are located. We designed FloorPair to achieve three goals: first, we constructed a relative pressure map with minimum costs; second, using the relative pressure map, we provided near 100% accuracy in determining the exact number of the floor; third, we maintained 100% accuracy over time for the sustainability of the floor localization service.
We first give a description of the variables used in this paper in Table 4. An array for relative pressure differences for a (ftop − fbottom)-story building Through Figure 3, we can observe that the barometers still have an inherent drift from the real atmospheric pressure and that the drift varies even between two devices of the same company and model. In addition, Figure 3 shows that the absolute pressure measured by modern barometers is still unreliable. This unreliable characteristic of absolute pressure is also seen in Figure 2. Hence, to make use of the barometer pressure readings, it is important to calibrate sensor drift and absolute pressure readings. Based on these observations, we develop a novel algorithm to marginalize these two uncertainties and thus construct a relative pressure map, as will be described in Section 4.

Design and Implementation of FloorPair
In this section, we describe a pressure pair based floor localization called FloorPair, which aims to determine the exact floor number on which smartphone users are located. We designed FloorPair to achieve three goals: first, we constructed a relative pressure map with minimum costs; second, using the relative pressure map, we provided near 100% accuracy in determining the exact number of the floor; third, we maintained 100% accuracy over time for the sustainability of the floor localization service.
We first give a description of the variables used in this paper in Table 4. A pressure value at each floor is estimated by Equation (1): Let us assume that P ground is the ground truth pressure of the reference floor and that we want to know a floor pair, FP(1, f ). Note that, as described in Section 1, the reference floor may or may not be the first floor. For simplicity, however, we assume that the reference floor corresponds to the first floor in Equation (1). Then, as described in Table 4, FP(1, f ) denotes the pressure difference between the reference floor (1) and the f -th floor. We construct a relative pressure map using a set of these FPs.
However, it is almost impossible to obtain the exact value of the sensor drift because every smartphone has a different value of drift, as described in Section 3.3. In addition, it is also impractical to measure P ground because we need a pre-installed and high-cost barometer on the ground floor. Therefore, in order to obtain a floor pair, we need to marginalize these two variables. For example, if we want to know FP(1, f ), we get it by subtracting Equation (2) from Equation (3): Then, FP(1, f ) can be obtained by the following equation, since FP(1,1) is zero: Our goal was to construct a relative pressure map using these FPs. Given a set of FPs, we may think that we easily construct a relative pressure map. Specifically, once we collect all pressure values at every floor, P(f ), we simply build a relative pressure map by subtracting P(1) from P(f ).
However, this naïve approach does not intuitively work for three reasons. First, pressure value varies, even during the process of pressure collection on each floor. This means that only pressure values collected within a time threshold T are valid when obtaining floor pairs. Second, we need to reduce the cost of collecting pressure values for practical reasons. We aimed at constructing a relative pressure map with minimal cost. Third, even after successfully constructing a relative pressure map, we had to iteratively update the value of P ref because pressure values such as P ref and P cur continued to vary over time. In the next three subsections, we address each of these three issues.

Pressure Variations in Minutes
Barometric pressure varies often enough to change every minute. To show this characteristic, we use the dataset of the pressure measurements in Seoul in February 2019 [14]. Table 5 summarizes the number of pressure changes in n minutes. For example, there were 20 cases where pressure variation in 1 minute was greater than 0.2 hPa. Similarly, the number of pressure variations greater than 0.3 hPa in 3 minutes was 94. Total 40,320 minutes in 28 days. Table 5 shows that a pressure value measured at a specific time t and a pressure value measured at t + T cannot be paired for calculating a relative pressure value. In other words, a floor pair is established only among the pressure values measured at times within a time threshold T. For small and low buildings, we may collect all pressure values required to construct a relative pressure map within T. In this case, we simply construct relative pressure maps for such buildings by calculating the differences between P ref and P(f ). However, in reality, we have to take into account the case where we cannot collect the required pressure values within T. To address this problem, we developed the FloorPair algorithm.

FloorPair: Generating a Relative Pressure Map from Collected Pressure Data
An input of the FloorPair algorithm is a set of collected pressure tuples consisting of floor number, pressure reading, and its timestamp (line 1 in Algorithm 1). Using these tuples, we generated a valid set of floor pairs using only tuples collected within T. Specifically, we generated a floor pair FP(f pivot , f probe ) with a condition where f pivot was greater than f probe and the difference of their timestamp was less than T (line 6 in Algorithm 1). To illustrate the algorithm for constructing a set of floor pairs, we present a running example in Tables 6 and 7. Note that we used a special order that represents a floor order to consider floors close to the reference floor first, i.e., {1, −1, 2, −2, 3, −3..}. To implement this floor order, we added 0.5 to the absolute value of negative floor numbers. For example, a basement floor B1 is greater than 1F and is less than 2F because the floor number of B1 is converted to 1.5.  f pivot , f probe FP(f pivot , f probe )
After constructing a set of floor pairs, FP_set, we sorted it in the floor order for Algorithm 2, as shown in line 10 in Algorithm 1.  Tables 8 and 9 shows the initial values of Diff_map and pivot_floors, respectively. Each element of the pivot_floors array contains its corresponding pivot floor number. Note that the bold and underlined numbers denote the values updated at that stage.
At the "Merging (3,x)" stage, there was one FP (3,4). However, it cannot change any values because the pivot value of 3 in the pivot_floors array was 0, which means that there was no connection to the reference floor. Figure 4a illustrates the pair relationship trees after the first for-loop in line 7~10 in Algorithm 2. As shown in Figure 4a, it was possible that the pair relationship trees were disconnected and thus formed a forest. In other words, the FP (3,4) had no connection to the reference floor, 1, which meant that there was no relation to calculate the pressure difference between the reference floor and floor 3. To prevent this case, we examined a pair relationship again but in reverse by swapping the role of the probe floor and the pivot floor in line 12~15 in Algorithm 2. In this backward merging step, we connected all separate trees by searching for a relationship between the probe floor (instead of the pivot floor) and the reference floor. The dashed line in Figure 4b shows such a relationship between floor 4 and the reference floor.  After two merging steps, we filled zero values with linear interpolated values between two nearest non-zero values in Diff_map (line 17~19 in Algorithm 2). Then, we completed a relative pressure map for a building, as shown in the column labeled "Final" in Table 8.

Estimating the Exact Floor Number and Refreshing the Reference Pressure
Once we obtained a relative pressure map, Diff_map, we estimated the number of the current floor on which a user is located simply by subtracting Pref from Pcur (line 11~12 in Algorithm 3), where Pcur is a pressure reading from a user's smartphone and Pref is the reference pressure obtained in line 5 in Algorithm 3. As mentioned in Section 2.2, we detected the entry floor, fentry, using [13] and then calculated Pref as shown in line 5 in Algorithm 3. // the current pressure, Pcur on fcur. However, the issue that makes the floor localization problem difficult is that Pcur continues to vary over time. For example, let us assume that a user is on a floor at a specific time t and its Pcur is 1000 hPa. After the user stays on the same floor for a couple of hours after t, Pcur may have changed to 1020 hPa. This means that the value of (Pcur − Pref) is no longer valid to estimate the exact floor number from Diff_map and thus we need to iteratively update the value of Pref in accordance with the variations of Pcur, as shown in line 16~17 in Algorithm 3. Specifically, if a user moves only horizontally After two merging steps, we filled zero values with linear interpolated values between two nearest non-zero values in Diff_map (line 17~19 in Algorithm 2). Then, we completed a relative pressure map for a building, as shown in the column labeled "Final" in Table 8.

Estimating the Exact Floor Number and Refreshing the Reference Pressure
Once we obtained a relative pressure map, Diff_map, we estimated the number of the current floor on which a user is located simply by subtracting P ref from P cur (line 11~12 in Algorithm 3), where P cur is a pressure reading from a user's smartphone and P ref is the reference pressure obtained in line 5 in Algorithm 3. As mentioned in Section 2.2, we detected the entry floor, f entry , using [13] and then calculated P ref as shown in line 5 in Algorithm 3. However, the issue that makes the floor localization problem difficult is that P cur continues to vary over time. For example, let us assume that a user is on a floor at a specific time t and its P cur is 1000 hPa. After the user stays on the same floor for a couple of hours after t, P cur may have changed to 1020 hPa. This means that the value of (P cur − P ref ) is no longer valid to estimate the exact floor number from Diff_map and thus we need to iteratively update the value of P ref in accordance with the variations of P cur , as shown in line 16~17 in Algorithm 3. Specifically, if a user moves only horizontally and not vertically for a certain time period s, the value of P ref is updated in accordance with the relative pressure value on f cur in Diff_map (line 16~17 in Algorithm 3).

Algorithm 3. Estimating the Current Floor Using
Algorithm 4 shows the IsUpdate() function. In order to determine whether a user moves vertically or not, we take into account two parameters: the pressure variations, p, allowed for a time period s. To determine whether a user is moving vertically or not, we divided a floor height into two ranges, i.e., true range and false range, as shown in Figure 5. The goal of the IsUpdate() function is to return TRUE only if it decides that a user is vertically stable within p (i.e., in the true range) for s seconds. Then, our algorithm updates P ref (line 17 in Algorithm 3). Otherwise, the IsUpdate() function returns FALSE, which means that our algorithm needs not to update P ref because a user is still moving vertically by taking an elevator/escalator or using the stairs. The IsUpdate() function also returns FALSE if a user is in the false range, even though the user stops for s seconds in the middle of stairs, e.g., a stair landing. This is to avoid wrong updates of P ref while a user is moving vertically very slowly. To address this issue, we introduced a lower bound of the parameter s.
The lower bound was based on the slowest vertical movement speed of a human, 0.2 m/s [15]. Therefore, the lower bound is calculated by 0.2 (m/s)/8 (m/hPa) = 0.025 hPa/s. The upper bound of s is derived from Table 5. If s is too long, it means that we cannot distinguish weather changes from users' vertical movements. Therefore, the upper bound corresponds to the maximum time period over which no change in atmospheric pressure occurs. As shown in Table 5, the number of pressure variations greater than 0.3 hPa is zero within 1 minute, which means that the upper bound is calculated by (0.3 hPa / 60 sec) = 0.005 hPa/s. The parameter s is determined by p / ((lower bound + upper bound)/2), i.e., p/0.015. For example, if p is the half of a typical floor pressure difference [1,12], 0.2 hPa, the parameter of s is 13 seconds. Since the parameter s is a function of p, the parameter s reflects the height of the floor. In the case where s exceeds the upper bound, there is a possibility according to Table 5 that a pressure change coming from weather changes is mistaken for a pressure change caused by an actual user's vertical movement. On the other hand, if s is below the lower bound and a user moves vertically very slowly (e.g., below 0.2 m/s), our method continues to make unnecessary updates of Pref. On the basis of these lower and upper bound characteristics, we set s to p/0.015 seconds in order to provide 100% accuracy, as shown in section 5.
(a) (b) Figure 6. Graphic representation of our iterative optimization method: (a) before applying our optimization method; (b) after applying our optimization method.
As shown in Algorithms 3 and 4, our algorithm is based on an iterative optimization method such as the expectation-maximization (EM) algorithm [16], which is widely used in statistics and data clustering in machine learning, to jointly optimize two parameters. Conceptually, when it is hard to optimize two interacting parameters A and B at the same, the EM algorithm optimizes parameter A while holding parameter B's value. In the next step, the EM algorithm optimizes parameter B based on parameter A from the previous step. The EM algorithm basically alternates between performing an expectation (E) step and a maximization (M) step.
In the E-step of our algorithm, we estimated an initial fcur using Pref. Then, in the M-step, conversely, we optimized Pref using the fcur estimated in the E-step. This new Pref is iteratively used to estimate fcur in the next E step. We present an illustration of our optimization method in Figure 6.
Because our algorithm is based on the concept of the EM algorithm, we can easily apply recent machine learning techniques to the floor localization problem and we will leave this as future work. In the case where s exceeds the upper bound, there is a possibility according to Table 5 that a pressure change coming from weather changes is mistaken for a pressure change caused by an actual user's vertical movement. On the other hand, if s is below the lower bound and a user moves vertically very slowly (e.g., below 0.2 m/s), our method continues to make unnecessary updates of P ref . On the basis of these lower and upper bound characteristics, we set s to p/0.015 seconds in order to provide 100% accuracy, as shown in Section 5.
As shown in Algorithms 3 and 4, our algorithm is based on an iterative optimization method such as the expectation-maximization (EM) algorithm [16], which is widely used in statistics and data clustering in machine learning, to jointly optimize two parameters. Conceptually, when it is hard to optimize two interacting parameters A and B at the same, the EM algorithm optimizes parameter A while holding parameter B's value. In the next step, the EM algorithm optimizes parameter B based on parameter A from the previous step. The EM algorithm basically alternates between performing an expectation (E) step and a maximization (M) step.
In the E-step of our algorithm, we estimated an initial f cur using P ref . Then, in the M-step, conversely, we optimized P ref using the f cur estimated in the E-step. This new P ref is iteratively used to estimate f cur in the next E step. We present an illustration of our optimization method in Figure 6. In the case where s exceeds the upper bound, there is a possibility according to Table 5 that a pressure change coming from weather changes is mistaken for a pressure change caused by an actual user's vertical movement. On the other hand, if s is below the lower bound and a user moves vertically very slowly (e.g., below 0.2 m/s), our method continues to make unnecessary updates of Pref. On the basis of these lower and upper bound characteristics, we set s to p/0.015 seconds in order to provide 100% accuracy, as shown in section 5.
(a) (b) Figure 6. Graphic representation of our iterative optimization method: (a) before applying our optimization method; (b) after applying our optimization method.
As shown in Algorithms 3 and 4, our algorithm is based on an iterative optimization method such as the expectation-maximization (EM) algorithm [16], which is widely used in statistics and data clustering in machine learning, to jointly optimize two parameters. Conceptually, when it is hard to optimize two interacting parameters A and B at the same, the EM algorithm optimizes parameter A while holding parameter B's value. In the next step, the EM algorithm optimizes parameter B based on parameter A from the previous step. The EM algorithm basically alternates between performing Because our algorithm is based on the concept of the EM algorithm, we can easily apply recent machine learning techniques to the floor localization problem and we will leave this as future work.

Collecting Pressure Data
One of our goals was to minimize the cost of collecting pressure data. It is important for the floor localization service to be widely deployed in practice with minimum cost for both construction and maintenance. Our FloorPair method basically needs to collect floor pairs to construct a relative pressure map for a building. Floor pairs are easily collected by reading the numbers of floors in a building and the pressure values and time of a smartphone without special devices or experts.
As described in the following two paragraphs, this collection process is performed only once by anyone who wants to provide the exact number of floors of a building, e.g., the owner of a building, a service provider, or an end-user.
If the floors of a building have the same height, we need only one floor pair. For example, in the case of a university building whose floors have the same height, we constructed a relative pressure map by collecting one pressure value at the first floor and one at the top floor, resulting in FP (1,15), as shown in Table 10. With this one FP, we can build a relative pressure map for this building and thus obtain the exact floor number with 100% accuracy.

Result of Experiments
As shown in Table 10, our method achieves 100% accuracy by iteratively correcting the errors. Once the relative pressure map is completed, our method also maintains 100% accuracy by optimizing the reference pressure in accordance with the current pressure using the framework of the EM (expectation and maximization) algorithm as described in Section 4.3.
To further validate the efficacy of our method, we conducted extensive field experiments in the various buildings, as listed in Table 11. Among the five smartphone models in Table 12, we used one or two models to collect floor pairs and five models to evaluate the accuracy of our proposed method, as shown in Table 13. We used different models of smartphones for both collection and evaluation to show that our method works well even when different smartphones are used for collection and evaluation. As shown in Table 14, our method shows 100% accuracy, independent of types of phones and buildings. For each trial, we counted success only when our method consistently showed the exact number of a floor for about 10 minutes to reflect constantly changing pressure values, such as P cur and P ref . Note that P cur is measured about 600 times in 10 minutes, while P ref is updated 20 to 50 times depending on the height of a floor.     Table 14, our method maintains 100% accuracy over time. In this paper we used the mean absolute error (MAE) metric defined by MAE = 1 n n 1 (estimated f loor number) − (actual f loor number) , where n is the number of tests, to evaluate the accuracy of our method.

Reasons for near 100% Accuracy
Even though our FloorPair method showed 100% accuracy in our experiments, our method is said to provide near 100% accuracy for the following reasons: First, we did not conduct our experiments under serious weather conditions, such as tornadoes and hurricanes. In this case, we do not expect that our method provides 100% accuracy. Second, if a user continues to move up and down for a long time, e.g., 5 minutes, it causes about 0.017% error according to Table 5. Third, if a user vertically moves below 12 cm per second, our method mistakes a user's vertical movement for a weather change, leading to erroneous results. In the second and third cases, our method cannot provide 100% accuracy only to users moving with these extreme patterns, but it continues to provide near 100% accuracy to other users.

Discussion
In this paper, we proposed a pressure-pair-based floor localization method called FloorPair that aims at determining the exact number of the floor on which smartphone users are located. Specifically, we had the following three goals for the floor localization problem: first, we construct a relative pressure map with minimum costs; second, using the relative pressure map, we provide near 100% accuracy in determining the exact number of a user's floor; third, we maintain near 100% accuracy over time for sustainability of the floor localization service.
To achieve these goals, FloorPair first generates a set of pressure pairs from a dataset of pressures collected in a building. In the process of this collection, FloorPair needs only a few pressure readings on a minimum number of floors, unlike previous approaches. Using this set of pressure pairs, FloorPair merges those pressure pairs into a relative pressure map that contains pressure differences between a reference floor and the other floors in the building. On the basis of this relative pressure map, FloorPair determines the exact floor number on which users are located with near 100% accuracy. In addition, FloorPair is able to maintain this high accuracy over time with an iterative optimization method based on the framework of the EM algorithm, making our method sustainable.
Extensive field experiments in various types of buildings show that FloorPair is near 100% accurate and is a sustainable floor localization method with minimum costs. For future work, we plan to augment our method with recent artificial intelligence techniques to further expand the adaptability of our method to various environments.