## Abstract

Simulation–optimization approaches are useful methods for the assessment of water resource engineering plans and finding the best management policy at the watershed scale. In this study, to find the optimum operation for a reservoir with the purpose of satisfying water demands while meeting the water quantity and quality criteria, a generic reservoir and river basin simulation model (MODSIM) is coupled with the particle swarm optimization (PSO) algorithm leading to construct the PSO–MODSIM model. With the decision variables of the reservoir's monthly releases, the objective function is to maximize the supply for downstream demands while keeping the electrical conductivity (EC) in the river flow lower than a predefined level at the downstream checkpoint, which is a function of the EC in the agricultural return flows. Moreover, a safe flow rate is defined in which the streamflow should not exceed at the checkpoint resulting in mitigation of the submerging lands damage. Results obtained by the PSO–MODSIM model indicate the ability of the proposed simulation–optimization approach for solving the problem of optimal quantity–quality-based water allocation in a reservoir–river system. For instance, the EC at the checkpoint is decreased by 61% in the optimum reservoir operation state comparing the present situation, whereas the municipal and environmental demands are fully met and the agricultural demands are supplied with a desirable reliability satisfaction level.

## HIGHLIGHTS

Finding optimum operation for a reservoir satisfying water demands.

Meeting the water quantity and quality criteria at the downstream checkpoint.

A generic reservoir and river basin simulation model (MODSIM) is coupled with the PSO.

Decision variables are monthly releases and the objective function is to maximize the supply.

Results prove the ability of the proposed simulation–optimization method.

## INTRODUCTION

The optimal operation of reservoirs has drawn the attention of many research works as a common problem in water resource systems analysis. Its importance is because of increasing water demands, lack of available water resources and increasing the economic value of fresh water. Reservoir operation models mainly consider quantitative or qualitative purposes to be simulated or optimized. But, in some cases, both quantity and quality objectives are proposed to be formulated. This kind of problem is categorized in the class of hard-complex problems due to a high number of variables and equations (Babamiri & Marofi 2021). According to the literature review on the optimal operation of reservoirs, few mathematical models have been proposed for the optimal quantitative–qualitative operation mainly due to limited special cases of water quality issues in the reservoirs and also high computational costs of computation.

Simulation and optimization models and integration of them have been used with quantity–quality-based purposes for river and reservoir systems management. A beginning research on quantity–quality reservoir planning is traced back to the 1980s when the reservoir's quality simulation models were growing. Loftis *et al.* (1985) integrated water quantity and quality considerations in the operation of a system of lakes by combining water quality simulation and mathematical optimization. Mehrez *et al.* (1992) developed a nonlinear programming model for optimal real-time operation of a regional water supply system for quantity and quality. de Azevedo *et al.* (2000) investigated multiple strategic planning alternatives for water quality and quantity management in a river basin. They used the generic reservoir and river basin simulation model (MODSIM) for water allocation and a model named QUAL2E-UNCAS for water quality routing considering the parameters’ uncertainties. Dai & Labadie (2001) introduced a model for water allocation called the MODSIMQ which is an extended version of the MODSIM. The MODSIMQ incorporates the river water quality assessment model of QUAL2E. They used the Frank–Wolfe nonlinear programming to link the water quantity and quality simulation models and attain optimal water allocation policies considering water quality issues.

Karamouz *et al.* (2006) developed models for the certain and uncertain optimization of a reservoir operation rule curve to improve the quality of stored and released water by focusing on the natural process of qualitative stratification in the reservoir. They also employed the genetic algorithm with a variable chromosome length to decrease the computational difficulties of the problem. Focusing on the natural process of stratification in the reservoirs, Kerachian & Karamouz (2007) developed models for certain and uncertain optimization of operation rules for reservoirs and river-tank systems. They used a numerical simulation model based on WQRRS and HEC-5Q models to simulate the quality of stored water and the water released from the tanks. Paredes-Arquiola *et al.* (2010) considered water quality and quantity issues in a basin-scale water resource management problem. They used two models of SIMGES and GESCAL to deal with the modeling of a reservoir–river system. A coupled water quality–quantity model was also proposed by Zhang *et al.* (2010). They divided the river basin into a network of reaches and tanks to analyze a water allocation optimization problem.

