# Pseudorange Measurement Method Based on AIS Signals
## 5 Optimal Estimation of Timestamps
### Minimum Mean Square Error Estimation Algorithm (MMSE-EA)  
A ship (considered as a user carrier of the AIS-R mode) is constantly moving, so the Doppler shift introduced by the relative motion of the ship will be included in the measurement results during one or more frames of measurement period. As the ship's tonnage is large, its acceleration and its high order derivatives are so small that they can be neglected. Therefore, modeling the TOA measurement result  
Figure 8: Comparison of timestamp detection results under different SNR. (**a**) Error mean; and (**b**) Error standard deviation.  
in one measurement period only needs to consider the ship's uniform motion. The fitting functions are as follows  
\[t_{n}=a+b\times n \tag{19}\]  
where \(t_{n}\) is TOA of a certain bit-0-phase, and is obtained by the timestamp detection method; \(n\) is the bit number corresponding to the measured value \(t_{n}\) in the bit sequence, and is obtained by matching the bit decision module and the message demodulation module; \(<\)\(n\), \(t_{n}\)\(>\) constitutes a set of measurement data pairs; \(a\) is the reception time of the first bit-0-phase in the frame message; \(b\) is the bit period of the digital message, and is affected by the Doppler shift caused by ship motion and the receiver clock frequency offset.  
Based on the obtained series of measurement data pairs, the parameters of the fitting function are estimated optimally. The optimal criterion is the minimum mean square error, and the estimated result is  
\[\left\{\begin{array}{l}a=\frac{\left(\sum\limits_{i=1}^{\pi}t_{i,x}\right) \left(\sum\limits_{i=1}^{\pi}n_{i}^{2}\right)-\left(\sum\limits_{i=1}^{\pi}n_ {i}\right)\left(\sum\limits_{i=1}^{\pi}nt_{i,x}\right)}{\left(\sum\limits_{i=1 }^{\pi}n_{i}^{2}\right)-\left(\sum\limits_{i=1}^{\pi}n_{i}\right)^{2}}\\ b=\frac{m\left(\sum\limits_{i=1}^{\pi}n_{i,x}\right)-\left(\sum\limits_{i=1}^{ \pi}n_{i}\right)\left(\sum\limits_{i=1}^{\pi}t_{i,x}\right)}{m\left(\sum\limits _{i=1}^{\pi}n_{i}^{2}\right)-\left(\sum\limits_{i=1}^{\pi}n_{i}\right)^{2}} \end{array}\right. \tag{20}\]  
where \(m\) is the number of measurement data pairs; \(<\)\(\alpha_{i}\), \(t_{n}\)\(>\) are the i-th measurement data pairs, where \(n_{i}\) is the corresponding bit number in the AIS message frame for the set of measurement data pairs; and \(t_{n,i}\) is the receiving time of the corresponding timestamp.  
The least square method is a statistical method that takes the least mean square error as the best estimation standard [27; 28; 29]. Generally, the larger the number of samples, the more accurate the estimation result. In order to evaluate the pseudorange measurement accuracy of the algorithm, Monte Carlo simulation was conducted on the estimation results with different packet lengths.  
Under the conditions of different SNRs and the numbers of packets, the simulation test was carried out by using the timestamp detection method and the optimal estimation algorithm proposed in this paper. The simulation was repeated 1000 times under each condition, and the standard deviation of the measured results was calculated. The simulation results are shown in Figure 9.  
As seen in the above figure, the longer the packet length, the smaller the SNR, and the higher the accuracy of the pseudorange measurement obtained from the optimal estimation. Under the condition that the packet length is more than 1250 bits; when the SNR is better than 10 dB, the  
Figure 9: Performance analysis of optimal estimation algorithm.  
standard deviation of TOA estimation is better than 2.97 \(\times\) 10\({}^{-7}\) s, which means that the corresponding pseudorange measurement error is better than 100 m (\(\delta\)). When the SNR is better than 30 dB, the standard deviation of TOA estimation is better than 2.95 \(\times\) 10\({}^{-8}\) s, which means the corresponding pseudorange measurement error is better than 10 m (\(\delta\)).