A Research on the Indoor Rotating Arc Triangle Positioning Algorithm Based on RSSI

In recent years, the rapid development of mobile communication technology has led to the development of positioning services, and the demand for indoor positioning technology has been increasing strictly. In the Internet information era, location-based services (LBS) have been applied in various fields after the emergence of location-based information technology, which brings new experience and convenience to people. In order to improve the indoor positioning accuracy of wireless sensor networks, an indoor positioning algorithm with a rotating arc triangle layout is proposed. This layout uses a circular arc triangle to deploy the beacon nodes and changes the position of the beacon nodes by rotating. Compared with the square, triangle, and equi-arc triangle layout, the rotating arc triangle layout reduces beacon nodes and is easy to rotate, but the layout after rotation has not changed. Experiments show that the layout of the rotating arc triangle layout is simple. By rotating the beacon node, multiple positioning prediction positions are superposed, and the positioning accuracy is improved. The rotating arc triangle layout is better than the square, the traditional triangle, the improved triangle, and the equal arc triangle. The average positioning accuracy of the arc triangle has been increased by 69.9%, 51.8%, 16.6%, 35.6%, and 32.9% respectively, which has certain use value and popularization.


I. INTRODUCTION
Due to the shortcomings of satellite positioning technology in indoor signal instability, low positioning accuracy, the diversity and complexity of different indoor environments and layout methods, the reliability, continuity and stability of indoor positioning technology are relatively poor, which cause that positioning accuracy is relatively poor. Unable to meet the demand, high-precision location perception in indoor environments is essential for mobile computing and mobile social networks [1]. Therefore, looking for effective and reliable positioning technology to improve positioning accuracy has become a hot spot for many researchers.
With the rapid development of wireless sensor technology and computer technology, as well as the rapid advancement of high-tech technologies such as cloud computing, The associate editor coordinating the review of this manuscript and approving it for publication was Lu Liu . artificial intelligence, the Internet of Things, and driverless technology, location-based services (LBS) have brought great convenience, among which technologies such as tracking, positioning and location navigation are being widely used by people all over the world [2].
With the rapid development of wireless sensor networks and computer technology, indoor positioning technology is also becoming increasingly mature and entering human life. At present, the most well-known GPS technology is widely used in global positioning. However, for indoor structural layout environments and densely built tall buildings, GPS cannot perceive satellite signals. There are two types of node positioning based on wireless sensor networks (wireless sensor networks, WSNs): ranging and non-ranging. There are also requirements for positioning accuracy and price. Instability, poor accuracy, and environmental factors in indoor positioning affect the accuracy of positioning. Therefore, a good positioning algorithm has an important impact on positioning VOLUME 8, 2020 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ accuracy. As a continuation of the positioning technology in the indoor environment, indoor positioning technology makes up for the shortcomings of traditional positioning technology. At present, it has been put into practical application in specific industries, and certain application results have been obtained, and it has promising application prospects. For indoor positioning, Bluetooth positioning, WI-FI positioning, infrared positioning, ZigBee positioning and other technologies are commonly used [3]. Wireless Sensor Networks (Wireless Sensor Networks, WSK) communicate wirelessly and are composed of micro sensor nodes deployed in the monitoring area [4], which can monitor various logistics information and are widely used in the environment, medical and other fields [5]. In the research of wireless sensor networks, the positioning method based on distance measurement needs to provide certain hardware support at the transmitter and receiver, extract relevant parameters as the parameter input of the positioning algorithm, and then provide corresponding parameters according to the corresponding algorithm to achieve positioning [6]. Ranging technology is generally divided into the following types: according to the transmission time of the wireless signal from the transmitting end to the receiving end, that is, the time of arrival (Time of Arrival, TOA) [7]; according to the wireless signal transmission time difference from the transmitting end to the receiving end, that is, the time of arrival difference (Time Difference of Arrival, TDOA) [8]; according to the wireless signal angle from the transmitter to the receiver (base station), that is, the angle of arrival (Arrival of Angle, AOA) [9]; according to the wireless signal from the transmitter to the receiver Received signal strength (RSSI) [10]. Non-ranging positioning algorithms mainly include Centroid [11], DV-Hop (Distance Vector-Hop) algorithm [12], Amorphous positioning algorithm [13], APIT (Approximate Point-in-triangulation Test) algorithm [14] and so on. Marcin U et al. arranged the sensor nodes around the positioning area [15]. The distance between the nodes is relatively long, and no regional model of layout refinement is involved. Zhu Jian et al. used 5m as the boundary. The RSSI is within 5m defined as a non-sensitive area and the area beyond 5m is a sensitive area. An equilateral triangle with a side length of 5m is proposed. However, 8 beacon points are used and the coverage area is 65%. Wang Hui pointed out that the traditional equilateral triangle positioning at the edge of the area where the equilateral triangle positioning layout is adopted. There is a lack of anchor nodes necessary for positioning, and there are anchor nodes on the boundary line of the triangular area that have similar effects, and the positioning results are constantly changing. In an area of 13m×6m, 7 beacon nodes are arranged according to an equilateral triangle with a side length of 4m. In the edge area lacking anchor nodes, Hui Wang proposed the method of adding 3 anchor nodes to achieve full coverage of the location. Due to the increase of beacon nodes, the workload will also increase. Xuming Liu proposed an equi-arc triangle layout with an equi-arc triangle area surrounded by three arcs. The equi-arc triangle layout enables indoor positioning accuracy to be obtained. To improve it [16], 8 beacon nodes are deployed.
In this paper, the received signal strength indicator (RSSI) received by ZigBee technology [17] is used to obtain the basis of the position distance between the beacon node and the unknown node through the logarithmic loss model. The square layout, traditional triangular layout, improved triangular layout, and equal arc are used. Triangular layout is tested separately [18]. This paper proposes a rotating arc triangle positioning layout, which reduces the number of beacon nodes in a certain area, improves positioning accuracy, and reduces workload. It compares the positioning error accuracy of different layouts under the same algorithm and obtains the effect of improving positioning accuracy.

