1 Introduction

Flood forecasting is a necessary component of both flood management and warning. Properly executed it can serve to help mitigate flood damage and increase the utility of the flood. For example, before a flood is predicted to occur, reservoir operators can respond to this prediction by decreasing the water level of the reservoir and then maintain a high water level after the threat of a flood has past. The former scenario results in the reduction in potential flood damage by protecting lives and property; the latter scenario serves to benefit the populace by utilizing the reservoir for power generation, water supply, irrigation, navigation and conservationism.

Flood forecasting is currently classified into three primary categories: the physical approach, the statistical approach and the data-driven approach (Nguyen and Chua 2012). The physical approach includes hydrological conceptual models and hydraulic models. It has a clear physical concept, reliable accuracy and easy operation. However, it also requires accumulation of a massive quantity of data relating to the characterization of the river basin, which is scarce in most cases. The statistical approach, including the regression analysis, auto-regressive and moving average model (ARMA), is not frequently used for flood forecasting, because it does not adequately reveal the highly nonlinear dynamics that are inherent in the flooding processes, which limits its performance capabilities (Hsu et al. 1995). The artificial neural network (ANN) is one of the data-driven approaches, and like a black box, it can sufficiently approximate the complex nonlinear relationships of a flood through a self-learning process. However, the drawback to this approach is that the utilization of the invisible learning process leads to a decrease in the credibility of the results and its degree of acceptance, since the output is difficult to explain. The fuzzy inference system (FIS) can be used to solve the problem where the language of nature and the reasoning capabilities of the human mind can be translated into a mathematical expression in an intelligent system. However, the formation of fuzzy rules and the selection and adjustment of the membership function must be completed by artificiality. The adaptive neuro-fuzzy inference system (ANFIS) perfectly integrates the ANN and the fuzzy inference system, which overcomes the disadvantages of a lack of self-learning in the fuzzy theory and lack of human language expression in the ANN. Thus, this approach can improve work efficiency by providing an improved simulation of artificial intelligence.

ANFIS (Jang 1993) was proposed and first applied in a control system before it became widely employed in many areas. Many hydrology researchers have used ANFIS to forecast water levels (or discharges) in a reservoir (Chang and Chang 2006; Chen et al. 2006; Ahmed et al. 2007; Wang et al. 2008; Banik et al. 2008; Liu et al. 2008; Mukerji et al. 2009; Ghalkhani et al. 2013; Nguyen et al. 2014). However, ANFIS has specific limitations (Bersini and Bontempi 1997; Arafeh, et al. 1999; MathWorks 2014), specifically:

  1. 1.

    it applies solely to the Takagi–Sugeno fuzzy inference;

  2. 2.

    it requires identical weight for each rule;

  3. 3.

    it utilizes only default membership functions and defuzziness functions;

  4. 4.

    when the number of input variables and MFs increases, the number of control rules and run time rapidly increases.

Thus, researchers have long sought a method to integrate with ANFIS that can augment its weaknesses, while improving the accuracy of prediction. Seo et al. (2015) combined wavelet decomposition and ANFIS to forecast hourly flooding. The wavelet-based adaptive neuro-fuzzy inference system (WANFIS) was found to yield better results than the ANN or the ANFIS and wavelet-based artificial neural network (WANN). Similarly, WANFIS, a model that combined discreet wavelet transform (DWT) and ANFIS, was developed to forecast the immediate day flow of the Gandak River in India when the only available data were the historic flows (Sahay and Sehgal 2014). When employing the various performance indices, the WANFIS model was shown to simulate the monsoon flows with better reliability than the ANFIS and AR models. Using data obtained from the Kosi River, another wavelet-adaptive neuro-fuzzy inference system (WANFIS) was developed to forecast river water levels with a 1-day lead time (Sehgal et al. 2014). The WANFIS model was divided into two sub-models: the WANFIS-split data model (WANFIS-SD) and the WANFIS-modified time series model (WANFIS-MS). A comparative analysis indicated that the WANFIS-SD model outperformed the WANFIS-MS model in predicting high flood levels. An ANFIS and a real-time recurrent learning neural network (RTRLNN) model with an optimized reservoir release hydrograph employing a mixed integer linear programming (MILP) model was built using data from historic typhoon events to develop a multi-phase intelligent real-time reservoir operation model for the use in flood control (Hsu et al. 2015). A combination of a fuzzy logic, artificial neural network (ANN) and genetic algorithm (GA) was proposed by Chidthong et al. (2009) and was shown to perform well in predicting flood peaks. ANFIS was used by Nguyen and Chua (2012) to forecast the daily water levels of the Lower Mekong River at Pakse, which functioned by utilizing the autoregressive (AR) and recursive AR (RAR) models to enhance ANFIS model outputs.

