SedSim: A River Basin Simulation Screening Model for Reservoir Management of Sediment, Water, and Hydropower

SedSim is an open-source model for simulating water and sediment flows, and hydropower production, in networks of reservoirs and river channels. SedSim enables water resources systems analysts and planners to explore alternative system configurations of reservoir sites, designs (i.e., dam outlet structures), and operating policies (SDO), and their implications for water flows, sediment transport, reservoir sediment trapping, and hydropower production in any river basin. The model enables simulation of a wide range of reservoir sediment management techniques, including flushing, sluicing, density current venting, bypassing, and dredging. The source code is written in the Visual Basic for Applications (VBA) language. The model is freely available at www.github.com/FeralFlows/SedSim.


Introduction
SedSim is an open-source, daily time step river basin model for simulating water and sediment flows, and hydropower production, in networks of reservoirs and river channels. The model permits users to simulate alternative configurations of reservoir sites (i.e., locations), designs (e.g., dam outlet structures), and operating policies (SDO), and explore their implications for water flows, sediment transport, reservoir sediment trapping, and hydropower production in any river basin. The model's core strength is its ability to perform empirically-based simulations of reservoir sediment management techniques for passing sediment through and around reservoirs, as well as the implications of these sediment management strategies for hydropower production and hydrology. Thus, the model is expected to be used for evaluating sediment management policies in river basins that have experienced (or will experience) extensive reservoir development. Techniques available in SedSim include sediment passthrough (sluicing, density current venting, and bypassing) and removal (flushing and dredging) [1][2][3]. SedSim is a screening model, in that its ideal use is to evaluate the relative performance of multiple alternative river basin infrastructure planning and management configurations, for purposes of identifying a subset of potential options worth exploring with more detailed (e.g., physicallybased) simulation or optimization models. SedSim is deterministic, in that it is designed to simulate a single sequence of daily mass balance in river channel segments and reservoirs, rather than multiple sequences in a Monte Carlo fashion.
SedSim was originally developed at Cornell University in 2011. It can be applied in any river basin, though it has been extensively applied in support of stakeholderled exploration of alternative river basin infrastructure planning and management scenarios in the Mekong River Basin [4][5][6][7][8][9]. The model was developed in the Visual Basic for Applications (VBA) language for purposes of facilitating user interaction with the model via a Microsoft Excel spreadsheet. The model has been used to study the potential for basin-wide sediment trapping in reservoir cascades, and the impact of this trapping on hydropower production, in the Se San, Sre Pok, and Se Kong (i.e., "3S") River basins within the Mekong basin [4]. It has also been used to study hydropower-sediment tradeoffs at individual dams in the Mekong basin, such as Sambor Dam [5] and Lower Se San 2 Dam [6]. Previous work has detailed aspects of SedSim's theoretical development, particularly its treatment of sediment transport [10]. Additionally, the SedSim Github repository contains a user manual with detailed coverage of SedSim's theoretical foundations (e.g., equations describing simulated processes).
River basin simulation models like SedSim often include representations of natural physical processes, which describe how water and sediment move through the natural landscape (e.g., rainfall and runoff); as well as management processes, which describe the various ways in which these natural processes may be modified by infrastructure (e.g., management of water and trapping of sediment in reservoirs). SedSim is limited in its representation of detailed natural physical processes. SedSim accounts only for routing of flows through networks of river channels, relying on external models (as discussed below) for the other processes, such as rainfall, runoff, and groundwater-surface water interactions. With respect to sediment, models are often classified as either loading models, which account for production of sediment suspended in watershed runoff, or as receiving models, which route sediment through channels and reservoirs [11]. SedSim is a receiving model, designed to receive input from a loading model (e.g., SWAT [12]). An important difference among receiving models is the degree to which sediment management processes are included. SedSim includes the trapping of sediment in reservoirs, the distribution of that sediment within reservoirs' storage geometry, and the various ways in which sediment can be removed or passed through or around reservoirs.
Any SedSim simulation consists of a user-defined network of river channel segments and reservoirs connected by junctions, as shown in Figure 1. The model maintains a mass balance of water and sediment in each of these system elements in each daily time step. SedSim employs relatively simplistic (e.g., empirical) approaches to representing complex sediment processes, largely to ensure they are simple enough to be applied in datalimited settings. In keeping with its intended use in a screening setting, SedSim simulates a single median sediment grain size rather than a grain size distribution. As shown in Figure 1, water and sediment can only enter the modeled system at junctions. As such, user-specified flows at junctions represent incremental, rather than cumulative, daily water and sediment runoff from the local watershed. The local watershed represents the contributing watershed area between successive incremental flow junctions. At the junction, these locally produced flows are then added to any upstream flows before being routed downstream. Note that junctions do not need to have incremental flows. Junctions with no incremental flows will only receive inputs from upstream simulation elements. SedSim does not simulate rainfall, runoff, and sediment production processes. Instead, these model inputs must be externally gathered (e.g., from gage station data) or generated (e.g., simulated with a separate model). For example, several studies have soft-coupled a calibrated Soil and Water Assessment Tool (SWAT) with SedSim for use in the Mekong River basin [4][5][6][7][8][9]. In data-limited river basins where sediment data may be sparse, SedSim also offers the ability to specify parameters for a rating curve function that describe daily sediment load production as a function of daily hydrologic flow, which can be calibrated using (1) suspended sediment concentration and flow time series data, or (2) estimates of annual sediment load [13]. Water and sediment incrementally entering a junction in a given day immediately enter the next downstream channel segment or reservoir and are thereafter routed through that downstream element along with any sediment and water entering from upstream. Figure 1 depicts this routing process for an example river channel segment i. Channels are assumed to be unregulated by hydraulic or other structures. SedSim thus offers several water flow routing options for determining outflow from river channel segments (as discussed in the user manual), including userspecified rating curve equations. This outflow rate is then used to route sediment through the channel segment. Specifically, as shown in Figure 1, each channel segment is assumed to have a ' carrying capacity' [14] to produce suspended sediment in its outflow as a power function of its already determined water outflow rate. As described in detail in the user manual, users can either pre-specify the channel carrying capacity parameters, or can allow the model to calibrate these parameters with the objective of reproducing each river channel segment's natural long-term sediment discharge characteristics [10]. If the concentration of sediment suspended in the water column exceeds the channel's carrying capacity, some sediment settles to the channel bed (i.e., deposition dominates). Otherwise, sediment is scoured from the channel bed (i.e., resuspension dominates). In contrast to channel segments, reservoirs are assumed to be regulated by a dam. A dam's daily outflows are determined by a user-defined operating policy, subject to constraints related to the dam's outlet works and that is designed to meet primary operational objectives.
The model includes representations of reservoir sediment trapping, distribution, and management processes (as shown in Figure 1). The fraction of inflowing sediment mass trapped in a reservoir during each time period, or trapping efficiency, is determined as a function of sediment size and residence time of water in the reservoir [15]. This results in declining trapping efficiency with declining storage capacity, which is an important but often neglected reservoir sedimentation process [16]. Figure 1 also shows that the model distributes deposited sediment within the reservoir's active and dead storage zones per user assumptions (using the approach described in [17]), thus reducing over time the reservoir's water storage capacity at elevations at which deposition occurs. This, for example, captures the impact of sedimentation on hydropower operations, which typically rely on active storage volume at the reservoir's upper elevations. Figure 1 does not depict SedSim's representations of sediment management processes, which are relatively more complex and therefore appear in the model user manual. In general, SedSim employs empirical approaches to simulating the sediment passage effectiveness of flushing [18], sluicing [19], and density current venting [20,21].
It is important to briefly mention that while other modelling tools are available that perform certain aspects of SedSim's functionality, we are aware of none that perform all of SedSim's functionality. Sediment management-focused models typically represent only a limited number of alternative sediment management strategies, such as flushing [22][23][24], and do so at fine resolution. Detailed simulations also tend to be more computationally inten sive and are difficult to embed within a broader multi-reservoir network simulation. For example, HEC-RAS [25,26] and Mike21C [27] offer physically-based simulations of management processes such as sluicing and flushing. Conversely, SedSim enables screening-level (i.e., less detailed) assessments of multiple alternative sediment management strategies for large-scale multi-reservoir systems. Before considering simulating particular reservoir sediment management techniques with SedSim, an external model such as the REServoir CONservation (i.e., RESCON) model should first be used to assess the economic and technical feasibility of those techniques given the reservoir's site-specific characteristics [28].

