Utilization of ANN technique to estimate the discharge coefficient for trapezoidal weir-gate


 Developing and assessing the performance of water projects and irrigation networks is based on many factors, such as flow measurement. Weir and gate structures have been extensively utilized for flow measurement and to get rid of sediments. The process of modeling and estimating the coefficient of discharge in the weir is an essential part of hydraulic engineering. Recently the application of computer skills was adopted instead of traditional methods. In the present study, the artificial neural network (ANN) was adopted to estimate the coefficient of discharge for a combined weir that consisted of the trapezoidal weir and rectangular gate. For this purpose, the experimental data were collected and analyzed. The dimensional analysis was used to identify the effective dimensionless parameters related to the discharge coefficient. The developed ANN network structure was designed as 6-10-1 and adopted the default scaled conjugate gradient algorithm for training using SPSS V24 software. It was found that the proposed model with ten neurons was highly accurate in predicting the discharge coefficient. The sensitivity analysis was adopted to assess the performance of the ANN using different numbers of effective input parameters. Assessing five models, the ratio of upstream head to gate height (H/d), slope of trapezoidal angle (tan θ), and the ratio of distance between weir and gate and gate height (y/d) parameters are adequate for estimating the discharge coefficient compared to other parameters. ANN model with input parameters of H/d, h/d (h is the flow depth over the trapezoidal weir), b
 g/d (b
 g is the gate width), tan θ, b
 g/b (b is the total width of flume), and y/d shows reasonable accuracy with acceptable statistical indicators, coefficient of determination (R
 2 = 0.87), relative error (RE = 0.096), and mean squared error (MSE = 1.86) for the discharge coefficient. The ANN model gave a good idea about which factors are more effective on the discharge coefficient, and the process of training the network is more accessible than the traditional method which represent the discharge coefficient by equation.


