PRG: A Distance Measurement Algorithm Based on Phase Regeneration

With the booming development of the Internet of things (IoT) industry, the demand of positioning technology in various IoT application scenarios is also greatly increased. To meet the positioning requirements of the IoT application, we propose a distance measurement method based on phase regeneration that can provide positioning capability for IoT applications in indoor and outdoor environments. The PRG algorithm consists of two phases: coarse ranging phase and fine ranging phase. Fingerprint positioning algorithm based on Gradient Boost Decision Tree (GBDT) is used to determine coarse distance. The host machine measures the difference between the transmitted carrier phase and the received regenerative carrier phase to fix the fine distance and then the coarse distance is used to determine the carrier phase integer ambiguity. Finally, high precision ranging is realized. Simulation results show that the PRG method can achieve range finding with decimeter level precision under the 10 MHz subcarrier frequency.


Introduction
Positioning of node information is crucial in IoT applications. In plenty of IoT applications, the sensor node information is meaningless when the positioning is uncertain, such as wearable devices, sweeping robot et.al. Location-aware based on range finding can be widely used in IoT node [1,2], compared with based on range-free has higher positioning accuracy [3]. Therefore, it is very important to nodes positioning to study the distance measurement of IoT nodes in the IoT.
Distance measurement is mainly divided by two methods: based on received signal strength (RSS) and time-of-flight estimation [4]. Wang H. et al. proposed a novel range finding algorithm based on RSSI in wireless sensor network ,the algorithm by creating a database between RSSI readings and distance reduce the impact on precision of range finding due to RSSI measurements volatility [5]. Cho H. et al. proposed a distance measure method by bluetooth equipment in the IoT, and the method by adding extra self-calibration beacon reduce the influence of environmental variation on the precision of range finding , and 90% probability of accuracy of range finding is less than 1.5 m [6]. Chowdhury T. I. et al. have used a multi-step RSSI-based distance calculation model using Samsung Galaxy S4 smartphone. They achieved the error level up to 13.4% [7]. Barai S. et al. proposed a method of distance measurement based on the curve fitting between RSSI and distance, reduce the average error level up to 8.32% [8]. Akiyama T. et al. proposed a positioning method of using smart phone to measure the time of arrival(TOA), employ modulated light with an signal for the time-of-flight short measurement, CMOS sensor to achieve precise TOA measurements by mobile phones, can realize positioning error less than 10 mm [9]. However, a low cost and simple distance measurement technology is still needed to provide the accuracy of meter positioning [10].
To address the aforementioned shortcomings, we present phase regeneration method for distance measurement, combining coarse range and fine range of ways to meet the demand of the system is simple, high precision range finding. Different positioning requirements can choose different parameters making the method is suitable for many positioning scenarios. Therefore, the range finding method based on phase regeneration has greater flexibility and scalability.
The remainder of this paper is organized as follows: A detailed description of PRG method for distance measure is presented in Section 2. In Section 3, the simulation results and evaluation is listed. Section 4 concludes this paper.

Phase Regeneration Ranging Algorithm
The PRG algorithm range finding model is shown in Figure 1. The detailed process of the PRG algorithm is as follows: Firstly, the pseudo-range measurement d p between the master node M and the slave node S can be obtained from the coarse range finding method. Secondly, the master node M continuously transmits the range finding signal to slave node S. After the slave node S receives the range finding signal and synchronizes the phase and frequency through the carrier tracking loop, then the slave node S continuously transmits the replication range finding signal to master node M. Thirdly, the master node M receives its replication range finding signal from previous slave node S and then obtains the phase difference measurement d φ between the transmitted and the received replication carrier. Finally, the distance d between the master and slave node can be expressed by: where λ is the wavelength of range finding signal, · f loor represents round down function. In the ideal case, it can be seen from the above Equation (1) that high precision range finding can be achieved without coarse range finding phase when the distance between master and slave node is less than λ 2 . In addition, the PRG method is unavailable due to carrier phase integer ambiguity in Equation (1) when the error of coarse range finding is greater than λ 2 . A conservative estimation method for carrier-tracking loop error is to ensure that the 1σ tracking error is no more than λ 24 . We assume that carrier-tracking loop error of the master and slave node is independent and the condition of no carrier phase integer ambiguity is that the precision of coarse range finding is d p ≤ 5λ 12 .

