# A Pilot-Based Integration Method of Ranging and LS Channel Estimation for OFDM Systems
## 3 Ranging
### Distance Measurement  
After tracking each ranging pilot, the tracking loop will continuously output the phase offset value of the corresponding subcode. Then, according to the Chinese remainder theorem, the receiver can calculate the total phase offset and measure the transmission distance. The ambiguity resolution algorithm based on Chinese remainder is as follows.  
1. Assuming that the pilot sub codes utilized for ranging in this design are \(p_{1}\), \(p_{2}\) and \(p_{3}\), respectively, and the periodic coprime of each ranging sub code is \(N_{1}\), \(N_{2}\) and \(N_{3}\), respectively, the maximum unambiguous distance that can be measured by the ranging code is \[(N_{1}N_{2}N_{3})T_{sym}c\] (16) where \(T_{sym}\) is the duration of a single ranging code element, and \(c\) is the speed of light.
2. Let the corresponding integer digital slice offsets of the code tracking loop output be \(x_{1}\), \(x_{2}\), and \(x_{3}\), and find \(Y_{1}\), \(Y_{2}\), and \(Y_{3}\) that satisfy the following conditions: \[\left\{\begin{array}{l}Y_{1}\bmod N_{1}=1\\ Y_{1}\bmod N_{2}=0\\ Y_{1}\bmod N_{3}=0\end{array}\right.,\left\{\begin{array}{l}Y_{2}\bmod N_{1 }=0\\ Y_{2}\bmod N_{2}=1\\ Y_{2}\bmod N_{3}=0\end{array}\right.,\left\{\begin{array}{l}Y_{3}\bmod N_{1 }=0\\ Y_{3}\bmod N_{2}=0\\ Y_{3}\bmod N_{3}=1\end{array}\right.\] (17)
3. Then the final summed integer offset \(Y\) based on the individual subcode integer slice offsets is \[Y=(x_{1}Y_{1}+x_{2}Y_{2}+x_{3}Y_{3})\bmod(N_{1}N_{2}N_{3})\] (18) The measured transmission distance is \[(Y+Y_{i})T_{sym}c\] (19) where \(Y_{i}\) is the fractional code piece offset of the tracking code loop output.  
The composite code chip offset is sensitive to the chip offset tracked by each ranging code. When the tracking of only one ranging code has errors, the overall calculation result will have multiple errors. However, when multiple ranging codes are used for ranging, the fractional chip offset of different ranging codes is consistent. In addition, when all ranging codes generate the same phase offset, the overall composite code will also generate the same size of phase offset. For example, assuming that the integer digital slice offsets of the code tracking loop output are \(x_{1}+c\), \(x_{2}+c\), and \(x_{3}+c\), the final offset \(Y_{C}\) based on chip offset tracked by each ranging code will be  
\[Y_{c}=Y+Y_{i}+c \tag{20}\]  
Therefore, according to this feature, the receiver can self-correct these tracking results according to the acquisition and tracking results of each ranging code.  
Note that the number of pilots will change depending on the number of subcarriers utilized in OFDM. Thus, the number of ranging codes utilized may vary accordingly. In the practical application environment of a UAV, only a few short-period ranging codes are needed to meet the ranging requirements. Therefore, after selecting the required ranging codes, these codes can be reused as pilots. In addition, the number of ranging codes depends on the maximum unambiguous distance of corresponding ranging codes. Table 1 gives the maximum unambiguous distance of different number of periodic coprime ranging codes when the code rate is 0.6 MHz.