Research on HAR-Based Floor Positioning

: Floor positioning is an important aspect of indoor positioning technology, which is closely related to location-based services (LBSs). Currently, ﬂoor positioning technologies are mainly based on radio signals and barometric pressure. The former are impacted by the multipath effect, rely on infrastructure support, and are limited by different spatial structures. For the latter, the air pressure changes with the temperature and humidity, the deployment cost of the reference station is high, and different terminal models need to be calibrated in advance. In view of these issues, here, we propose a novel ﬂoor positioning method based on human activity recognition (HAR), using smartphone built-in sensor data to classify pedestrian activities. We obtain the degree of the ﬂoor change according to the activity category of every step and determine whether the pedestrian completes ﬂoor switching through condition and threshold analysis. Then, we combine the previous ﬂoor or the high-precision initial ﬂoor with the ﬂoor change degree to calculate the pedestrians’ real-time ﬂoor position. A multi-ﬂoor ofﬁce building was chosen as the experimental site and veriﬁed through the process of alternating multiple types of activities. The results show that the pedestrian ﬂoor position change recognition and location accuracy of this method were as high as 100%, and that this method has good robustness and high universality. It is more stable than methods based on wireless signals. Compared with one existing HAR-based method and air pressure, the method in this paper allows pedestrians to undertake long-term static or round-trip activities during the process of going up and down the stairs. In addition, the proposed method has good fault tolerance for the misjudgment of pedestrian actions.


