## 2 Algorithm
### The Procedure of PLGAIM
#### 2.2.2 HPL and the Availability of PRAIM  
This article focuses on horizontal positioning, so only the horizontal protection level (HPL) is analyzed. HPL refers to the horizontal positioning error that can be guaranteed when a fault occurs in current pseudolite constellation before fault detection. If HPL exceeds a given HAL, the current pseudolite constellation is not available. In other words, HPL is to ensure that the maximum \(P_{md}\) under the current pseudolite constellation does not exceed the demand. There are usually two methods to calculate:  
The first way is to use the geometric factor SLOPE between horizontal position error (HPE) and test statistic [41]. SLOPE represents the mapping of the test statistic to HPE, reflecting the relationship between them. If there is a deviation in the test statistic, it will be reflected in the SLOPE.  
The horizontal position errors are the first two elements of \(K_{k}V_{k}\) nan extended Kalman filter. Let \(S=(I-H_{k}K_{k})^{T}(I-H_{k}K_{k})\), assuming that the deviation occurs only in the \(i\)th pseudolite and the other pseudolites are normal. \(H\)SLOPE(\(i\)) can be used to indicate the sensitivity of horizontal position error to the deviation of the \(i\)th observations,  
\[H\)SLOPE(\(i\)) = \(\sqrt{(K_{1i}^{2}+K_{2i}^{2})/S_{ii}} \tag{14}\]where \(S_{ii}\) represents the \(i\)th element in diagonal matrix \(S\). SLOPE is purely a geometric factor. Corresponding to the same test statistic, \(P_{md}\) is the highest one when a fault occurs on apseudolite with the largest SLOPE. Therefore, the larger the \(H\)_SLOPE_, the more difficult it is to detect. In other words, when SLOPE is the largest, its statistic is the smallest in the case of the same HPE, which means that its residuals are the smallest, too. At this time, the minimum detectable deviation bias (MDB) is set to _pbias_ and it can be calculated according to the threshold and a given \(P_{md}\).  
If a fault occurs, \(T/\sigma\) should theoretically be greater than \(T_{h}\). If \(T/\sigma\) is smaller than \(T_{h}\), it indicates that a missed detection happens. The following probability equation can be established for a given \(P_{md}\),  
\[P_{r}(T^{2}/\sigma^{2}<T_{h}^{2})=\int_{0}^{T_{h}^{2}}f_{\lambda^{2}(m,\ \lambda)}(x)dx=P_{md} \tag{15}\]  
where \(\lambda\) is the noncentral parameter, _pbias_2 = \(\sigma^{2}\ \lambda/(n-t)\). \(\sigma\) represents the standard deviation of carrier phase measurements. The horizontal protection level HPL can be calculated as,  
\[\begin{array}{l}HPL_{1}=H\text{SLOPE}_{\text{max}}\times pbias\\ =H\text{SLOPE}_{\text{max}}\times\sigma\sqrt{\lambda}/\sqrt{(n-t)}\end{array} \tag{16}\]  
The other way is to use the position estimate uncertainty, in which the first three elements of covariance matrix (\(P\)) is applied,  
\[HPL_{2}=k_{H}\sigma_{H} \tag{17}\]  
The positioning error can be regarded as Gaussian noise and \(k_{H}(P_{r})\) can be obtained based on a given confidence probability \(P_{r}\) (usually 1 -\(P_{md}\)). In (17), \(\sigma_{H}\) represents the horizontal position uncertainty,  
\[\sigma_{H}=\sqrt{P_{11}+P_{22}} \tag{18}\]  
where \(P\) represents covariance matrix in expression (4). According to (16) and (17), HPL can be expressed as,  
\[HPL=\text{max}(HPL_{1},\ HPL_{2}) \tag{19}\]