Implementation and architecture
As summarized in Figure 2, an execution of the model constitutes three key steps: (1) importing data; (2) executing the simulation by running VBA code; and (3) exporting time series, statistical, and runtime output data files. Each of these steps warrants additional discussion.
Referring to the top of Figure 2, the user is required to specify one Microsoft Excel-based input file (e.g., "Input_ Data_File.xlsx"), referred to henceforth as the input file. The input file is an Excel workbook containing multiple worksheet (i.e., tabs). The required input file format for each worksheet is detailed in the SedSim user manual. Each worksheet corresponds to a different data type, such as reservoir specifications, or reservoir inflow data.
Some worksheets are required, such as the user-defined "Network connectivity" worksheet defining reservoirs, river channel segments, and junctions, and their spatial relationships. Conversely, some worksheets are optional, such as one pertaining to downstream environmental flow targets for reservoirs. The paper's Github repository provides an example input file template for users as a reference, though users may create their own input file as long as it conforms to the formatting requirements described in the user manual. SedSim is object-oriented in design only in the data input and output modules, as inputs and outputs are organized in VBA workbook  figure). Finally, the model produces time series, statistical, and runtime output files for all user-defined system locations (bottom of figure).
objects, which contain worksheet objects, which contain range objects and worksheet function objects. The VBA code that runs the model is contained within an Excel-based macro ("SedSim.xlsm"). Upon opening this file in Microsoft Excel, users should see the "Run Model" worksheet. Users should populate this worksheet with specifications regarding the locations of input and output files. After providing these specifications, users can run the model by clicking on the "Run SedSim" button within the "Run Model" worksheet. The VBA code can be accessed by opening the main model file and keying in "Alt + F11". Then, referring to the left-hand side menu, open "SedSim_ MODEL" under the "modules" section to see the code.
The SedSim code itself is organized into 8 core subroutines. As shown in Figure 2, a top-level sub-routine (i.e., master caller) is responsible for executing each of the eight lower-level sub-routines. Any simulation begins with the master caller invoking two data import sub-routines. The first data import sub-routine is geared toward creating the simulation network of reservoirs, river channel segments, and the junctions that connect them. The second data import sub-routine is geared toward reservoir operation and design specifications, including sediment management. Next, if specified by the user, a sediment calibration subroutine is called to calibrate the parameters at junctions and river channel segments that define the production and transport of sediment. The calibration, which uses Excel's built-in solver, seeks to identify the values of parameters that produce mean annual sediment loads at junctions and river channels that reflect the long-term mean annual sediment production values specified by the model users. This calibration, which is optional and reflects the most data-sparse modelling circumstance, is discussed in [10] and in the user manual. To avoid calibration, users may simply specify a time series of daily sediment loads (e.g., outputs from a separate model), or a relationship between daily hydrologic water flows and the sediment loads transported by those flows (i.e., a sediment rating curve).
Having conducted data import and calibration, the main simulation sub-routine advances through daily time steps, where each time step requires conducting a mass balance for all system elements (i.e., channels, reservoirs, and junctions). The system elements are simulated in an order that ensures mass balance of upstream elements is conducted before downstream elements. The Channel sub-routine is called for unregulated elements, whereas the Reservoir sub-routine is called for regulated elements. Junctions do not store mass; rather, they are used to distribute mass to downstream reservoirs and channels. Hence, a sub-routine is implemented at the end of every time step at each junction to determine how much water and sediment mass will be available to distribute to downstream elements in the next time step.
After completing all daily time steps, the model performs statistical post-processing of time series output data. The time series data are exported to an Excel spreadsheet for select SedSim state variables, and statistics corresponding to those state variables are provided in a separate statistics Excel worksheet. Information is printed to the runtime file continuously throughout the simulation.