Range Finding Signal
The range finding signal of PRG algorithm is single-sideband modulation. The modulation block diagram is shown in Figure 2, first the double sideband signal is obtained from the analog baseband signal m(t) with mean 0 and sinusoidal carrier signal c(t) multiplication and then the amplitude modulated signal by low pass filter H(ω) for filter, get lower sideband modulation signal S SSBi (t). The analog baseband signal in PRG algorithm is tone signal with a frequency of f d , and denoted by: represents the amplitude of analog baseband signal. We can get the signal S i (t) as: The range finding signal s SSBi (t) is obtained by a low-pass filtering of S i (t) with cutoff frequency of f i and can be expressed as: The modulation signal can be got with frequency of f 1 − f d , f 2 − f d , · · · , f n − f d and different carrier frequencies are used to identify different master and slave node to apply multi-master, multi-slave case. To ensure that each modulation signal does not interfere with each other, we need to make sure that adjacent two frequency points have a wide enough frequency protection interval so that the RF front end can separate signals from each frequency point.

Search Scope
The doppler shift can be ignored because the current user case of the scenario is low dynamic. Therefore, the search space of range finding signal is one dimension, the signal acquisition can be carried out by searching the frequency point of the signal.

Signal Detection
Signal acquisition is estimate the frequency of the receiving signal and then initialize the tracking loop according to these parameter to help the receiving channel to track the signal. Figure 3 illustrates a high level block diagram typical of signal acquisition where the digitized received RF signal is applied to the input. Referring to Figure 3, first the digital RF is stripped of the carrier by the replica carrier signals to produce in-phase (i) and quadraphase (q) sampled data and then the results i and q generate data to I and Q after the coherent integration with time T c . Finally, the incoherent integral amplitude V is obtained by incoherent integration. The incoherent detection method of signal acquisition determines whether the received signal has been detected by detecting the magnitude of the incoherent integral amplitude V: if the incoherent integral amplitude V is less than the acquisition threshold value V t , the signal has not been searched and the receiver adjusts the carrier numerical control oscillator according to the set search step and continues to search and detect signals in the next search cell. Otherwise, if V > V t , the signal is searched, and the receiver then confirms that the signal is successfully captured. The complex form of coherent integration is: Where a is the amplitude of signal, f e represents frequency difference between received carrier and replica carrier generated by NCO, φ e represents phase difference between 2 carriers, and n I ∼ N(0, σ 2 n ), n Q ∼ N(0, σ 2 n ), and n Q and n I is independent. The σ n can be expressed by: Without noise, the amplitude of r(n) is: We can see phase difference φ e between receiving and replica carrier does not affect the value of V, so the V can be used for capture detection. From the above assumption of n I and n Q , the amplitude V have Ricean distributions in the presence signal and have Rayleigh distributions in absence of signals [11]. The Rayleigh distribution probability density function f n (v) is shown in Equation (2) and the probability density function f s (v) of Ricean distribution is shown in Equation (3), and its probability density curve is shown in Figure 4. We can be seen from Figure 4, selecting the appropriate capture threshold value V t is the key step for signal acquisition to achieve good performance. Too small threshold value can easily cause false alarm, and too high threshold value can easily cause leakage alarm. It is often necessary to set a false alarm rate P f a of signal acquisition and then calculate the corresponding acquisition threshold value according to the false alarm rate. Moreover, signal acquisition sensitivity is also related to false alarm rate and leakage rate P md . we assume that the acquisition probability P d = 1 − P md = 0.9 and P f a = 10 −3 can be able to capture normally and then the probability density formula is given: We can get the acquisition threshold can be expressed as: (4) and (5) with acquisition probability, can be obtained: We assume that T c is 1 ms. According to the above equation, we can get the carrier to noise ratio C/N 0 can be expressed as: At 298 K ambient temperature, the power density of background thermal noise in the atmosphere is −174 dBm/Hz at 1 atmosphere standard, so the acquisition sensitivity is: In addition, the signal-noise ratio can be denoted as: From the above derivation, we can get the conclusion that: (1) the longer coherent integration time can improve the SNR; (2) under the condition of the same false alarm rate, namely the acquisition threshold V t unchanged, the higher signal-to-noise ratio, the higher the probability of detection.

