# Identification of Water Hammering for Centrifugal Pump Drive Systems
## 3 Real-Time Simulation Results
### Linear Regression Model  
Water hammering is a transient flow in pipes, created by rapid changes of velocity in pipelines. This phenomenon can occur because of an increase and decrease of pressures in water pipelines. Thus, water hammering is created by sudden closing, shutting off, or sudden restarting of valves. ML, more specifically, the field of predictive modeling, is primarily concerned with minimizing the error of a model or making the most accurate predictions possible. In applied ML, it is possible to borrow, reuse, and steal algorithms from many different fields, including statistics, and use them towards these ends. As such, linear regression was developed in the field of statistics and studied as a model for understanding the relationship between input and output variables, and it is borrowed by ML. It is both a statistical algorithm and an ML algorithm. It is possible to calculate the R-square error; the root mean square error in the regression model is based on the number of observations. The pressure head and velocity have an inverse relationship in the linear regression model. As velocity increases, the pressure head of the system decreases. In this research, the number of observations is 11, error degrees of freedom are 9, root mean squared error is 0.67, and root squared error is 0.0204, whereas adjusted R-square error is 0.0884, a system error is 0.08 (Table 2). It is applicable when three valves are suddenly closed and opened. Several ML algorithms are used, but, among those, the linear regression method is more accurate regarding training time and prediction speed. Head loss due to pipe friction can be calculated by using the Darcy-Weisbach formula. The boundary condition can be implemented for the head value of the pump and velocity of the fluid. The head value (H) is constant if the water surface elevation is constant in time. It is represented in expression form as Equations (7)-(8). At the initial condition, the head is denoted by \(H_{0}\) and \(H_{p1}\) is the head value for Case 1 [23]. \(H\) is the head of the pump in different pressure, \(V\) is velocity, \(g\) is gravitational acceleration, \(a\) is the wave propagation velocity change, \(f\) is friction factor, \(D\) is the diameter of the pipe of the pump, \(T\) is total time, and \(t\) is a particular time, and \(N\) is the speed of the pump. \[H_{P1}=H_{0} \tag{7}\]  
The velocity expression is  
\[V_{P1}=V_{2}+\frac{g}{a}(H_{0}-H_{2})-\frac{f\Delta t}{2D}V_{2}|V_{2}| \tag{8}\]  
Let us assume the valve is closed so that the velocity decreases from \(V_{0}\). The velocity behaviour measured in terms of constant time \(T_{C}\). \(T_{C}\) is the valve closure time. \(V_{P}\) is vapor pressure, \(V_{P_{N+1}}\) is vapor pressure at next speed; see Equation (9):  
\[V_{P_{N+1}}=V_{0}\bigg{(}1-\frac{t}{T}\bigg{)},0\leq t\leq T_{C}V_{P_{N+1}}=0,t>T_{C} \tag{9}\]  
The equation for \(H_{P}\) is Equation (10):  
\[H_{P_{N+1}}=H_{N}-\frac{a}{g}\big{(}V_{P_{N+1}}-V_{N}\big{)}-\frac{a}{g}\frac {f\Delta t}{2D}V_{N}|V_{N}| \tag{10}\]  
where \(H_{N}\) is the head value of \(N\) speed and \(H_{P_{N+1}}\) is next pressure-head value of the next speed (Equation (10)). If, during water hammering detection, the ML algorithms are implemented, then a more suitable algorithm can be detected using the values of RMSE and R\({}^{2}\) error. The R\({}^{2}\) and RMSE of different algorithms help detect the accuracy level of the system and can find out the best-suited application of the algorithm. Therefore, accurate prediction of the output is also possible. RMSE is the function of the difference between the real and predicted target outputs [25]. During the training stage of the classifier, we need to train the system with the minimum RMSE (error threshold). If the system error converges to the minimum error threshold, the accuracy of the system during the testing stage will be  
VFD based pumping system has been used for the experiment [26]. Vibration details are recorded for analysis of the motor and pumping state to predict water hammering.