Quality control
Before applying SedSim to any unique case study, users should consider first running the example SedSim model application provided in the publication's Github repository. This example model application is a 43-reservoir system in the Se San, Sre Pok, and Se Kong tributaries of the Mekong River basin. This transboundary river basin includes territory in Cambodia, Laos, and Vietnam. Numerous key model features are demonstrated in this example model application, including (1) multi-reservoir simulation; (2) multi-purpose reservoirs, including reservoirs with and without hydropower plants, and reservoirs with diversion outlets directing the dam's discharge to some location other than directly downstream; (3) reservoir operating rule curve simulation; (4) reservoir environmental flow requirements; (5) calibration of sediment production and transport parameters; and (6) reservoir sediment management techniques, including flushing, sluicing, density current venting, bypassing, and dredging. This application has been previously published and validated [4] as part of a broader study led by the Natural Heritage Institute. Note that the example model application's simulation duration is limited to five years to reduce data storage requirements and simulation wall clock time.
To run the example, follow the "Getting Started" directions specified in the SedSim user manual regarding how to set up the model, including specifying file paths and modifying Excel settings. Additionally, the Github repository provides the statistical output file, time series output file, and runtime file that should be produced during the example model run. Users interested in confirming SedSim is running correctly on their local machine should compare their output files to those provided in the /example directory on the Github repository. The model is deterministic rather than stochastic, so user results should be identical to the provided results.
Having run the example case, users should then be prepared to evaluate whether or not their unique application of SedSim is running correctly. If a major error occurs during model execution, SedSim may produce messages that appear to the user on the screen, describing the reason for the error. Most errors will occur as a result of incorrectly formatted input data file worksheets. SedSim may also automatically take you to the location in the code where failure occurred, which may help you in debugging your error. Finally, users have the option of producing runtime output during the execution of a simulation. This will print information to a text file as a simulation runs. Each row represents a new piece of information. The information in the runtime files includes the current time step, the current system elements (e.g., reservoirs) being simulated, the model sub-routines (in Figure 2) being run, and a confirmation of a completed simulation. This runtime file may guide users in debugging model issues that arise, given it specifies which model components ran successfully up until the error. Importantly, producing a runtime file is optional, because writing to the runtime file slows down simulation speed, and the runtime file can become large in size.
Users can confirm that the simulation has been successful by checking that the model produces a "simulation complete" message, along with the wall clock duration of the run. Given SedSim is a mass balance model that conserves mass, a successful completion of a model run is confirmation that mass is balanced across system elements. The model has been applied in real river basin infrastructure planning contexts, and thus its mass conservation skill has already been thoroughly evaluated. Users wishing to confirm this separately can do so using time series model outputs for sediment and water fluxes across system elements.

