Blockage Detection in Pipeline Based on the Extended Kalman Filter Observer

: Currently numerous approaches with various applicability have been generated in order to detect damage in pipe networks. Pipeline faults such as leaks and partial or complete blockages usually create serious problems for engineers. The model-based leak, as well as block detection methods for the pipeline systems gets more and more attention. Among these model-based methods, the state observer and state feedback based methods are usually used. While the observability, as well as controllability, are taken to be the prerequisites for utilizing these techniques. In this work, a new technique based on the extended Kalman ﬁlter observer is proposed in order to detect and locate the blockage in the pipeline. Furthermore, the analysis of observability and controllability in the pipe networks is investigated. Important theorems are given for testing the observability as well as controllability of the pipeline system.


Introduction
Leaks, as well as partial or complete blockages, can be considered as a usual fault arising in pipelines that creates troubles [1][2][3][4]. Leaks result in loss of fluid that causes a loss in pressure, efficiency as well as economic expense, also on occasions it may impact the environment. Blockage barricade flow, which causes a loss in pressure, and so enhances the required pumping expenses in order to dominate the loss in pressure, also occasionally blockage results in absolute termination of functioning [5,6]. Advanced diagnosis, as well as an exact place of leaks or blockages, can help in avoiding the troubles created by such faults and also develop the correct timing decision in order to deal with faults for preventing or diminishing production/performance suspension [7][8][9][10][11].
Blockages have been classified based on their physical extent related to the entire length of the system. Localized contractions, which are taken to be point discontinuities, are defined as discrete blockages. Blockages that contain remarkable length related to the entire pipe length are defined as extended blockages [12]. Dissimilar to the leaks inside piping systems, blockages do not produce obvious exterior indicators for their location to be mentioned as the release and agglomeration of fluids surrounding the pipe. Oftentimes intrusive approaches, utilizing devices the insertion of a closed-circuit camera or a robotic PIG (pipeline intervention gadget), are needed in order to specify the place of blockages. Insertion of a camera or robotic pig can lead to several uncertainties related to the speed of travel and the distance of travel in the midst of the insertion point and the blockage such that on many occasions cases the camera or the robotic pig is trapped into the blockage and leads to greater trouble in this case compared with the appearance of the blockage solely. that on many occasions cases the camera or the robotic pig is trapped into the blockage and leads to greater trouble in this case compared with the appearance of the blockage solely.
Recently, flow analysis is developed on the basis of efficient methods in order to identify blockages. The developed techniques utilize fluid transients according to the responding of the system to an injected transient in order to detect, locate, as well as to measure blockages, which have demonstrated a promising development. In [13,14] a time reflection technique is suggested in order to detect partial blockage of discrete and extended types in a single pipeline for different numbers of blockages. In [15] an impulse response technique is proposed in order to detect leaks as well as partial blockages of discrete type in a single pipeline, and also the technique is tested numerically. In [16] the authors used the damping of fluid transients on the basis of the analytical solution as well as experimental verifications in order to detect partial single discrete blockage in a single pipeline. In [17] the numerical outcomes with laboratory experiments are compared and concluded that the blockage location can be identified with nearly no error, whilst the size identification contains some errors.
The recent published research findings are more dependent on designing the observer, controller or fault identification approaches [18][19][20][21][22][23][24]. In this work, a novel method is proposed in order to analyse pipeline system, generally for identification and location of blockage using model-based techniques and extended Kalman filter observer. The modelling process is based on discretization with the finite-difference technique of classical mass as well as continuity equations. The discretization results in a system of ordinary differential equations with boundary conditions, which demonstrate faults as well as pipeline accessories. The states of the produced system are flows, pressure heads, the blockage and a parameter concerned with the blockage intensity. In continuous-time, a nonlinear system is used for designing observers. Observers are commonly on the basis of a conversion of the treated system into a triangular observable form accordingly, the variables that are straightly estimated correlate with the output derivatives. Furthermore, in this paper, the observability and the controllability of the pipe networks are investigated.

