A Novel Method to Enhance Pipeline Trajectory Determination Using Pipeline Junctions

Pipeline inspection gauges (pigs) have been used for many years to perform various maintenance operations in oil and gas pipelines. Different pipeline parameters can be inspected during the pig journey. Although pigs use many sensors to detect the required pipeline parameters, matching these data with the corresponding pipeline location is considered a very important parameter. High-end, tactical-grade inertial measurement units (IMUs) are used in pigging applications to locate the detected problems of pipeline using other sensors, and to reconstruct the trajectories of the pig. These IMUs are accurate; however, their high cost and large sizes limit their use in small diameter pipelines (8″ or less). This paper describes a new methodology for the use of MEMS-based IMUs using an extended Kalman filter (EKF) and the pipeline junctions to increase the position parameters’ accuracy and to reduce the total RMS errors even during the unavailability of above ground markers (AGMs). The results of this new proposed method using a micro-electro-mechanical systems (MEMS)-based IMU revealed that the position RMS errors were reduced by approximately 85% compared to the standard EKF solution. Therefore, this approach will enable the mapping of small diameter pipelines, which was not possible before.


Introduction
Advances in micro-electromechanical-systems (MEMS) technology combined with the miniaturization of electronics, have made it possible to produce low cost and lightweight chip-based inertial sensors. These chips are small, lightweight, reliable and they consume very little power. They have therefore found a wide spectrum of applications in the automotive sector and other industrial applications. MEMS technology, therefore, can be used to develop navigation systems that are inexpensive, small, and consume low (microwatt) power. The attractive advantages of MEMS technology have led to remarkable research progress in the field of MEMS inertial sensors. However, on the negative side, the performance currently achieved by these low cost sensors is relatively poor due to their sensor errors. The goal of this paper is henceforth to introduce new constraints for pipeline navigation to increase the position parameters' accuracy and reduce the total RMS.
Pipelines are the lifelines of a dynamic country's infrastructure; they provide fuel, water, and all kinds of other needs that touch millions of lives. In addition, they represent one of the safest transportation methods available for crude oil, natural gas, and chemical fluids; they provide a transport medium with speed, efficiency and reliability. Furthermore, they are considered an eco-friendly option. So-called smart pipeline inspection gauges (pigs, Figure 1) commonly carry out inspection and fault identification of these pipelines. Pigs are devices/tools that can be inserted into the pipeline and travel throughout the length of the pipeline, driven forward by the differential pressure across the tool [1,2]. Pigs carry embedded computers and sensors, to acquire information and to perform various maintenance operations in a pipeline. The pigging procedure requires the pipeline contents to be flowing to facilitate the pig's movement. In general, the pig's total journey length can vary from hundreds of meters to hundreds of kilometers [3]. A variety of methods are used for pipeline inspection such as ultrasonic techniques, echo sounding, radiography, and cameras. In the past, the position determination of the pig used to be achieved with a set of velocity wheels (odometers). These wheels provide the longitudinal speed of the pig that can be integrated to provide the distance traveled along the pipeline. Fiber Optic Gyro (FOG)-and/or Ring Laser Gyro (RLG)-based high-end inertial navigation systems has been proposed to be included in the positioning solution [4], which is currently being used for this purpose in the large diameter inspection tools.
This work addresses the issue of providing a MEMS-based aided inertial navigation system to replace the current high-end tactical grade IMUs. MEMS-based inertial sensors are characterized by large uncertainties and high noise (i.e., bias, scale factor and non-orthogonality). Therefore, the errors in position, velocity and attitude of the motion pig grow rapidly in standalone mode. Therefore, aiding navigation systems become essential to solve the unpredictable problems of sensor errors and noises [1]. The aided information will be derived mainly from odometer sensors, pipeline modeling and Global Navigation Satellite System (GNSS).
Due to the distance underwater or underground, and/or the material that the pipeline is made of, it is not possible for the pig to communicate directly with the outside world. The collected data is saved internally and processed later (post-processed). The process requires that extra navigation sensors be used to improve the performance of the pig's location estimation methods. A wheel odometer, for instance, can measure traveled distances (by counting the number of wheel revolutions) that are translated later into velocity measurements. These measurements can be used as external updates for the navigation algorithms. Figure 2 illustrates the main parts of the navigation sensors of a typical pig tool. Supports are mainly the front and end parts that provide the sealing for the main parts. These supports have nominal diameters larger than the pipe diameter to produce efficient sealing [2]. The pig body is contained between the two supports.  Pigs are devices/tools that can be inserted into the pipeline and travel throughout the length of the pipeline, driven forward by the differential pressure across the tool [1,2]. Pigs carry embedded computers and sensors, to acquire information and to perform various maintenance operations in a pipeline. The pigging procedure requires the pipeline contents to be flowing to facilitate the pig's movement. In general, the pig's total journey length can vary from hundreds of meters to hundreds of kilometers [3]. A variety of methods are used for pipeline inspection such as ultrasonic techniques, echo sounding, radiography, and cameras. In the past, the position determination of the pig used to be achieved with a set of velocity wheels (odometers). These wheels provide the longitudinal speed of the pig that can be integrated to provide the distance traveled along the pipeline. Fiber Optic Gyro (FOG)-and/or Ring Laser Gyro (RLG)-based high-end inertial navigation systems has been proposed to be included in the positioning solution [4], which is currently being used for this purpose in the large diameter inspection tools.
This work addresses the issue of providing a MEMS-based aided inertial navigation system to replace the current high-end tactical grade IMUs. MEMS-based inertial sensors are characterized by large uncertainties and high noise (i.e., bias, scale factor and non-orthogonality). Therefore, the errors in position, velocity and attitude of the motion pig grow rapidly in standalone mode. Therefore, aiding navigation systems become essential to solve the unpredictable problems of sensor errors and noises [1]. The aided information will be derived mainly from odometer sensors, pipeline modeling and Global Navigation Satellite System (GNSS).
Due to the distance underwater or underground, and/or the material that the pipeline is made of, it is not possible for the pig to communicate directly with the outside world. The collected data is saved internally and processed later (post-processed). The process requires that extra navigation sensors be used to improve the performance of the pig's location estimation methods. A wheel odometer, for instance, can measure traveled distances (by counting the number of wheel revolutions) that are translated later into velocity measurements. These measurements can be used as external updates for the navigation algorithms. Figure 2 illustrates the main parts of the navigation sensors of a typical pig tool. Supports are mainly the front and end parts that provide the sealing for the main parts. These supports have nominal diameters larger than the pipe diameter to produce efficient sealing [2]. The pig body is contained between the two supports. Pigs are devices/tools that can be inserted into the pipeline and travel throughout the length of the pipeline, driven forward by the differential pressure across the tool [1,2]. Pigs carry embedded computers and sensors, to acquire information and to perform various maintenance operations in a pipeline. The pigging procedure requires the pipeline contents to be flowing to facilitate the pig's movement. In general, the pig's total journey length can vary from hundreds of meters to hundreds of kilometers [3]. A variety of methods are used for pipeline inspection such as ultrasonic techniques, echo sounding, radiography, and cameras. In the past, the position determination of the pig used to be achieved with a set of velocity wheels (odometers). These wheels provide the longitudinal speed of the pig that can be integrated to provide the distance traveled along the pipeline. Fiber Optic Gyro (FOG)-and/or Ring Laser Gyro (RLG)-based high-end inertial navigation systems has been proposed to be included in the positioning solution [4], which is currently being used for this purpose in the large diameter inspection tools.
This work addresses the issue of providing a MEMS-based aided inertial navigation system to replace the current high-end tactical grade IMUs. MEMS-based inertial sensors are characterized by large uncertainties and high noise (i.e., bias, scale factor and non-orthogonality). Therefore, the errors in position, velocity and attitude of the motion pig grow rapidly in standalone mode. Therefore, aiding navigation systems become essential to solve the unpredictable problems of sensor errors and noises [1]. The aided information will be derived mainly from odometer sensors, pipeline modeling and Global Navigation Satellite System (GNSS).
Due to the distance underwater or underground, and/or the material that the pipeline is made of, it is not possible for the pig to communicate directly with the outside world. The collected data is saved internally and processed later (post-processed). The process requires that extra navigation sensors be used to improve the performance of the pig's location estimation methods. A wheel odometer, for instance, can measure traveled distances (by counting the number of wheel revolutions) that are translated later into velocity measurements. These measurements can be used as external updates for the navigation algorithms. Figure 2 illustrates the main parts of the navigation sensors of a typical pig tool. Supports are mainly the front and end parts that provide the sealing for the main parts. These supports have nominal diameters larger than the pipe diameter to produce efficient sealing [2]. The pig body is contained between the two supports.   An above ground marker (AGM) is another device that can be installed on the surface of the ground above the pipeline. This device detects and records the passage of the pig in the pipeline. AGMs provide the navigation coordinates of their position (latitude, longitude, and height) along with the pig's time passage. This information is used as a coordinate update (typically called CUPT) in the estimation algorithm. The cost of these devices often minimizes their use. Usually, these AGMs are installed every 1-3 km [5] when the pig uses high-end tactical grade IMUs.
A nonlinear sensor fusion algorithm has been applied in [6] to estimate the trajectory of pipeline pigs. IMUs along with odometers and AGMs are the sensors that have been used for navigation purposes. The filter states have been propagated using the IMU with an update from the odometer while the AGM is not reached. The AGM performs position updates when the pig passes underneath.
Similarly, in [7], an IMU along with an odometer and reference GPS have been used to simulate pig data. The results shows that by decreasing the position reference updates, the accuracy increased due to the propagation of IMU errors.
To allow proper maintenance operations and to reconstruct the pipeline trajectory in certain projects, a position referencing technique is required to find the exact coordinates of the defective parts detected by the pig's sensors. The core of this work, therefore, is to improve the accuracy of the final reconstructed trajectories by introducing new sources of information and adding new constraints to the estimation technique.
Generally, the pig carries inertial sensors (accelerometers and gyroscopes), along with other sensors, to assess its position coordinates. To minimize possible cumulative errors arising from the MEMS-IMU, the sensor fusion technique, which involves pairing inertial sensors with non-inertial sensors, is implemented. An odometer and AGM, employed as non-inertial sensors, are used to update the algorithm.
Different estimation techniques can be used in such applications. The Extended Kalman Filter (EKF) [8,9] is commonly used for sensor fusion integration in navigation applications, especially for nonlinear dynamic models. It has been selected to demonstrate the newly proposed algorithm in this paper. In Section 2, the idea of the new algorithm will be introduced. The Methodology section (Section 3) will demonstrate the algorithm implementation, and the results will be discussed in Section 4.