II. PATH LOSS MODEL A. RSSI DISTANCE RELATIONSHIP
Use the host computer development environment IAR Embedded Workbench to compile the coordinator, reference node program and blind spot program respectively, and burn them into the ZigBee module of CC2530F256RHAR as the main control chip through the emulator to collect RSSI. Due to the influence of factors such as multipath effects, the wireless signal follows the Shadow model during transmission, as shown by formula (1): In formula (1), d is the actual distance between the known node and the unknown node; d 0 is the experimental reference distance, generally taken as d 0 = 1m; Pr(d) is the received signal strength received by the receiving terminal; Pr(d 0 ) is the received signal intensity indicator, represented by A when the reference distance of 1m; n is the signal path loss factor, whose detailed value is changed by environmental influences; X is Gaussian random noise with a mean value of 0, following the Gaussian distribution. In the experimental environment, X is ignored, and a simplified Shadow model is obtained, as shown by formula (2):

B. KALMAN FILTER
In the early 1960s, R.E.Kalman and R.S.Bucy proposed a new linear filtering and prediction theory called Kalman filtering. The Kalman filter is described by a series of recursive mathematical formulas. They provide an efficient and computable method to estimate the state of the process and minimize the estimated mean square error. The basic idea of the Kalman filter algorithm: take the minimum mean square error as the best estimate, use the state space model of signal and noise, use the estimated value at the previous moment and the observed value at the current moment to update the estimation of the state variable, and find for the estimated value at the current moment. The algorithm estimates the minimum mean square error for the signal to be processed according to the established system equation and observation equation.
Kalman time update: Among them,x k−1 andx k represent the posterior state estimation when the value is at k-1 and k respectively, that is, the result after update;xk is the a priori state estimation when the value is at time k, which is the intermediate result of filtering; P k−1 represents the posterior estimation agreement variance at time of k-1; Pk is the a priori estimated covariance at time of k, A is the state transition matrix, and B is the matrix that converts the input to the state. Kalman filter state update equation: Among them, H is the conversion matrix from state variable to measurement, which connects state and observation; Z k is the measured value, that is, input; P k is the posterior estimated covariance at time of K. Update the covariance estimate: In formula (7), K k is the filter gain matrix, and R is the measurement noise covariance.
In this paper, the collection of indoor received signal strength indicator (RSSI) is to use ZigBee to receive 100 sets of data at different distances from 0 to 10m, and record the actual distance. After filtering by Kalman filter, the distance and RSSI are obtained by linear fitting. The value relationship is shown in Figure 1: After linear fitting, A = −39.80dB and the path loss factor n=1.85 are obtained, and the resulting Shadow model is shown in formula (8): Therefore, the relationship between RSSI and distance is shown in formula (9): The path loss model obtained is shown in Figure 2: From the path loss model, we can see that within 0∼10m, the RSSI decreases with the increase of the distance, but the decreasing trend becomes smaller and smaller. This article takes 4m as the beacon node as the best communication distance. Within the best communication distance, the attenuation of the RSSI value on the distance is more obvious. After a distance of more than 4m, due to environmental factors, the received RSSI will fluctuate up and down. The RSSI value varies slightly but the distance varies greatly, and the experimental error is large. Therefore, the greater the distance, the greater the positioning error caused by the energy fluctuation, and the positioning accuracy is not accurate.