Introduction
The important part of hydraulic studies is the modeling of hydraulic structures in field conditions. In irrigation projects, like irrigation and drainage networks, weirs and gates are usually used [1,2]. Weirs are obstructions perpendicular to the direction of flow. The derivation of an equation for measuring the discharge neglected the effect of the suspended sediments. The sediments are materials that are carried as the result of a change in velocity in a channel. It is deposited upstream of the weir or obstruction because of a decrease in the water velocity. The representation of the flow state without sediments was unrealistic. Therefore, a combined weir was adopted in the last century. The combined weir is composed of a weir and gate. The weir is used to pass the flow over the crest. The gate is used to get rid of the sediment in the lower part of the weir. The combined weir changed the derived equation governing this condition in real situations. When the weir is combined with the gate in one device, they are used to regulate and measure the flow. It has reduced maintenance as most of the sediment will be passed through it. Because of this, the deposited materials were not collected upstream. It can be used in arid and non-arid regions where these problems appear.
Many researchers have studied different types of combined weir. Alhamid et al. [1] studied the combined weir type of rectangular weir over the triangular gate.
They found that the factors of distance between weir and gate y, the gate height d, the flow depth over the trapezoidal weir h, the total width of flume b, and the gate width b g as the following ratios (y/d, h/d, b/b g , h/b, and b g /d) are affecting free flow and submerged flow. However, the factor presented as the measured head at downstream hd over d (hd/d) only affects submerged flow. The triangular weir and rectangular gate were studied by Alhamid et al. [2] and Hayawi et al. [3]. Alhamid et al. [2] found a quasi-empirical equation for calculating the discharge. It depended on the parameters of flow and geometry of the weir. Hayawi et al. [3] found that parameters b/h, y 1 /h, and d/h, where y 1 is the depth of the flume, inversely affect the discharge coefficient and the oretical discharge. However, theoretical discharge directly affects the distance between the weir and the gate. The angle of the notch inversely affects the discharge coefficient. Alhamid et al. [2], Negm [4], and Negm et al. [5] studied the compound weir type with rectangular weir and rectangular gate. Also, they studied the properties of hydraulic structures and developed equations to represent experiments in lab. The trapezoidal notch and flow under rectangular gate was adopted by Ismail [6]. She tested the effects of parameters of geometric and hydraulic structures on the discharge coefficient of the combined weir. The dimensional analysis is used by π-theorem to calculate the coefficient of discharge. The researchers, as mentioned above, used the traditional method to find the discharge coefficient or calculate an equation for discharge coefficient based on the preceding method. The discharge coefficient is found through empirical equations proposed by researchers. Usually, the equations are linear, and some of them are nonlinear with restrictions.
With the development of computer software technologies, these techniques are utilized to model hydraulic phenomena accurately. Recently, researchers started using sophisticated computer programs. It was adopted to simulate practical experiments and to find the variables or coefficients for these experiments. One of the most important methods is the artificial neural network (ANN). ANNs can make very complex nonlinear relationships with reasonable accuracy. In 2014, Al-Suhili and Shwana [7] used this technique to represent the compound weir type (cipolletti notch and flow under a rectangular gate). They studied the hydraulic properties of the combined weir by changing many geometrical dimensions and flow values to find actual discharge for free and subcritical flow. The dimensional analysis tested the parameters' effects on the value of the discharge coefficient. Then, they developed the equation to calculate the coefficient of discharge by ANNs. In 2016, Parsaie and Haghiabi [8] used the support vector machine (SVM), ANN, and adaptive neuro-fuzzy inference systems (ANFIS) to predict the coefficient of discharge for side weir. The Froude number and the ratio of length of the weir to the depth of water upstream were more affected parameters. ANN and ANFIS gave good results. The results showed that SVM with a radial-basis function (RBF) kernel model was best than ANN and ANFIS in predicting the coefficient discharge. In the SVM trained by gamma coefficient and epsilon, the results were 15 and 0.3, respectively. The coefficient of determination (R 2 ) was 0.96 and 0.93 for training and testing, respectively. In 2017, Parsaie and Haghiabi [8] studied the prediction of the coefficient of discharge of triangular labyrinth lateral weirs by five models, ANN, ANFIS, SVM, group method of data handling (GMDH), and multivariate adaptive regression splines (MARS). The result of ANN includes 2 hidden layers with 8 and 5 neurons in each hidden layer, respectively. RBF is best to transfer functions. The values of R 2 and root mean square error (RMSE) were 0.96 and 0.07, respectively. While ANFIS had one hidden layer and the resulted values of R 2 and RMSE were 0.94 and 0.136, respectively. In SVM, Gaussian function was the best to transfer, and the values of R 2 and RMSE were 0.96 and 0.07, respectively. As for GMDH and MARS, the results were the same for R 2 and RMSE which were equal to 0.93 and 0.08, respectively. In 2018, Parsaie and Haghiabi [9] predicted the coefficient of discharge for the side weir. They used empirical equation and two models, multilayer perceptron (MLP) and RBF. They concluded that Emiroglu formula's empirical formulas were accurate with correlation coefficient R = 0.65 and RMSE = 0.03 They concluded that the MLP method gave the best result than RBF because correlation coefficient R and RMSE for MLP were more than RBF, where the R for MLP was 0.89 and RMSE was 0.067, while it was 0.71 and 0.08 for RBF, respectively. In 2019, Parsaie et al. [10] compared the performance of ANFIS with MLP. They found the ANFIS was more accurate. MLP and ANFIS gave sensitivity analysis of hydraulic factors on discharge coefficient for cylindrical weirgate. Parsaie and Haghiabi [11] used three techniques, ANN, SVM, and ANFIS to evaluate the performance of the rectangular weir-gate. All three models gave suitable accuracy. The SVM model showed good performance from others. Nevertheless, ANN gives sensitivity higher than others. Azimi et al. [12] studied the determination of the discharge coefficient for rectangular side weirs using SVMs. They made six models (SVM 1-SVM 6). The study gave a poor accuracy in estimating the discharge coefficient. In 2020, Hayawi et al. [13] studied the determination of the discharge coefficient for triangular side weirs using ANN architecture. They found a correlation between the Rehbock empirical equation and ANN, where R = 0.982 and mean squared error (MSE) = 0.00113. Alwan et al. [14] studied the determination of the discharge coefficient for combined weir (rectangular weir-orifice) using MLP-ANN and multi nonlinear regression (MNLR) techniques. They tested the accuracy of the models by R 2 and relative error (RE). The MLP-ANN model gave R 2 = 0.91 and RE = 0.47%, while the MNLR model gave 0.75 and 1.13%, respectively. They suggested using the artificial intelligence instead of statistical regression technique to predicted the coefficient of discharge.
In this work, the application of computer skills will be merged instead of traditional methods, while identifying the capabilities of the developed models being sensitive to prediction of errors compared with traditional methods. The model will also check the sensitivity of each factor of the inputs to the model, while predicting the coefficient of discharge using ANN type RBF and comparing with traditional methods for the combined weir consisting of a trapezoidal notch and a rectangular gate.
The main difference in data used to build the ANN model in this study was the change in the half-angle of the trapezoid weir from 0-45 but remained constant at 14 in the study by Al-Suhili and Shwana [7], and the weir width, b w , was constant but it was changed in the study by Al-Suhili and Shwana [7]. The other parameters are the same where they were divided by the height of the gate opening. In the study by Al-Suhili and Shwana [7], the parameters were divided by the height of the water on the weir. The ANN model was built by Neuframe software, while this study depends on the program SPSS V24 software to create the model. The importance of each parameter on the model is studied as a percentage.
In the beginning, the introduction included the academic articles and the most important results. The factors affecting the weir will be clarified and then used in the neural network model. The sensitivity of the model will also be tested. The flowchart represented the methodology of the article. The discharge which passes above the weir or below the gate is not equal to the actual discharge for several reasons. The ratio of the actual discharge to the theoretical discharge is called the discharge coefficient. In general, the aim of this study is to find the value of the discharge coefficient through statistical analysis of the factors affecting the flow. The present work examines estimating the discharge coefficient for combining the trapezoidal weir and rectangular gate adopted by Ismail [6]. Many factors affect the environment of the experiment. Generally, the discharge coefficient is affected by the flow's characteristics, the dimension of the channel, the shape of the weir, and the dimension of the weir. The effective parameters of the hydraulic characteristics established on the outflow from the trapezoidal weir and rectangular gate, as presented in Figure 1, are the opening of gate height d, flow depth over the trapezoidal weir h, upstream head H, weir width b w , trapezoidal angle θ, gate width b g , and distance y between weir and gate, and the channel width b. This situation of flow can be formatted as shown in equation (1) [6].
where Q is the total discharge, g is the gravitation acceleration, μ is the dynamic viscosity, σ is the surface tension, and s is the channel slope. The dimensional analysis used the theorem of π. In this method, all parameters are represented by three components: length, time, and mass shown by equation (1) where Cd is the coefficient of discharge. The Reynolds number R e was neglected because of the high-velocity gradient where the discharge was measured. The Weber number W e is adopted in the curvature in the flow surface, narrow places, or small size of the model.
The experiments were carried out on a stainless-steel plate, and the wall is a glass channel with a cross-section of 0. This study adopted the combined weir trapezoidal notch and a rectangular gate for predicting the discharge coefficient by ANN and compared it with traditional methods