Pipeline Junctions
Pipelines consist of multiple pieces of pipeline and fittings (bends, T-connections, valves . . . etc.). The pipeline pieces are fabricated in straight-line shapes. Different methods can be used to connect these pipeline pieces with each other, such as push on, flanges, and welding techniques, as shown in Figure 3. In all cases, a small gap tolerance will appear between two pieces. An above ground marker (AGM) is another device that can be installed on the surface of the ground above the pipeline. This device detects and records the passage of the pig in the pipeline. AGMs provide the navigation coordinates of their position (latitude, longitude, and height) along with the pig's time passage. This information is used as a coordinate update (typically called CUPT) in the estimation algorithm. The cost of these devices often minimizes their use. Usually, these AGMs are installed every 1-3 km [5] when the pig uses high-end tactical grade IMUs.
A nonlinear sensor fusion algorithm has been applied in [6] to estimate the trajectory of pipeline pigs. IMUs along with odometers and AGMs are the sensors that have been used for navigation purposes. The filter states have been propagated using the IMU with an update from the odometer while the AGM is not reached. The AGM performs position updates when the pig passes underneath.
Similarly, in [7], an IMU along with an odometer and reference GPS have been used to simulate pig data. The results shows that by decreasing the position reference updates, the accuracy increased due to the propagation of IMU errors.
To allow proper maintenance operations and to reconstruct the pipeline trajectory in certain projects, a position referencing technique is required to find the exact coordinates of the defective parts detected by the pig's sensors. The core of this work, therefore, is to improve the accuracy of the final reconstructed trajectories by introducing new sources of information and adding new constraints to the estimation technique.
Generally, the pig carries inertial sensors (accelerometers and gyroscopes), along with other sensors, to assess its position coordinates. To minimize possible cumulative errors arising from the MEMS-IMU, the sensor fusion technique, which involves pairing inertial sensors with non-inertial sensors, is implemented. An odometer and AGM, employed as non-inertial sensors, are used to update the algorithm.
Different estimation techniques can be used in such applications. The Extended Kalman Filter (EKF) [8,9] is commonly used for sensor fusion integration in navigation applications, especially for nonlinear dynamic models. It has been selected to demonstrate the newly proposed algorithm in this paper. In Section 2, the idea of the new algorithm will be introduced. The Methodology section (Section 3) will demonstrate the algorithm implementation, and the results will be discussed in Section 4.

