# Improved Defect Detection Using Adaptive Leaky NLMS Filter in Guided-Wave Testing of Pipelines
## 3 Methodology
### Adaptive Filtering  
The main challenge in the inspection of guided waves is to decrease the energy of coherent noise in the test since non-coherent noise is generally removed by bandpass filtering and averaging. Dispersion characteristics of guided wave modes vary with regards to the structural features, frequency, and wave mode. However, the non-dispersive torsional mode is typically constant with an approximate speed of 3260 m/s. By shifting the rings to overlay the T(0,1) signals together, the wave modes which travel at different speeds will be less correlated with those that travel at constant speed. Furthermore, as shown in Figure 1, the flexural waves are highly variable in the space while the torsional mode has a higher correlation. In this case, the existing torsional mode is highly correlated while the noise and flexural modes will be less correlated in time. Therefore, instead of the summation of the signals, adaptive filters can be utilized to enhance the signal resolution. The output signal of an finite impulse response (FIR) filter in time-domain can be achieved by the convolution operation using [10; 40; 41; 42]:  
\[\mathrm{y(n)}=\sum_{k=0}^{P}w_{k}(n)\times(n-k) \tag{1}\]  
where \(P\) is the filter length, \(n\) is the iteration number, \(w_{k}(n)\) is the filter coefficients with the index of \(k\), and \(x(n)\) is the input signal. In the following equations, both \(x(n)\) and \(w(n)\) are vectors of size \(P\) (represented by bold characters). The resultant error signal would be:  
\[e(n)=\ d(n)-y(n) \tag{2}\]  
where \(d(n)\) represents the required reference (desired) signal; hence, in order to use this method, at least two signals are required. In adaptive filtering, the goal is to minimize the error signal by setting the filter weight. Therefore, in each iteration the filter weights should be updated:  
\[w(n+1)=w(n)+\Delta w(n) \tag{3}\]  
Figure 4: Flowchart of general propagation routine currently used in guided-wave devices. where \(\Delta w(n)\) is the correction step applied to previous filter coefficients to update them for the next iteration; the key component of the adaptive filter is to define \(\Delta w(n)\) in a way that it decreases the mean square error over time. One of the robust methods is the normalized least mean square [20; 41], which tries to minimize the least mean square error by setting the coefficients according to a variable step size. The formula is as follows:  
\[w(n+1)\ =\ \w(n)\ +\ \beta\frac{x(n)}{e+\abs{x(n)}^{2}}\ e(n) \tag{4}\]  
where \(\beta\) is a normalized step size with \(0<\beta<2\), \(e\) is some small positive number to bypass the problem when \(\abs{x(n)}^{2}\) becomes too small. The noise in guided waves is highly variable due to the existence of time-varying multiple modes. To make sure the filter is not over-fitted to the characteristics of previous iterations, a leakage factor, \(\alpha\), is added to reduce the effect of previous iterations [42]:  
\[w(n+1)\ =\ \alpha w(n)\ +\ \beta\frac{x(n)}{e+\abs{x(n)}^{2}}\ e(n) \tag{5}\]  
The flow chart of this algorithm is shown in Figure 5. In this setup, instead of adding the signals received from the rings of transducers, they are selected as the desired response \(d(n)\) and the input signal \(x(n)\). Every other signal is updated based on the characteristics of each iteration and \(y(n)\) is the output of the filter. The selected reference and input signals are the two sets generated in the general propagation routine, as marked in Figure 4. Applying this phase delay and summation of arrays within each ring, two sets of signals are created where both have the following components:  
* S(t) Signals of interest/anomalies: Highly correlated and in phase
* N(t) Flexural and other noise: That are not correlated to S(t). Furthermore, noise sources of two signals are correlated to each other. This satisfies the need for a reference signal in using adaptive filtering.