# Distributed Fault Detection and Isolation Approach for Oil Pipelines
## 4 Case Study: FDI System for Oil Pipeline
### Mathematical Modeling of Oil Pipeline
The momentum Equation (3) considering that \(v=const.\), \(\tau_{w}=\lambda\rho v|v|/8\) and \(\sin\alpha(x)=\frac{\mathrm{d}z}{\mathrm{d}x}\) gives [48]:\[\frac{\mathrm{d}}{\mathrm{d}x}\bigg{(}\frac{p}{\rho g}+z\bigg{)}=-\lambda\frac{1}{d} \frac{v|v|}{2g} \tag{8}\]  
The equation of total energy balance (6), considering that \(e_{in}=C_{v}T+const.\), \(\frac{\mathrm{d}}{\mathrm{d}x}\bigg{(}\frac{p}{\rho g}+z\bigg{)}=-\lambda\frac{ 1}{d}\frac{v|v|}{2g}\) and \(q_{n}=-K(T-T_{ex})\), is written as [45]:  
Figure 4:0  
where \(C_{v}\) is the specific heat, \(T\) is the oil temperature, \(T_{ex}\) is the temperature outside the pipeline, \(K\) is the heat transfer factor, and \(\lambda\) is the hydraulic resistance factor. The expressions (7)-(9) are the basis equations for mathematical modeling of the stationary operating regimes of oil pipelines. From the combination of the continuity Equation (7) and the differential momentum Equation (8), the following Bernoulli equation in its algebraic form [18; 45] is obtained:  
Figure 4:1  
where \(x=0\) and \(x=L\) are, respectively, the initial and terminal cross-sections of the oil pipeline section with length \(L\). Equation (10) relates the pressure \(p_{0}\), \(p_{L}\) at the beginning and at the end of a pipeline section, respectively, with the velocity \(v\) of the oil flow. Taking into account that the head is represented as \(h=p/\rho g\), Equation (10) becomes [18]:  
Figure 4:2  
where \(z_{0}\) and \(z_{L}\) are the geometric head at the beginning and at the end of a pipeline section, respectively. The mathematical model of the pumping station is represented by the following algebraic equation [45]:  
Figure 4:3  
where \(\Delta H\) is the differential head produced by the pumping station on the oil flow rate \(Q\), \(p_{ex}\), \(p_{in}\) are the pressure after, and the pressure before the oil pumping station, respectively, \(h_{ex}\), \(h_{in}\) are the head after, and the head before oil pumping station, respectively. The dependence \(\Delta H=F(Q)\) defines the head-discharge \((Q-H)\) characteristic of the pumping station. The flow rate \(Q\) through a pipeline (in m\({}^{3}\)/s) is obtained by the expression [18]:  
Figure 4:4  
Taking into consideration that the oil pipeline under study consists of three sections with a pumping station located at the beginning of each section, for the mathematical modeling of each of this section, the Bernoulli Equation (10) is used, in which the pressure \(p_{0}=p(0)\) at the initial cross-section of the pipeline section is replaced with the help of the following condition [45]:  
Figure 4:5Figure 4:6  
where \(p_{0}=p_{in}\), the velocity \(v\) is measured in (m/s), \(a\) and \(b\) are the approximation factors of the head-discharge \((Q-H)\) characteristic of the pumping station. After replacing \(p_{0}\), it is obtained [45]:  
Figure 4:7  
Therefore, the mathematical modeling of the system \(\Sigma\) and its respective sub-systems \(\Sigma_{i}\) are represented as:  
\[\Sigma_{1} \begin{cases}e_{1}:&h_{u1}+\Delta H_{1}+z_{1}-h_{u2}-z_{2}=\lambda \frac{L_{1}}{d}\frac{v_{1}^{2}}{2g}\\ e_{2}:&\Delta H_{1}=a_{1}-b_{1}Q_{1}^{2}\\ e_{3}:&Q_{1}=3600 Sv_{1}\\ e_{4}:&y_{Q_{1}}=Q_{1}+f_{Q_{1}}\\ e_{5}:&y_{h_{u1}}=h_{u1}\end{cases}  \tag{17}\] \[\Sigma_{2} \begin{cases}e_{6}:&h_{u2}+\Delta H_{2}+z_{2}-h_{u3}-z_{3}= \lambda\frac{L_{2}}{d}\frac{v_{2}^{2}}{2g}\\ e_{7}:&\Delta H_{2}=a_{2}-b_{2}Q_{2}^{2}\\ e_{8}:&Q_{2}=3600 Sv_{2}\\ e_{9}:&Q_{2}=Q_{1}+f_{1}\\ e_{10}:&y_{Q_{2}}=Q_{2}\\ e_{11}:&y_{h_{u2}}=h_{u2}+f_{h_{2}}\end{cases} \] (18) \[\Sigma_{3} \begin{cases}e_{12}:&h_{u3}+\Delta H_{3}+z_{3}-h_{L}-z_{L}= \lambda\frac{L_{3}}{d}\frac{v_{2}^{2}}{2g}\\ e_{13}:&\Delta H_{3}=a_{3}-b_{3}Q_{3}^{2}\\ e_{14}:&Q_{3}=3600 Sv_{3}\\ e_{15}:&Q_{3}=Q_{2}+f_{2}\\ e_{16}:&y_{Q_{3}}=Q_{3}\\ e_{17}:&y_{h_{u3}}=h_{u3}+f_{h_{3}}\end{cases} \] (19) \[\Sigma_{4} \begin{cases}e_{18}:&Q_{4}=Q_{3}+f_{3}\\ e_{19}:&y_{Q_{4}}=Q_{4}+f_{Q_{L}}\\ e_{20}:&y_{h_{uL}}=h_{uL}+f_{h_{L}}\end{cases}