III. RESEARCH ON POSITIONING LAYOUT BASED ON ROTATING ARC TRIANGLE A. ARC AND TRIANGLE POSITIONING LAYOUT
Because the indoor positioning accuracy is not high, in order to improve the indoor positioning accuracy, a circular-arc triangle layout is proposed to improve the positioning accuracy by changing the layout of the beacon nodes. The circular-arc triangle layout is based on an equi-arc triangle as a reference under the best communication distance, and a circular arc with a radius of 4m is used to form the positioning area. The area enclosed by three circular arcs is the Rulocs triangle (Arc triangle) and its layout makes the beacon node in the communication range the best layout. The schematic diagram of the equal arc triangle layout is shown in Figure 3: The three dots of circle centers are the positions of the beacon nodes, and the arc triangle surrounded by the three beacon nodes and the three arcs between the dots is the layout mode. The three beacon nodes are located in the best receiving area, and the distance of any coordinate in the area from each beacon node is no more than 4m. The layout of the arc and triangle is shown in Figure 4:  In Figure 4, the black dots are beacon nodes. This layout is in an area of 8m * 8m, using 7 beacon node layouts, and the coverage area reaches 78.5%.

B. ROTATING ARC TRIANGLE LAYOUT
The rotating arc triangle layout uses the beacon node on the center of the circle as the rotation points are 20 • and 40 • , and all beacon nodes on the circle are rotated clockwise by a certain angle. The beacon nodes on the circle move with the rotation of the circle. The layout of the rotating arc triangle is shown in Figure 5: After the rotation, the signal is collected again and a new database is established. Compared with the square layout, the traditional triangle layout and the equi-arc triangle layout, the rotating arc triangle layout requires 8 beacon nodes and the improved triangular layout requires 14 beacon nodes. The layout makes the workload reduced such as: the place of experimental beacon nodes, RSSI collection and processing of received signals and improves work efficiency.