Search Algorithm
If we assume that a linear search for frequency of signal and the coherent integration time is 1 ms, the simulation result is shown in Figure 5. It can be seen that frequency shift is 0 Hz, and the amplitude V of incoherent integration is the function of |sinc| and 3 dB loss corresponding frequency incoherent integration is about 440 Hz. Therefore, if the coherence integral is 1ms, the frequency interval between 2 frequency without interference is at least 440 Hz, otherwise it is impossible to identify each signal at different frequency. Incoherent integral amplitude in the real frequency may be less than other search cell due to noise in range finding signal , so we cannot think that signal acquisition is successful once positive test is obtained and this will also lead to a high false alarm rate. For this reason, we introduce a Tong search detector for PRG method, which is a linear search method in the form of variable search time. As illustrated in Figure 6 [12], the algorithm determines that the search is successful if the detection value of continuous A signal exceeds the threshold value and then it determines that the signal acquisition is successful. Under the condition that the false alarm rate of a single search is P f a and the detection rate is P d and the overall false alarm rate P F A and the overall detection rate P D can be expressed as:

Range Signal Tracking
During the range finding signal tracking phase, first the receiver signal channel obtains the carrier frequency estimates from signal acquisition capture phase, and then fine estimates of the carrier frequency and phase is obtained by tracking loop. Finally, the replica carrier is used for phase measurement or transmission to master node.
The carrier tracking discriminator defines the type of phase-locked loop and frequency-locked loop. The phase-locked loop adopts narrow noise bandwidth and can track the signal closely. The phase precision of the output carrier of phase-locked loop is most accurate, but it is more sensitive to dynamic stress than the frequency-locked loop. The frequency-locked loop adopts the wide noise bandwidth, so it has good dynamic performance and can be more robust when tracking during tolerance of high dynamic stress. However, the signal tracking is slightly less dense due to the higher of loop noise, so the precision of output carrier phase of frequency-locked loop is poor. The main factors influencing the accuracy of ranging in PRG method is carrier loop tracking accuracy to carrier phase. We adopt the phase-locked loop in the carrier tracking loop at the low dynamic scenario. A typical carrier tracking loop is shown in Figure 7. We can see from Figure 7 that the tracking performance is relate to the phase detector, loop filter and coherent integration time.

Phase Detector
The carrier tracking loop shown in Figure 7 is a Costa loop and the phase-locked loop discriminator commonly used are as follows [12,13] φ e = I · Q Figure 8 compares the input and output relationships of the four phase detectors above without noise.When the actual phase difference is greater than 90 • , all the other three phase detectors output phase discrimination results less than 0 except for the four-quadrant arctangent phase detector. This will cause the carrier phase of the tracking loop to adjust to the opposite direction, ultimately causing the loop to unlock the signal.

Loop Filter
To analyze the effect of loop filter on the performance of phase-locked loop, it is necessary to start with the system function of phase-locked loop expressed as: where θ o (s) represents the Laplace transform of the instantaneous phase of the output signal of the NCO, θ i (s) represents the Laplace transform of the instantaneous phase of the input signal, K is loop gain and F(s) is the system function of loop filter.
The selection of F(s) of loop filter is mainly related to the dynamic stress form of users, and the resulting excitation signal can be decomposed into many forms, such as phase step, frequency step and frequency ramp. We assume that this user case does not suffer too much and acceleration effects, so the phase-locked is only affected by phase step and frequency step, so we can choose one order loop filter, which is a second order phase-locked loop, the system function can be expressed by [14]: We can be seen from Equation (6) that the characteristics of the system function is mainly dependent on the characteristic frequency ω n and the coefficient of damping ζ. From the perspective of frequency domain, the second-order phase-locked loop bandwidth B L can be expressed as: The selection of loop bandwidth is related to user dynamics and noise performance and the larger the loop bandwidth, the higher the tolerance of user dynamics, but the worse the noise performance. Therefore, the selection of ω n and ζ needs to balance the noise performance and user dynamic performance. The lower the damping coefficient, the faster the system response to the converges. However, when the damping coefficient is too small, the response of the carrier loop will oscillate violently.

