Real-time updating of HEC-RAS model for streamflow forecasting using an optimization algorithm

Real-time updating of channel flow routing models is essential for error reduction in hydrological forecasting. Recent updating techniques found in scientific literature, although very promising, are complex and often applied in models that demand much time and expert knowledge for their development, posing challenges for using in an operational context. Since powerful and well-known computational tools are currently available, which provide easy-to-use and less time-consuming platforms for preparation of hydrodynamic models, it becomes interesting to develop updating techniques adaptable to such tools, taking full advantage of previously calibrated models as well as the experience of the users. In this work, we present a real-time updating procedure for streamflow forecasting in HEC-RAS model, using the Shuffled Complex Evolution University of Arizona (SCE-UA) optimization algorithm. The procedure consists in a simultaneous correction of boundary conditions and model parameters through: (i) generation of a lateral inflow, based on Soil Conservation Service (SCS) dimensionless unit hydrograph and; (ii) estimation of Manning roughness in the river channel. The algorithm works in an optimization window in order to minimize an objective function, given by the weighted sum of squared errors between simulated and observed flows where differences in later intervals (start of forecast) are more penalized. As a case study, the procedure was applied in a river reach between Salto Caxias dam and Hotel Cataratas stream gauge, located in the Lower Iguazu Basin. Results showed that, with a small population of candidate solutions in the optimization algorithm, it is possible to efficiently improve the model performance for streamflow forecasting and reduce negative effects caused by lag errors in simulation. An advantage of the developed procedure is the reduction of both excessive handling of external files and manual adjustments of HEC-RAS model, which is important when operational decisions must be taken in relatively short times.