IV. ROTATING ARC TRIANGLE POSITIONING ALGORITHM A. PARTICLE SWARM POSITIONING ALGORITHM
The particle swarm algorithm was brought in 1995, which originated from the study of bird predation behavior. The basic core is to use individual bird flocks to share information to obtain the optimal solution to the problem. The particle swarm uses the following formula to update its speed and position [19]. Particle position: Particle speed: Among them, V is the velocity of the particles, and the update of V is random, which makes the global optimization ability of the entire PSO algorithm strong. The best position of individual particle experience: Best position experienced by the population: The d-dimensional velocity update formula of particle is: Among them, w is called the inertia weight of PSO. Its value is in the range of (0,1). It is applied to adopt an adaptive value method, that is, set w=0.9 at the beginning, which makes the ability of PSO global optimization stronger. As the iteration progresses, the parameter w decreases, so that the PSO has a strong local optimization capability. When the iteration ends, w=0.1. The parameters c1 and c2 are called learning factors and are generally set to 2; and r1 and r2 are random probability values between [0,1].
The d-dimensional position update formula of particle i: Obtain the distance (x, y) from the unknown node to the beacon node A1 (x1, y1), A2 (x2, y2), A3 (x3, y3),. . . , An (xn,) through the received RSSI signal through the Shadow model yn) are d1, d2, d3,. . . ,dn, and the ranging errors are 1, 2, 3,. . . , n. Make it satisfy: The sum of errors is f(x, y). The smaller the sum of errors is, the more accurate the estimated position and the smaller the error are. Therefore, the particle fitness position is the position where f(x, y) is the smallest. The problem can be transformed into the value of the minimum nonlinear equation system, that is, solving the estimated coordinate (x, y) or f(x, y) that minimizes the value. The fitness function is used to evaluate the quality of the particle position and guide the search direction of the particle motion algorithm. The fitness function of the particle is: (17) where f(x, y) is the fitness value of the particle position (x, y), (x i , y i ) is the position coordinate of the beacon node i, and d i is the actual distance from the unknown node to the beacon node i. The algorithm framework of the entire particle swarm optimization algorithm is as follows: Step1: population initialization. It can perform random initialization or design a specific initialization method according to the optimized problem, and then calculate the fitness value of the individual to select the local optimal position vector of the individual and the global optimal position vector of the population.
Step 2: Iteration setting. Set the number of iterations and set the current number of iterations to 1.
Step 3: Speed update. Update the speed vector of each individual.
Step 4: Position update. Update the position vector of each individual.
Step 5: Update local position and global position vector. Update the local optimal solution of each individual and the global optimal solution of the population.
Step 6: Judgment of termination condition. When judging the number of iterations, the maximum number of iterations is reached. If it is satisfied, the global optimal solution will be output; otherwise, the iteration will continue and jump to step 3.
For the application of particle swarm optimization algorithm, it is mainly the design of velocity and position vector iterative operators. Whether the iterative operator is effective will determine the performance of the entire PSO algorithm, so how to design the iterative operator of PSO is the research focus and difficulty of the application of PSO algorithm.
The particle swarm algorithm starts from the random solution and evaluates whether it is the optimal solution through fitness. If the current fitness is better than the best position, the best position is changed until the corresponding number of iterations. The final optimal solution is to predict the position of the node.