Pipeline Modelling
Here, we neglected the convective variation in velocity, also the compressibility in the line of length (Γ). The liquid density ( ), the flow rate (Φ) and also pressure (Ρ) at the entry and exit of the pipe can be measured for evaluation. The cross-sectional region (Θ) related to the pipe was taken to be fixed all over the pipe system. The feature of the pipe is illustrated in Figure 1. For acquiring the mass and momentum in hydrodynamics utilizing Newton's second law ( = ) to a control volume in the continuum and body force pipe [25] ) the below-mentioned equation can be developed, For acquiring the mass and momentum in hydrodynamics utilizing Newton's second law (F = ma) to a control volume in the continuum and body force pipe [25] (ρ = f 2δ v) the below-mentioned equation can be developed, ∂v ∂t By substituting v = Φ Θ and p = ρgΠ in (1) the following relation is gotten, which may be simplified as This equation may be written as where Π is taken to be the pressure head (m), Φ is taken to be the flow rate (m 3 /s), λ is considered as the length coordinate (m), t is considered as the time coordinate (s), g is taken to be the gravity m/s 2 , Θ is taken to be the section area m 2 , δ is taken to be the diameter (m) and f is considered as the friction coefficient.
In most work the friction coefficient is fixed, even if it is sometimes updated known to depend on the so-called Reynolds number (Re) and the roughness friction coefficient of the pipe (e). The Swamee-Jain equation [26] describes this friction coefficient value for a pipe with a circular section of diameter (δ) as: Such that, where ρ is the fluid density and µ is the fluid viscosity. Equation (5) is valid for 10 −8 < e δ < 0.01 and 5000 < Re < 10 8 .
The continuity equation can be defined as follows for the pipeline system, Replacing the pressure head (Π) as well as the flow rate (Φ) in Equation (7), we have, Such that a is taken to be the velocity of the pressure wave (m/s). The pressure head (Π) and flow rate (Φ) are taken to be functions of position and time as Π(x, t) and Φ(x, t), such that λ ∈ [0, Γ], where Γ is the pipe length.
If a system has minor variations we have,

Blockage Modelling
Blockages have been considered as usual faults in pipes as well as pipeline networks. They can be generated because of the agglomeration of the transported fluid or the partial block of a valve. A blocked is a reduced cross-sectional area of the pipe with significant length γ. For modelling the Electronics 2020, 9, 91 4 of 16 blocked stretch (see Figure 2), the blockage region, displayed by Θ b , is expressed as a percentage of the pipe region Θ. The subscript b signifies the blockage.
Pressure H 1 varies due to the blockage and this changed pressure is displayed by H 1b . A mathematical expression for a blockage can be deduced from the Bernoulli's equation, which relates the pressure difference between the pipeline inside and outside. Bernoulli's equation applies under the following considerations [27].
• Non viscous flow; • Continuous flow; • Through the pipe line; • Constant density. By applying Bernoulli's principle as well as continuity equations among point 1 (before the blockage) and point 1b (in the blockage), we have [27], where Π denotes the pressure head of the fluid, V denotes the velocity of the fluid flow, ρ is considered to be the density of the fluid, Z is taken to be the elevation at points blockage, ℎ denotes energy inputs with pumps or turbines and also is the pressure losses in the pipe sector. Since In horizontal pipe levels 1 , as well as 1 , are equivalent, and also energy inputs with pumps and/or turbines are zero (in this case), so we have According to the continuity of conservation of mass we have where Θ is taken to be the cross-sectional area of the pipeline, also Θ is taken to be the cross-sectional area at the blockage. Hence, By substituting Equation (13) in Equation (11) the following relation is extracted Assume to be very small, as it is taken to be a function of the flow as well as the blockage geometry. Hence, the below-mentioned relation, which contains a discharge coefficient , is utilized: By substituting Equation (15) in Equation (14) the following relation is extracted A mathematical expression for a blockage can be deduced from the Bernoulli's equation, which relates the pressure difference between the pipeline inside and outside. Bernoulli's equation applies under the following considerations [27]. By applying Bernoulli's principle as well as continuity equations among point 1 (before the blockage) and point 1b (in the blockage), we have [27], where Π denotes the pressure head of the fluid, V denotes the velocity of the fluid flow, ρ is considered to be the density of the fluid, Z is taken to be the elevation at points blockage, h w denotes energy inputs with pumps or turbines and also ε is the pressure losses in the pipe sector. Since In horizontal pipe levels Z 1 , as well as Z 1b , are equivalent, and also energy inputs with pumps and/or turbines are zero (in this case), so we have According to the continuity of conservation of mass we have where Θ is taken to be the cross-sectional area of the pipeline, also Θ b is taken to be the cross-sectional area at the blockage. Hence, By substituting Equation (13) in Equation (11) the following relation is extracted Electronics 2020, 9, 91