Pipeline Junctions
Pipelines consist of multiple pieces of pipeline and fittings (bends, T-connections, valves … etc.). The pipeline pieces are fabricated in straight-line shapes. Different methods can be used to connect these pipeline pieces with each other, such as push on, flanges, and welding techniques, as shown in Figure 3. In all cases, a small gap tolerance will appear between two pieces.  The connection point between two pipelines is called the pipeline junction/joint. These junctions can be detected using magnetic flux leakage (MFL) and electromagnetic acoustic transducers for pipeline analysis purposes. However, due to sudden vibrations of the pig while passing through pipeline junctions, INS sensors are sensitive enough to capture these junctions. Sample accelerometer pipeline data outputs for a MEMS-based IMU (SiIMU02) and a high-end tactical grade IMU (LN200) are illustrated in Figures 4 and 5 respectively. As seen, repetitive pattern spikes appear. Studying different IMUs signals collected from different pigs for different pipelines trajectories shows a repetitive signal/pattern in all the accelerometers' signals. Taking into consideration the speed of the pig, the distance between two spikes is equal to the length of the fitting or the pipeline pieces. Therefore, the pattern represents the pipeline junction (PLJ). Such information is used as a new constraint to the estimation techniques (as explained in Section 3.2). The connection point between two pipelines is called the pipeline junction/joint. These junctions can be detected using magnetic flux leakage (MFL) and electromagnetic acoustic transducers for pipeline analysis purposes. However, due to sudden vibrations of the pig while passing through pipeline junctions, INS sensors are sensitive enough to capture these junctions. Sample accelerometer pipeline data outputs for a MEMS-based IMU (SiIMU02) and a high-end tactical grade IMU (LN200) are illustrated in Figures 4 and 5, respectively. As seen, repetitive pattern spikes appear. Studying different IMUs signals collected from different pigs for different pipelines trajectories shows a repetitive signal/pattern in all the accelerometers' signals. Taking into consideration the speed of the pig, the distance between two spikes is equal to the length of the fitting or the pipeline pieces. Therefore, the pattern represents the pipeline junction (PLJ). Such information is used as a new constraint to the estimation techniques (as explained in Section 3.2).