ANN
ANN is one of the promising techniques that generally utilizes engineering problems. It is recently used in the water resources model [15], specifically in the hydraulic problems. The accepted results of using the ANN approach showed its applicability in determining the relationships among different parameters of problems. Its work depends on internal connections called neurons. The nodes deal with inputs and outputs to know the relation between them. Relationships are either linear or nonlinear mathematical solutions with complex interconnectedness. It is a capable model of many complex models. The neural network consists of three layers called the input, the hidden, and the output. Each layer consists of a group of nerve nodes that connect these layers (called neurons) with a complex network and different weights [16]. The weights give an impression of the strength and influence of each of the inputs on the outputs [17].
RBF is a type of neural network model which contains two types of learning, supervised and unsupervised learning. The reason for naming the primary function is that the middle layer cells perform a series of base functions, such as the Gaussian function. The diffusion of the data is similar to the ray, so it was called the radial base function network (RBFN). The RBFN is a hybrid network with properties of ANN , such as the single perceptron layer, and the backpropagation error. The network acquired the property of returning the error amount from the two networks mentioned above, in addition to the learning law (in the output layer) it gained from the single-layer perception network [18]. The weights are not changed in the hidden layer because the instruction in it is unsupervised learning. The Gaussian activation function is used, and the mathematical form is used: where O j represents the actual output of the cell (j) and the value of the output is limited to [0-1], X is the input vector for the network, W is the vector of weights associated with the entries, which are random values generated, and σ is the appropriate spread magnitude. The weights in the output layer are changed when the required output is not obtained through the following mathematical equations Change of weights if the required output is not achieved through the following equation: where X i represents the entries for cell j, C represents the percentage of learning in the network, E J is the error amount calculated, T j is the required output for cell j, and O j is the actual output of cell j. RBF networks have faster learning and setup processes. Because neurons are focused on a specific operating range, they are easier to modify [15]. Figure 2 is a diagram of the radial base type neural network.
The neural network was made to estimate the coefficient of discharge for the combined weir. The entered data is divided into three parts: training data, test data, and finally, verification data. The training sample contains the applied data needed to train a neural network. In some cases, a percentage is selected in the dataset of the training sample to build the model. The neural network is trained on separate data from the user data called the test data to prevent over-training. The verification data contained independent data not used in constructing the model. It is used to estimate the network's efficiency in prediction.