Coherent Integration Time
The coherent integral gain G c is calculated from the change of noise bandwidth before and after the integrator. Although there is no change before and after integral in signal power, noise power spectrum density and carrier to noise ratio, the noise bandwidth B L has changed by the integrator from B pd to 1/T c . Since the integral gain value is defined as the multiple of the signal-to-noise ratio increase, the integral gain value is equal to the reduction factor of the noise bandwidth and can be denote as: Because there is quantization loss in the process of digital signal processing, which may bring loss to the coherence integral, the actual noise-to-noise ratio will be reduced, generally no more than 2 dB. Next we will analyze the loss of the coherent integral due to the frequency error.
The coherence integral in the Figure 7 can be denoted as: where a is the amplitude of IF signal, f e represents frequency error of carrier loop, T c is the coherent integration time, θ e is the initial phase error and t 1 is the moment for integration to start. The coherent integral loss caused by frequency error is shown in Figure 9, and we can see from Figure 9 that the 3 dB coherent integral loss is 0.44/T c , which is also the maximum frequency error f e allowed by the tracking loop. Figure 9. The relationship between coherent integral loss and frequency error.

Coarse Range Finding Method
Through the above analysis, we can get the need to provide better than 5λ/12 wavelength ranging precision of coarse range finding method can eliminate the carrier phase integer ambiguity, and then gets the fractional part of carrier phase measurement by the carrier loop measuring phase difference between master and slave node, to can achieve high precision range.We assume that the second-order carrier wavelength of the range finding signal is 30 m, and then the coarse range finding method with accuracy of 12.5 m is required in PRG method. Existing media transmissions such as Wi-Fi, BLE are commonly used for indoor positioning, and can provide the range finding between two nodes. The accuracy of range finding using BLE is less than 1.5 m [6] and Wi-Fi is less than 2.9 m [15]. Range finding accuracy using Wi-Fi and BLE meets the requirements of the above coarse range finding. Wi-Fi signals are common in modern buildings, so there need not deploy any equipment. We can through the fingerprint positioning algorithm based on Wi-Fi get the coarse position of the current node, and then calculate the Euclidean distance of coordinates points of two nodes could satisfy the requirement of the PRG algorithm. We adopted Wi-Fi fingerprint positioning based on Gradient Boost Decision Tree(GBDT), and the algorithm flow is shown in Figure 10. The proposed fingerprint algorithm consists of two phase: an offline phase and an online phase. During the offline phase, RSS readings and its orientation that the mobile device are facing are collected on grid of reference points(RP), and then these are stored in fingerprint database, GBDT algorithm was used to train the fingerprint database, and the relationship model between signal strength vector x and position coordinate point p was obtained, f M (x). The online phase consists of the mobile devices measuring RSS, and positioning estimation by model f M (x).

Range Finding Signal Acquisition
We assume that the signal on the branch of I and Q is subjected to non-correlated gaussian additive noise with a mean of 0 and a variance of σ n , and we simulated the false alarm rate P f a by monte carlo simulation method. As shown in Figure 11 below, 10,000,000 random points were selected. It can be seen that the theoretical value is very similar to the calculated value. Figure 11. The false alarm rate simulation.