Nikoo *et al.* (2012) developed a methodology for the optimal allocation of water and waste load in rivers utilizing a fuzzy transformation method (FTM). The FTM, as a simulation model, was used in an optimization framework for constructing a fuzzy water and waste load allocation model. Nikoo *et al.* (2014) developed a methodology for the optimization of water and waste load allocation in the reservoir–river systems considering the existing uncertainties in reservoir inflow, waste loads and water demands. A stochastic dynamic programming (SDP) model was used to optimize reservoir operation considering the inflow uncertainty, and another model called PSO-SA was developed and linked with the SDP model for optimizing water and waste load allocation in the downstream river. Zeng *et al.* (2017) developed a random interval segmented optimization model with the Laplace criterion for the allocation of sustainable water resources and qualitative water management under multiple uncertainties. Mishra *et al.* (2017) analyzed water quality parameters (BOD and DO) to evaluate the sustainability of the surface water resources of Kathmandu Valley. For this purpose, they implemented current and future wastewater production and treatment scenarios based on two important aquatic health indicators. In this study, the integrating tool of QUAL2 K and WEAP models was used to simulate the water flow and quality parameters. Jamshidi & Shourian (2019) investigated the optimal operation of a reservoir by incorporating the hedging policy and the Bat algorithm. The deficit in the water supply by the dam was minimized as the objective function and the optimal monthly releases from the reservoir were determined and compared in three hedging-based operation rules. Afterward, the results using the hedging rules were compared with the standard operating policy (SOP) and it was found that the reservoir performance is more desirable in satisfying water demands when the hedging policy is applied.

Saadatpour (2020) used simulation and optimization models for water quality–quantity management of the Meimeh Reservoir in Iran. This study evaluated the upstream saline inflow by CE-QUAL-W2 and WEAP models to determine the best inflow scenario. The adaptive surrogate-assisted WQSM was linked to the hybrid NSGA-II_AMOSA algorithm to ascertain the desired operation policy. Babamiri & Maroti (2021) studied the optimal operation of the surface water resources system in terms of quantity and quality simultaneously, using the Non-Dominated Sorting Genetic Algorithm-II (NSGA-II) algorithm. For this purpose, the WEAP-QUAL2 K coupling model was developed for the simulation of water quality and quantity. Masoumi *et al.* (2021) introduce a sustainability-based water quality–quantity management model in the river–reservoir system. The two-dimensional hydrodynamics and water quality simulation model (CE-QUAL-W2) was linked to the multi-objective particle swarm optimization (MOPSO) to develop a simulation–optimization approach. Also, the artificial neural network (ANN) model, substituted for the CE-QUAL-W2 model, reduced the computational time in an adaptive, dynamically refined routine. The results showed that using ANN in an adaptive form, replacing CE-QUAL-W2, significantly impacts the computational time, considering accuracy in the developed simulation–optimization model.

Research on quantity–quality-based reservoir and river systems management shows that the use of classic gradient-based optimization methods mostly face with restrictions because there are many variables and nonlinear relations in the problem which make it hard to solve with gradient-based methods. On the contrary, search-based optimization methods which integrate an optimization algorithm with a simulation model can find more easily the possible optimal solutions. In the present research, a novel simulation–optimization approach is developed for the optimum operation of a reservoir–river system. To do so, MODSIM, the generic river and reservoir simulation model, is coupled with the particle swarm optimization (PSO) algorithm for finding the optimum reservoir monthly releases, whereas the river flow quantity and quality indices met the downstream checkpoint. To examine the efficiency and applicability of the methodology, it is applied to the Gotvand reservoir–river system in the southwestern part of Iran.

## PROBLEM DEFINITION

^{3}/s) with an average annual volume of over 14 billion cubic meters. For the simulation of the reservoir to be linked with the optimization algorithm, the reservoir inflow in the period of 2005–2016 is used which contains various kinds of hydrologic behavior of the basin. In Figure 2, the time series of the Gotvand dam inflow is presented.

Level of gate (masl) . | Storage (mcm) . | EC (μm/cm) . |
---|---|---|