Results and discussion
In this study, all or some of the following parameters shown were adopted as inputs to the ANN technique for multiple scenarios to find the value of Cd. These parameters included the opening height of gate (d), the flow depth over the trapezoidal weir (h), the upstream water head (H), weir width (b w ), the trapezoidal angle (θ), and the gate width (b g ). The ANN model was developed for the prediction of discharge coefficient of trapezoidal weirgate, 150 related datasets concerning equation (6) were prepared, and summarized as presented in Table 1. Some data collected by ref. [6] through laboratory experiments were used in the present study, which included the maximum, minimum, and mean values of each parameter, and these affected Cd value.
In the present study, the RBF has been utilized to develop the ANN model. The developed model involves three layers; these layers are input, hidden, and output. The layer of input contains five neurons, while the layer of output includes only one. The weights that connect the neurons are reset randomly. The function of overall error is computed at the output layer for both training and testing steps.
The ANN was prepared by taking 70% dataset through training, 15% to testing, and the rest for validation. The developed model of the ANN is given in Figure 3. Figures 4 and 5 presented the ANN performance through the training stage and the results through the validation stage, respectively. Figure 4 represents a comparison between the practical values by Ismail [6] and the theoretical values using ANN, where the highest value in practice was 0.58, while the highest value in theory was 0.57. The lowest practical and theoretical values were 0.47 and 0.45, respectively. The mean practical value was 0.56 and the  mean theoretical rate was 0.55. The reason for the difference is due to several factors, the most important being that the academic program does not take the nature of the flow, the conditions of laboratory measurements, and the fluid properties such as viscosity, density, and others which are reflected in the amount of the discharge coefficient. When comparing the Al-Suhili and Shwana model [7] and the theoretical values using ANN in this study, the highest value in the Al-Suhili and Shwana [7] was 0.68, while it was 0.594 in this model, and the lowest value was 0.543 in the Al-Suhili and Shwana model [7], while it was 0.53 in this model. The difference is due to the difference in the program used to configure the model where they used Neuframe software and, and the difference in the function used where they used the backpropagation algorithm. As in Figure (4), a substantial agreement can be seen between the result of the program using the ANN method and the results of the experimental runs. The correlation coefficient value between them was 0.92, and the lowest value of RE was 0.029. Therefore, using the six factors to calculate the discharge coefficient has more convergence than ignoring one of them, represented by the following ratios: H/d, h/d, b g /d, tan θ, b g /b, and y/d.

Sensitivity analysis of ANN
The significance of each input parameter on the output is examined. This step is crucial in the development of computer model process. These models are compared with the empirical models. Accordingly, numerous methods have been suggested to implement the analysis of sensitivity. In the present study, the simple method considered the effect of each input on the output. Several models were implemented by negligence of one entry in each model and assessed as shown in Table 2. It shows the normalized importance of each parameter and its effect on the model. Six scenarios were adopted by introducing the factors affecting the value of Cd. These scenarios adopted the ratios extracted by the method of dimensional analysis (equation (6)), including either all of them (six factors), or five, four, or three factors. When three ratios are input as variables, that is H/d, h/d, and    derivative by dimensional analysis (equation (6)), the sequence of importance for the sixth model was as follows: first, the ratio h/d, the two ratios b g /d and b g /b with the same importance as second, then third, the ratio H/d, and finally tan θ and y/d in sequence. Statistical indicators must be checked to choose the best model from the number of inputs affecting the discharge. MSE, RE, and R 2 were used as performance evaluation parameters. MSE and RE can be defined as follows: i n da i da dp i dp i n da i da i n dp i dp where n is the number of the observations; C da is the experimental coefficient of discharge; C da is the experimental mean for coefficients of discharge; C dp is the estimated coefficient of discharge; and C dp is the estimated mean for coefficients of discharge. Model performances were assessed by an overall number of 150. Figure 6 illustrates the results of ANN for different inputs. It represents the relationship between the experimental coefficient of discharge and the estimated one in the neural network model through the absence of one of the parameters. Most of the results were below the perfect line, which gives underestimation, except for the model containing all the input parameters as represented in Figure 4. The statistical analysis proved that all the model parameters were used according to equation (3). The results of the statistical analysis are presented in Table 3. The highest value of the correlation coefficient (R 2 = 0.87) for all testing scenarios was the last. That is, the number of inputs as a ratio was six. The lowest value for the residuals for this model, represented by RE was 0.096. So, this model was adopted based on statistical values. In other words, the ratios of the six factors derived from the dimensional analysis H/d, h/d, b g /d, y/d, b g /b, and tan θ affected the Cd value.

Conclusion
This study deals with estimating the discharge coefficient of the trapezoidal weir-rectangular gate using the ANN model. The adopted ANN model was designed as 6-10-1 (6 input, 10 hidden layers, and 1 output). It was found that the proposed ANN model with ten neurons was highly accurate in predicting the discharge coefficient using the trial procedure and depending on the statistical indicators. The sensitivity analysis was adopted to evaluate the ANN performance using a different number of effective input parameters. The results of the sensitivity analysis showed that the six inputs (H/d, h/d, b g /d, tan θ, b g /b, and y/d) as ratios gave the highest value for the correlation coefficient (R 2 = 0.87) and the lowest value for the residuals represented by RE = 0.096. The importance of the factors for the sixth model and their effect on Cd value were arranged as follows: first, the ratio h/d, the two ratios b g /d and b g /b with the same importance as second, then third, the ratio H/d, and finally tan θ and y/d in sequence.

Conflict of interest:
Authors state no conflict of interest.