INTRODUCTION
One of the greatest challenges of reservoir operation relies in our ability to anticipate future conditions of a river system. This can be achieved through a hydrological forecast, in which variables such as streamflow and river stage are predicted with sufficient lead time to support decision-making procedures. Especially during occurrence of floods, decisions about gate opening and closing are extremely important in order to prevent loss of human life and damage of infrastructure, whilst in many cases must be taken in short time intervals (e.g. few hours) under stress conditions.
Hydrological forecasting can be performed through a myriad of mathematical models, ranging from statistical upstream-downstream relationships to physically-based routing models described by full 1D Saint-Venant equations. Historically, the latter approach has received little attention due to its high computational burden, detailed topography requirements and greater complexity regarding statistical methods. These limitations have been overcome with technological advances of the last decade (PAIVA; COLLISCHONN; TUCCI, 2011), giving rise to software packages that provide easy-to-use and low time-consuming platforms for preparation of hydrodynamic models. For instance, the HEC-RAS model, which is widely used in traditional engineering problems (e.g. CESTARI JUNIOR; SOBRINHO;OLIVEIRA, 2015;RIBEIRO NETO et al., 2015;MONTE et al., 2016) and scientific studies covering large complex river systems (e.g PAZ et al., 2010;BRAVO et al., 2012), has been successfully applied in institutions related to operational streamflow forecast (e.g. HICKS; PEACOCK, 2005;MOREDA et al., 2009;ADAMS;HEIN, 2011;MASHRIQUI et al., 2014). In the Brazilian context, a partnership signed in 2013 between the Brazilian National Water Agency (ANA) and the US Army Corps of Engineers (USACE) is currently motivating the use of HEC-RAS and other modelling tools for water resource management, including flood control and real-time reservoir operation.
However, when hydrological forecasting is performed using a physically-based routing model, differences between calculated and observed values are routinely noticed even for intervals prior to the start of forecast. These differences usually emerge from errors in the input data and simplifications/parameterizations adopted in related physical processes (MASKEY et al., 2004;CLOKE;PAPPENBERGER, 2009;ZAPPA et al., 2011;MELLER et al., 2012), which can be reduced with a common procedure called model updating or data assimilation. Potential benefits and opportunities of data assimilation have been extensively discussed since the 80s (e.g. O'CONNEL; CLARKE, 1981;LIU et al., 2012), and currently it is treated as an optimal combination of model output and independent observations to quantify and minimize uncertainties in model predictions (LIU et al., 2012). In hydrodynamic models, where physics are relatively well represented, major uncertainties can arise from instability of the numerical scheme, boundary conditions derived from rating-curves, coefficients (e.g. roughness, hydraulic structures) and geometry of the cross sections (PAPPENBERGER et al., 2005;RICCI et al., 2011;DOMENEGHETTI;CASTELLARIN;BRATH, 2012;HABERT et al., 2016).
In general, model updating is conducted through four different approaches. These include corrections of model input, output, parameters or state variables (REFSGAARD, 1997;NEAL et al., 2007;MELLER et al., 2012), and it can be done using stochastic methods (e.g. BABOVIC et al., 2001;ROMANOWICZ et al., 2008), deterministic empirical techniques (e.g. PAZ et al., 2007), or more sophisticated methods such as particle filtering and variations of Kalman Filter (e.g. STOKNER, 2005;NEAL et al., 2007;RICCI et al., 2011;HABERT et al., 2016). In a brief literature review, Hsu et al. (2003Hsu et al. ( , 2006 updated, respectively, the simulated stage and the Manning coefficient of a hydrodynamic model, through a minimization of a least-square error function. Ricci et al. (2011) used the Ensemble Kalman Filter (KF) to update both upstream flows and model hydraulic state variables during flood events, occurring in two French catchments. Wu et al. (2013) developed a real-time forecasting model for Yangtze river operation of the Three Gorges reservoir, combining the Ensemble KF to a hydrodynamic model. In a recent study, Habert et al. (2016) applied an Extended KF to update boundary conditions (i.e. upstream and lateral inflows) and friction coefficients using, respectively, observed discharge and observed water level.
Although filtering techniques are the state-of-the-art in scientific research and, indeed, very promising for model updating in streamflow forecast, some shortcomings still remain when these methods are applied for operational purposes. In general, these techniques are very complex and require a good understanding of total uncertainty to provide useful results, which is not a straightforward task in practical situations (ROMANOWICZ et al., 2008;LIU et al., 2012). In addition, models used for testing such techniques are often very specific and demand much time and expert knowledge for their development, posing challenges for operational institutions since robust and easily handled models are rather preferable.
Therefore, the development of adaptable techniques to widely known computational platforms becomes interesting, and a Siqueira et al.
possible approach consists in the use of optimization algorithms. Although rarely explored for data assimilation in flood forecasting models (e.g. MEDIERO; GARROTE; CHAVEZ-JIMENEZ, 2012), some recent studies have shown the potential of these algorithms when combined to models such as HEC-RAS and other similar software packages. In most of the cases, global search heuristic algorithms (e.g evolutionary algorithms) are used to solve multi-purpose reservoir problems (e.g. NGO et al., 2007;MALEKMOHAMMADI et al., 2010;CHE;MAYS, 2015;BASHIRI-ATRABI et al., 2015) as well as optimal estimation of the Manning coefficient (e.g. AYVAZ, 2013;YANG et al., 2014). Inspired by the aforementioned studies, the objective of this work is to present a simple method of real-time updating of HEC-RAS model for streamflow forecast using a global search optimization algorithm. This paper is organized as follows. Firstly, the hydraulic model (HEC-RAS) and the SCE-UA algorithm are briefly described. Next, estimation of a lateral inflow and optimization details are presented, as well as the procedure for coupling HEC-RAS with SCE-UA. Finally, the updating method is tested in a tributary of Parana river as a study case.

METHODS
Herein, the updating of HEC-RAS model is given as a deterministic data assimilation, in which internal boundary conditions and model parameters are estimated based on downstream real time observed discharge. Considering a situation where the flow of tributaries for a specific river reach is unknown, model calculations are corrected by applying the global search algorithm to estimate the "optimal" lateral inflow, so that model underestimation in output flows can be addressed. Furthermore, the Manning coefficient is simultaneously adjusted by the optimization algorithm, which is justified by uncertainty in upstream flows, errors in geometry of cross sections (PAPPENBERGER et al., 2005;DOMENEGHETTI;CASTELLARIN;BRATH, 2012) and variations of channel roughness for different flow conditions (HSU et al., 2006).

HEC-RAS model
HEC-RAS is a widely used hydraulic model for river flow simulation, which is developed by the Hydrological Engineering Center/U.S. Army Corps of Engineers (HEC; USACE, 2010). In its current version, the HEC-RAS allows the numerical solution of the full 1D Saint-Venant equations and determination of flow characteristics under steady or unsteady conditions, providing a friendly graphical user interface for data handling and visualization of model results.
The Saint-Venant equations are represented through conservation of mass and momentum. In the former case, conservation of mass (Equation 1) for a volume control states that the rate of change in storage must be equal to the net rate of flow into the volume, given as (HEC; USACE, 2010): Where: "A" represents the cross section wetted area in the volume control; Q is the streamflow and; ql is the lateral inflow per unit length. Conversely, the net rate of momentum entering the volume plus the sum of external forces acting on the volume control are equal to the rate of accumulation of momentum (Equation 2). This is also known as the dynamic wave equation: Where: u is the mean velocity of flow along the 'x' direction; z is the water elevation (relative to a datum); Sf is the friction slope, which is commonly written as the Manning equation for uniform, steady flow (Equation 3): Where: RH is the hydraulic radius and; n is the Manning coefficient.

SCE-UA algorithm
The SCE-UA algorithm (Shuffled Complex Evolution -University of Arizona) (DUAN et al., 1992) combines the search strategies of the Simplex method (NELDER; MEAD, 1965) with concepts of random search, competitive evolution and complex shuffling. This algorithm has shown suitable results regarding parameter estimation, especially for calibration of hydrological models (e.g. DUAN et al., 1992; BREDA; GONÇALVES; SILVEIRA, 2011) and reservoir optimization (e.g. NGO et al., 2007;BRAVO et al., 2008).
Briefly summarized, the SCE-UA performs with a population (s) of points -or solutions -that evolves towards the global optimum of a mono-objective function, which is continuously evaluated through successive iterations. Solutions are ranked according to their objective function and are partitioned into complexes, giving rise to offspring through a sequence of steps based on Simplex algorithm. Inside a complex, a given solution (parent) is replaced by an offspring if the latter is better fitted than the former one, and after a number of evolutionary steps, the complexes are shuffled. This procedure is repeated until the convergence criteria are satisfied and the objective function is minimized. Parameters of the algorithm that must be defined are the number of complexes and number of individuals in each complex. Usually, values are selected so that c ≥ 1 and p ≥ 2n + 1, where c represents the number of complexes, p the number of points in each complex and n the number of decision variables in the optimization problem. The population size is equal to c times p. Further details about the algorithm can be found in Duan et al. (1992).

Estimation of a lateral inlfow
For simplicity and due to a small number of necessary parameters, the standard SCS dimensionless unit hydrograph (DUH) (NRCS; USDA, 2007) was chosen as a basis for generation of a lateral inflow. However, some changes in the gamma equation of the original method were done as following (Equation 4): Where: Q lat (t) is the lateral flow for t time interval (m 3 s -1 ); Nhidro is the total number of synthetic SCS hydrographs; Q base is a variable baseflow. Therefore, one or more synthetic hydrographs can be used to generate the lateral inflow, considering the optimization of decision variables Q base , Qp i and td i , (i = 1,...,Nhidro). Parameters Tp and m represent, respectively, the rise time of a typical basin hydrograph and a shape factor related to the DUH peak rate factor (m = 3.7 for standard DUH), which were held fixed during the optimization procedure. The total number of hydrograph intervals corresponds to the whole simulation period, from the warmup of HEC-RAS model up to the end of forecast range.
Regarding the decision variables, parameter Q p is the magnitude of the lateral inflow, in which the limits of the search space can be defined from a comparison between downstream simulated and observed hydrographs. In addition, td represents the displacement in peak position in relation to the time of rise (T p ), changing the instant of its occurrence while preserving the original shape of the hydrograph. For instance, considering a T p equivalent to 30 hours, a td value of 20 means that the peak instant occurs in t = 50 hours, while a td value of -10 indicates that the peak occurrence is at t = 20 hours. In order to illustrate this approach, Figure 1 shows a set of hydrographs generated with a Q p = 500 m 3 s -1 and a Tp = 30 hours, but with different values of td, representing the displacement in peak position.
The lateral inflow is inserted in HEC-RAS model in a lumped way into an intermediate cross section, which can be in a specific tributary or after the confluence of the most important rivers along the simulated reach. Nevertheless, this method can be easily adapted in order to consider a uniformly distributed lateral inflow.

Defining a mono-objective optimization function for model updating
An optimization procedure is then performed in order to solve the updating problem, i.e., the estimation of decision variables corresponding to both lateral inflow parameters and Manning coefficient. For this, the SCE-UA algorithm runs in a time window similar to that one used by Ricci et al. (2011), defined here as the "optimization window". This window starts after the conclusion of warmup period and remains until the last interval with available real time observed data, which coincides with the start of forecast. The objective function (Equation 6) is computed as the sum of squared errors between simulated and observed values over the optimization window, but weighted according to the analyzed time interval: subject to: Where: FO is the objective function to be minimized; Qcalc t is the simulated flow in time interval t, computed for the cross section where observed data is available; Qobs t is the observed data in time interval t; w(t) is a weight function that depends on the analyzed time interval; NTw is the number of time intervals for model warmup and; NTotim is the number of time intervals in the optimization window. The w(t) function (Equation 7) was introduced so that the weight of errors are increased for latter time intervals along the optimization window. This is justified by the fact that a better agreement of calculated and observed values right before the start of a forecast is desirable, since errors in the predicted flows can be reduced especially for earlier forecast lead times. Thus, w(t) was undertaken in terms of a cubic function, described as following: Where: t is the simulation time interval. The weighted function w(t) is maximized (equal to unity) in the last time interval of the optimization window. Figure 2 shows a graphical example of the model updating considering a warmup period of 24 hours, an optimization window of 72 hours and a lateral inflow composed by two synthetic hydrographs. However, it is important to mention that a large optimization window can cause excessive weights for a large number of time intervals, and in this case a less agreement between simulated and observed discharge is likely to occur right before the start of forecast. Conversely, a small time window can be insufficient to properly optimize the Manning coefficient or to route the lateral inflow hydrograph to the downstream river gauge, for which the objective function is calculated.

Coupling SCE-UA + HEC-RAS model for real time streamflow forecast
In order to perform a simultaneous run of SCE-UA optimization and HEC-RAS model, a coupling algorithm was developed in VB.NET language using the HECRASController module (GOODELL, 2014;LEON;GOODELL, 2016). This controller provides a set of computational subroutines that allows the full automation of HEC-RAS model, including data input, simulation and results acquisition. Changes in Manning coefficient can be done directly in HECRASController module, just indicating the cross sections where this parameter must be set. On the other hand, definition of both simulation period and inflow data for each model run require the external manipulation of specific files associated to HEC-RAS project (.prj), which are (HEC; USACE, 2010): • Plan file: refers to the file with ".p" extension, where dates of start and end of simulation are set; • Unsteady flow data file: refers to the file with ".u" extension, where initial conditions, boundary conditions and lateral inflow data are set.
Moreover, parameters of the coupling algorithm that are needed to handle these files are defined here as simulation parameters: • Nhidro: number of synthetic hydrographs; • NT_warmup: number of time intervals for model warmup; • NT_otim: number of time intervals for the optimization window; • NT_prev: number of time intervals for the forecast range; • NT_sim: number of time intervals for the simulation period, equal to: NT_warmup + NT_otim + NT_prev.
The simulation period in HEC-RAS model must be configured to have the same number of time intervals as NT_sim.
It is important to emphasize that the synthetic hydrographs must comprise all the simulation period, so that the model has enough data for streamflow computations along the forecast range. Likewise, additional data must be set in the upstream boundary condition to represent the flow in forecast intervals, which can be a constant value such as the persistence of the last observed discharge, for example.
Regarding the SCE-UA algorithm, the initial population of candidate solutions (s) are randomly generated within the limits of the search space, considering the parameters Q base , Qp, td and Manning coefficient. Each of the individuals in s population is composed by a single value of Manning coefficient and a single value of Q base , as well as Nhidro parameters of both Qp i and td i . After applying the standard DUH gamma equation, the resulting synthetic hydrographs must have NT_sim time intervals and be further summed to compose the lateral inflow, which is inserted in a lumped way in a specific cross section (set in the Unsteady flow file). Manning coefficient is uniformly set in channel of all cross sections and the HEC-RAS model is run, allowing to obtain the flow at the point of interest and the calculation of the objective function. After determining the FO for each individual in the population, the algorithm starts the evolutionary process Figure 2. Example of the model updating considering an optimization window of 72 hours (24-96 h). The above illustration shows the simulation being influenced by the weighted function w(t), so that simulated flows get closer to the observed values especially for later optimization intervals (Sim. + optim.). The illustration below shows the lateral inflow (Q lat ) generated by the sum of two SCS synthetic hydrographs (Q 1 (t) and Q 2 (t)), as well as its position over the optimization window.
(SCE-UA Evolution) and the hydraulic model is internally called whenever the FO needs to be evaluated.
Only the maximum number of SCE-UA generations is used as the convergence criterion. After ending, the algorithm selects the best candidate solution among the final population of individuals to provide the lateral inflow parameters and the estimated Manning coefficient. Figure 3 presents a simplified flow chart of SCE-UA and HEC-RAS model coupling with the main steps of the real time updating procedure.

Study case: Lower Iguazu basin
The Iguazu river basin has a total area of 70000 km 2 and lies between the states of Parana and Santa Catarina, in southern Brazil. Rainfall is relatively well distributed throughout the year and its annual average has an increasing gradient along east-west direction, from 1400 mm in the headwaters to about 2000 mm near the confluence with Paraná River (DEMARIA et al., 2014).

Siqueira et al.
A cascade of hydropower plants is found downstream of Uniao da Vitoria city in the Upper Iguazu, and some of the reservoirs are used for both energy production and flood control purposes. Due to the geomorphological and climatic characteristics of the basin, tributaries may have rapid rise of the hydrograph with very high peaks (REYNAUD; MINE; KAVISKI, 2014), posing challenges for streamflow forecasting which is sometimes performed by coupling stochastic or hydrological models to numerical weather prediction (e.g. GUILHON; ROCHA; MOREIRA, 2007;CASTANHARO et al., 2007;FIGUEIREDO et al., 2007;ARAUJO et al., 2014).
In the lower part of the basin, the maximum hourly and daily flow variations are constrained in a streamgauge called R-11, located a few hundred meters downstream of the confluence with Parana river. These constraints were imposed by international agreements such as the Tripartite signed by Brazil, Argentina and Paraguay in October 1979, ensuring safety of the population in areas subject to flooding (FERREIRA; SOARES FILHO, 2012). To meet the constraints, the operation of Itaipu reservoir in Parana River depends on the predicted flows of Acaray and Monday rivers on the right bank and especially the flows of Iguazu river on the left bank, since high peak flows may occur in the latter during floods.
A HEC-RAS model is already set for this river system in order to support the operation of Itaipu reservoir. For the lower Iguazu basin, model is extended approximately 220 km up to Salto Caxias reservoir encompassing a drainage area of 10380 km 2 (Figure 4), which is characterized by a sparse real time monitoring network. Since the tributaries along this reach are not considered in the hydraulic model, flows calculated in the last gauge station (Hotel Cataratas) are underestimated ( Figure 5), which undermines the effectiveness of streamflow forecasting in R-11. Therefore, the local forecaster must estimate and manually enter a lateral inflow in HEC-RAS model to address this problem, turning into a time-consuming trial and error process.
Thus, the updating procedure was applied for the reach between Salto Caxias reservoir and Hotel Cataratas river gauge, which was extracted from the Itaipu HEC-RAS model. Detailed channel bathymetry is available for each 5 km on average, while 3 arc-sec SRTM data (FARR et al., 2007) is used for a roughly representation of floodplain geometry. Upstream boundary condition is defined by hourly outflows of Salto Caxias reservoir, whereas the downstream condition is given by friction slope for normal depth. Right after Hotel Cataratas gauge, the Iguazu Falls are represented by an inline weir with equivalent width to the Iguazu River at this point. Also, observed data from Hotel Cataratas gauge was available in hourly time interval comprising the years of 2013 and 2014. Figure 6 shows the original configuration of HEC-RAS model in terms of Manning coefficient, which was calibrated based on observed river stage. For the updating procedure, the lateral inflow was inserted approximately 110 km upstream of Hotel Cataratas gauge, taking into account the main tributaries of this reach including Cotegipe, Sao Salvador, Capanema, Gonçalves Dias and Santo Antonio rivers. Real-time updating of HEC-RAS model for streamflow forecasting using an optimization algorithm The 5.0 Beta version of the HEC-RAS model was run using an Intel  Core i5 3.46 GHz (64 bits) processor with 8 Gb of RAM. Simulation parameters for testing the methodology were chosen as following: -Nhidro = 2 synthetic hydrographs for generation of lateral inflow. The gamma shape factor (m) adopted was the same as the standard SCS DUH, equivalent to 3.7 (NRCS; USDA, 2007). Rise time (Tp) was fixed in 20 hours according to observed data from Capanema river.
-NT_warmup = 72 hours. In a test model run, this warmup period was long enough to address instabilities in the initial condition.
-NT_otim = 72 hours. As shown in Figure 2, a time window with NT_otim = 72 indicates that flows in the last 14 optimization intervals have a weight of above 50% in the objective function. These 14 time intervals are sufficient to characterize both rising and recession limb of the hydrograph in Hotel Cataratas, according to daily operation cycle of Salto Caxias reservoir.
-NT_prev = 24 hours. This forecast range was chosen because travel time between Salto Caxias and Hotel Cataratas is around 20 hours, considering normal conditions of reservoir operation.
For a Nhidro = 2, six decision variables (n = 6) are defined for SCE-UA: td 1 , td 2 , Qp 1 , Qp 2 , Q base and Manning. The minimum and maximum limits used for each one of these variables are shown in Table 1. In respect to the maximum limit of td, a value equivalent to NT_otim-Tp was used in order to avoid the occurrence of peaks after the end of optimization window.

Convergence of SCE-UA and real time applicability of the coupling algorithm
Firstly, the coupling algorithm was evaluated in terms of convergence of SCE-UA in order to verify its computational performance. Three different setups of the SCE-UA parameters ( Table 2) were defined within the recommended range by Duan et al. (1992), from a minimum number of individuals in each complex (p=n+1) to a number of p=2n+1. Other parameters such as the number of points in each subcomplex (q), number of consecutive offspring generated by subcomplex (α) and the number of evolutions in each complex (β) were held the same as in Duan et al. (1992) and Santos, Suzuki and Watanabe (2003), equivalent to n + 1, 1 and 2n + 1, respectively.
A time window with NT_sim intervals was randomly chosen within the available data period. Table 3 shows the total number of simulations and the estimated variables after the end of optimization procedure. For each run, the average time necessary for the HEC-RAS evaluation was little more than 2 seconds. Except for the Manning coefficient, results were similar among tested configurations, since the objective function was minimized in all cases with a small difference between the estimated variables. Regarding the computational efficiency, processing time was directly related to the number of HEC-RAS simulations, which in turn is linked mainly to the number of complexes in SCE-UA algorithm. For a value of β = 2n + 1, i.e, 13 evolution steps for each complex in each generation, only the setup 1 completed the optimization procedure in less than 1 hour. Figure 7 shows the best solution for each setup over SCE-UA generations, and the square root of the FO was adopted for viewing purposes. For a larger number of individuals in the population    .g setup 3), the objective function in the initial generation tends to be smaller, which is expected due to a better coverage of the search space. Conversely, convergence becomes slower as much as the size of the population is increased. For setup 3, almost 30 generations were needed in order to minimize the objective function, while for the other cases, the convergence of SCE-UA occurred with approximately 15 generations.
Whereas decisions about gate opening and closing must occur in short time intervals, a less processing time configuration of the coupling algorithm becomes essential. Therefore, even if a smaller number of complexes may result in a lack of information in the search space and, consequently, an easier convergence to a local optimum (BREDA et al., 2011), a set of SCE-UA parameters similar to setup 1 may be preferable for an operational context. In this way, real time updating of HEC-RAS model can be relatively efficient.

Statistical assessment of the updating method
A second test was carried out to assess the performance of the updating method in a long period, encompassing both low and high flow values. The hydraulic model was initialized each day between jun-2013 and jun-2014, i.e., by applying the coupling algorithm, advancing 24 hours in start date of simulation and so on. For each model run, the last observed discharge in Salto Caxias reservoir was used as a persistence forecast for upstream boundary condition, assuming the outflow at t = NT_warmup + NT_otim for all intervals in the forecast range. The parameters of SCE-UA algorithm were the same as in setup 1 of the convergence test, but using a smaller number of generations (NG = 15) in order to reduce the computational cost (~25 min per convergence). Thus, 188340 HEC-RAS simulations were conducted by the coupling algorithm for this statistical evaluation. Figure 8 shows a scatter plot between calculated and observed values along the optimization window, with and without HEC-RAS model updating. To ignore calculated flows during both model warmup (0-72 h) and first intervals in the optimization window (73 h-108 h), since the latter is much penalized by the weight function w(t), only values for the interval between 108 h and 144 h were plotted corresponding to the second half of this window. When the hydraulic model is run without updating, the tendency of underestimation increases for higher flows, while farthest points of the perfect prediction (45º dashed line) may be related to higher flow contributions from tributaries. In addition, the loop-shaped curve can be mainly explained by lag errors associated to the hydraulic model. It happens because obtaining accurate results of discharge for both high and low flow conditions is difficult, especially when the model is calibrated with river stage and geometry of the cross sections is complemented by SRTM data. Nevertheless, when HEC-RAS updating is performed, it can be clearly seen that model simulations almost fit the observed flows over the optimization window, accounting for errors originating from different sources of uncertainty.
To assess the behavior of decision variables and characteristics of the estimated lateral inflows, Figures 9 and 10 show the parameters related to streamflow plotted against the displacement parameter and the Manning coefficient, respectively. In these diagrams, the average between Qp 1 and Qp 2 summed to Q base is related to the magnitude of the lateral inflow, while the absolute difference between td 1 and td 2 indicates the distance between peaks of both resulting hydrographs. Regarding the displacement parameter, a concentration of points near the origin of x-axis shows that the   in an global optimum, since a given combination of lateral inflow parameters (td, Qp and Q base ) offsets the lack of representativeness of Manning coefficient. Therefore, adopting a large search space for this parameter may be inadequate, precisely by making the updating method more susceptible to an equifinality problem (BEVEN, 2006). In order to assess the benefit of HEC-RAS updating for operational streamflow forecasting, the Nash-Sutcliffe efficiency (NSE) (Figure 11), the mean absolute error (MAE) and the mean relative error (MRE) (Figure 12) were plotted for different forecast lead times. Results were separated according to the 10% value of the flow duration curve (Q 10 = 3580 m 3 s -1 ), so that performance can be evaluated for flows exceeding and not exceeding the Q 10 value.
When model is run without updating, all metrics have an approximately sinusoidal behavior for flows below Q 10 threshold, whereas model performance is better for longer lead times. This occurs because most of the forecasts started during the rise of the hydrograph generated by the daily operation cycle of Salto lateral inflow was unimodal in many cases, but the associated flows were often relatively small. This is not much expected, since the sum of peaks in very close intervals would be more appropriate to account for major underestimation, i.e., during high flow periods. Moreover, it can be noticed that the predominant distances between the peaks ranged between 20 and 35 hours. Considering the rise time adopted for the case study (Tp = 20 hours), distances close to or above this value would indicate a bimodal lateral hydrograph occurring in most part of the time.
In relation to the Manning coefficient, it is clear that the SCE-UA algorithm found possible solutions in the whole search space. For lateral inflows with lower magnitude, the roughness values were well distributed within minimum and maximum limits. Although with a fewer number of points, this tendency can be also noticed for high flows, and in cases where the lateral inflow exceeded 3000 m 3 s -1 , Manning coefficients were either less than 0.030 or greater than 0.060. This behavior indicates that a solution composed by a less physical meaning of roughness can also result  Caxias reservoir, as well as by a delay in flows calculated by the hydraulic model (lag error). Thus, flow underestimation reach maximum values at the peak of observed hydrograph (first lead times) and reduce during its recession (longer lead times), since predicted flows are still rising during the latter period. For flows exceeding the Q 10 threshold, results without model updating are in agreement with the ones by Meller, Bravo and Collischonn (2012) where model performance hardly varies in forecast range. This is explained by the fact that no modification of the initial conditions is conducted prior to the forecast and because there is little or no influence of the daily operation cycle for this range of flows.
By the other hand, it is noteworthy that updating of HEC-RAS model had a very positive impact on the performance of streamflow forecast, accounting for both underestimation and lag errors in model computations. Performance is maximum in the start of forecast and gradually reduces when lead time is increased, which is somehow expected since the recession of lateral inflow hydrograph occurs during the forecast range.    Finally, in the illustration (f) the updating procedure is applied during a flood situation, when flows of Iguazu river are starting to exceed the channel capacity. Thus, the observed hydrograph has Siqueira et al.
a delayed peak compared with the simulated one due to a slight floodplain attenuation, which is poorly represented in HEC-RAS model since SRTM data is used as a complementary information to geometry. In this case, the lateral inflow hydrograph is closer to the left side of optimization window to account for higher flow differences in the intermediate time intervals, which had a great impact on the objective function. The benefit of model updating in the forecast range was lower if compared with the other cases, which could be improved by adjustments in the weight function w(t).

CONCLUDING REMARKS
Recent technological advances and development of software packages have been facilitating the preparation of hydrodynamic models for solving a variety of water resources problems. When it comes to operational hydrological forecasting, where challenges still remain by either complexity of assimilation techniques or preference for robust and easily handled models, the widely known computational tools can be very useful to overcome these limitations especially when combined with simpler methods of real time model updating.
In this work, we presented a real-time HEC-RAS updating procedure for streamflow forecasting using the SCE-UA optimization algorithm. For its evaluation, an existing HEC-RAS model for Iguazu river, a tributary of Parana river right after the Itaipu dam, was used as a study case. Results showed that differences between simulated and observed discharges can be reduced with the application of SCE-UA algorithm, which proved to be effective when used with a relatively small number of complexes and solutions. The updating procedure improved the performance of HEC-RAS for predicting flows, also reducing negative effects caused by lag errors in the hydraulic model. However, it is important to note that the algorithm does not differentiate between a more physically consistent solution to other hardly found in the real world. This means that the parameters obtained for the lateral inflow may offset a low or high value of Manning coefficient (for instance, n = 0.06 for the river channel in the latter case), which requires a more suitable search space for the roughness parameter.
The methodology presented herein shows that it is possible to update a widely known model such as the HEC-RAS for real-time streamflow forecasting, taking full advantage of a previously calibrated model as well as the experience of the users. Automation of the hydraulic model reduces both the need for excessive manipulation of files and manual adjustments in the model itself, which presents as a major advantage when important decisions must be taken in a relatively short time. In the Brazilian context, where reservoir operation is essential for both energy production and flood control, similar procedures could be developed for other purposes, such as opening and closing gates for meeting local constraints based on predicted reservoir inflow.