# Application and Optimization of Algorithms for Pressure Wave Evaluation Based on Measurement Data
## 4 Algorithms  
Based on 22 real events where a refill process acted on the rest of the DHN as a leakage, the corresponding PDTPs were determined. Nine algorithms were available, which are described in detail. All the algorithms were implemented within open source R statistics software [25]. The first five algorithms were self-developed, whereas the other four algorithms were already existing. Table 2 shows the nine algorithms used here. The objective of the algorithms was to find the PDTPs in an evaluation time frame that contained the LDTP. Due to the physical behavior of DHNs, pressures had to change close to the LDTP. PDTPs as an input for the attribution of the EA (cp. Figure 3) had to be determined as precisely as possible. This was demanding because the sensors distributed in the DHN delivered measurement data as non-uniform, time-discrete values. Furthermore, only 60% of the data points were closer than 4-5 s to each other, which was very high compared to the 250 ms presented in [2,10] as a requirement for uniform, time-discrete data. Within the evaluation time frame, for each sensor \(i\) a number of data points \(N_{i}\) was present. The algorithms were applied to each sensor \(i\) separately. For simplification, \(i\) was not used as an index for the following descriptions of the algorithms. The chosen CPD algorithms from the literature were employed in this paper, but within a different scope: the task was not to detect a change-point in an approximate time interval. However, the requirement was the precise determination of the same distinct point in the times series data of several sensors. The first algorithm was the mean algorithm (MAN algorithm, cp. Figure 4, top left). First, the mean value of the measurements \(M_{i,a}\) before time point \(j\) with \(j\in\{1,\ldots,N-1\}\) and the mean value \(M_{i,b}\) after time point \(j+1\) were determined for all \(j\). The maximum difference \(Q_{i}\) between the mean values showed the largest change in the signal. At this point \(j\), the pressure then began to drop, and this was the PDTP. For sensor \(i\), Equations (1)-(3) were used:  
\[M_{i,a}(j)=\sum_{i=1}^{j}\frac{p_{i}(t_{n})}{j} \tag{1}\]\[M_{i,b}(j)=\sum_{n=j+1}^{N_{i}}\frac{p_{i}(t_{n})}{j} \tag{2}\] \[Q_{i}(j)=\left|M_{i,a}(j)-M_{i,b}(j)\right| \tag{3}\]  
The second algorithm was the difference algorithm (DFN algorithm, cp. Figure 4, top right). With this algorithm, the maximum difference \(D_{i}\) of each pressure curve between the value of data point \((j-1)\) and the value of data point \((j+1)\) was searched. If the maximum absolute difference of each pressure curve was found, the value and time of each pressure signal could be determined. The data point with the maximum absolute difference \(D_{i}\) was the PDTP, and Equation (4) was applied:  
\[D_{i}(j)=p_{i}\big{(}t_{j+1}\big{)}-p_{i}\big{(}t_{j-1}\big{)} \tag{4}\]  
The third algorithm was the prediction algorithm (PDN algorithm, cp. Figure 4, middle left). Two points were predicted and compared with the next real point, respectively. The data points \(a\) with \(p_{i,1}^{*}\big{(}t_{j}\big{)}\) and \(c\) with \(p_{i,2}^{*}\big{(}t_{j}\big{)}\) were predicted and compared with the real data \(p_{i}\), respectively. The data point \(a\) was predicted with a linear regression \(p_{i,1}^{*}\) of the previous four data points \(\{j-4,\ j-3,\ j-2,\ j-1\}\). The data point \(c\) was also predicted with  
Figure 4: Explanation of the five self-developed algorithms\(-\)MAN (**top left**), DFN (**top right**), PDN (**middle left**), LNR (**middle right**), MLR (**bottom left**), and MLR zoomed (**bottom right**). linear regression \(p_{i,2}^{*}\), but using the four data points \(\{j-3,\ j-2,\ j-1,j\}\). The data points \(b\) and \(d\) were real data points with \(p_{i}\big{(}t_{j}\big{)}\) and \(p_{i}\big{(}t_{j+1}\big{)}\), respectively.