B. K NEAREST NEIGHBOR ALGORITHM(KNN)
The K-Nearest Neighbor (KNN) classification algorithm is a theoretically mature method and one of the simplest machine learning algorithms. The idea of this method is that in the feature space, if most of the k nearest (that is, the nearest neighbors in the feature space) samples near a sample belong to a certain category the sample also belongs to this category. It obtains the fingerprints of the first K reference points closest to the point to be located in space, and obtains the estimated position coordinates of the unknown node according to the position coordinates of the K reference points. The basic distance space can be calculated as formula (18): Among them, RSSI j is the RSSI from the positioning phase, and RSSI ij is the RSSI from the fingerprint database. The variable i depends on the distance the algorithm prefers, i=2 represents the Euclidean distance. The KNN algorithm itself is simple and effective. It is a lazy-learning algorithm. The classifier does not need to use the training set for training, and the training time complexity is 0. Although it is less accurate than probabilistic algorithms, many researchers still tend to use it due to its low computational complexity. KNN largely depends on the granularity of the RP space. The more RP in the coverage area there is, the more accurate the positioning accuracy is. However, the workload in the offline phase will increase at this time and cause the loss of human resources. The K nearest neighbor method (KNN) is an improvement of the nearest neighbor method. K nearest position coordinates are selected, and the average coordinate (X, Y) of these K coordinates is obtained as the positioning result, as shown in equation (19): Among them, the average coordinate(X , Y )of the K coordinates is used as the positioning result. Among them, To find the k nearest neighbors to make predictions, only need to calculate the distance between the prediction sample and all the samples in the training set, and then calculate the smallest k distance. Then majority vote, and it is easy to make a prediction. However, in this paper, three sets of predicted positions are obtained after one layout and two rotations, so three sets of test data are directly used for processing. The three sets of predicted unknown node coordinates are passed VOLUME 8, 2020 through the K Neighbor Method (KNN) to obtain the final positioning result.
Experimental steps: Step 1: Initialize the layout model and node location information.
Step 2: Receive the RSSI signal, filter the RSSI signal through the Kalman filter, and select the three largest RSSIs to calculate the distance through the path loss model, and pass the three distances and position relationships through the particle swarm algorithm.
Step 3: Initialize the number of particle swarms to 10, the number of iterations is 1000, and set the fitness of the initial particle to the fitness value corresponding to the global best position. The fitness is set to 1000, and each particle is randomly assigned an initial position and speed, the initial number of iterations is 1, the learning factor c1=2, c2=2.
Step 4: Calculate the fitness of the particle according to its formula (17). For each particle, compare the fitness value of its current position with the fitness value corresponding to the global best position. If the fitness value of the current position is higher, use the current location to update global best location.
Step 5: Update the speed and position of each particle according to formula (14) and formula (15).
Step 6: If the end condition is not met, return to step 4. If the end condition is met, the algorithm ends, and the global optimal position is the global optimal solution.
Step 7: Rotate the beacon node of the arc triangle clockwise, its rotation angle is 20 • and 40 • . Return to step (2) to calculate the optimal solution.
Step 8: Three positions to be measured are obtained through one layout and two rotations, and the final position to be measured of unknown nodes is obtained by using the k-neighbor method to measure the positions.
Step 9: Output the predicted coordinates of the node to be tested.

A. EXPERIMENTAL LAYOUT
This article collects data in an indoor area of 8m * 8m, using square layout, traditional triangle layout, improved triangle layout, equi-arc triangle layout and rotating arc triangle layout positioning methods to collect RSSI, and collect RSSI signals and their related coordinates. The particle swarm algorithm is used to locate and predict the location of unknown nodes. The experimental environment and data collection environment are shown in Figure 6: In Figure 6, the ZigBee module is placed on a 1.2m high bracket in order to prevent the influence of the experimental environment on the path loss factor and then the RSSI. The top view of the experimental environment and data collection is shown in Figure 7: Figure 7 is a top view of the laboratory on the sixth floor of Building B, Science Building, School of Information and Communication Engineering, North University of China. The laboratory is about 8m wide and 12m long, which is suitable  for the layout of this experiment. In this paper, on the basis of turning a circle into a triangle, the beacon nodes on the circle are rotated clockwise by the angles 20 • and 40 • respectively. The layout after rotation and the deployment of beacon nodes and unknown nodes in several other layouts are shown in Figure 8: In Figure 8, black dots represent beacon nodes, and black five-pointed stars represent random unknown nodes. This paper uses 8 unknown nodes whose coordinates are (1, 1), (2,2), (3,3), (5,5), (6, 6), (7, 7), (0.5, 3), (7.6, 5.2), each unknown node receives the RSSI value sent from all beacon nodes, and stores it in the corresponding library for subsequent processing. It can be seen from Figure 8 that the square layout consists of 8 beacon nodes, the distance between nodes is relatively long, and no regional model of layout refinement is involved; the traditional triangular layout consists of 8 beacon nodes, and the coverage area of beacon nodes is 65%. The improved triangular layout is deployed by 14 beacon nodes, which can cover all beacon nodes, but there are more beacon nodes. The equal arc triangular layout is deployed by 8 beacon nodes, and the coverage rate of beacon nodes reaches 88%, whose covering rate is the highest; while the arc-triangle layout is deployed by 7 beacon nodes, the coverage rate of beacon nodes is 78.5%, but the beacon nodes are the least.