Distance Measurement Performance of PRG Method
Because PRG method adopts carrier phase to realize distance measurement, its precision is completely dependent on the tracking precision of carrier loop. The tracking accuracy of carrier loop mainly depends on thermal noise, oscillator frequency oscillation error, Allan mean square error and dynamic stress error. In this paper, the simulation experimental parameters are set follows as Table 1, and then the carrier loop tracking error analysis is as follows [10,16].
The mean square error of Allan can be expressed as: 3. Phase jitter caused by the mechanical vibration of user movement and the receivers of the frequency of oscillation is 2 • , and then Then, the 1σ distance measurement error caused by the tracking of carrier loop can be expressed as: 1992 m Under the static condition of the user, the parameter setting is the shown in Table 1, and the we use Matlab software to simulate the tracking performance of carrier loop. We can be seen from Figure 12 that after 100 ms, the standard deviation of the tracking phase error is 0.043 rad, and the corresponding tracking error is 0.2055 m. The simulation result is very close to the theoretical analysis above. In addition, the corresponding 1σ range finding error is 0.411 m in the PRG method.

Coarse Ranging Finding Performance
In the off-line phase, the fingerprint map is constructed through signal collector, which collects RSSI of each AP through RAK476 module [17]. The positioning area was selected at the room 1015, National University Science Park, Beijing University of Posts and Telecommunications, the total dimension of the room was 5.6 × 7.2 m. In addition, there are multiple deployed wireless routers around the room, and we collected RSSI of 13 reference points in the room. In the off-line training phase, RSSI of 6 AP at 13 reference points was collected within 2 min as fingerprint database, and the grid size was 1.7 m.
The cumulative distribution function(CDF) of coarse range finding error is shown in Figure 13, and we can get the range finding accuracy of GBDT fingerprint algorithm with the probability of 67% at 2.05 m and can meet the accuracy of coarse range finding requirements in PRG method.

Discussion
We suggest that the PRG method can achieve high precision range finding by eliminating the carrier integer ambiguity using coarse range finding method and it provides a basis for high precision positioning. Applying carrier phase measurement to study distance measurement using phase regeneration, we found that the method is both stability and accuracy, as demonstrated in the phase-locked loop results. Distance measurement accuracy was examined by comparing the PRG method and the coarse ranging finding method based on RSS. Our results in the range finding accuracy show a high precision compared to coarse range-based RSS finding method.
The carrier phase measurement technology in PRG method proposed in this paper reference the GPS of measurement technology, and a general standard require the mean square error of carrier phase measurement is less than half wavelength carrier for using pseudorange to round up the carrier phase integer ambiguity algorithm [18], and this requirement is consistent with accuracy of coarse range finding in this paper. Apart from the influence of carrier loop parameter settings on the distance measurement accuracy, the carrier frequency has an influence on accuracy of distance measurement as well. In addition, it is helpful to improve the robustness of PRG method by detecting sudden changes in integer values to cope with large coarse range finding error in practical applications. The higher the carrier frequency, the smaller the spatial distance metric, and then the higher the range accuracy. However, the requirement of precision of coarse range finding also needs to be improved.
The positioning method, based on distance measurement, consists of distance measurement and geometric calculation. Distance measurement can be divided based on the time synchronization and non-synchronization measurement. It is difficult to require high precision time synchronization for positioning in some scenarios, such as IoT. The PRG method proposed in this paper is combined with RTD and carrier phase measurement, so it has the advantages of not requiring high precision time synchronization and high precision distance measurement.
There are two issues that need to be studied in the future. One is the the system design and simulation verification of using Code Division Multiple Access (CDMA) signal as the range finding signal m(t) in multi-master, multi-slave case. The main reason for using CDMA signals is to identify different masters and slaves through different spreading codes. The other is the effect of indoor multipath on the accuracy of range finding by PRG method, we intend to use CDMA signal as range finding signal in the future research, and reduce the influence of indoor multipath through RAKE diversity reception. We plan to use the software radio platform and the existing transmission media (e.g., Wi-Fi, BLE) to achieve ranging by the PRG method, and to research the positioning algorithm in the case of multiple machines. The software radio platform is used to transmit and receive range finding signal and obtain the difference carrier phase between the transmitted and the received replication carrier. Existing transmission media is mainly used for coarse range finding by conventional range finding method.