Detecting Pipeline Junctions
To detect the spikes in the signal, different methods have been used in the signal processing literature. In this paper, a discrete wavelet transformation (DWT) has been used to detect these spikes due to its simple implementation. The definition of wavelet transform can be written as: The connection point between two pipelines is called the pipeline junction/joint. These junctions can be detected using magnetic flux leakage (MFL) and electromagnetic acoustic transducers for pipeline analysis purposes. However, due to sudden vibrations of the pig while passing through pipeline junctions, INS sensors are sensitive enough to capture these junctions. Sample accelerometer pipeline data outputs for a MEMS-based IMU (SiIMU02) and a high-end tactical grade IMU (LN200) are illustrated in Figures 4 and 5, respectively. As seen, repetitive pattern spikes appear. Studying different IMUs signals collected from different pigs for different pipelines trajectories shows a repetitive signal/pattern in all the accelerometers' signals. Taking into consideration the speed of the pig, the distance between two spikes is equal to the length of the fitting or the pipeline pieces. Therefore, the pattern represents the pipeline junction (PLJ). Such information is used as a new constraint to the estimation techniques (as explained in Section 3.2).

Detecting Pipeline Junctions
To detect the spikes in the signal, different methods have been used in the signal processing literature. In this paper, a discrete wavelet transformation (DWT) has been used to detect these spikes due to its simple implementation. The definition of wavelet transform can be written as:

Detecting Pipeline Junctions
To detect the spikes in the signal, different methods have been used in the signal processing literature. In this paper, a discrete wavelet transformation (DWT) has been used to detect these spikes due to its simple implementation. The definition of wavelet transform can be written as: Here x p.q is the input, and M p.q is the mother wavelet. The parameters paq is real number that represent a time location. pbq is a positive real number that represents the scaling. Many types of mother wavelets can be used in signal pattern detection applications, such as the Haar basis and Mexican Hat. Figure 6 illustrates the Mexican Hat mother wavelet that has the following model: Here . is the input, and . is the mother wavelet. The parameters is real number that represent a time location.
is a positive real number that represents the scaling. Many types of mother wavelets can be used in signal pattern detection applications, such as the Haar basis and Mexican Hat. Figure 6 illustrates the Mexican Hat mother wavelet that has the following model: The Mexican Hat mother wavelet has been applied to detect the signal patterns (pipeline junctions) as shown in Figure 7. For more details about the wavelet detection technique, please refer to [10][11][12][13][14]. Since these patterns represent the pipeline junctions, a constraint is introduced here and called Pipeline Junction Constraint (PJC). This constraint fixes both the heading and pitch angles during the movement inside the pipeline piece (not during the junctions) [15]. New measurement model for PJC will be introduced in Section 3.2. It is noticeable that roll angle is free to rotate along the pipeline axis. Therefore, roll angle will not be included in PJC measurement model.
Until now, we assumed that the period between two junctions represents a straight pipe. However, due to the fittings (i.e., bends), this assumption cannot be considered true all the time. Therefore, the PJC model will be supported by a bend detection algorithm (BDA) to detect the bends and disable the PJC model during the bend periods. BDA is introduced in the next section.
Finally, it is useful to mention that any junction detection function should be executed prior to the navigation offline process to save the pipeline junctions file. This file will be used as an input to the navigation offline process. The Mexican Hat mother wavelet has been applied to detect the signal patterns (pipeline junctions) as shown in Figure 7. For more details about the wavelet detection technique, please refer to [10][11][12][13][14].
Here . is the input, and . is the mother wavelet. The parameters is real number that represent a time location.
is a positive real number that represents the scaling. Many types of mother wavelets can be used in signal pattern detection applications, such as the Haar basis and Mexican Hat. Figure 6 illustrates the Mexican Hat mother wavelet that has the following model: The Mexican Hat mother wavelet has been applied to detect the signal patterns (pipeline junctions) as shown in Figure 7. For more details about the wavelet detection technique, please refer to [10][11][12][13][14]. Since these patterns represent the pipeline junctions, a constraint is introduced here and called Pipeline Junction Constraint (PJC). This constraint fixes both the heading and pitch angles during the movement inside the pipeline piece (not during the junctions) [15]. New measurement model for PJC will be introduced in Section 3.2. It is noticeable that roll angle is free to rotate along the pipeline axis. Therefore, roll angle will not be included in PJC measurement model.
Until now, we assumed that the period between two junctions represents a straight pipe. However, due to the fittings (i.e., bends), this assumption cannot be considered true all the time. Therefore, the PJC model will be supported by a bend detection algorithm (BDA) to detect the bends and disable the PJC model during the bend periods. BDA is introduced in the next section.
Finally, it is useful to mention that any junction detection function should be executed prior to the navigation offline process to save the pipeline junctions file. This file will be used as an input to the navigation offline process. Since these patterns represent the pipeline junctions, a constraint is introduced here and called Pipeline Junction Constraint (PJC). This constraint fixes both the heading and pitch angles during the movement inside the pipeline piece (not during the junctions) [15]. New measurement model for PJC will be introduced in Section 3.2. It is noticeable that roll angle is free to rotate along the pipeline axis. Therefore, roll angle will not be included in PJC measurement model. Until now, we assumed that the period between two junctions represents a straight pipe. However, due to the fittings (i.e., bends), this assumption cannot be considered true all the time. Therefore, the PJC model will be supported by a bend detection algorithm (BDA) to detect the bends and disable the PJC model during the bend periods. BDA is introduced in the next section.
Finally, it is useful to mention that any junction detection function should be executed prior to the navigation offline process to save the pipeline junctions file. This file will be used as an input to the navigation offline process.

