3. PJ identification by fast orthogonal search

In Figure 2, the azimuth and pitch of PIG are invariant when it travels inside the SPS; they only changed at the PJ part. In addition, the roll of PIG is varied with the PIG rolling motion in the pipeline [15]. Therefore, the precise identification of the PJs between two adjacent SPSs could provide accurate azimuth and pitch updates indication for SINS in the corresponding SPS.

This section introduces a novel PJ detection technique by using FOS to analyze the MEMS accelerometer data. FOS is a random method that is used for the short-term signal processing, the time series analysis, and the complex system identification [16]. The simulated data sets are acquired when IMU is installed on the triaxial positioning and rate table at first. Then, the accelerometer data are analyzed and extracted by wavelet and FOS, respectively. After that, the detection result reveals the FOS could detect PJ from accelerometer data sets successfully when it is compared with the wavelet. Finally, FOS-based PJ detection result could provide indication for the azimuth and pitch updates in the corresponding SPS [16].

#### 3.1. FOS-based PJ detection

#### 3.1.1. Fast orthogonal search

FOS has been adopted in denoising and random error modeling of MEMS inertial sensors successfully [17]. An arbitrary set of nonorthogonal candidate function pm(n) is used to discover a functional expansion of an input y(n) by minimizing the mean squared error (MSE) between pm(n) and y(n) [18]. The input y(n) in terms of the pm(n) is presented:

$$y(n) = \sum\_{m=0}^{M} a\_m p\_m(n) + \varepsilon(n) \tag{5}$$

where am(m = 1, 2,…,M) are the weights of pm(n), and ε(n) is the model error.

The principle of FOS is to rediscover the right side of Eq. (5) into a sum of terms that are mutually orthogonal from n=0 to N of the overall portion of the data:

$$y(n) = \sum\_{m=0}^{M} \mathbf{g}\_m w\_m(n) + e(n) \tag{6}$$

where wm(n) (m = 1, 2,…,M) denote the orthogonal functions that are generated from pm(n) by Gram-Schmidt orthogonalization method, which are yield by

$$w\_m(n) = p\_m(n) - \sum\_{r=0}^{m-1} \alpha\_{mr} w\_r(n) \tag{7}$$

where

$$\alpha\_{mr} = \sum\_{n=0}^{N} p\_m(n) w\_r \bigg/ \sum\_{r=0}^{N} \left( w\_r(n) \right)^2 \tag{8}$$

$$\mathcal{g}\_m = \sum\_{n=0}^N y(n) w\_m(n) \bigg/ \sum\_{\ell=0}^N \left( w\_m(n) \right)^2 \tag{9}$$

The orthogonal expansion coefficients gm are calculated to achieve a least-squares fitting:

$$MSE = \sum\_{n=0}^{N} \quad y\_n - \sum\_{m=0}^{M} \not{p}\_m w\_m(n) \bigg/ \binom{n}{m}^2 \bigg/ \binom{N+1}{m} \tag{10}$$

However, the construction of orthogonal expansion function wm(n) in Eq. (7) is high time and memory consumption. Here, the FOS computes the orthogonal expansion coefficients gm without explicitly creating the orthogonal function wm(n) to significantly reduce the computing time and memory requirements consequently. The coefficients gm are calculated by

$$\mathbf{g}\_m = \mathbf{C}(m) / D(m, m), m = 0, \cdots, M \tag{11}$$

where

$$D(m,0) = 1,\\ D(m,m) = \overline{p\_m(n)},\\ D(m,r) = \overline{p\_m(n)p\_r(n)} - \sum\_{i=0}^{r-1} \alpha\_{mi}(m,i) \tag{12}$$

$$\alpha\_{mr} = D(m,r)/D(r,r),\\ m = 1, \cdots, M; r = 1, \cdots, m$$

with

$$\mathbb{C}(0) = \overline{\mathcal{Y}(n)}; \mathbb{C}(m) = \overline{\mathcal{Y}(n) p\_m(n)} - \sum\_{r=0}^{m-1} \alpha\_{mr} \mathbb{C}(r) \tag{13}$$

The MSE in Eq. (10) is equivalent to

$$MSE = \overline{y^2(n)} - \sum\_{m=0}^{M} \mathcal{g}\_m^2 D(m, m) \tag{14}$$

The overbar of the previous equations is the time average that calculated over the portion of data recorded from n=0 to N.

The MSE reduction given by math model addition is

$$Q\_m = \mathcal{g}\_m^2 \overline{w\_m^2(n)} = \mathcal{g}\_m^2 D(m, m) \tag{15}$$

Therefore, FOS could search a model with a few fitting terms that reduce the MSE in order of its significance. Generally, FOS is terminated by one of the following three conditions. The first is when the predefined number of terms reached. The second is when the ratio of MSE to the mean squared value of the input signal is under a preset threshold. The third is when the reduction of the MSE by adding another term to the model is less than fitting the white Gaussian noise (WGN). FOS is completed by selecting the candidates pm(n) that are the pairs of sine and cosine functions at the interested frequencies. The candidate functions pm(n) are

$$\begin{cases} p\_{2m-1}(n) = \sin\left(\omega\_m n\right) \\ \quad p\_{2m}(n) = \cos\left(\omega\_m n\right) \end{cases} \tag{16}$$

where ωm(m = 1, 2,…,K) and K are the digital frequency and the number of the candidate frequency, respectively.

#### 3.1.2. Design of FOS for PJ detection

In PJ detection, the accelerometer measurement data are transformed to a different domain by FOS to model the PIG motion dynamics from the inertial sensor measurement, and meanwhile to reject as much of the noises of inertial sensor as possible. In addition, the FOS extracts the singularity signals from the inertial sensors by its amplitude when maintaining the PJ detection precision.

The length of data record, the candidate functions, and the termination conditions could be used to determine the modeling accuracy of the FOS. The long-time recorded data are usually divided into a few short segments [19], and the each segment is modeled by FOS to extract the dynamic components from the noisy measurements. Furthermore, the frequency, amplitude, and phase of recorded data are included in the output of each segment of the FOS model terms, which could be utilized to synthesize an estimation of the true motion dynamics. Finally, all the segments are repeated by this process separately and recombined to implement the overall modeled data.