of 16
Assume ε to be very small, as it is taken to be a function of the flow as well as the blockage geometry. Hence, the below-mentioned relation, which contains a discharge coefficient η, is utilized: By substituting Equation (15) in Equation (14) the following relation is extracted which, stated in regards to the volumetric flow Q = VΘ, becomes This model considers the two circumstances happening at the two edges of the blocked sector: a constriction happening upstream of the blockage (from Θ to Θ b ) and a distension happening downstream (from Θ b to Θ).
where Π 1b and Π 2 are calculated using Bernoulli's and continuity Equations [27] as below and at the point of the blockage, the flow rates are equal such that In Equations (18) and (19), Π 0 , Π 1 , Π 1b , Π 2 , Π 2b and Π n are the pressure head variables and Φ 0 , Φ 1 , Φ 1b , Φ 2 , Φ 2b and Φ n are the flow rate variables. In this work, we aimed to construct observer and controller for the systems stated in Equation (8) as well as Equation (9). A nonlinear model can be expressed as follows such that x is taken to be the state vector, which has i unknown flow perturbation quantities at every point. Several numerical methods are available for the solution of Ordinary differential equations (ODEs) Equations (20) and (21). Here the finite-difference approach is used for its simplicity, and because it is suitable for simulation and non-linear observer design [28]. Control variables in the different cases can be presented by the pressures head and flow rates at the beginning and end of the pipe. The solution of the discretized model, using any technique needs boundary conditions that present known values of the variables at the edge of the researched area. Boundary conditions may just be pressures head, just flows, or combining both. The selection of boundary conditions alters the construction of the models, also may change the quantity of equations wherein the discretized model is subdivided. In real systems, boundary conditions can be defined using the elements existing in the hydraulic system. Figure 3 represents the possible boundary conditions in a scheme of a discretized pipeline. We had six cases for the modelling, based on choosing the control variables. The controllable initial as well as boundary conditions are taken to be pressure heads at the start and ending of the pipe, see Figure 3A. The input conditions can be stated as and output values are The vectors ( ) and ( ) are the inputs and outputs of the system respectively. We have = (Φ 0 Φ 1 Φ 2b Φ n Π 1 Π 2b λ Θ ) , ≔ [Π Π ] = (Π 0 Π n ) and = (Φ 0 Φ n ) . Hence, Case 1: The controllable initial as well as boundary conditions are taken to be pressure heads at the start and ending of the pipe, see Figure 3A. The input conditions can be stated as and output values are The vectors u(t) and y(t) are the inputs and outputs of the system respectively. We have where Π 1b and Π 2 are calculated using Bernoulli's and continuity Equations as below, Case 2: The controllable boundary conditions are taken to be flow rate and pressure head at the start and ending of the pipe, respectively, see Figure 3B. The input conditions can be stated as and output values are The vectors u(t) and y(t) are the inputs and outputs of the system respectively. We have where Π 1b and Π 2 are calculated using Bernoulli's and continuity equations as below, Case 3: The controllable initial and boundary conditions are taken to be flow rate and pressure head at the start of the pipe, see Figure 3C. The input conditions can be stated as and output values are The vectors u(t) and y(t) are the inputs and outputs of the system respectively. We have where Π 1b and Π 2 are calculated using Bernoulli's and continuity equations as below, Case 4: The controllable initial and boundary conditions are taken to be flow rate at the start and pressure head at the ending of the pipe, see Figure 3D. The input conditions can be stated as and output values are Electronics 2020, 9, 91 9 of 16 The vectors u(t) and y(t) are the inputs and outputs of the system respectively. We have where Π 1b and Π 2 are calculated using Bernoulli's and continuity equations as below, Case 5: The controllable initial and boundary conditions are taken to be flow rate at the start and ending of the pipe, see Figure 3E. The input conditions can be stated as and output values are The vectors u(t) and y(t) are the inputs and outputs of the system respectively. We have where Π 1b and Π 2 are calculated using Bernoulli's and continuity equations as below, (41) Case 6: The controllable boundary conditions are taken to be pressure heads and flow rate at the start and ending of the pipe, respectively, see Figure 3F. The input conditions can be stated as and output values are The vectors u(t) and y(t) are the inputs and outputs of the system respectively. We have where Π 1b and Π 2 are calculated using Bernoulli's and continuity equations as below, (45)