Bend Detection Algorithm (BDA)
The used IMU has three gyroscopes that measure and record the angular rates`ω x , ω y , ω z˘o f pig's motion around three axes x, y, and z, respectively. The axes are defined as shown in Figure 8. The x-axis angular rate pω x q measures the rate change of the roll angle, while ω y and ω z measure the rate change of the pitch and heading angles, respectively.

Bend Detection Algorithm (BDA)
The used IMU has three gyroscopes that measure and record the angular rates , , of pig's motion around three axes , , and , respectively. The axes are defined as shown in Figure 8. The x-axis angular rate measures the rate change of the roll angle, while and measure the rate change of the pitch and heading angles, respectively. To detect whether the pig is located inside a fitting (bend), the change in heading and/or pitch angles of the pig in motion should not exceed a certain threshold . This threshold can be selected by sensor calibration. The change rate for both the and axes are monitored at every epoch. The change of the angular velocity magnitude can be compared to the selected threshold . For simplicity, both values are merged as follows: Here is called a resultant angular rate. Selecting the threshold is the most important part in this method. By plotting different resultant angular rates for different IMUs, it has been noticed that the best value to select is the mean value of the static period (during the calibration time). Checking the condition of this threshold should be done at every iteration and before applying the PJC constraints as shown in Figure 9.   To detect whether the pig is located inside a fitting (bend), the change in heading and/or pitch angles of the pig in motion should not exceed a certain threshold pC th q. This threshold can be selected by sensor calibration. The change rate for both the y and z axes are monitored at every epoch. The change of the angular velocity magnitude can be compared to the selected threshold pC th q. For simplicity, both values are merged as follows: Here ω R is called a resultant angular rate. Selecting the threshold is the most important part in this method. By plotting different resultant angular rates for different IMUs, it has been noticed that the best value to select pC th q is the mean value of the static period (during the calibration time). Checking the condition of this threshold should be done at every iteration and before applying the PJC constraints as shown in Figure 9.

Bend Detection Algorithm (BDA)
The used IMU has three gyroscopes that measure and record the angular rates , , of pig's motion around three axes , , and , respectively. The axes are defined as shown in Figure 8. The x-axis angular rate measures the rate change of the roll angle, while and measure the rate change of the pitch and heading angles, respectively. To detect whether the pig is located inside a fitting (bend), the change in heading and/or pitch angles of the pig in motion should not exceed a certain threshold . This threshold can be selected by sensor calibration. The change rate for both the and axes are monitored at every epoch. The change of the angular velocity magnitude can be compared to the selected threshold . For simplicity, both values are merged as follows: Here is called a resultant angular rate. Selecting the threshold is the most important part in this method. By plotting different resultant angular rates for different IMUs, it has been noticed that the best value to select is the mean value of the static period (during the calibration time). Checking the condition of this threshold should be done at every iteration and before applying the PJC constraints as shown in Figure 9.

Methodology
To cater for all three-dimensional dynamics of the pig motion, a total of six sensors are used in a full IMU, which comprises three gyroscopes and three accelerometers. In addition to the IMU, the odometer is used to measure the displaced travel distance of the pig. AGMs and their measurement model will be shown in this section, although the target is to use the fewest number of AGMs as possible.

Dynamic Error Model
A MEMS-based IMU was the main sensor used to collect the pig's motion data. EKF was used as an estimation technique to overcome the poor performance and non-linearity of the dynamic system in this work. Both dynamic and measurement models developed in this section to estimate the states of the system. The state vector to be estimated was designed to include the errors associated with the position, velocity, attitude, and the stochastic bias errors associated with the gyroscopes and accelerometers. The state vector was defined as follows [16]: where: Position error 3 1 Velocity error 3 1 Attitude error 3 1 Gyroscope bias error 3 1 Accelerometer bias error 3 1 .
The dynamic model is non-linear and can be represented in discrete form as follows [17,18]: where is the dynamic model, is the stochastic model, and is the process noise. The linearized error state system model can be expressed as: where: : is the 15 1 state vector : is the 15 15 transition matrix

Methodology
To cater for all three-dimensional dynamics of the pig motion, a total of six sensors are used in a full IMU, which comprises three gyroscopes and three accelerometers. In addition to the IMU, the odometer is used to measure the displaced travel distance of the pig. AGMs and their measurement model will be shown in this section, although the target is to use the fewest number of AGMs as possible.

Dynamic Error Model
A MEMS-based IMU was the main sensor used to collect the pig's motion data. EKF was used as an estimation technique to overcome the poor performance and non-linearity of the dynamic system in this work. Both dynamic and measurement models developed in this section to estimate the states of the system. The state vector to be estimated was designed to include the errors associated with the position, velocity, attitude, and the stochastic bias errors associated with the gyroscopes and accelerometers. The state vector was defined as follows [16]: where: δr Position error p3ˆ1q δv Velocity error p3ˆ1q δε Attitude error p3ˆ1q δb g Gyroscope bias error p3ˆ1q δb a Accelerometer bias error p3ˆ1q.
The dynamic model is non-linear and can be represented in discrete form as follows [17,18]: where f is the dynamic model, g is the stochastic model, and w is the process noise. The linearized error state system model can be expressed as: where: is the p15ˆ1q noise distribution matrix w k : is the unit-variance white Gaussian noise.
By applying Taylor series expansion and ignoring the higher order terms, the linearized system model in the local level frame (LLF), represented as north, east, and down (NED), can be expressed as follows: where: where:

R ij
Rotation matrix´R l b¯e lements from body to local level frame. ∆t Rate change of time.
The linearized measurement error model can be expressed as: Here H is the design matrix and ν is the measurement noise. Both process and measurement noises are assumed to be white and uncorrelated to each other. Readers can refer to [19] for more details about measurement models. In this work, a new measurement model has been developed specifically for pipeline navigation. The mathematical equations will be demonstrated in the next section.

Pitch & Heading Measurement Model
The rotation matrix (direct cosine matrix-DCM) is updated at every epoch. The attitude angles (roll, pitch, and heading) can be calculated using this matrix. Heading and pitch angles of the pig in the pipeline are computed from the elements of the following (DCM) [19]: fi ffi fl (19) where´R k j¯r epresents the DCM from pjq to pkq frames, pb, l, vq represent the IMU body, local level (navigation), and vehicle (pig) frames, respectively. The rotation matrix from the body to vehicle (pig) frame is calculated after installing the IMU in the pig. From Equation (19), the requiredâ ij elements to be used for heading and pitch angles calculation can be expressed as follows: a 11 " b 11 pc 11`c21 δA´c 31 δpq`b 12 pc 12`c22 δA´c 32 δpq`b 13 pc 13`c23 δA´c 33 δpq a 21 " b 11 pc 21`c31 δr´c 11 δAq`b 12 pc 22`c32 δr´c 12 δAq`b 13 pc 23`c33 δr´c 13 δAq a 31 " b 11 pc 31`c11 δp´c 21 δrq`b 12 pc 32`c12 δp´c 22 δrq`b 13 Ideally as per the algorithm assumption, the heading and pitch angles do not change in the pipeline piece; the change in these angles should be zero. Therefore, the approximated changes of heading and pitch angles model can be expressed as follows: whereˆ is the computed heading and pitch vector, and r is the measured heading and pitch vector. The measurement design matrix can be expressed as follows: The design matrix elements are expanded in the Appendix. Finally, the innovation sequence of EKF at each epoch can be calculated as follows: where δx k represents the error state vector

