# Pipeline Leakage localization Based on FBG Hoop Strain Sensors Combined with BP Neural Network
## 3 Calculation of Hoop Strain Time-History Curve
### The Method of Characteristics  
The method of characteristics (MOC) is a common method to solve the hydraulic transient. The derivative of the model can be integrated into the total differential, and the characteristics of the fixed grid are changed. Based on the continuity equation and momentum equation for unsteady pipe liquid flow, the characteristics are converted into the following form:  
\[C^{+}:\begin{cases}\frac{dV}{dt}+\frac{g}{a}\frac{dH}{dt}+\frac{f}{2D}V|V|=0\\ \frac{dx}{dt}=a\end{cases} \tag{1}\]  
\[C^{-}:\begin{cases}\frac{dV}{dt}-\frac{g}{a}\frac{dH}{dt}+\frac{f}{2D}V|V|=0 \\ \frac{dx}{dt}=-a\end{cases} \tag{2}\]  
where \(x\) is the distance of the centerline of the pipeline, \(t\) is time, \(V\) is average velocity, \(H\) is the piezometric head, \(a\) is NPW velocity, \(D\) is the inner diameter and \(g\) is gravity acceleration.  
\(C^{+}\) and \(C^{-}\) are the two characteristic equations of the transient flow problem. Since the friction is nonlinear, the equations can be solved by the finite difference method to get the numerical solution, as shown in Figure 4. In this method, the length of the pipeline is discretized, and the length of each section \(\Delta x=L/N\). The time step \(\Delta t\) is the travelling time of NPW along (\(\Delta t=\Delta x/a\)). In Figure 4, the horizontal axis is the discretized pipeline and the vertical axis is the transient time, respectively.  
Figure 3: Time history curve of the FBG hoop strain sensor for leak detection. NPW, negative pressure wave.  
Equations (1) and (2) are integrated along the characteristic lines. The pressure head and mass flow rate at any point can be solved by the intersection of two characteristic lines \(C^{+}\) and \(C^{-}\). For instance, the pressure head \(H_{P}\) at node \(P\) can be expressed as:  
\[\begin{cases}C^{+}:H_{P}=H_{M}-B(Q_{P}-Q_{M})-R|Q_{M}|Q_{P}\\ C^{-}:H_{P}=H_{N}+B(Q_{P}-Q_{N})+R|Q_{N}|Q_{P}\end{cases} \tag{3}\]  
where \(B\) is the characteristic impedance and \(R\) is the friction loss. Then, the mass flow rate \(Q_{P}\) at node \(P\) can be solved by the above simultaneous equations, as:  
\[Q_{P}=\frac{H_{M}-H_{N}+BQ_{M}+BQ_{N}}{2B+R(|Q_{M}|+|Q_{N}|)} \tag{4}\]  
Therefore, the fluid state of any time step can be obtained from the previous time step by using two linear equations.  
For the leak point, the mass flow rate on the left side is equal to the sum of the leak flow rate and the mass flow rate on the right side. Based on this assumption, the pressure head and the mass flow rate at the leak point can be derived as the following equation set:  
\[\begin{cases}C_{P}=H_{M}+BQ_{M}-R|Q_{M}|Q_{M}\\ C_{M}=H_{N}-BQ_{N}+R|Q_{N}|Q_{N}\\ C_{V}=\frac{C_{P}+C_{M}}{B}\\ C_{B}=\frac{2}{B}\\ H_{P}=\frac{2C_{V}C_{B}+(C_{d}A_{l})^{2}-C_{d}A_{l}\sqrt{(C_{d}A_{l})^{2}+4C_{ V}C_{B}}}{2C_{B}^{2}}\\ Q_{P}=\frac{H_{P}-C_{M}}{B}\end{cases} \tag{5}\]  
where \(C_{d}\) is the orifice discharge coefficient and \(A_{l}\) is the leakage area, respectively. The product term \(C_{d}A_{l}\) is used to describe leakage magnitude.  
When using the above equations, the leak occurrence time is considered to be the initial time step. In other words, at the first time step, the fluid state changes only at the leak point while the other points remain unchanged. If the terminal time is set, the pressure or even the hoop strain time-history curve can be solved. The hoop strain reaches a new steady state after certain steps' calculation.