159 | 733 | 920 |

123 | 166 | 2,500 |

90 (dead storage) | 20 | 35,000 |

Level of gate (masl) . | Storage (mcm) . | EC (μm/cm) . |
---|---|---|

159 | 733 | 920 |

123 | 166 | 2,500 |

90 (dead storage) | 20 | 35,000 |

## METHODOLOGY

### MODSIM, generic reservoir–river simulation model

*A*is the set of all arcs or links in the network;

*N*is the set of all nodes;

*O*is the set of all links originating at node

_{i}*i*(i.e., outflow links);

*I*is the set of all links terminating at node

_{i}*i*(i.e., inflow links);

*q*is the integer-valued flow rate,

_{l}*l*is the lower bound and

_{l}*u*is the upper bound on flow in link

_{l}*l; c*is the cost (i.e. negative benefits in the minimization form); weighting factors or priorities per unit of flow rate in link

_{l}*l*;. The database for the network optimization problem is completely defined by the link parameters for each link

*l*:

*[l*, as well as the sets

_{l}, u_{l}, c_{l}]*O*and

_{i}, I_{i}, N*A*. The distinguishing feature of MODSIM is its customization ability which enables the user to specify, embed or link the water allocation model to the desired routines. Using this ability, water quality balance relations are coded in the customization environment of MODSIM and then the water quantity–quality simulation model is coupled with the PSO algorithm for obtaining the optimum operational releases from the reservoir. More details about the application of MODSIM are presented in Shourian

*et al.*(2008).

### PSO algorithm

*d*= 1, 2,…,

*D*is the dimension;

*i*= 1, 2,…,

*N*is the number of particles while

*N*is the size of the swarm; is the constriction factor usually equal to 1; is the inertia weight linearly degrading from 1.2 to 0.1; and are two positive constants whose values of 2.5 and 1.5 have shown good performance; and are random numbers uniformly distributed in [0,1] and represents the iteration number. More details about the application of PSO are presented in Sabzzadeh & Shourian (2020) and Akbari

*et al.*(2022).

### Coupling MODSIM and PSO: developing the simulation–optimization model

Decision variables to be generated and optimized by PSO are the values of *TS _{t}*, amounts of target storage of the reservoir in monthly time steps which by defining a high priority for the reservoir, storing volumes are constrained to be equal to them in the NFP routine of MODSIM. Target storage values are generated between the minimum and maximum volumes of the reservoir. The objective function is to maximize the water supply for the downstream demands. The following two constraints for the reservoir releases are considered: (1) stream flow at the downstream reach must be lower than the safe flow rate in the river at the checkpoint and (2) EC concentration in the checkpoint station must be lower than the desirable limit. Considering the characteristics of the metaheuristic optimization algorithms, these constraints are aggregated with unit weight and are summed with the objective function of the PSO algorithm.

*nT*is the number of monthly time steps;

*nD*is the number of demand nodes; (

*i,t*) is the water allocation to node

*i*in month

*t*which is a function of reservoir target storage (

*TS*) in month

_{t}*t*;

*F*is the NFP solver of MODSIM;

*Q*

_{Check}is the average monthly river flow at the checkpoint;

*Q*

_{safe}is the safe river flow at the control point equal to 80% above the average of long-term discharge of the river; EC

_{Check}is the average EC concentration at the checkpoint; EC

_{Standard}is the desired value for EC at the checkpoint considered equal to 900 μm/cm. The assumed values for

*Q*

_{safe}and EC

_{Standard}are considered based on institutional guidelines.

*) is estimated using the observed values of EC in the checkpoint station. According to Figure 3,*

_{R}*Q*

_{Res}is the reservoir release discharge with the quality of EC

_{Res}.

*q*is allocated to agricultural zone

_{i}*i*and

*q*is returned to the river with the concentration of EC

_{Ri}*.*

_{R}*q*is known by running MODSIM,

_{i}*q*is known based on the irrigation efficiency in the agricultural zone

_{Ri}*i*and EC

*is unknown. By assuming the same value for EC*

_{R}*for all agricultural zones and solving the following mass balance equations up to the checkpoint with a known EC*

_{R}_{Check}, the value of EC