Results
This section introduces the equipment used and describes the pipeline inspection test performed to assess the efficacy of the PLJ algorithm. The results of the proposed method-Pipeline junctions integration-Will be discussed in detail and compared with the results of the traditional method of the EKF-based odometer/AGM integration for pipeline navigation. In figures and tables, EKF/PLJ will be referred to as the new developed method, while EKF will be referred to as the normal EKF method. Please note that odometer and AGM (if available) are used in both methods. The developed method was examined through real pipeline inspection trajectories, using as few AGMs as possible.
The pig's data and the reference trajectory have been provided by M/s ROSEN. A SiIMU02 (by UTC Aerospace Systems, Brea, CA, USA) MEMS-based inertial sensor was used for the experiment. SiIMU02 is a six degree of freedom inertial system that uses solid-state devices to measure the angular rate and linear acceleration. Table 1 shows the IMU specifications. The forward velocity time stamp was synchronized with the IMU data. The odometer standard deviation (STD) is 0.15 m{s. One point worth noting is that the pig operator did not provide the AGMs' positions, however, they provided the full reference trajectory. As a result, an artificial AGMs were extracted from the true reference trajectory. The total pig journey distance is almost 3 km over a total travel time of 1 h.
For comparison purposes, the proposed algorithm was applied for two different scenarios. In both scenarios, the position of the first and last point of the trajectory is known. The first point represents the pig pipeline inlet and the last point is the pig pipeline outlet.

