Abstract
Fluid, when running through pipes, makes a complex sound emission whose parameters change nonlinearly with respect to flow speed. Especially, in household pipe systems, there may be spraying effects and resonance effects which make the emission more complex. We present a novel approach for predicting flow speed based on wavelet packet analysis of sound emissions rather than traditional time and frequency domain methods. Wavelet packet analysis, by providing arbitrary time–frequency resolution, enables analyzing signals of stationary and non-stationary nature. It has better time representation than Fourier analysis and better high-frequency resolution than wavelet analysis. Wavelet packet analysis subimages are further analyzed to obtain feature vectors of norm entropy. These feature vectors are fed into a multilayer perceptron for prediction. Prediction accuracy of 98.62%, with 3.99E−04 L/s mean absolute error and its corresponding 1.85% relative error is achieved. Time sensitivity is ±0.453 s and is open to improvement by varying window width. The result indicates that the proposed method is a good candidate for flow measurement by acoustic analysis.
Keywords
I. Introduction
Flow of a fluid can produce complex sound emissions in household pipe systems because of the spraying effects, resonances in the pipe structures and other mechanical interactions including friction. With highly varying parameters, this sound can hardly be used by linear methods to predict flow speed.
The possibility of pipe monitoring or flow measurement based on sound analysis has been investigated by researchers. Most of the researchers who worked on this subject have not reported measurement accuracies, but rough statistical correlations; for example, Dinardo et al. 1 and Campagna et al. 2 showed a linear dependence between the amplitude of the vibration acceleration in its frequency domain and the flow rate in a pipe and developed a fluid flow rate monitoring system; Campagna et al. 2 developed a methodology for the measurement of the fluid flow rate in a pipe, by means of appropriate evaluations to be implemented on the vibrational signals in the frequency domain; Dinardo et al. 3 related the power content of the processed signals (by introducing the signal root mean square value) to the flow rate in a pipe; Saito et al. 4 and Thompson et al. 5 developed a relationship between pressure fluctuations caused by sudden flow rate changes; Evans et al. 6 developed a flow rate measurement technique based on signal noise from an accelerometer attached to the surface of a pipe. They defined the signal noise as the standard deviation of the frequency averaged time-series signal and presented experimental results that indicate a nearly quadratic relationship between the signal noise and the mass flow rate in the pipe; Safari and Tavassoli 7 showed empirical results that indicate that there is a relationship between the output signal of microphone in frequency domain and the flow rate in a pipe; Medeiros and Barbosa 8 presented a method for measuring flow in pipelines based on the frequency domain values of vibration caused by the flow of water; and Hu et al. 9 used accelerometer on a pipe to recognize the type of household water use activity.
Some of the researchers in this field reported measurement accuracies; for example, Jacobs et al. 10 determined a mathematical relationship between the sound signal and the flow rate near a tap. Three models, based on Fourier transforms of data in the frequency domain, were devised to estimate the flow rate of water as a function of the audible sound signal properties. An average error of 15% was determined; Kim et al. 11 introduced a nonintrusive autonomous water monitoring system based on pipe dynamic theories to household plumbing in the form of an optimization problem and achieved flow measurement with 7% mean absolute error; and Kim et al. 12 used parameter estimation via numerical optimization technique to estimate flow rate with 5% average error.
Time domain, frequency domain (Fourier) and time–frequency domain (wavelet) analysis are the main tools used for analyzing signals but Fourier analysis has poor time representation and wavelet analysis has poor resolution at high frequency. Wavelet packet analysis (WPA), on the other hand, overcomes both of these, and the arbitrary time–frequency resolution enables analysis of signals of both stationary and non-stationary nature.
WPA has been successfully used to analyze signals for various applications; for example, Hu et al. 13 used relative wavelet packet energy to classify surface electromyography (EMG) signals; Wang et al. 14 used relative energy of harmonic wavelet packet to classify surface EMG signals; Wu and Liu 15 used Shannon entropy of wavelet packet transform (WPT) for fault diagnosis in internal combustion engines; Ekici et al. 16 used energy, norm entropy and Shannon entropy of WPT to locate fault on transmission lines; Hariharan et al. 17 used energy and Shannon entropy of WPT for pathological infant cry analysis; Arjmandi and Pooyan 18 used energy and Shannon entropy of WPT for pathological voice quality assessment; Yen and Lin 19 used wavelet packet node energies to monitor vibration; Sekine et al. 20 used power of detail signals of wavelet packet decomposition (WPD) to classify waist acceleration signals; Averbuch et al. 21 used energy of WPD to acoustically detect moving vehicles; Ting et al. 22 used energy of WPD for electroencephalogram (EEG) feature extraction to be used in brain computer interfacing; Zhang et al. 23 used relative energy and Shannon entropy of WPD to automatically recognize cognitive fatigue from physiological indices; Crovato and Schuck 24 used Shannon entropy of WPD for classification of dysphonic voices; Subasi 25 used wavelet packet energy to classify EMG signals; Shao et al. 26 used wavelet packet energy to classify fault in gear; Zhang et al. 27 used wavelet packet energy for classification of power quality disturbance; Avci et al. 28 used norm entropy of WPD to recognize targets; Avci and Avci 29 used wavelet packet energy for digital radio signal classification; Toliyat et al. 30 used energy of WPD to detect railway defect; Alyt et al. 31 used WPD and higher order statistics to detect and localize radio frequency (RF) radar pulses in noisy environment; Daqrouq 32 used Shannon entropy of WPD for text-independent speaker identification; Avci 33 used norm, log energy and sure entropy of WPD to recognize a speaker; Behroozmand and Almasganj 34 used energy and Shannon entropy of WPD for classification of pathological speech; and Sengur et al. 35 used energy and norm entropy of WPD for texture classification.
In this work, we would like to predict the flow speed in a household water pipe system based on the analysis of emitted sound. For this purpose, we record sound under varying flow speed. We choose to make the analysis by WPA. Output of the WPA is a set of subsignals, number of which depends on the depth of the WPA. We choose norm entropy as a feature vector calculated from these subsignals. We look for a mapping tool from the feature vectors to the flow speed. Multilayer perceptron (MLP) provides such a possibility. It is a kind of neural network which is shown to be effective in black box modelling and function approximation.
II. Material
Sound emissions are recorded from 1.00 cm away from a household pipe with no contact to the pipe using a digital recorder attached to a microphone. Pipe has a circular cross section, made of steel and has a radius of 2.25 cm. The flow speed is varied in 11 even incremental steps between 0.0159 and 0.0526 L/s. Flow speed is measured using a volumetric method by keeping track of the time until fluid from the pipe fills a 1.0-L container. The flow speed is calculated by dividing 1.0 L by the time information from the chronometer. The digital recorder is set to a sampling rate of 44,100 Hz. Recordings from each flow speed are partitioned into 0.907-s long windows which provide us with a total of 110 windows for training and 110 for testing. The window width is selected as 40,000 time steps which we choose depending on our earlier experience in similar applications. Since each window is 0.907-s long, we have a time sensitivity of ±0.453 s. Figure 1 displays sample windows of signals from each of the 6 odd-numbered flow speeds out of 11 between 0.0159 and 0.0526 L/s.