Operating system
SedSim has been successfully tested on Windows7.

Programming language
Microsoft Visual Basic for Applications (VBA), version 7.1

Additional system requirements
SedSim is capable of simulating networks containing many reservoirs and river channels. In such applications, a minimum memory size of 8 GB is recommended to run the model. However, note that the required memory size will depend upon the number of elements being simulated and the time horizon of the simulation. Memory capacity will also affect how quickly the model executes.

Dependencies
SedSim does not have any package dependencies, but it does require access to Microsoft Excel and Microsoft Office Visual Basic for Applications (VBA).

List of Contributors
In addition to the authors of this publication, the model was developed and tested with frequent input from numerous Mekong River basin scientists and engineers who contributed to testing and improving SedSim throughout its development during workshops and training sessions

(3) Reuse potential
SedSim is a generic river basin simulation model that can be applied in any river basin of interest, provided basic data are available regarding reservoir specifications (e.g., location and size) and natural processes (e.g., hydrologic flows and sediment loads). The model has been widely tested and applied in the Mekong River basin, as previously discussed. The model can be used in both single-and multi-reservoir simulation contexts.
Currently the model only supports simulation, as opposed to optimization. The model is best reused in a simulation screening setting to evaluate the potential performance of multiple alternative infrastructure options. After the screening stage, more detailed analysis of a subset of options identified with SedSim can be conducted with a more detailed simulation or optimization model. Users interested in optimization (e.g., reservoir operating policy optimization) could consider coupling SedSim with an external optimization algorithm. However, this would require code modification to vary key control variables such as reservoir operating policy parameters. Instead, users interested in optimization functionality are encouraged to use the open-source PySedSim model. Currently under development (https://github.com/FeralFlows/pysedsim), PySedSim will be a Python-based implementation of SedSim that adds stochastic optimization and stochastic simulation functionality and has been successfully applied [29]. Support for SedSim will continue despite the availability of PySedSim. SedSim was designed for use in data-limited settings, so a range of data can be used as model input. For example, with respect to sediment production, users have the option of specifying daily sediment loads (e.g., from an external model or a gage station) at multiple distributed locations in a river basin. Alternatively, in the absence of such data, users can instead specify annual sediment loads at one location in a river basin, spatially allocating production of these sediment loads throughout the river basin. Another example of this flexibility is that multiple dam control outlets can be specified in detail, including stage-capacity curves, or alternatively a single generic outlet can be specified. Users are referred to the user manual for more details.