Introduction
Indoor positioning technology is one of the core technologies of artificial intelligence (AI) in the future [1]. It has been widely used in multiple industry sectors and markets [2], including shopping centers, hospitals, nursing homes, airports, railway stations, warehouses, parking lots, and prisons/detention centers. Today, high-rise and multi-storey buildings are widely distributed. In multi-storey indoor environments, users need floor information in the vertical dimension, alongside positions on a 2D plane. With the wide application of indoor location services, the demand for floor positioning information is increasing [3], especially in emergency rescue situations [4]. In a multi-floor indoor environment, an indoor positioning system (IPS) is sensitive to floor location [5], and floor recognition functions make indoor positioning systems more effective. In some cases, it is not easy to obtain the floor location information, such as in complex multi-floor environments, for people with limited vision [6], or in conditions with weak indoor light or fire smoke. Highly similar multi-storey parking lots have caused trouble for people trying to find their cars. The correct floor plan map in an indoor positioning system depends on the right floor positioning, and accurate floor judgment can effectively reduce the search time in the fingerprint-based method matching stage, while improving the positioning accuracy and reducing the computational overhead [7]. In the Indoor Positioning and Indoor Navigation (IPIN) competition, the competition area is usually a multi-floor building. In 2018, at the Microsoft indoor localization competition hosted by the international conference on Information Processing in Sensor Networks (IPSN), a 3D Track was used [8]. Therefore, during the competition, the participants need to first solve the problem of floor positioning. In general, floor positioning plays an important role in the field of indoor positioning.
The common floor positioning technologies mainly include radio-based floor identification technologies [9][10][11][12][13][14][15][16][17][18][19], floor determination methods based on barometric pressure [6,[20][21][22][23][24], and floor positioning methods based on inertial sensors [25][26][27][28][29][30]. They can be used alone, or in combination [31][32][33][34][35], to perform floor positioning. However, the first two methods have some limitations. The radio-based method is dependent upon widespread wireless signal infrastructure support [36]. The effective positioning depends on a stable wireless network structure [37]. Most floor recognition algorithms are based on the difference or sudden change in wireless signals between different floors [10,38]. This type of method has high precision and good universality, but also some limitations. For the wireless signal method, the floor positioning accuracy is affected by the access point (AP) deployment conditions; multipath effects are likely to cause large fluctuations in the wireless signal strength (received signal strength indicator (RSSI)) [2,[39][40][41], leading to a large error in indoor positioning [1], and floor positioning also suffers from this issue. Differences in the internal spatial structures of multiple floors will also affect the accuracy of floor positioning.
Methods based on barometric pressure also have some shortcomings. For these methods, although the floor recognition accuracy is high, the universality is inadequate. Air pressure is easily affected by environmental changes, such as the indoor temperature and humidity [15,30,42]. When pedestrians stay in a certain position for a long time, changes in the corresponding air pressure will cause errors in recognition of the floor [42]. Further, different barometer terminals need to be calibrated in advance [43,44]. Methods based on a reference base station require additional deployment and data communication, and some smartphones lack barometers [45]. The above shortcomings have affected the popularization of this method [21]. In addition, it can be difficult to obtain high-accuracy flooring information due to a high similarity in radio signals and the small barometric pressure difference between adjacent floors in a multi-storey environment with staggered floor structures, a low story height, stairwells [46], or atrium structures [17,18].
Existing HAR methods based on acceleration sensors can adapt to multi-floor structures and perform well under certain test conditions, but they need to be improved in terms of fault tolerance and action switching. There remain omissions in the stand still state or going back and forth when humans going up and down the stairs. The Ftrack method proposed by Ye [25] uses an acceleration sensor to calculate the time spent taking the elevator, or the number of steps taken when climbing stairs between any two floors, through information exchange when users meet and from the users' trajectories. The feature data of the current floor are deduced and stored in a database. In the positioning stage, the floor positioning can be realized according to the time taken or the number of steps. In this method, the traversal of all floors and landmarks is needed in advance to obtain complete reference values, and to realize the omnibearing floor positioning. This method cannot reflect the process of going up and down stairs, and does not consider pedestrian round trips and stays. In the literature [27], smartphone pedometers and building shape models have been used to fix the specific position of a user through a particle filter. The symmetry of stairs has been used to solve the positioning of multiple floors. This method needs to be improved in terms of its real-time performance, however, because conclusions can only be drawn after a certain period of time or motion state. They will become invalid when users stay still for a while when going up/down stairs, or engage in back-and-forth walking, and the choice of shoe installation is not conducive to popularization of the applications. In other literature [29], it has been pointed out that some smartphones do not contain barometers, so the height of multi-storey buildings cannot be obtained from their data. Therefore, a pedestrian activity classification algorithm has been proposed to detect the activities of going up and down stairs, and in this way, the building height can be obtained. Then, the HAR results combined with WLAN positioning can be used to realize floor positioning through Kalman filtering. This method does not consider the static states during back-and-forth movement, and static states when going up and down stairs, and it requires the all-the-way tracking of WLAN.
In [30], the floor was determined by combining the barometric pressure with motion sensors. Equipment worn around the waist was used for stair climbing activity detection, landing detection, and counting. Then, the height variation was obtained by measuring barometric pressure. The Bayesian network model was used for floor positioning. However, this method is limited by the variability of barometric pressure when pedestrians are stationary or moving back and forth in a stairwell, and it cannot reflect the transition process of users going up and down.
Fetzer et al. [47] used threshold-based activity recognition based on barometer and accelerometer readings to realize floor change detection, which is simple and easy to implement. However, the floor change detection process is mainly based on the air pressure method, which affects its universality. The floor positioning system proposed by Ye et al. uses acceleration data to detect the time of entering and exiting the elevator, and recognizes and updates the floor through Wi-Fi signals. This method is mainly based on wireless signals, and is not necessarily suitable for multi-floor environments without elevators [36].
Inertial sensors in smartphones are not easily affected by multi-floor indoor structures, temperature, humidity, or wind speed. This type of method does not require calibration in advance, and has high relative accuracy, robustness, and universality. Thus, methods based on acceleration sensors can be used to identify the floor, making up for the shortcomings of radio-based methods and barometric-pressure-based methods, and can achieve high precision, stability, and universal floor positioning effects.
Based on the above discussion, we propose a method that involves using pedestrian activity status to determine floor changes and then achieve floor positioning information. The method allows pedestrians to stay static or engage in a round trip when going up and down stairs. The classification algorithm is used for activity classification (AC). On the basis of AC, the change in elevation of each stair in a multi-storey building can be obtained. The pedestrian vertical position and flooring information can also be obtained by synchronously detecting changes in the pedestrian's floor location.
The paper is organized as follows. Section 2 introduces the method to achieve HAR, based on smartphone sensor data. Section 3 presents the algorithm used to detect the floor change. Section 4 demonstrates the algorithm accuracy and floor positioning results through experiments by a process of alternating multiple types of activities. In Section 5, the conclusions are given.

Human Activity Recognition
Generally, when pedestrians are walking (WA), upstairs (US), or downstairs (DS) in a multi-floor indoor environment, the three-axis accelerometer data in smartphones held by them show a certain periodicity. In this study, the vector sum of three-axis accelerometer data (TAAD) was taken as the total acceleration data (TAD), and the filtered TAD were divided periodically, which is similar to the step frequency detection used in pedestrian dead reckoning (PDR) [48]. In the classification algorithm, the feature vector of each step accounting period was extracted as training samples during the training stage. The classification model was trained and refined by the classification algorithms through machine learning. During the classification stage, the feature vector extracted in pedestrian movement was input into the classification model, giving us the activity categories [49][50][51]. We determined the positions of pedestrians in the elevation dimension to calculate their floor location. Therefore, this study mainly developed high-precision AC for the following actions: WA, US, and DS.
Although the existing HAR classification algorithms are very mature and have achieved good performance [29,[50][51][52][53], the selection of features still plays a significant role in classification accuracy. Pedestrians may engage in walking, going up/down stairs, and taking the elevator, although most of the time they stay still (ST). The classification algorithm is unable to correctly determine other pedestrian activities with small probabilities. In order to address this problem, the overall features of the TAD of common activities were extracted, and the threshold values were divided. In this way, pedestrian activities with small probabilities could be masked. Such activities belonged, overall, to the state of walking because they usually occurred on the ground. Figure 1 shows the specific HAR classification algorithm flow.

Filtering
During the movement of pedestrians, TAAD (the three-axis data are respectively represented by ax, ay, and az.) were output at the frequency of 50 Hz, and TAD was a_all, as expressed by Equation (1). In order to effectively remove the "noise" data, the mean filtering algorithm was selected. After filtering, TAAD and a_all were set as ax , ay , az , and a_all , respectively. Taking a_all as an example, the mean filtering process is shown in Equation (2).

Step Frequency Detection
The periodic law of a_all was used for step detection, and the peak point of each period could be determined according to the fluctuation characteristics of a_all . The peak point was taken as the demarcation point of adjacent periods. Each period was recorded as one step, and the index corresponding to the peak was set as step_index. Considering that there were no obvious periodic features of a_all during the activities of going up/down elevators or keeping still, the mean value of the frequency avg_af of the other movement states was taken as a one-period frequency. That is, if the fluctuation range of a_all was within a small range and there was no peak within the sampling frequency of 50/avg_af after the previous peak, a period could be recorded. The overall peak value determination logic was summarized as follows: the filtered acceleration value effectively removes the false peak. If a sample value is greater than the three sample values before and after it, and, at the same time, is greater than a set minimum peak threshold (according to statistics, the threshold is set to 10.1 here), the sample is judged to be a peak. At this time, a cycle is recorded. The logic example of the overall step determination (Algorithm 1) is as follows.

Algorithm 1:
Step Determination Algorithm Input: filtered acceleration set A, average steps set avg_af in one second Output: step_index

Threshold Filtering
The peaks of a_all corresponding to pedestrian activities (WA, US/DS, taking the elevator, and ST) had different numerical ranges, so this was used as the filtering basis before HAR classification. In the actual multi-storey building, pedestrian activities mainly included WA, US, DS, elevator up (LU), elevator down (LD), and ST. Other activities with small probabilities, such as running, jumping, and shaking, were included in the state of walking in this study.
The acceleration due to gravity was set as g at the testing site. The analysis of a_all of the motion states (the data related to different activity states are shown in Figure 2) indicated that the fluctuation of a_all was at the minimum and had no periodicity when pedestrians were in the states of standing still and taking the elevator, with the value sitting around g (roughly fluctuating ±0.5). At the same time, when the elevator went up and down, a_all indicated accelerating, uniform, and decelerating motions. The average acceleration of each step was avg_a_all , the second maximum value was max_a_all , and the second minimum value was min_a_all . Under such a background, if avg_a_all and min_a_all were larger than g within two consecutive steps, the elevator had an upward acceleration or a downward deceleration. If they were less than g, the elevator movement was the opposite. The ranges of the peak and valley values of a_all were relatively close in the states of walking and going up and down stairs, with the maximum value interval of (10.5, 16) and a minimum value interval of (5,9), as shown in Figure 2. If both the maximum and minimum values of a_all were outside of the aforementioned ranges, the motion state belonged to other activities, and was marked as new_a_all in the HAR classification. The classification of a_all is expressed as follows. It can be seen from Figure 2 that the a_all data in the latter three states (ST, LU, and LD) have obvious characteristics, and threshold conditions can be selected to differentiate them from one another. High-precision classification can be completed even without the use of classification algorithms, and thus computing resources can be saved.

Selection and Extraction of Eigenvalues
The complex calculation of frequency domain features is not conducive to real-time classification on smartphones [54]. According to the related literature [51][52][53]55,56], from periodic curve characteristics of new_a_all of three kinds of motion (WA, US, and DS) and filtered barometric pressure data, a total of 91 eigenvalues were taken (see Table 1). Of these, 88 features were from TAAD, and the others were barometric pressure data. If there was no barometric pressure sensor in the smartphones, features of TAAD could be selected for AC. Suppose the selected features are F i , where i = 1,2,3, . . . ,91. Assume that the air pressure data feature is called Air.

Classification Algorithms
During the algorithm selection process, two types of software, Matlab and Waikato Environment for Knowledge Analysis (WEKA) [29], were respectively used to carry out approximately 1500 classification experiments, as shown in Figure 3. The above classification trainings are carried out using multiple algorithms and multiple combinations of feature vector. We selected more than ten machine learning classification algorithms (see Figure 3), including decision tree (C4.5), logistic model tree (LMT), random forests, Bayes, support vector machine (SVM), etc. Considering that some smartphones do not contain a barometer, the first 88 feature values were selected for classification. In the figure, the columns represent different classification algorithms, and the rows in red area represent the different combinations of selected features. The red gradient is used to indicate the difference in classification accuracy. Darker color means higher classification accuracy. The data in the figure show that when the same classification algorithm is used, the average difference in the classification accuracy due to selecting different feature sub-vectors is about 43%; when the same features is used, the average difference in the classification accuracy of different classification algorithms is about 13%. The eigenvalues corresponding to the classification results in the white dashed box in the figure were classified by unfiltered eigenvalues, and the accuracy was low, failing to reach 50%. It can be seen that the features have a greater impact on the classification accuracy, and adding the feature value of the filtered data can effectively remove the noise and improve the classification accuracy. The last three rows of data respectively show the average, maximum, and minimum classification accuracy of each algorithm. After comparing the classification accuracy of different classification algorithms, it was found that the algorithm with the highest classification accuracy was SVM, so the SVM algorithm was selected for real-time activity classification in the floor positioning phase.

Detection Scheme for Floor Changes
After obtaining the pre-acquired high-accuracy initial floor position, the floor positioning could be implemented recursively through the floor change detection scheme proposed in this study. The method of floor change detection is summarized as follows. Firstly, different AC results for each step of the pedestrians were processed differently. Then, based on the pre-stored floor stair library (see Table 2), each step's status data could be calculated and saved. Floor change determination was also conducted (see Figure 3). Finally, the current floor position could be obtained based on the previous floor position or the high-accuracy initial floor recursion. The detection process included online and offline stages. In the offline stage, the parameters of the target indoor multi-storey structure were investigated, including the number of stairs on each floor, the number of floor platforms, positions of the platforms, and the height of the floor. These data were saved and sample data are given in Reference Floor (RF) table, see Table 2.
If there were elevators in the multi-storey space, it was necessary to record the elevator up-and-down time in advance, and we stored them in the ETRF table. The ETRF mainly recorded the relationship between elevator running height and time, as shown in Table 3 and Figure 4. The data were obtained through various real operations. Equation (4) expresses the relationship between running time and running height. The fitting function's R 2 was 0.9964. In the real-time determination stage, the discrepancy in elevation was obtained according to the elevator running time, and then, the new floor position could be calculated according to the previous floor position and the floor height in the Table RF.  In the online phase, a temporary table Temp (as shown in Table 4) was established to store data relating to different motion states of pedestrians during human movement. Time in the table was used to record the time, the up_down_rate recorded the degree level of the floor transition to another, and up_steps, down_steps, stay_steps, and walk_steps, respectively, recorded the steps of US, DS, ST, and WA in the process of the floor change. This table was mainly used to record the movement status series of pedestrians and provide data support for pedestrian floor change plans.  Figure 5 shows the flow for detecting the floor change, the 'St' in the figure represents each calculation step. It shows that the high-accuracy initial floor could be obtained by Step 1 or using an external input, and the position was input into Step 5.
Step 2 classified the TAAD of each step by HAR to obtain the AC of the pedestrians. In Step 3.1 to Step 3.4, increment and decrement operators were used on different fields in the temp table, according to various ACs. In Step 4, the change of floor was updated according to the motion states and up_down_rate. Finally, the current floor position was calculated by Step 5. In this way, floor positions over a long period of time could be realized through cyclic calculation.   Step 4: Judging the floor change. This is used to calculate the general position of pedestrians in the vertical direction during the process of going up and down stairs. If the up_down_rate in the temp table is 0.5 while the pedestrian is going up stairs, F4 (as an example) is given by Step 5, indicating that the pedestrian is in the middle of the stairs between F4 and F5, which can be shown on the map. If the value of the up_down_rate is close to 0, it is set to 0, indicating that the pedestrian is on the same floor. If it is close to ±1, it showed that the pedestrian only goes up (close to 1) or down (close to −1) the stairs. At this point, Step 5 is executed. At the same time, the values of up_steps, stay_steps, and down_steps are set to zero. If none of the above is true, the pedestrian is still going up/down stairs, and there was no need to conduct any calculation. To sum up, all steps are used to calculate the floor position according to the logic relationship presented in Figure 5. After each cycle of human activity, the steps calculate, process, increase, or decrease the degree value, determine the threshold value, and analyze and determine the floor position. Through cooperation among the steps, the real-time floor position can be obtained.

Introduction to the Experimental Environment
The experiment was carried out in a five-story office building in China University of Mining and Technology. The experimental site covered an area of about 3800 m 2 , and the main corridor of each floor was about 210 m long. There were one elevator and four sets of stairs for the experimental floors, including the five-story office areas and one underground garage. The floor height of the garage and the first floor was 5 m, and that of the other floors was 4 m. Figure 6 shows the experimental environment.

Characteristics of a_all' with the Elevator in Operation
The acceleration sensor data were used to reflect the operation of the elevator. The fluctuation range of a_all during elevator operation was much smaller than that for pedestrians walking or going up and down stairs. In the upward process of the elevator, a_all firstly accelerated upward, then moved at a uniform speed for several seconds and decelerated to a stop. The change law of a_all was opposite to this in the downward process. a_all occurred several seconds of uniform state between the intermediate moment of acceleration and deceleration. The starting and ending time of the elevator was related to ∆h [25]. On this basis, the number of floors of the change of pedestrians could be inferred during the operation of the elevator. Figure 7 shows the variation characteristics of a_all during the operation of the elevator. The green broken line is the filtered acceleration a_all (left ordinate), the orange curve is the corresponding floor position (right ordinate), and the abscissa represents the data sampling frequency. In order to highlight the change in a_all (shown by different dotted lines), the a_all data for the waiting time beyond the upward and downward movement of the elevator were deleted. In the process of taking an elevator, pedestrians often stop halfway (for other people to get on or off the elevator) and then continue to move to the target floor. Therefore, the floor change could be processed with several stages of upward movement and downward movement of the elevator. Each process will generate a ∆h. ∆h can be converted to the number of the relative floor change. Finally, the values can be superimposed. If a pedestrian takes the elevator from F1 to F5, and others get out of the elevator on F3, the determination of the floor change can be processed in two stages.

Classification Algorithms and Feature Vector Selection
The SVM algorithm is a classic machine learning classification algorithm. It can solve problems such as nonlinearity and local minima, and it performs well in text, face, image, and speech recognition. Since the data characteristics corresponding to the three motions of ST, LU, and LD are obvious and easy to distinguish, even without using machine learning classification algorithms, high-precision classification can be achieved. The three kinds of activities of WA, US, and DS have a high degree of similarity, and it is difficult to distinguish them in a simple way. Therefore, we focused on classification testing for these three types of activities. In the classification test process, eight testers with heights between 1.58 and 1.89 m were asked to carry out WA, US, and DS movements. A total of more than 70,000 accelerometer data points were collected via smartphones, corresponding to a total step frequency of about 3000 steps. The 10-fold cross-validation method was used to evaluate the accuracy. Considering versatility, 88 features that did not include air pressure data were selected for classification. The average activity classification accuracy of the eight testers was 96.8%. The heights of different testers and the corresponding classification accuracy are shown in Figure 8. It can be seen from the figure that the feature vector selected in this study has a good classification performance, high classification accuracy, and good data support for the subsequent floor change check algorithm.

Fault Tolerance Analysis of Continuous Misjudgement and Floor Change Detection
In the floor change detection scheme, a threshold was set to assist the floor change detection. If walk_steps in the temp table exceeded 3, and up_steps+down_steps exceeded 3, the pedestrian was judged to move from one floor to another, and Step 5 in Figure 5 was activated. The three-step threshold was mainly determined based on the training results for the number of consecutive misjudged steps of HAR. During the pedestrian's movement, the more consecutive misjudged steps there were (especially for the activities of going up and down stairs), the more unfavorable the conditions for the detection of the floor change. Through the analysis of the results in Figure 8, the number of incorrect steps misclassified by multiple people was 90 steps in total. We found that the continuous value of the number of misjudged steps was mostly 1, a small number of misjudged steps were 2, and the maximum was 3 steps. The specific distribution is shown in Table 5. It can be seen that this statistical result supports the implementation of the floor change detection scheme in this article.

Comparison of Floor Positioning Effects Based on Wi-Fi Signals and HAR
To determine the floor, Wi-Fi signals were collected at a frequency of 1 Hz and TAAD were collected at a frequency of 50 Hz by walking along the corridor on F3 (in the experimental environment of Figure 6). Both types of data are collected by hand-held smartphones during pedestrian's walking. Figure 9 shows the floor positioning results from the two methods. The method based on Wi-Fi signals was introduced in [9]. In Figure 9a, the overall floor positioning accuracy of the Wi-Fi signals was quite ideal during pedestrian walking, and the accuracy was about 92%. However, the floor was misjudged continuously (in the red dashed box) in some areas due to the relatively high signal similarity between adjacent floors. This was because the method based on Wi-Fi signals is easily affected by the indoor environment, architectural pattern, AP layout, etc., which may lead to incorrect results. In Figure 9b, the pedestrian was walking in the corridor of F3, taking a total of 180 steps. At this point, the characteristics of pedestrian walking could not easily be changed, so the activity classification and floor result were not affected by the indoor environment. Even if there was occasional misjudgment of the activity state, the result of the floor was the same as the reference floor F3 by the algorithm in Chapter 3. In short, if the pedestrian keeps walking on a plane, the algorithm in this paper keeps the pedestrian's floor position unchanged.

Comparison of Floor Estimation Results
A pedestrian may be in a static state when going up and down stairs, such as when thinking, smoking, engaging in voice communication, taking video calls, etc. Therefore, it is necessary to consider the impact of the static state on floor determination. In general, when the temperature and humidity change rapidly, the barometric-pressure-based and non-base-station floor estimation method will most likely fail. In this study, multiple activities were involved in the experiments related to going up and down stairs, and there were about 15 min of the ST state during this period. The effects of two non-base-station barometric-pressure-based methods and one HAR-based floor positioning method were compared with the proposed method. The BPFI method in the literature [58] was used as the non-base-station barometric-pressure-method, and the relationship between barometric pressure and height difference was also used for floor positioning. Another HAR-based method, was discussed in literature [30]. The corresponding results are shown in Figure 10. Figure 10a shows the barometric pressure values during the test, and Figure 10b shows the human activities. The black area represents the 15 min of static state on the platform from F3 to F2. Figure 10c shows the actual floor, and the results of the three floor positioning methods. It can be seen from Figure 10c that our HAR-based method was not affected by the ST state of the pedestrians, and compared with other methods, the floor positioning accuracy was the highest.

Analysis of Floor Positioning Results under Multiple Activities
Similar to most indoor positioning systems, accuracy is one of the classical measurements of a floor positioning technology [59]. Through a series of activities, we calculated the floor position by the proposed method, and compared it with the real floor position. Figure 11 shows the specific floor positions obtained by the HAR classification algorithm, where the x-axis represents steps of pedestrian movement, the lower scale of y-axis represents the number of floors, and the top row represents the different AC at each moment. The occasional dots of different colors in the middle represent the misjudgment of HAR. The blue line below represents the intermediate results, and the red represents the actual floor position. According to the action type data, the elevation position (the blue poly-line area) can be derived. It can be seen that, even if there were misjudged states of pedestrian movements, the results could be corrected in time, and the overall floor change determination accuracy was high. In addition, it can be inferred that as long as the classification algorithm maintains an accuracy of more than 92% and more than four steps of misjudgment do not occur, the floor determination accuracy would always remain at 100%. If no more than two steps of misjudgment occur every 10 steps (i.e., the accuracy of HAR is higher than 80%), the floor determination accuracy remains unchanged.

Conclusions and Prospects
There are some problems with floor positioning in the following situations. Radio signals can be affected by multi-storey and complex indoor environments. Barometric changes are limited by temperature and humidity. The floor recognition rate is low in staggered floor and atrium spaces. In addition, some smartphones do not have barometric sensors. In order to solve these problems, a HAR-based method was proposed in this study to obtain real-time floor positions. The SVM algorithm was used for activity classification, and 91 eigenvalues were selected for classification. The recognition accuracy of WA, US, and DS was as high as 99.3%. The average activity recognition accuracy of multiple people could still be maintained at 96.8%, even in smartphones without barometers. Thus, high-accuracy floor change recognition could be guaranteed.
Threshold analysis was used to filter the static states of pedestrians, and then detect the state of taking the elevator up and down. The running time of the elevator was recorded and used to judge the floor change. Then, the results of the floor change and the HAR were utilized to detect the real-time floor change by a series of aforementioned detailed steps. The floor positioning was also realized. Finally, the floor positions of pedestrians' movements in a multi-storey building were evaluated and compared with the actual floor positions. The test results indicate that our method could achieve high-accuracy floor change and real-time floor positioning. It also had a sound fault tolerance rate in the case of the continuous misjudgment of a three-step motion state. Moreover, it was not sensitive to the complex multi-storey environment and had high universality. It was able to detect floor changes during elevator operation, even without barometers, but also allowed for pedestrian round-trips and static behavior.
The scheme for detecting the HAR-based floor change was described in this paper on the basis of ensuring HAR accuracy, and the number of consecutive misjudged steps. In the case of different phone modes, such as trouser pocket modes, and waist or ankle positions, the HAR accuracy could be ensured by extracting the same and even higher accuracy classification models through further sample training. If there appeared more than four misjudged consecutive steps, the accuracy of the classification model could be improved by increasing the training sample size, optimizing feature vector. If the accuracy still cannot be improved, we can adjust relevant thresholds to increase the fault tolerance rate of our method. In short, higher HAR accuracy can ensure the high-precision floor positioning of the HAR-based method described in this article.

Data Availability Statement:
Restrictions apply to the availability of these data. Data are classified and are not able to be published publicly.