In this reported study, the fuzzy control system comprised of a novel combination of ANFIS and the two-dimensional Mamdani fuzzy controller, ANFIS-FC, was used for hydrological forecasting. More specifically, it was used to predict the water level of Three Georges Reservoir during the flood season in China. The preliminary forecast of water level outputs was obtained using ANFIS and historic input–output data. A two-dimensional Mamdani fuzzy controller, which has both tracking and control capabilities, was used to observe and control the error rate between forecast and observed water quantities amounts below 0.05 %. The final forecasted results were acquired by reason of the error feedback. Thus, a real-time online closed-loop prediction model and accurate outputs were achieved by use of ANFIS and the two-dimensional Mamdani fuzzy controller, as shown in Fig. 1. The development of ANFIS and the two-dimensional Mamdani fuzzy controller are introduced in Sect. 2. A specific case study and how the input variables are selected for a model are discussed in Sect. 3. The results of the hybrid model are presented and discussed in Sect. 4. Finally, the conclusions of this study are presented at the end.

Fig. 1
figure 1

Flowchart of flood forecasting

2 Methods

2.1 ANFIS

An adaptive neuro-fuzzy inference system (ANFIS) is a multilayer feed-forward network that uses neural network learning algorithms and fuzzy reasoning to map an input space to an output space. It can extract information and determine regularity from numerical data or expert knowledge and then adaptively construct a rule base (Chen et al. 2006; Ahmed et al. 2007). The details of this system are as follows (Chang and Chang 2006):

For simplicity, we assume that the fuzzy inference system under consideration has two inputs, x and y, and one output, z. For a first-order Sugeno fuzzy model, a typical rule set with two fuzzy if–then rules can be expressed as:

$$Rule\;1: If\; x\; is\; A_{1} \quad and\; y\; is\; B_{1}\quad then\;\; Z_{1}=p_{1}\times x_{1}+q_{1}\times x_{2}+ r_{1}$$
(1)
$$Rule\; 2: If\;x\; is\; A_{2}\quad and\; y\; is\; B_{2}\quad then\;\; Z_{2}=p_{2}\times x_{2}+q_{2}\times x_{2}+r_{2}$$
(2)

where p i , q i and r i (i = 1 or 2) are linear parameters in the then-part (consequent part) of the first-order Sugeno fuzzy model. The architecture of ANFIS consists of five layers (Fig. 2), and a brief introduction of the model is as follows.

Fig. 2
figure 2

ANFIS architecture for the two-input Sugeno fuzzy model with four rules (Chang and Chang 2006)

Layer 1

Input nodes. Each node of this layer generates membership grades that belong to each of the appropriate fuzzy sets using appropriate membership functions:

$$\left\{ {\begin{array}{*{20}l} {O_{1,i} = \mu_{Ai} \left( x \right) } \hfill & { {\text{for}}\;\; i = 1,2} \hfill \\ { O_{1,i} = \mu_{Bi - 2} \left( y \right) } \hfill & {{\text{for}}\;\; i = 3,4} \hfill \\ \end{array} } \right.$$
(3)

where x and y are the crisp inputs to node i and Ai, and Bi are the linguistic labels characterized by appropriate membership functions, \(\mu_{Ai}\), \(\mu_{Bi}\), respectively. Due to smoothness and concise notation, the Gaussian has become increasingly popular for specifying fuzzy sets. So the Gaussian membership function was used in this reported study.

$$\mu_{Ai} = e^{{ - \frac{{\left( {x_{i} - c_{i} } \right)^{2} }}{{2\sigma_{i}^{2} }}}} \quad \mu_{Bi} = e^{{ - \frac{{\left( {y_{i} - c_{i} } \right)^{2} }}{{2\sigma_{i}^{2} }}}}$$
(4)

here \(\left\{ {c_{i} ,\sigma_{i} } \right\}\) is the parameter set of the membership functions in the premise part of the fuzzy if–then rules that change the shapes of the membership function. Also c i is the mean and dictates the center of the function, when \(\sigma_{i}\) is the variance and dictates the width of function curve.

Layer 2

Rule nodes. In the second layer, the AND operator is applied to obtain one output that represents the result of the antecedent for that rule, i.e., firing strength. Firing strength means the degree to which the antecedent portion of a fuzzy rule is satisfied when it shapes the output function for the rule. Hence, the outputs O 2 , k of this layer are the products of the corresponding degree from Layer 1:

$$O_{2,k} = w_{k} = \mu_{Ai} \left( x \right) \times \mu_{Bj} (y)\quad k = 1, \ldots ,4; \,\, i = 1,2;\,\, j = 1,2$$
(5)

Layer 3

Average nodes. In the third layer, the main objective is to calculate the ratio of each ith rule’s firing strength to the sum of the rule’s firing strength. Consequently, w i is taken as the normalized firing strength:

$$O_{3,i} = \overline{{w_{i} }} = \frac{{w_{i} }}{{\mathop \sum \nolimits_{k = 1}^{4} w_{k} }}\quad k = 1, \ldots ,4$$
(6)

Layer 4

Consequent nodes. The node function of the fourth layer determines the contribution of each ith rule toward the total output and the function defined as:

$$O_{4} ,_{i} = \overline{{w_{i} }} = \overline{{w_{i} }} \left( {p_{i} x + q_{i} y + r_{i} } \right),\quad i = 1, \ldots ,4$$
(7)

where \(\overline{{w_{i} }}\) is the ith node’s output from the previous layer. With respect to {p i ,q i ,r i }, these parameters are the coefficients of this linear combination and are also the parameter set in the consequent part of the Sugeno fuzzy model.

Layer 5

Output nodes. The single node computes the overall output by summing all of the incoming signals. Accordingly, the defuzzification process transforms each rule’s fuzzy results into a crisp output in this layer as defined by:

$$O_{5,1} = \mathop \sum \limits_{i = 1}^{4} \overline{{w_{i} }} f_{i} = \frac{{\mathop \sum \nolimits_{i = 1}^{4} w_{i} f_{i} }}{{\mathop \sum \nolimits_{i = 1}^{4} w_{i} }}$$
(8)

ANFIS uses a hybrid learning algorithm to identify both the premise and consequence parameters of the T–S fuzzy inference system. The system utilizes a combination of the least-squares method and the back propagation gradient descent method to train the FIS membership function parameters to emulate a given training data set. During his process, the model output conforms to the system output using a minimum root-mean-square error. It should be noted that the number and shape of the membership functions for each variable are predefined (Ahmed et al. 2007). The details of the algorithm and the process can be found in the report of Jang (1993).

2.2 The two-dimensional Mamdani fuzzy controller

A fuzzy controller consisting of fuzzy rules was first introduced in the paper “Application of Fuzzy Algorithms for Control of Simple Dynamic Plant” by Mamdani (1974) and was successfully applied in the control of a boiler-steam engine system. This report symbolizes the birth of fuzzy control theory and technology, where the fuzzy controller became widely utilized in many fields. The traditional control system is comprised of three parts: the controller, the controlled object and the feedback sensor channel. The system control employs control of the input signal to obtain an output signal that is close to that required to effect a minimum difference between the two values. In other words, it attempts produce an output that is as close to the standard signal as possible by adjusting the input signal. Three essential issues of automatic control include establishing the system model, analysis of the model and controller design. First, the mathematical model of the controlled object is established through the use of the mechanism analysis and the experimental method. The controller is then designated based on the control objective and the constraint conditions (Shi and Hao 2008). The confirmed structure and the parameters of the traditional controller, such as the PID, are dependent on the mathematical model of the controller object. The fuzzy controller does not need to know the mathematical model or the working principle that forms the basis for the controlled object. The fuzzy rules are generated by fuzzy condition statements based on analyzing, understanding and summarizing the known conditions. The structure of the fuzzy controller is determined by these rules to select the major variables, their fuzzy subsets and the membership functions. Finally, the fuzzy controller is designed from these parameters.

The independent variable in the input of the fuzzy controller (FC) is often viewed as a vector, and the number of its component is the number of dimensions of the fuzzy controller. Generally speaking, the fuzzy controller is divided into three categories according to the dimensions. The input variable of a one-dimensional FC is the deviation e. This results in a poor dynamic system performance, because it is difficult to reflect the dynamic characteristics of the process. The two-dimensional FC has two input variables, the deviation e and the change rate of deviation ec = de/dt. This performs better than a one-dimensional FC due to its ability to control output variables with dynamic characteristics. The three-dimensional FC is rarely chosen, because of an increasing number of control rules and the computing time of the reasoning algorithms that results from adding the input variable of the change rate of the deviation change rate ecc = d2 e/dt 2. Thus, the two-dimensional FC is currently the most widely employed FC (Pang and Cui 2013).

The two-dimensional Mamdani fuzzy controller is described in Fig. 3. The two components of sampling are regarded as the input variables of the fuzzy controller, primarily the deviation e and its change rate ec = de/dt. The inputs are fuzzified through the use of a fuzzification module D/F, which changes the accurate values of e and ec into the fuzzy quantities E and EC through the quantification factors, k e , k ec . Then, the controlled quantity U, a fuzzy quantity, is calculated according to the input quantities E, EC and the fuzzy control rule using the fuzzy inference module R, and becomes the clear controlled quantity u in the defuzzification module F/D by means of the scale factor k u . In knowledge based, μ is the membership function base, transforming digital values into fuzzy quantities. R is the control rule base, which has the approximate reasoning F conditional statements and the algorithm of approximate reasoning, when the defuzzification model base is fd, reserving the algorithm to process the clearness of the fuzzy quantity.

Fig. 3
figure 3

Schematic of the two-dimensional Mamdani fuzzy controller

3 Case study

3.1 The Three Gorges Reservoir

The Yangtze River basin is an abundant water resource. The length of the upstream portion is 4512 km, which accounts for 70.9 % of the span length of the Yangtze River and has an annual average runoff volume of 4.478 × 1011 m3 as defined from the source of its main stream to the Nanjing Guan station of the export of the Three Gorges Reservoir (TGR) in Yichang City, Hubei Province. The ample rainfall along with the significant monsoon climate characteristics results in an average annual rainfall in the Yangtze River basin of 1067 mm. A flood in this basin primarily results from a rainstorm in which the runoff is comprised of rainfall recharge. The runoff is concentrated in the flood season, and the biggest runoff occurs in July and August with an average yearly runoff depth of 526 mm.

The Three Gorges Reservoir (TGR) is used for flood control, power generation and navigation and is a vital component of water resource development of China’s largest river, the Yangtze River (Fig. 4). The TGR is located in Sandouping Town, Yichang City, and its control catchment area is 1 million km2, which accounts for 56 % of the basin area of the Yangtze River and 49 % of the annual runoff volume of 4.51 × 1011 m3 at the Yichang hydrological station, located 43 km downstream of Sandouping Town, which is used as the control station of the flow of Yangtze River passing through the TGR. The TGR is a typical river channel-type reservoir with a length of ~570–650 km, an average width of ~1.1 km, a mean annual discharge of 1.43 × 104 m3/s and a storage coefficient of approximately 3.7 %. The TGR is the seasonal regulation, or incomplete yearly regulation reservoir and the runoff from June to October accounts for 72.3 % of the total y annual runoff. The normal water level of the TGR is 175 m, and the corresponding total reservoir storage capacity is 3.93 × 1010m3. The limited water level is 145 m, and the corresponding flood control storage is 2.215 × 1010 m3. The structures of the project are designed based on the 1000-year flood condition and checked by 10,000-year flood plus 10 %.

Fig. 4
figure 4

Approximate area map of the TGR (Liu et al. 2015)

3.2 The data employed

An ANFIS with the two-dimensional Mamdani fuzzy controller, ANFIS-FC, was used in this study to conduct the forecasting of a 1-day water level based on the input–output pattern in the TGR. With the time internal of 1 day, 1840 sets of flood season data (from June to September) from 2006 to 2010 were used. The data were divided into three independent subsets: the training, validating and testing subsets. The training subset included the data from 2006 to 2007, the validating subset included the data from 2008 to 2009, and the testing subset included the data from 2010. The training subset was used to generate the initial FIS and to continuously correct the FIS structure parameters to identify the optimum parameters. The validating subset was used to avoid over-fitting of the model, and the testing subset was used to examine the generalization capability of the resulting fuzzy inference system.

3.3 Model development

3.3.1 Input selection

A multiple-input and single-output model (MISO) was used when the input variables were derived primarily from the main upstream water levels (Cuntan water level gauging station), the tributary water levels (Wulong water level gauging station) and the rainfall of the intervening basin (from Cuntan and Wulong water level gauging station to Yichang water level gauging station). The output of our modeling was the water level of Three Gorges Reservoir, and the water level of the Yichang water level gauging station was regarded as the water level of the TGR. The forecast period of our model was 1 day ahead in the flood season of TGR (June 10–September 9). The TGR dam was completely regulated by human activities, but we only considered the stream segment, which was between the upstream basin of the TGR and in front of the TGR and it was the natural regime. So the type of the TGR, a seasonal regulated dam, was not influence the forecasting of our model in this study.

The optimum input for the ANFIS was selected using statistical approaches including the cross-correlation function (CCF), the autocorrelation (ACF) and the partial autocorrelation function (PACF) (Kant et al. 2013; Nguyen et al. 2014; Hsu et al. 2015; Nguyen and Chua 2012). All of the results of this study were obtained using MATLAB R2012b.

The autocorrelation and partial autocorrelation functions of the water levels at Yichang water level gauging station for different lags are shown in Figs. 5 and 6. These results suggest that the time series of water levels at Yichang water level gauging station approached 0 after two time lags. A general input–output function of the ANFIS models can be depicted as follows:

$$Z_{y} \left( {t + 1} \right) = f\left\{ {Z_{y} \left( t \right), \, Z_{y} \left( {t - 1} \right)} \right\}$$
(9)

where \(Z_{y} \left( {t + 1} \right), \, Z_{y} \left( t \right), \, Z_{y} \left( {t - 1} \right)\) represent the water levels at the Yichang water level gauging station at one time step ahead, the current time and one previous time step.

Fig. 5
figure 5

ACF of the water level at Yichang water level gauging station for different time lags

Fig. 6
figure 6

PACF of the water level at Yichang water level gauging station for different time lags

The cross-correlation function of the water levels between Yichang and Cuntan water level gauging stations implies the existence of a significant correlation from 3- to 5-day lags and is shown in Fig. 7. The CCF for the water levels between Yichang and Wulong water level gauging stations provides good correlation from 6- to 8-day lags, which is shown in Fig. 8. The model can then be denoted as:

$$Z_{y} \left( {t + 1} \right) = f\left\{ {Z_{c} \left( {t - 2} \right), \, Z_{c} \left( {t - 3} \right), \, Z_{c} \left( {t - 4} \right), \, Z_{w} \left( {t - 5} \right), \, Z_{w} \left( {t - 6} \right), \, Z_{w} \left( {t - 7} \right)} \right\}$$
(10)

where \(Z_{c} \left( {t - 2} \right), \, Z_{c} \left( {t - 3} \right), \, Z_{c} \left( {t - 4} \right)\) represent the water levels at the Cuntan water level gauging station at two, three and four previous time steps and \(Z_{w} \left( {t - 5} \right), \, Z_{w} \left( {t - 6} \right), \, Z_{w} \left( {t - 7} \right)\) represent the water levels at the Wulong water level gauging station at five, six and seven previous time steps.

Fig. 7
figure 7

CCF between the water level at the Yichang and Cuntan water level gauging stations

Fig. 8
figure 8

CCF between the water level at the Yichang and Wulong water level gauging stations

To investigate the relationship between the interval rainfall and the water levels at Yichang water level gauging station, the rainfall histogram shown in Fig. 9b was used. This was done, because the CCF between the interval rainfall and water levels at Yichang water level gauging station had a weak correlation and rainfall was an important input variable in flood forecasting during the flood season in the TGR. The water levels of the Yichang water level gauging station were found to be similar to the pattern and peak of rainfall histogram out to 18 days in Fig. 9a, b. To determine the influence of rainfall on the forecasting model, ANFIS was divided into two sub-models: ANFIS1 with rainfall and ANFIS2 without rainfall. The decision as to whether the rainfall was selected as an input variable depended on the results of the two sub-models. The relationship of the interval rainfall and the water levels at Yichang water level gauging station can be expressed as follows:

$$Z_{y} \left( {t + 1} \right) = f\left\{ {R\left( {t - 18} \right)} \right\}$$
(11)

where R(t − 18) is the interval rainfall at the 18th previous time step.

Fig. 9
figure 9

Observed water level at the Yichang water level gauging station versus t − 18 interval of rainfall

Finally, the input–output form of the ANFIS models used in the present study is represented as:

$$Z_{y} \left( {t + 1} \right) = f\left\{ {Z_{y} \left( t \right), \, Z_{y} \left( {t - 1} \right), \, Z_{c} \left( {t - 2} \right), \, Z_{c} \left( {t - 3} \right), \, Z_{c} \left( {t - 4} \right), \, Z_{w} \left( {t - 5} \right), \, Z_{w} \left( {t - 6} \right), \, Z_{w} \left( {t - 7} \right), \, R\left( {t - 18} \right)} \right\}$$
(12)

or

$$Z_{y} \left( {t + 1} \right) = f\left\{ {Z_{y} \left( t \right), \, Z_{y} \left( {t - 1} \right), \, Z_{c} \left( {t - 2} \right), \, Z_{c} \left( {t - 3} \right), \, Z_{c} \left( {t - 4} \right), \, Z_{w} \left( {t - 5} \right), \, Z_{w} \left( {t - 6} \right), \, Z_{w} \left( {t - 7} \right) \, } \right\}$$
(13)

3.3.2 Model evaluation

In this study, three statistical measurements were used to assess the model’s performance, which included the root-mean-square error (RMSE), the mean absolute error (MAE) and the reliability of fit with respect to the benchmark (G bench). These are defined as follows:

$${\text{RMSE}} = \, \left[ {\mathop \sum \limits_{i = 1}^{n} \frac{{\left( {\widehat{{Z_{i} }} - Z_{i} } \right)^{2} }}{n}} \right]^{2}$$
(14)
$${\text{MAE}} = \mathop \sum \limits_{i = 1}^{n} \frac{{\left| {\widehat{{Z_{i} }} - Z_{i} } \right|}}{n}$$
(15)
$$G_{\text{bench}} = \, 1 - \frac{{\mathop \sum \nolimits_{i = 1}^{n} \left( {\widehat{{Z_{i} }} - Z_{i} } \right)^{2} }}{{\mathop \sum \nolimits_{i = 1}^{n} \left( {\widehat{{Z_{i} }} - Z_{{i,{\text{bench}}}} } \right)^{2} }}$$
(16)

where \(\widehat{{Z_{i} }}\) and \(Z_{i}\) represent the forecast and observed water levels and \(Z_{{i,{\text{bench}}}}\) is the previously observed value, for example, for the nth step ahead prediction \(Z_{{i,{\text{bench}}}} = Z_{i - n}\).

4 Results and discussion

4.1 ANFIS results without updating

The criteria for RMSE, MAE and G bench used for the forecasting of the water levels using ANFIS for all three different data sets are shown in Table 1. ANFIS is divided into two sub-models: ANFIS1 with the rainfall and ANFIS2 without the rainfall. The final model was selected by changing the number of membership functions and rules with a fixed Gaussian-type membership function. The results indicated that the G bench was negative when the number of MFS and the rules was equal to 7 and 7 in the check set for ANFIS1 and the number of MFS and rules was equal to 5, 7 and 5, 7 in the check set for ANFIS2. This indicated a poor forecast performance when compared to the benchmark. Therefore, these three groups were dismissed. Finally, the ANFIS1, where the number of MFs and rules was equal to 5, was selected, because the results were better for RAME, MAE and G bench when compared to the other two groups.

Table 1 The criteria used in the ANFIS model

4.2 ANFIS results with updating

A two-dimensional Mamdani fuzzy controller was developed for the updating process for ANFIS. The relationship of the observed and the forecast water levels in the testing phase using only the ANFIS is shown in Figs. 10 and 11, which shows this relationship after a fuzzy controller was added to the process. These two figures distinctly demonstrate that the performance of the models was accurate, where all of the data points roughly fall in a line of agreement and that use of ANFIS in combination with an updating process in the testing phase is superior to using ANFIS without an updating process. A perfect error control is displayed in Fig. 12, and the error rate was controlled precisely below 0.05 % through the use of the two-dimensional Mamdani fuzzy controller. Comparison with observed water levels shows the ANFIS forecast and ANFIS-FC forecast in the testing phase in Fig. 13. These results indicate that the forecast provided by the ANFIS-FC is closer to the observations than the forecast using ANFIS. So, the forecast accuracy of ANFIS-FC is better than that of the ANFIS.

Fig. 10
figure 10

Comparison between observed and ANFIS forecast water levels over test period

Fig. 11
figure 11

Comparison of observed and ANFIS-FC model forecast water levels over test period

Fig. 12
figure 12

Comparison of error between ANFIS (error before fuzzy controller) and ANFIS—FC model (error after fuzzy controller) over test period

Fig. 13
figure 13

Observed and forecasted water levels using ANFIS and ANFIS-FC models during test period

5 Conclusions

In this study, the fuzzy control system was applied for the first time to flood forecasting. A novel ANFIS model using the two-dimensional Mamdani fuzzy controller was developed to forecast the water levels of the TGR during flood season. The following conclusions can be drawn from this study:

  1. 1.

    As a result of the capabilities of learning, constructing, expensing and classifying, the ANFIS was used to forecast a 1 day in advance water level in the TGR. The eight basic input variables representing the main upstream water levels and the tributary water levels were selected using CCF, ACF and PACF. ANFIS was divided into two sub-models to account for the influence of rainfall. These were termed ANFIS1 with the rainfall and ANFIS2 without rainfall. The final selected ANFIS model was ANFIS1, because of the acceptable results of RAME, MAE, G bench and the suitable number of MFs and rules.

  2. 2.

    However, there are a few significant errors in the ANFIS forecast, which are represented in Fig. 12. These errors resulted from ANFIS’s own limitations, including the Takagi–Sugeno fuzzy inference, the sole dependence on default membership functions and defuzziness functions to name a few. Consequently, a two-dimensional Mamdani fuzzy controller was developed as an updating process for ANFIS. The results of this effort showed that the fuzzy controller has the ability to precisely control reliable outputs, because the error rate was kept below 0.05 %. Thus, the f ANFIS model that integrates a two-dimensional Mamdani fuzzy controller can accurately forecast TGR flooding.