Scenario #1
In this scenario, one AGM was added after 20 min of motion to provide position update (CUPT) to the navigation algorithm. Figure 11 shows the solutions of the EKF-based and EKF/PLJ-based, where both solutions are compared against the reference trajectory. The EKF/PLJ proposed solution showed an improvement over the standalone EKF solution, which is clearly noticed in Figure 12. The figures illustrate the north, east, and height position errors for both methods. The errors in the north and east direction are clearly smaller in the EKF/PLJ algorithm. However, the height error is slightly smaller using EKF only. The maximum and RMS position errors (in meters) for each solution are shown by bar graphs in Figures 13 and 14 respectively.
to the navigation algorithm. Figure 11 shows the solutions of the EKF-based and EKF/PLJ-based, where both solutions are compared against the reference trajectory. The EKF/PLJ proposed solution showed an improvement over the standalone EKF solution, which is clearly noticed in Figure 12. The figures illustrate the north, east, and height position errors for both methods. The errors in the north and east direction are clearly smaller in the EKF/PLJ algorithm. However, the height error is slightly smaller using EKF only. The maximum and RMS position errors (in meters) for each solution are shown by bar graphs in Figures 13 and 14, respectively.   In this scenario, one AGM was added after 20 min of motion to provide position update (CUPT) to the navigation algorithm. Figure 11 shows the solutions of the EKF-based and EKF/PLJ-based, where both solutions are compared against the reference trajectory. The EKF/PLJ proposed solution showed an improvement over the standalone EKF solution, which is clearly noticed in Figure 12. The figures illustrate the north, east, and height position errors for both methods. The errors in the north and east direction are clearly smaller in the EKF/PLJ algorithm. However, the height error is slightly smaller using EKF only. The maximum and RMS position errors (in meters) for each solution are shown by bar graphs in Figures 13 and 14, respectively.

Scenario #2
Scenario #2 is similar to scenario #1, without adding any AGM. Directly from the output trajectory, the difference between both solutions is clear, as shown in Figure 15. The position errors for each method are shown in Figure 16.

Scenario #2
Scenario #2 is similar to scenario #1, without adding any AGM. Directly from the output trajectory, the difference between both solutions is clear, as shown in Figure 15. The position errors for each method are shown in Figure 16.

Scenario #2
Scenario #2 is similar to scenario #1, without adding any AGM. Directly from the output trajectory, the difference between both solutions is clear, as shown in Figure 15. The position errors for each method are shown in Figure 16.  The bar graphs in Figures 17 and 18 show that the proposed EKF/PLJ method greatly improve the accuracy of the results. The bar graphs in Figures 17 and 18 show that the proposed EKF/PLJ method greatly improve the accuracy of the results. The bar graphs in Figures 17 and 18 show that the proposed EKF/PLJ method greatly improve the accuracy of the results.    The bar graphs in Figures 17 and 18 show that the proposed EKF/PLJ method greatly improve the accuracy of the results.   EKF/Odometer integration for pipeline navigation, using the developed method of EKF/PLJ, had a maximum position error of 11.59 m in the north direction, and EKF/odometer solution only had a maximum position error of 76.41 m in the same direction. This is an overall average improvement of 85%. Despite all the improvements in the horizontal plane (north and east directions), the above bar graphs reveal that height errors have slight increase using the new EKF/PLJ method. This increase does not affect the total solution for the pipeline trajectory, especially, if we consider that the pipeline is usually located 1-5 m below the Earth surface. Finally, the results can be summarized as shown in Tables 2 and 3 where north, east, height maximum and RMS errors for both scenarios are shown.

Conclusions
The main objective of this work was to increase the accuracy of pipeline navigation. Based on the reality of constructing the pipelines (i.e., straight shapes), and how they connect to each other, pipeline junctions have been modeled and included as new measurements to update the navigation estimation algorithm. The new developed algorithm will also lead to a reduction in the total required number of AGMs. Two different testing scenarios were discussed based on real pipeline data that was collected using a MEMS-IMU-based system. These results show that the newly proposed method is capable of reducing the trajectory navigation RMS error by around 80% over one hour of operation and without using any AGM along the pig journey.