# Software for Monitoring the In-Service Efficiency of Hydraulic Pumps
## 3 Implementation of an Algorithm to Assess Pump Efficiency
Using the reading and data fitting component in Figure 2 for a finite set of data received as input for \(H(Q)\), \(P_{m}(Q)\), respectively, \(\eta_{P}(Q)\), the best 2 nd- and 3 rd-order polynomial functions are obtained and, automatically, the values for these curves' coefficients, with a minimal square error:  
\[\chi^{2}=(\sum_{i}^{w_{i}}y_{i}-\sum_{j}^{x_{ij}}c_{j})^{2}=||y-X_{c}||_{w^{2}} \tag{13}\]  
where \(y\) is the input data vector of order \(n\), \(X\) is a \(n\,x\,p\) matrix having predictor variables, and \(c\) is the vector with those \(p\) fitting coefficients that must be estimated. The matrix \(w=diag(w_{1}w_{2}\ldots w_{n})\) contains the weights of the observed vector. The \(\chi^{2}\) square error also takes the form in Equation (17) where \(w_{i}=(y_{i}-f(x_{i}))^{-2}\). The determination of the values of the polynomial curve coefficients has been performed using the GSL Scientific Software Library [31] available as free software and tested in numerous scientific and engineering applications on the market. The measured volumetric flow rate passing through the pump, \(Q_{ms}\), is used to verify the percentage error \(\varepsilon_{Q}\) compared to the value estimated by the algorithm. The user receives a warning if the error exceeds the 3% threshold. The flowmeters used by the water supply company have an accuracy limit of \(\pm 3\%\). Figure 3 shows a diagram of the application's use cases. The operator uses a mobile phone to enter the suction and discharge pressure values, \(p_{s}\) and \(p_{d}\), and then scans the QR barcode with the parameters configured and printed in the desktop application. Optionally, this software application can also be used to assess the percentage error \(\varepsilon_{Q}\) if the measured volumetric flow rate value \(Q_{ms}\) is available as input data; see Figure 2.  
After reading the barcode that identifies each pump, containing its hydraulic configuration, and after the input of the two read data, \(p_{s}\) and \(p_{d}\), the duty point of the hydraulic pump is determined. Then, the pump efficiency of the duty point is compared with the BEP value. The hydraulic pump operates normally if the duty point falls in the green region. The pump operation is defective if the duty point falls into the other regions, and the operator must look for the causes and determine the appropriate intervention. The \(R^{2}\) parameter will be used to approximate the set of points with the selected polynomial function, defined as follows:  
\[R^{2}=1-\frac{\chi^{2}}{TSS} \tag{14}\]  
where  
\[TSS=\sum_{i}^{n}(x_{i}-\bar{x})^{2} \tag{15}\]  
Figure 3: Use case diagram for the software solution. is the total sum of the squares of the variations compared to the average value  
\[\bar{x}=\frac{1}{n}\sum_{i}^{n}ix_{i} \tag{16}\]  
and  
\[\chi^{2}=\sum_{i}^{n}(y_{i}-f(x_{i}))^{2} \tag{17}\]  
is determined with the approximation function for those \(n\) experimental read data. The approximation of the set of points \(n\) with the selected polynomial function is more precise when the \(R^{2}\) parameter is closer to 1. Moreover, \(R^{2}<1\) as long as \(n+1<N\) where \(n\) is the approximation polynomial's order, and \(N\) is the total number of read data values in the input set.