Sound signals recorded for odd-numbered 6 speeds out of 11 speeds (between 0.0159 and 0.0526 L/s) in increasing order from top to bottom
III. Method
Our analysis and prediction workflow is shown in Figure 2 . Each signal is first decomposed into wavelet packet subsignals by WPA. Then, features are extracted from these subsignals using norm entropy. These features are fed into our predictor, the MLP. By looking at prediction accuracy, we fine-tune the parameters: WPA depth, mother wavelet used and which nodes (all or final) of WPA to include in the prediction. Search is done by starting with the simplest parameters and increasing until the best prediction accuracy. The MLP parameters, which are the number of hidden layers and the number of neurons, are determined by pruning. This is to start with an MLP with one hidden layer with one neuron and increasing the number of layers and neurons until achieving the best accuracy. We analyze the contribution of each component of the feature vector corresponding to the nodes of WPA to prediction by a bar plot of the mean values of the feature vectors and then a box plot of the feature vectors at each of the WPD nodes at varying speeds. This lets us decide whether further reduction in the feature vector is needed.

Classification workflow
A. WPD
WPD is used to decompose the signals. Wavelet packets are a generalization of wavelet bases by taking linear combinations of wavelet functions. 36 In the following explanation, we take a parallel approach to Yen and Lin 19 and Wu and Liu. 15
A wavelet function has three indices: j is the index scale (integer), k is the translation (integer), n is the oscillation parameter and t is the time
The first two wavelet packet functions are the scaling function and the mother wavelet function
Wavelet packet functions with higher oscillation parameters are
where h(k) and g(k) are quadrature mirror filters 37 associated with the scaling function and the mother wavelet function. The wavelet packet coefficients are defined as the inner product of wavelet packet functions with the input signal f(t), which also defines the range of t
WPD is applied as shown in Figure 3 for three levels. The left-hand side sub-branches are obtained by low-pass filter h(k) and decimation; and the right-hand side sub-branches are obtained by high-pass filter g(k) and decimation. S is the original signal, A stands for approximation, D for detail and the number for level.

WPD tree up to three levels
B. Feature
Norm entropy is used as the feature vector for prediction. Entropy is a common measure used in signal processing which is able to extract useful information from a signal
where
C. Predictor: MLP
Various tools including neural networks are available for prediction. We choose MLP with backpropagation learning which can efficiently process large data sets and has been shown to be effective in black box modelling and function approximation.38,39
MLP is a network of nodes arranged in layers. A node can be modeled as an artificial neuron that computes weighted sums of inputs with bias and presents it to an activation function. A general MLP model is shown in Figure 4 . Linear activation functions are used for input and output layers and hyperbolic tangent sigmoid activation functions for the hidden layer(s) which are in the following form