Observer Design by Using the Extended Kalman Filter
In estimation theory, the extended Kalman filter (EKF) is the nonlinear version of the Kalman filter, which linearizes about an estimate of the current mean and covariance. The extended Kalman filter was introduced to solve the problem of non-linearity in Kalman filter. The standard extended Kalman filter is commonly derived from a first order Taylor expansion of the state dynamics and measurement model. There is a version of the extended Kalman filter that extends this concept to include also an approximation of the second order Taylor term. The extended Kalman filter resembles the Kalman filter in that they both intend to get correct first order moments. The extended Kalman filter makes the non linear function into linear function using Taylor Series, it helps in getting the linear approximation of a non linear function. However, one common idea considered in this paper for the aim of blockage identification problem is the blockage parameter approximation λ, γ as well as Θ b , utilizing an extended Kalman filter. For this aim, the model proposed in Equations (18) and (19) has been developed by the dynamics of these parameters, also a nonlinear observer has been made for the developed system [29]. For different cases it has been assumed to measure only pressures head, or only flow rates or combination of both at the beginning or end of the pipeline. For case 1, flow rates at the start and ending of the pipe are considered as outputs which are directly measured as follows, and the pressure heads at the start and ending of the pipe considered as known inputs are Also, . λ = 0; . γ = 0; .
The derivatives of blockage parameters z, λ and Θ b have been taken zero as their alterations are minute. Therefore Equations (18) and (19) can be extended as below, where Π 1b and Π 2 are computed as below [27], Accordingly, Equation (49) can be formulated as below, u) is taken as a nonlinear function. Now, to estimate the block parameters λ, γ and A 0 , a discrete-time extended Kalman filter is designed for the nonlinear model described in Equation (49). To do that, this model is discretized by using Heun's method. In this method, the solution for the initial value problem is given by [30], Therefore, where ∆t is taken to be the time step also, i is taken to be the index of discrete-time. Applying Equation (53) into Equation (49) the following are extracted, in compact form: where

Observer Approach
A the discrete-time extended Kalman filter as a state observer for the system Equation (49) is defined as below [31] wherex˜i is the priori estimate of κ i is the Kalman gain: P˜i is the priori covariance matrix: P i is the posteriori covariance matrix: J i is the Jacobian matrix: Finally, R and Q are known as the covariance matrices of measure and process noises, respectively. Notice that: with P0 = (P0) T > 0, R = R T > 0 and Q = Q T > 0.

Simulation Results
Here, simulations were carried out in Matlab for one case for the model shown in Figure 1. The model was realized on the pipeline with the following physical parameters: The length of the pipeline was Γ = 120 m, the diameter of the pipe was δ = 0.08 m, the cross-section was Θ = 5.03 × 10 −3 m 2 , density was ρ = 1000 kg/m 3 , gravity was g = 9.81 m/s 2 , the friction factor of the pipe was f = 0.006, the friction factor of the blockage part was f b = 0.016 and the wave speed was a = 1250 m/s. Control variables are the pressures head at the start and ending of the pipeline (Π 0 and Π n ). In addition, the flow rates (Φ 0 and Φ n ) are taken to be outputs of the system.
The covariance matrices of measure and process noises introduced by expressions respectively The initialization of the state is given in Table 1. The model, the observer, as well as the state feedback construction are demonstrated in Figure 4. The length of the pipeline was Γ= 120 m, the diameter of the pipe was = 0.08 m, the cross-section was Θ= 5.03 × 10 −3 m 2 , density was = 1000 kg m 3 ⁄ , gravity was = 9.81 m s 2 ⁄ , the friction factor of the pipe was = 0.006, the friction factor of the blockage part was = 0.016 and the wave speed was = 1250 m s ⁄ . Control variables are the pressures head at the start and ending of the pipeline (Π 0 and Π n ). In addition, the flow rates (Φ 0 and Φ ) are taken to be outputs of the system.
The covariance matrices of measure and process noises introduced by expressions respectively The initialization of the state is given in Table 1. The model, the observer, as well as the state feedback construction are demonstrated in Figure 4.

Conclusion
The second order extended Kalman filter (SEKF) is based on a second order Taylor expansion of a nonlinear system, in contrast to the more common (first order) extended Kalman filter (EKF) that is based on a second order Taylor expansion of a nonlinear system. The objective of this paper was to analyse and model the blockage in the pipe networks. We utilized the finite difference technique since it is an uncomplicated approach for designing a more appropriate model for observing and controlling the construction of the nonlinear system. This technique partitions the whole pipe into sectors. Flow and pressure head estimations were well estimated in the presence of a blockage. Some theorems were presented in order to detect blockage in the system. In future we will investigate the estimation of multi blockages in the pipe networks.

Conclusions
The second order extended Kalman filter (SEKF) is based on a second order Taylor expansion of a nonlinear system, in contrast to the more common (first order) extended Kalman filter (EKF) that is based on a second order Taylor expansion of a nonlinear system. The objective of this paper was to analyse and model the blockage in the pipe networks. We utilized the finite difference technique since it is an uncomplicated approach for designing a more appropriate model for observing and controlling the construction of the nonlinear system. This technique partitions the whole pipe into N sectors. Flow and pressure head estimations were well estimated in the presence of a blockage. Some theorems were presented in order to detect blockage in the system. In future we will investigate the estimation of multi blockages in the pipe networks.