Prediction of Pressure–Discharge Curves of Trapezoidal Labyrinth Channels from Nonlinear Regression and Artificial Neural Networks

AbstractEmitters are important components of drip irrigation systems, and the use of labyrinths as a mechanism of energy dissipation stands out in the drippers’ design. Relating the geometric chara...


Introduction
The emitters are the main components of drip irrigation systems. These devices are installed along polyethylene pipes (i.e., the lateral lines) and are responsible for controlling the discharge to apply water evenly on the soil (Frizzone et al. 2012). Drippers designed based on labyrinth channels commonly are used in drip irrigation systems due to their low cost, simple structure, and efficient hydraulic performance (Yu et al. 2019;Zhang et al. 2010). A labyrinth consists of a narrow channel with several baffles that generate head losses and ensure discharge regulation (Al-Muhammad et al. 2018;Wei et al. 2006;Zhang et al. 2016).
The geometric parameters (i.e., dimensions and shape) of labyrinth channels are critical for hydraulic performance and the resistance of drippers to clogging (Feng et al. 2018;Haosu et al. 2016;Wei et al. 2006;Yu et al. 2019;Zhang et al. 2013). The resistance of drippers to clogging (i.e., anticlogging performance) relies on the drippers' design and the water quality. The narrow flow path of the drippers can be clogged easily by particles, inorganic matter, chemical precipitation, biofilm development, and other impurities. Several current studies investigated and optimized the flow path geometrical characteristics to enhance the transport capacity of particles through the labyrinth channel (Feng et al. 2018;Li et al. 2006;Yu et al. 2019;Zhang et al. 2011Zhang et al. , 2010. The emitter hydraulic performance of drippers may be linked with the flow exponent (x) of the pressure-discharge equation. The lower the flow exponent, the better is the hydraulic performance. A low flow exponent indicates that the emitter discharge is less sensitive to inlet pressure. In addition, the maximum length of the lateral lines may increase as the emitter flow exponent decreases (Frizzone et al. 2012), and this may be economically beneficial in the design of the irrigation subunits.
Relating the constructive characteristics of labyrinths to their hydraulic performance usually is a complex process in which hydraulic parameters, such as head loss and discharge, cannot be determined by means of trivial hydraulic equations used in the study of pressurized pipes. Conventionally, the development of 1 Ph.D. Student, Dept. of Biosystems Engineering, College of Agriculture "Luiz de Queiroz," Univ. of São Paulo, Piracicaba, SP 13418-900, Brazil. Email: rogeriolavanholi@hotmail.com 2 Professor, Agricultural Engineering College, Univ. of Campinas, Av. Cândido Rondon, 501, FEAGRI/UNICAMP, Campinas, SP 13087-875, Brazil (corresponding author emitters involves the manufacturing and testing of several prototypes until a prototype with the desired characteristics is obtained, increasing the time and cost for the development of a new dripper (Celik et al. 2011). Computational fluid dynamics (CFD) has been a useful tool in the study of flow characteristics and particle transport in labyrinth channels of drippers (Al-Muhammad et al. 2018;Feng et al. 2018;Haosu et al. 2016;Yu et al. 2019Yu et al. , 2018. Although CFD is a powerful and effective tool to investigate and support the design of labyrinth channels, such numerical simulations usually demand considerable computational capacity. A rapid method for predicting the hydraulic performance of labyrinth channel drippers by exploring the relationship between structural parameters of emitters and hydraulic performance was proposed by Zhang et al. (2013). They described an approach to estimate pressure loss and discharge in labyrinths that is based on a coefficient φ. This coefficient is a dimensionless parameter that quantifies the total head loss caused in each labyrinth baffle. They proposed an empirical second-order polynomial model to estimate the coefficient φ that considers the geometry of the labyrinth.
The present study assumed that it is possible to develop empirical mathematical models based on nonlinear regression and to use neural networks based on multilayer perceptrons (MLPs) to relate geometrical and operational characteristics of labyrinth channels. Artificial neural networks (ANNs) can solve nonlinear and complex problems, and they are adaptable systems that learn relationships from the input and output data sets and then predict a previously unseen data set with similar characteristics to the input set (Haykin 1999). ANNs are suited to the modeling of agricultural data, which are known to be complex and often nonlinear (Mattar and Alamoud 2015). The use of ANNs is expanding in irrigation engineering, and they have been applied successfully for simulating/ predicting the distribution of water by drippers (Elnesr and Alazba 2017;Hinnell et al. 2010), minor losses for integrated emitters (Martí et al. 2010), hydraulic performance of labyrinth channel emitters (Mattar and Alamoud 2015), filtered volume in microirrigation sand filters (Puig-Bargués et al. 2012), photovoltaic irrigation systems (Dursun and Özden 2014), soil water retention (Nguyen et al. 2017), and evapotranspiration modeling (Kumar et al. 2011).
This study developed and evaluated models that can predict the discharge of labyrinth channels as a function of their geometry to make possible the rapid prediction of pressure-discharge curves due to modifications in the labyrinth geometry. The study was limited to the evaluation of non-pressure-compensating, trapezoidal labyrinths with a rectangular flow section, but the approaches described might be useful for modeling other geometries of labyrinth channels.

Geometry and Design of Prototypes
Twenty-four distinct flat, non-pressure-compensating prototypes with trapezoidal labyrinths and rectangular flow section were designed, manufactured, and evaluated. Because of the differences in design characteristics, the prototypes were divided into two groups. The first group, Type 1, had prototypes with labyrinths that provided uniform flow through the channel section and undeveloped vortices. The emitters in the second group, Type 2, had regions that make possible the development of well-defined vortices of various magnitudes. In both groups, the labyrinths were sized to provide a discharge near 1.4 L h −1 under 100 kPa pressure. Drippers with discharges lower than 2 L h −1 commonly are used in microirrigation systems (Frizzone et al. 2012).
The choice of the two groups studied was linked to the fundamentals of clogging processes and sediment transport within the labyrinths. Some low-speed regions associated with vortices are prone to sediments deposition and should be avoided to enhance particle transport through the emitter flow path (Feng et al. 2018). Therefore, at first, it was supposed that one way to reduce the emitters' sensitivity to clogging was to maintain a large mainstream area and eliminate or reduce low-flow-velocity regions. The uniform flow emitters (Type 1) had a geometry and characteristics that minimized the vortex zones and emphasized the mainstream area. However, the Type 2 emitters had a design that favored the formation of vortices, and, consequently, as discussed subsequently, an evaluation of both groups showed the importance of vortices in the hydraulic performance of labyrinths.
For Type 1 emitters, the labyrinth geometrical variables considered [ Fig. 1(a)] were channel width (W), channel depth (D), and tooth angle (α). The length of the flow path centerline in Region 1 [ Fig. 1(b)] was twice the channel width, whereas Region 2 had a length equal to W. The Type 1 prototypes had square flow cross sections (i.e., W ¼ D). Four values of channel width and depth (0.5, 0.6, 0.7, and 0.8 mm) and three values of tooth angle (45°, 60°, and 75°) were evaluated, resulting in 12 prototype models of Type 1. Most of the values mentioned were selected within a practical range that represents commercially available drippers and made it possible to obtain discharges close to the target value of 1.4 L h −1 .
For the Type 2 prototypes, the geometrical parameters considered were channel width (W) and ratio H=W (Fig. 2). Three values of channel width (0.7, 1.0, and 1.3 mm) and four values of H=W ratio (1.0, 1.2, 1.4, and 1.6) were evaluated, resulting in 12 prototype models of Type 2. The channel depth (D) and tooth angle (α) parameters were set at 0.8 mm and 75°, respectively.  To obtain the target discharge in each of the combinations, the number of teeth (N) and, consequently, the labyrinth length (L) were estimated. Because of the pressurized-pipe hydraulics, the energy is dissipated under two forms in the labyrinth channel: one occurs in the straight sections of the channel and is related to the friction losses during fluid flow, and the other is related to minor losses resulting from sudden changes in flow direction and dissipation because of vortices. The labyrinth channels consist of a series of teeth that have the same shape, providing the same head loss in each baffle when flow conditions are fully developed (Adachi and Hasegawa 2006). Therefore, as proposed by Zhang et al. (2011), the total pressure drop between the inlet and outlet sections of the labyrinth (Δp) can be expressed as where Δp = pressure drop in labyrinth (Pa); Δp d and Δp l = friction and local pressure drops, respectively (Pa); and N = number of baffles. Based on the Darcy-Weisbach equation and the minor loss equation, Eq.
(1) can be rewritten where f = friction factor of the Darcy-Weisbach equation; l = length of flow path centerline [ Fig. 1 (3)], serves as an indicator of total head loss caused in each labyrinth baffle. Higher values of φ indicate flow characteristics that cause greater head loss and enable smaller and more-compact labyrinths to be obtained When Eqs. (2) and (3) are combined and N is isolated, Eq. (4) is obtained, and it makes possible to calculate the number of baffles and, consequently, the labyrinth length The value of φ for each prototype model was estimated by CFD in COMSOL Multiphysics version 5.1 using the standard k-ε model and free tetrahedral meshing. The numerical simulations were run using a labyrinth segment, and it was assumed the total head loss was similar in every baffle [Eq.
(2)]. The mean flow velocity at the inlet of the first baffle was set to the corresponding flow rate of 1.4 L h −1 . The atmospheric pressure was fixed at the outlet section of the eighth baffle. From the simulations, the mean pressure at the inlet section was obtained, and, consequently, the total head loss in the labyrinth segment was the difference between the inlet and outlet pressures. The value of φ was obtained by dividing the total head loss by the number of baffles in the labyrinth segment. Once φ was estimated, the number of baffles and labyrinth length were calculated [Eq. (4)] to obtain 1.4 L h −1 at 100 kPa. No rigorous simulations were required for the purpose of this work, because the simulations were used only to approximate the lengths of labyrinths. After that, the mathematical models were fitted based only on experimental data.

Manufacture and Assembly of Emitter Prototypes
The prototypes were built using a computer-numerical-control (CNC) milling machine with 0.01-mm resolution, equipped with a milling cutter with a 0.5-mm diameter, 3.0-mm cutting height, and 3.2-mm shaft diameter. The labyrinth channels were carved on 2-mm-thick polymethyl methacrylate plates of varying length and width according to the dimensions of each prototype model.
The prototypes were mounted in an accessory designed to enable the labyrinth to operate like commercial emitters integrated into polyethylene pipes. The experimental setup ( Fig. 3) was built from a nylon rod with 41-mm outer diameter, 18-mm internal diameter, and 150-mm length, with a cavity made for laying the acrylic plate with the engraved labyrinth. The cavity was a leveled surface 33 mm wide and 117 mm long. At the cavity, 2-mm-thick silicon rubber was installed between the acrylic plate and the nylon surface to avoid water leakage. An orifice of 16.6 mm 2 (diameter = 4.6 mm) enabled water to flow from the nylon pipe to the labyrinth. An 8-mm-thick glass plate was installed at the upper surface of the acrylic plate and fixed using metal plates, screws, and nuts. The glass plate was fully transparent and made it possible to visualize the flow in the labyrinth channels. In real cases, when an emitter is installed in polyethylene pipes, the friction losses in the labyrinth might be different from those occurring with the thick glass plate. The prototype did not have any kind of grid or prefilter to retain particles before the labyrinth channel, because clogging experiments were not part of the purpose of this research.

Experiments for Hydraulic Evaluation of Emitters
Laboratory tests were carried out with clean water to determine the pressure-discharge equation of the prototypes where q = emitter discharge (L h −1 ); k = coefficient of pressuredischarge equation; x = exponent of flow; and h = operating pressure head (m).  3. Components of the accessory built for testing the emitter prototypes: 1 = screw, 2 = metal frame, 3 = nylon tube, 4 = silicone rubber, 5 = acrylic plate with engraved labyrinth, 6 = glass plate, and 7 = nuts.
The flow exponent (x) is affected by the emitter geometry, and ranges from 0 to 1, and it serves as an indicator of discharge sensitivity to variations in operating conditions, such as pressure and water temperature (Clark et al. 2005;Rodríguez-Sinobas et al. 1999). Based on the flow exponent, emitters can be classified as fully turbulent flow for x ¼ 0.5, partially turbulent for 0.5 < x<0.7, unstable for 0.7 < x<1.0, and laminar flow for x ¼ 1.0 (Keller and Karmeli 1974). When the emitters are regulated (i.e., when they have mechanisms to compensate for the pressure), the exponent tends to zero.
The experiments were undertaken using a test bench consisting of a hydraulically closed circuit (Fig. 4). A 120-μm disk filter was installed at the pump outlet to retain undesirable contaminants. A digital manometer (measurement range 0-500 kPa, resolution 0.1 kPa, expanded uncertainty 0.5% full scale) was used to monitor testing pressure. Four prototypes were evaluated simultaneously, spaced 0.20 m apart. The flow rate of each prototype was determined by the mass of water collected from each emitter in 30 min. One unit of each prototype model was evaluated under seven pressures, ranging from 50 to 350 kPa in increments of 50 kPa. During the experiments water temperature was 25°C AE 1°C.

Modeling Emitters Discharge Based on Nonlinear Regression
Nonlinear regression was evaluated as one of the approaches for modeling emitter discharge. Nonlinear regression models based on the power law have been used successfully to model hydraulic phenomena (Perboni et al. 2015;Vekariya et al. 2010;Vilaça et al. 2017;Zitterell et al. 2013). For a steady water temperature, it was assumed that the labyrinth discharge was influenced mostly by the labyrinth geometry and the operating pressure. To obtain an equation for rapid prediction of discharge, several mathematical models were evaluated by a trial-and-error approach. The model presented in Eq. (6) fitted the experimental data, and high values of accuracy indicators were obtained. The empirical coefficients were adjusted using the least-squares method and the Solver tool of Microsoft Excel. The variables were empirically chosen based on the physical interpretation of the phenomenon, because the flow exponent from Eq. (5) is influenced mostly by the tooth angle (α), because α has a significantly impact on the total head loss coefficient in each baffle (φ) and, consequently, on the labyrinth flow characteristics (Table 3) where q = emitter discharge (L h −1 ); H = tooth height (mm); W = channel width (mm); L = labyrinth length (mm); α = tooth angle (rad); D = channel depth (mm); h = pressure head at labyrinth inlet (m); and β i = empirical coefficients.

Computational Modeling of Emitter Discharge Based on Neural Networks Using Multilayer Perceptron
In this study, MLP feed-forward networks were used with backpropagation (Haykin 2009;Rumelhart and Hintont 1986) because of their adaptability to many engineering problems. The ANN input layer had the following variables: tooth height (H), channel width (W), labyrinth length (L), tooth angle (α), channel depth (D), and pressure head at the labyrinth inlet (h). The output layer had only the emitter discharge (q). The water density and the coefficient of dynamic viscosity were the same in all experiments; hence, they were not included in the ANN model.
All ANN neurons used were configured based on the model by Haykin (1999). The hidden and output neurons can be mathematically characterized as follows: where υ j = neuron's activation value; ω ji = synaptic weight; X S i = normalized input parameter; B j = bias at hidden layer; y j = output layer neuron; and φ = activation function. The hyperbolic tangent (tanh) function was used as an activation (transfer), which commonly is applied in engineering problems (Mattar and Alamoud 2015;Zanetti et al. 2007). The tanh can be mathematically expressed as The connections or synapses [ Fig. 7(b)] have weights (i.e., synaptic weights) to store information. Changing these weights under a learning algorithm is known as the learning or training process. Additionally, the Adam optimization algorithm (Kingma and Ba 2015) was implemented to optimize the loss function. According to Mattar and Alamoud (2015), training a network with backpropagation involves three stages: (1) the feed-forward of the input training pattern, (2) the calculation and back-propagation of the associated error, and (3) the adjustment of the weights.
The ANN model was trained over multiple iterations, and the number of neurons in the hidden layer was selected based on a trial-and-error approach, which is typical in such problems. Before exporting the data to the ANN for training, the network input was automatically normalized to a range of values between 0 and 1. This normalization accelerates the training process and improves the network's generalization capabilities, and learning algorithms benefit when they feed on standardized data (Shanker et al. 1996). The following equation was used: where X S i = normalized input parameter; X i = raw input parameter; X min = minimum feature value; and X max = maximum feature value. MLP architectures are prone to overfitting (Prechelt 1998)-that is, although the model fits well to the training set, at some point during training, the error increases in the testing set, and overfitting starts to occur. During the training process, k-fold cross-validation was performed using early stopping as the criterion to decide when to stop training. K-fold cross-validation consisted of splitting Fig. 4. Representation of the test bench used to determine the pressuredischarge equation of the prototypes. 1 = reservoir, 2 = pump, 3 = disk filter, 4 = needle valves for adjusting testing pressure, 5 = digital manometer, 6 = prototypes, and 7 = catch cans. the available training data into five partitions, instantiating five identical models, and training each one on four partitions, while evaluating on the remaining partition (i.e., the validation subset) (Chollet 2017). Early stopping is a method for avoiding overfitting, because it is a regularization technique based on choosing a stopping time for an iterative algorithm (Raskutti et al. 2014).
The ANN algorithms were coded in Python using the libraries Keras (2020) and Tensorflow (2020).

Fitting and Assessment of Models
The data set used to fit and evaluate the models was obtained from experiments to determine the pressure-discharge curves of the prototypes. Twenty-four prototypes were evaluated under seven operating pressures, resulting in a data set with 168 records. The experimentally obtained data set was randomly divided into two subsets: (1) the training data set, accounting for 80% of the experimental data (134 records), which was used to fit the models; and (2) the testing data set, consisting of the remaining 20% of the data (34 records), which was used to validate the accuracy and performance of the models. Because a relatively small data set was available, the testing data set of 20% was defined to favor proper training of the models. The models' performances were assessed using two statistical indicators: the mean squared error (MSE) and the RMS error (RMSE) where O i = observed or measured value; P i = predicted value; and n = number of records evaluated. The MSE was used during the training stage by the earlystopping algorithm. The RMSE is a common index to measure the accuracy of models (Duran-Ros et al. 2010;Provenzano et al. 2016) that quantifies differences between estimated and observed values and also makes it possible to compare the performances of models. Graphical error analysis also was performed to evaluate the accuracy of the predictions, and it was a useful tool to quantify prediction errors associated with the frequency of occurrence (Sobenko et al. 2018;Vilaça et al. 2017).

Results and Discussion
Geometric Characteristics of Prototypes Table 1 presents geometric characteristics of the Type 1 prototypes. The number of baffles and the labyrinth length were calculated using Eq. (4). For a given tooth angle (α), as the flow section was enlarged, longer labyrinths were required to obtain the target/ project discharge. The increase in the number of baffles and, consequently, the channel length had the effect of increasing head loss along the labyrinth, reducing the flow velocity and adjusting the discharge to the target value. Therefore, one obvious way to control the emitter discharge is by changing the number of baffles (Wei et al. 2007).
Regarding the tooth angle, the prototypes with α ¼ 45°provided the longest labyrinths. With a 15°increase in the tooth angle, the labyrinth length was reduced by 57%, and with a 30°increase in the tooth angle, the reduction was approximately 81%. In addition, the coefficient of total head loss per baffle (φ) was little influenced by changes in the flow section, but φ had strong sensitivity to variations in the tooth angle. Increasing α by 15°obtained an average increase of 85% in φ, and when the angle was increased by 30°, the increase in φ was approximately 238%. Li et al. (2006) mentioned that the tooth angle is one of the constructive parameters that most affects the coefficient of head loss φ in trapezoidal labyrinths. The tooth angle influences the changes in the flow direction, which cause abrupt changes in the flow conditions and cause variations in the minor loss component. Therefore, tooth angles closer to 90°provide greater head loss in each baffle and make it possible to design shorter labyrinths (Li et al. 2006;Zhang et al. 2013). Table 2 presents the geometric characteristics of the Type 2 prototypes. The values of φ, N, and L were obtained by the same procedure described for the Type 1 prototypes. As with the Type 1 prototypes, as the flow section was enlarged, longer labyrinths were required to obtain the target/project discharge. However, increases in the ratio H=W resulted in a significant increase in the coefficient of head loss φ and reduction in the labyrinth length (L) for a given flow section (A). The shortest labyrinths were obtained at the highest H=W ratio, indicating that these prototypes had the highest values of φ and better hydraulic performance compared with the others.
The labyrinth length decreased as the H=W ratio increased (Fig. 5). The first increase in H=W ratio, from 1.0 to 1.2, provided the most significant reductions in L, ranging from 17.4% to 25.8% Note: W = channel width, D = channel depth, H = tooth height, α = tooth angle, A = flow section area, φ = head loss coefficient, N = number of baffles, and L = labyrinth length. decreases from the initial length. Decreases in L gradually became smaller in the next two changes in H=W ratio, and values of H=W higher than 1.6 produced insignificant decreases in the labyrinth length. The increase in the H=W ratio of the Type 2 prototypes intensified vortices capable of causing greater head loss per baffle, resulting in shorter emitters of better hydraulic performance. Ratio H=W between 1.2 and 1.4 had the most significant effects on the labyrinth length, and higher values did not contribute to producing compact and short labyrinths. For similar channel widths, the Type 2 prototypes had shorter labyrinths than the Type 1 prototypes (Tables 1 and 2). Prototypes with geometric characteristics that promoted the development of more-intense vortices tended to be more efficient in terms of hydraulic performance. Feng et al. (2018) evaluated the optimization of trapezoidal labyrinths and observed that eliminating regions that allowed the formation of vortices increased the emitter discharge by 2-5 times. They also reported that the reduction of vortices in the emitter design would require an increase in the labyrinth length, resulting in higher manufacturing costs. Therefore, vortices are important mechanisms for energy dissipation and discharge control, and are necessary in the design of emitter labyrinths. Table 3 shows the flow exponents (x) and the coefficients k of the pressure-discharge equations fitted from the experimental data set and the discharge measured under an operating pressure head of 10 m.

Experimental Pressure-Discharge Curves
For the Type 1 prototypes, as the tooth angle increased, the exponent of flow decreased according to the function x ¼ 0.57α −0.35 , where α is the tooth angle (rad). Although this function has little relevance, the coefficients served as initial values for fitting some of the coefficients of Eq. (6). For the Type 2 prototypes, the tooth angle was maintained at 75°, and the values of x did not change significantly because of other geometrical changes in the prototypes. This supports the assumption that α is a parameter of high influence in the flow exponent. For the Type 2 prototypes, emitters with desirable hydraulic performance were observed because the values of x were less than 0.5 for all prototypes of this group. For the Type 2 prototypes, the increase in the H/W ratio increased the coefficient of total head loss per baffle (ϕ), but it caused a minor decrease in the values of x.
For all Type 1 prototypes, exponents of flow ranged from 0.5 to 0.7, making it possible to classify them as partially turbulent flow (Keller and Karmeli 1974). For a tooth angle of 75°, the lowest values of x were obtained (from 0.518 to 0.524), and, thus, the best hydraulic performance was achieved for this group of prototypes. In terms of hydraulics, emitters with low exponents of flow (<0.5) are preferable because the discharge is less-affected by fluctuations in the operating pressure and water temperature (Rodríguez-Sinobas et al. 1999).
For the Type 2 prototypes, the flow exponents ranged from 0.453 to 0.491. The three prototypes with H=W ¼ 1.0 had the highest values of flow exponent, with values of 0.480, 0.482, and 0.491 for channel widths of 0.7, 1.0, and 1.3 mm, respectively. The lowest exponents were observed for the emitters with a channel width of 1.3 mm, with values of 0.462, 0.453, and 0.458 for the H=W ratios of 1.2, 1.4, and 1.6, respectively. These results indicate that the geometric characteristics of this group of prototypes provided turbulent flow and had superior hydraulic performance to those of Type 1. The increase in the H=W ratio provided moredeveloped vortices, contributing to the increase of turbulence and head loss, resulting in reduction of x.
Based on the discharge measured at a 10-m pressure head (Table 3), the values obtained experimentally were close to the target value of 1.4 L h −1 . For the Type 1 prototypes, the discharge ranged from 1.29 to 1.52 L h −1 , whereas for the Type 2 prototypes it ranged from 1.44 to 1.52 L h −1 . The observed differences between the target and the measured discharges can be attributed to imperfections in the process of engraving the flow paths on the acrylic plate and in the simulation procedures to obtain the labyrinth lengths.

Empirical Model Based on Nonlinear Regression for Estimating Discharge of Prototypes
When several potential predictors are available, the selection of variables required to build a model represents a frequent problem in regression analysis related to hydraulics (Vilaça et al. 2017   description of the process and may result in poor predictions, whereas omitting important effects may reduce predictive power (Chatterjee and Simonoff 2013). An approach to select a subset of variables to build a model consists of defining a criterion that measures how well a model performs, evaluating the criterion for each subset of potential variables, and picking the subset that optimizes the criterion (Seber and Lee 2003). Generally, the model with the smallest RMSE should be chosen (Bates and Watts 1988). The model in Eq. (13) was the simplest model found with satisfactory performance. Eq. (13) includes the labyrinth geometric characteristics and the operating pressure head. Water physical properties were assumed to be constant during the experiments; hence, they were not included in the regression or in the ANN models where q = emitter discharge (L h −1 ); H = tooth height (mm); W = channel width (mm); L = labyrinth length (mm); α = tooth angle (rad); D = channel depth (mm); and h = pressure head at labyrinth inlet (m). Eq. (13) is valid for trapezoidal labyrinths with rectangular flow sections and was fitted based on experimental data within the following ranges: 45 ≤ α ≤ 75°, 5 ≤ h≤35 m, 0.5 mm ≤ W ≤ 1.3 mm, 0.7 mm ≤ H ≤ 2.08 mm, 15.18 mm ≤ L ≤ 888.42 mm, and 0.5 mm ≤ D ≤ 0.8 mm. Fig. 6(a) shows the linearity between the observed and estimated values of discharge for the training and test data sets. Analyzing the training and test data sets revealed that the RMSE values were 0.0530 and 0.0606, respectively. The maximum relative errors (δ) of the predicted discharges were 9.0% and 9.4% for the training and test data sets, respectively [ Fig. 6(b)]. In addition, 95% of the predictions had δ lower than 6.0% and 6.3% for the training and test data sets, respectively. These results prove the adequate fitting of the mathematical model proposed in Eq. (13) and show that, although the model is quite simple, it can be useful to relate geometric and operational characteristics of emitters such as those described. The model presented proper goodness of fitting for the training and test data sets, which indicates no problem of overfitting. A similar approach could be extended to other designs of labyrinths.

Computational Method for Predicting Discharge Based on Neural Networks
After preliminary tests, 11 single-hidden-layer ANN architectures were evaluated using the RMSE as the indicator of model performance [ Fig. 7(a)]. The highest-performance ANN architecture had an input layer with six neurons, six neurons in the hidden layer, and an output layer with a single neuron [ Fig. 7(b)].
During the training process of the ANN models, k-fold cross-validation was performed using early stopping as the criterion to decide when to stop training in order to avoid overfitting. Errors quantified by MSE varied during the iterations (i.e., epochs), reaching MSE values of 0.0210 (training data set) and 0.0192 (validation subset-k-fold cross-validation) in Epoch 836, when the iterations were stopped by the early-stopping algorithm [ Fig. 8(a)]. As the number of epochs increased, the values of weights were optimized in the neural network and the curves went from underfitting to optimal condition. The MSE values of the training data set and validation subset decreased until Epoch 836 [ Fig. 8(b)]. From this point, MSE values of the validation subset started to increase, indicating risk of overfitting. Figs. 8(a and b) indicate that the iterations were stopped before overfitting occurred. Fig. 9(a) plots only test data, and it makes possible a comparison between the discharge predictions from the regression model in Eq. (13) and the ANN model, indicating linearity between observed and predicted values for both models. Fig. 9(b) also presents only test data for comparison of both models. Analyzing the ANN model indicated that the maximum relative error (δ) of the predicted discharges was 9.5%, and 95% of the predictions had relative errors less than 7.3%.
Based on RMSE and δ values, both models had high accuracy in predictions of discharge, but the nonlinear regression was slightly better than the ANN model. Definition of the nonlinear regression model was an empirical and time-consuming procedure that required many trials to obtain the functional relation in Eq. (6). Because this study was limited to the evaluation of non-pressurecompensating, trapezoidal labyrinths with a rectangular flow section, there is no guarantee that the mathematical function in Eq. (6) would fit well to data obtained from evaluating other designs of labyrinths. Although the approach described might be useful for modeling other geometries of labyrinth channels, obtaining mathematical functions different from Eq. (6) might require time, assumptions, and trials. On the other hand, the procedure to obtain single-hidden-layer ANN models for other designs of labyrinths would demand less time than obtaining mathematical functions different from Eq. (6). As a starting point, the number of neurons at the input layer matches the input variables available in the data set, and the output layer will have a single neuron (i.e., a single output). Computational simulations would be necessary only to optimize the number of neurons in the hidden layer [ Fig. 7(a)]. The early stopping algorithm automatically prevents model overfitting. The methodology adopted to obtain the computational ANN model can be useful in similar future works.

Web Application to Simulate Discharge of Labyrinths
A web application was developed as a tool to simulate the discharge of labyrinths as a function of their dimensions and operating pressure. The user fills out the forms with input values and obtains the estimated values of discharge from the model based on nonlinear regression in Eq. (13) and from the ANN model [ Fig. 7(b)].
In addition, the pressure-discharge curve and the corresponding equation is presented for the user. The website front end was programmed using HTML, CSS, and JavaScript, whereas the ANN routines ran in Python (back end). The web application is available online (Lavanholi et al. 2020).

Conclusions
Mathematical models based on nonlinear regression and neural networks using MLP were developed to relate geometric and operational characteristics of labyrinths. The nonlinear regression model has only seven coefficients and the ANN model has an input layer with six neurons, a hidden layer with six neurons, and an output layer with a single neuron (i.e., ANN architecture 6-6-1). Both models were accurate and made possible the rapid prediction of the emitter's discharge. Analyzing the test data set indicated that the maximum relative errors of predicted discharges were 9.5% and 9.4% for the ANN and nonlinear models, respectively. An open-source web application was developed to simulate the pressure-discharge curve of labyrinths within a range of geometric and operational characteristics. The nonlinear regression model and the methodology adopted to obtain the computational ANN model can be useful in similar future works.
Changes in the channel width resulted in significant increases in labyrinth length for both groups of prototypes. The increase in the ratio H=W decreased the labyrinth length. Ratios of H=W between 1.2 and 1.4 had the most-significant impacts on the labyrinth length, and values higher than that did not help to produce compact and short labyrinths. For the Type 2 prototypes, the increase in the H=W ratio increased the coefficient of total head loss per baffle, but caused a minor decrease in the values of the exponent of flow (x). The flow exponent was strongly affected by the tooth angle, indicating that the higher values of α resulted in lower values of x and better hydraulic performance.

Data Availability Statement
Some or all data, models, or code generated or used during the study are available from the corresponding author by request (all raw experimental data, and source codes related to the ANN and to the web application).