General architecture of the MLP
Training of the MLP is the adjustment of the weight parameters to map the input to the output with minimum error. For this purpose, backpropagation algorithm is adopted where the error between the actual output of the network and the target is backpropagated through the network to adjust the weight parameters.40,41
IV. Results and Discussion
We start by WPD of the signals. We start at level 1 and increase the level until achieving the best prediction accuracy, which is at level 5. Final node of subsignals of WPD at depth 5 at speeds 0.0159 and 0.0526 L/s is shown in Figure 5 . Each vertical line is a subsignal. The WPD figures for two flow rates are visually different from each other at both the lower frequency (upper parts) and the higher frequency (lower parts) nodes in the WPD domain.

WPD of sound signals at speeds 0.0159 L/s (left) and 0.0526 L/s (right)
We calculate norm entropy of the final-level nodes of WPD. Bar plot of the mean values of the norm entropy for final 32 nodes of WPD for odd-numbered 6 speed steps out of 11 between flow rates 0.0159 and 0.0526 L/s is given in Figure 6 . This figure shows that feature vectors are different at various speeds and therefore will contribute to prediction.

Mean values of norm entropy at final 32 nodes of WPD for odd-numbered 6 speed steps out of 11 between 0.0159 and 0.0526 L/s
To see how each WPD node is contributing to prediction more precisely, we box plot norm entropy for the same nodes of WPD corresponding to odd-numbered 6 speed steps out of 11 between 0.0159 and 0.0526 L/s in Figure 7 . In this figure, the central mark of each box is the median, the edges are the 25th and 75th percentiles and the whiskers cover the most extreme data points that are not outliers. Outliers are plotted individually as + signs. These plots show that feature vector at all nodes is different from each other at various flow rates so these will contribute to prediction; therefore, we decide not to make any reduction in the feature space.

Box plot of norm entropy for 32 nodes of final level of WPD at depth 5 corresponding to odd-numbered 6 speed steps out of 11 between 0.0159 and 0.0526 L/s
We feed the norm entropy features into the MLP. We perform a search in the parameters: WPD depth, mother wavelet used, p value of norm entropy and WPD nodes used in prediction (all or final). We search by starting with the simplest or lowest value of the parameters and increase complexity until reaching the best prediction accuracy. Mother wavelet is found by a search in Daubechies wavelet family by starting with the simplest and increasing complexity until finding that db4 gives best prediction accuracy. Number of MLP hidden layers and the number of neurons are found by the method of pruning. This is to start with one hidden layer of one neuron and increase the number of layers and neurons until best prediction accuracy. The best parameter values that are found by the search, along with best average prediction accuracy, mean absolute prediction error and its corresponding relative error are given in Table 1 .
Parameters corresponding to best prediction accuracy
WPD: wavelet packet decomposition; MLP: multilayer perceptron.
Figure 8 shows the prediction result belonging to all test instances by plotting the actual and the predicted speeds. We see that prediction is mostly consistent with minor random fluctuations. Fluctuations can be linked to noise not related to flow which exists in some of the instances. We see that best prediction with 98.62% mean accuracy and 3.99E−4 L/s mean absolute error, which corresponds to 1.38% relative error, is accomplished with an MLP of two hidden layers with 10 and 5 neurons. Figure 9 shows the training performance of this best performing MLP.

Actual speeds (blue) and predicted speeds (red) for all test instances corresponding to best prediction

Training performance of the MLP with two hidden layers of 10 and 5 neurons
Most results that were reported in the literature review part of the “Introduction” section report rough statistical correlations in flow measurement by sound analysis. Three of them reported accuracy: Jacobs et al. 10 who reported 85% accuracy using models based on Fourier transform; Kim et al. 11 who reported 93% accuracy using pipe dynamic theories parameter estimation; and Kim et al. 12 who reported 95% accuracy using parameter estimation via numerical optimization.
Although it is impossible to make a comparison between these results and ours, since all authors report results using different data sets, we can at least say that our result of flow measurement by WPA of sound emissions with 98.62% mean accuracy is among the good results. The result is in the household flow rate range of 0.0159–0.0526 L/s and further experimentation in other flow ranges is needed in order to generalize the method. The effect of the pipe material can also be investigated in a future research.
V. Conclusion
An approach for flow measurement by sound signal analysis is presented. WPA is chosen as the analysis tool and norm entropy is extracted as the feature vector from the wavelet packet subsignals. Prediction is done with an MLP. An average prediction accuracy of 98.62% with 3.99E−4 L/s mean absolute error and its corresponding 1.38% relative error is achieved. This result is in the household flow range of 0.0159–0.0526 L/s and is extendable to other ranges with further experimentation. Time sensitivity is ±0.453 s and is open to improvement by exploring different window widths. Experimentation with other pipe materials can be done in a future research. The method according to the given results presents us with a promising tool for flow speed measurement by sound emission analysis. It opens the way for a new kind of lower cost, portable and noninvasive flow sensor which can be used to monitor flow in pipe systems.