*is determined.*

_{R}By knowing EC* _{R}*, the above equations are written in the custom coding of MODSIM and the unknown value of EC in the checkpoint (EC

_{Check}) is determined and compared with EC

_{Standard}. Also,

*Q*

_{Check}is compared with

*Q*

_{Safe}. In cases of violation, a penalty is added to the objective function and accordingly, PSO finds the optimum values for the reservoir target storages that meet these two constraints.

## RESULTS AND DISCUSSION

*t*have 12 values varying in the months of a year but are repetitive in 11 years of the operation period (2005–2016). So, the problem has 12 decision variables in S1. In the second scenario (S2), the values of

*TS*are relaxed to vary in all 132 months of the operation period so that the problem faces 132 decision variables. Therefore, in S2, the reservoir operation rule curve has more degree of freedom to be searched by PSO for the optimum solution in the search space. The PSO–MODSIM model is executed for the defined scenarios and the results are compared with simulation of the status quo (S0) which represents the existing situation in the basin. In Figure 5, variations of the reservoir storage in simulation and optimization states are depicted.

_{t}As stated, the safe flow at the control point (*Q*_{safe}) is considered equal to 80% higher than the average of the long-term time series of the river discharge according to institutional guidelines. This means that the maximum safe capacity for the river discharge is 1.8 times the *Q*_{ave} at the checkpoint which for the river downstream of the Gotvand dam, *Q*_{safe} is equal to 2,075 mcm/month. As seen in Figure 8, by simulation of the existing situation in S0, there are many time steps that the river flow is higher than the safe flow. The reason is that there is no limitation defined for the reservoir releases reaching the downstream area. But, by defining this limitation for the optimization models, the river discharge has rarely violated the *Q*_{safe} constraint in S1 and S2. Therefore, it is seen that in the optimized operation of the reservoir, water supplies are reduced, but the quantity and quality constraints defined in the system are satisfied. So, through these results, the role of optimum operation of the reservoir for quantity–quality-based management of the downstream system is obviously observed.

## SUMMARY AND CONCLUSION

In the present study, a simulation–optimization approach for quantity–quality management of a reservoir–river system is used. MODSIM, the generic river basin simulation model, is coupled with the PSO algorithm to find the optimum operation for the Gotvand reservoir in Iran which has the problem of the high density of salt in the bottom layers. This phenomenon may cause to increase in EC in the downstream reach of the river and turns the subject of water allocation into a complex problem in the system. The objective function is maximizing water supply for the downstream demands while the river discharge should be lower than a predefined safe flow as the quantity constraint, and also EC should meet the standard criteria as the quality constraint defined for the model at the checkpoint on the river.

The present situation in the basin (S0) is simulated and the results are compared with two optimization scenarios defined for the operational rule curve of the reservoir. In the first scenario (S1), the operational decision variables vary in 1 year but are repetitive for the whole of the operation period, whereas in the second scenario (S2), the decision variables are relaxed to change during the operation period. It is seen that the downstream demands are totally supplied in S0; however, the river flow and EC exceed the desired values during the operation period. On the other hand, in S1 and S2, averaged water supplies are decreased to 75 and 84% annually but the safe flow and standard EC limitations are satisfied. Water supplies are higher in S2 due to the higher degree of freedom defined for the operational rule curve. The results indicate the significant role of optimum operation in a river–reservoir system. Also, it is concluded that the PSO–MODSIM model can be used as a robust simulation–optimization tool for optimum water allocation and planning in complex reservoir–river systems. Considering the impact of climate change on the optimum operation of the reservoir could be considered as a scope for future studies.

## FUNDING

No funds, grants, or other support was received.

## ETHICS APPROVAL

This research does not contain any studies with human participants or animals performed by any of the authors.

## AUTHORS’ CONTRIBUTIONS

All authors contributed to the study's conception and design. Material preparation, data collection and analysis were performed by A.E. The first draft of the manuscript was written by A.E. and M.S. Both authors read and approved the final manuscript.

## DATA AVAILABILITY STATEMENT

All relevant data are included in the paper or its Supplementary Information.

## CONFLICT OF INTEREST

The authors declare there is no conflict.