## 4 Algorithm Design
### Leak Detection Algorithm
#### 4.1.3 Final Decision Based on Improved Evidence Combination Rule
In order to meet the requirement of the sum of BPA function of each proposition is 1, we process the BPA function via reliability degree expression:  
\[\left\{ \begin{aligned} & m_{i}^{*}(A_{j})=Cred_{i}m_{i}^{*}(A_{j}), \ \ A_{j}\
eq\emptyset\\ & m_{i}^{*}(\Theta)=1-\sum_{d_{j}\leq\Theta}m_{i}^{*}(A_{j}) \end{aligned} \right. \tag{11}\]  
(3) Evidence Combination  
Suppose \(m_{1}\) and \(m_{2}\) respectively represent the BPA function of the same frame of discernment, focal elements of which are \(A_{i}\) and \(B_{j}\). The combination rule of \(A\) and \(B\) are shown:  
\[\left\{ \begin{aligned} & m_{1\oplus 2}(A)=0,\ \ \ \ A=\emptyset\\ & m_{1\oplus 2}(A)=\frac{\sum_{A(\bigcap d_{j}=A}m_{1}(A_{i})m_{2}(B_{j })}{1-K}\end{aligned} \right. \tag{12}\]  
where \(K=\sum_{A_{i}\bigcap A_{j}=\emptyset}m_{1}(A_{i})m_{2}\) (\(B_{j}\)) denotes the conflict weight. (1) Signals Grouping  
Related research shows that with the increase of the transmission distance, the energy of leak signals will gradually decline, which reflects in the decrease of average amplitude of the signal waveform. Suppose there are \(N\) sensor nodes near the leak point detecting the abnormal signals when the leak happens. The distances between neighboring nodes are all \(D_{0}\), and the distance between leak point and two nearest nodes from both sides are \(X_{1}\) and \(X_{2}\), respectively (shown in Figure 5). All the sensor nodes, which detect the leak signals, send single mode signals, their own ID and location to the sink. Suppose \(X_{1}<X_{2}\), the characteristic function method is used to calculate the RMS amplitude of each signal, and the Equation is:  
\[V=\sqrt{\frac{1}{\Delta T}\int_{0}^{\Delta T}V^{2}(t)dt} \tag{15}\]  
where \(\Delta T\) denotes signal sampling time. We compare all the signals' average amplitude \(V_{i}\) (\(i=1,2,\ldots,N\)) and obtain that:  
\[V_{i}>V_{i-1}>V_{i+1}>V_{i-2}>\cdots>V_{1} \tag{16}\]  
As can be seen from Figure 5, node \(i\) is the closest to the leak point, so its amplitude \(V_{i}\) is the largest. In contrast, node 1 is the farthest to the leak point, so the amplitude \(V_{1}\) is the smallest. Then the signals above are divided into two groups according to an interval grouping criterion. One group  
Figure 4: Principle of TDOA localization. Figure 5: Multi-node integrated localization. contains the signals collected by sensor nodes on the left of the leak point, whereas the other includes the signals collected by nodes on the right of the leak point. That is:  
\[U=\{S_{i-1},S_{i-2},\cdots,S_{i}\},\qquad W=\{S_{i},S_{i+1},\cdots,S_{N}\} \tag{17}\]  
where \(S_{i}\) (\(i=1\),\(2\),...,\(N\)) denotes the signal sent to the sink by node \(i\). If \(N_{U}\) and \(N_{W}\) respectively denote the signal numbers in group \(U\) and \(W\), the number of signal pairs can be obtained from the following Equation:  
\[N_{P}=N_{U}\cdot N_{W}=(i-1)\times(N-i+1) \tag{18}\]  
(2) Determination of Time Difference  
The original leak signal is generally a sort of continuity signal, so it is definitely difficult to obtain the exact time when nodes receive the leak signals. In this situation, we adopt cross correlation analysis for signals to get the time difference of the signal arriving at upstream and downstream nodes. Suppose cross correlation function \(R_{AB}(\tau)\) between wave \(A(t)\) and wave \(B(t+\tau)\) with delay time \(\tau\) is expressed as follows:  
\[R_{AB}(\tau)=\frac{1}{T}\int_{0}^{t}A(t)B(t+\tau)dt \tag{19}\]  
where \(T\) denotes the finite time interval. It will be seen from the Equation (19) that if \(\tau\) is a variable, \(R_{AB}(\tau)\) is a function of \(\tau\). Divide \(A(t)\) and \(B(t)\) into \(n\) equal time units separately. Suppose \(t=t_{i}\), \(A(t)=a_{i}\), \(B(t)=b_{i}\), \(i=0\),\(1\),\(2\),...,\(n\). If \(B(t)\) has a time delay \(\tau^{\prime}\) relative to \(A(t)\):  
\[ \begin{cases}R_{AB}(\tau_{j})=\sum_{i=0}^{n}a_{i+j}b_{j},&j=1,2,...,n\\ R_{AB}(\tau_{j})=\sum_{i=0}^{n}a_{i}b_{i-j},&j=-1,-2,...,-n\\ R_{AB}(\tau_{j})=\sum_{i=0}^{n}a_{i}b_{i},&j=0\end{cases}