B. ERROR ANALYSIS
Through indoor positioning experiments, six layout methods are used to locate beacon nodes, including square layout, traditional triangle layout, improved triangle layout, equi-arc triangle layout, and rotating arc triangle layout. The terminal host computer receives unknown nodes from the beacon. The RSSI signal data of the target node is stored in the signal database. The collected data is processed by the Kalman filter and the mean filter to obtain the RSSI signal strength. Finally, the particle swarm positioning algorithm and the K nearest neighbor algorithm are used to predict the position of the unknown node, and the experiment is obtained positioning error. Among them, the positioning error of the rotating arc  triangle is shown in Figure 9, the black circle represents the real coordinate, and * represents the predicted coordinate.
The comparison of the six positioning layout errors in the experiment and the maximum value are shown in the cumulative distribution of positioning errors in Figure 10 and the layout errors in Table 1: From Figure 10 and Table 1, the following conclusions can be drawn: 1. The positioning accuracy of the rotating arc triangle layout method is higher than other layout methods, and its maximum error, minimum error and average error are small. They are rotated to 20 • and 40 • respectively. The same layout is used for three different beacon nodes to improve positioning accuracy.
2. Because the coordinates of the first and sixth unknown nodes of the rotating arc triangle layout are located at (1,1) and (7,7), they exceed the coverage of the rotating arc triangle layout and their accuracy is low.
3. The improved triangle has higher positioning accuracy than the square, traditional triangle and equi-arc triangle. The reason is the addition of 6 beacon nodes.
4. Since the k-nearest neighbor algorithm is used for the three-time positioning result, the positioning accuracy of the rotated arc triangle layout is higher than that of the un-rotated arc triangle.
5. Compared with the square, traditional triangle, improved triangle, equi-arc triangle and arc triangle, the average positioning accuracy of the rotating arc triangle has been improved by 69.9%, 51.8%, 16.6%, 35.6% and 32.9% respectively.

VI. CONCLUSION
In order to improve the indoor positioning accuracy, this paper proposes a rotating arc triangular positioning layout and the advantages of the rotating arc triangular layout are verified through experiments-the accuracy and superiority of the layout of the rotating arc triangular layout. Compared with other layout methods, the rotating arc triangle layout has a good positioning effect, improves work efficiency, reduces the workload of data collection and processing, and reduces the average and maximum deviations of unknown nodes. Achieving large-scale and high-precision indoor positioning has always been the focus of indoor positioning technology research. Reasonable placement of beacon nodes can effectively improve positioning accuracy. The next step is to improve the positioning layout model and further improve the effectiveness of the positioning algorithm. A large number of nodes can be used to conduct the positioning experiments in a complex environment.
LI MAOZHEN received the Ph.D. degree from the Institute of Software, Chinese Academy of Sciences, in 1997. He is currently a Professor with the Department of Electronic and Computer Engineering, Brunel University London, U.K. He has over 160 research publications in these areas including four books. His main research interests include high-performance computing, big data analytics and intelligent systems with applications to smart grid, smart manufacturing, and smart cities. He is a Fellow of the British Computer Society and IET. He has served over 30 IEEE conferences and is on the editorial board of a number of journals.
WANG ZHAOBA received the Ph.D. degree in detection technology from the Nanjing University of Science and Technology, in 2002. He is currently a Professor with the Department of Information and Communication Engineering, North University of China, China. He is the author of more than 80 articles. His main research interests include signal and information processing.
XIAOQIAN ZHAO was born in Shanxi, China, in 1995. She received the B.Sc. degree from Xinzhou Normal University. She is currently pursuing the M.Sc. degree with the North University of China. Her research interests include signal processing and ZigBee indoor positioning.
YANG YANFANG was born in Shanxi, China, in 1997. She received the B.Sc. degree from Xinzhou Normal University. She is currently pursuing the M.Sc. degree with the North University of China. Her research interests include signal processing and magnetic field indoor positioning. VOLUME 8, 2020