Thursday, July 20, 2017

Using Multiple Operations Sets in HEC-ResSim

This post is a continuation of previous posts discussing the use of Multiple Watershed Configurations and Multiple Reservoir Networks.  These posts can be found in the locations given below:

Multiple Watershed Configurations:

Multiple Watershed Configurations Link

Multiple Reservoir Networks:

Multiple Reservoir Networks Link


Multiple operations sets can be used to test various operating criteria.  These operating criteria can include rules of operation and the definition of operating zones.

The watershed setup is shown below.




The first operations set is titled, "flow thru".  This operations set contains no rules of operation and the top of the conservation pool is set to 75 feet.  In this operations set, the following will occur:

  • Inflow will be held if the pool is below the top of conservation until the pool reaches the top of conservation
  • Top of conservation will be held by passing inflow assuming that inflow does not exceed the physical release capacity
  • If the pool is above top of conservation, the inflow plus storage above the top of conservation will be released until the pool is at top of conservation.  The limiting factor on reaching top of conservation is the release capacity.


The next operations set is titled, "max based on downstream conditions".  In this operations set, a rule has been added to limit the maximum release based on the conditions at the downstream junction, titled, "downstream control".  The operations when below the top of conservation are the same as those for the "flow thru" operations set.  When holding the top of conservation or releasing inflow and stored water to get back down to the top of conservation, the releases will be limited such that the flow at "downstream control" will not exceed 500 cfs.


The next operations set is titled, "max at dam and downstream".  This includes the same rule in the operations set shown above along with an additional rule that limits the release from the dam to 350 cfs.  Since there are two maximum release rules, HEC-ResSim will use the lower of the two maximums.  This maximum is applied when holding the top of conservation or when releasing to bring the pool down to the top of conservation.  


The final operations set is titled, "cons zone change".  In this operations set, the same rules developed in the operations set shown above apply.  However, the top of the conservation pool has been decreased from 75 feet to 73 feet.



In a future post, the development of multiple alternatives will be shown.  Developing multiple alternatives from these various operations sets allows the user to study the impacts of alternative operational scenarios.  

















































































Wednesday, July 19, 2017

Using KML files for Placemarks in Google Earth

I recently developed a map in Google Earth to show the location of Clearwater Lake on the Black River in Missouri along with the locations of downstream gages.

To place a single Placemark for Clearwater Lake, the coding is as follows:




I placed this code in a text file and then selected "Import KML File" to bring this location into Google Earth.  The result is shown below.




To put multiple Placemarks into Google Earth, I used the coding shown below.  The additional locations are Poplar Bluff, Black Rock, and Newport.





The results of importing this into Google Earth are shown below.



Saturday, July 8, 2017

Python Advanced #15 - Developing a dictionary from values in external text file

This post demonstrates how to develop a dictionary from values in an external text file.  For this example, the values are set to the flag of "true" or "false".  It may be desirable to store these values in an external text file to instruct the program whether to perform a computation or not without having users altering these flags within the code.

The external text file is named, "dicts from text.txt".  The contents of this text file are shown below.

The following is performed in the code shown below:


  • Each line is read and stored in a temporary list.
  • The values are split based on the colon between them.
  • Any extra spaces are stripped and the values are added in key:value pairs in the dictionary named "flag_dict".
  • The temporary list is cleared after each line is read into the dictionary.
  • For this example, I used print statements based on the values; however, computations could be performed based on the values.



The output from this program is shown below.



Thursday, June 22, 2017

Python Advanced #14 - Using Lambda in Python for Interpolation

In my post on November 13, 2016, I showed how to interpolate values by using a function in Python.

That function is shown below.



The full post is located here:

Link for Interpolating Values Post

The function shown above computed a flow value given a stage along with the stages and flows above and below in the rating table.

In this post, I show how to perform the same computation using lambda in Python.  The coding to do this is shown below.



The results of this computation are given below.  Since I entered 2.5 as the stage value, I would expect the flow value to return 250 based on the values that I supplied for the bounding values of stage and flow.




Wednesday, June 21, 2017

When to Use Multiple Reservoir Networks in HEC-ResSim

This post details the use of multiple reservoir networks within an HEC-ResSim model.

This post is a continuation of the post titled, "When to Use Multiple Watershed Configurations in HEC-ResSim", from 30May2017.

That post is found here:

Multiple Watershed Configurations Link

Basically, multiple reservoir networks are needed whenever you want to vary a physical parameter of the system while also preserving the original parameter.  These parameters can include:

  • Routing parameters
  • Outlet capacity or number of outlets
  • Storage elevation tables
For example, in the model shown below, I use null routing for the stream reaches.  To compare the differences in results from using various routing methods, multiple reservoir networks can be created with the various routing methods.








In this model, I have a single controlled outlet.  If the capacity of this outlet has changed or additional outlets have been added or proposed, the impacts of the physical changes can be examined by creating a new reservoir network that reflects these changes.



As I mentioned above, the impact of an updated storage-elevation table can be examined by updating that rating within a new reservoir network.  Running alternatives with the original storage-elevation relationship and the updated storage-elevation relationship, for example, can allow the modeler to determine the impact of reservoir sedimentation on peak release and peak pool elevation from an historic or synthetic event.  




Thursday, June 15, 2017

Python Advanced #13 - Computing average annual flow from a csv file

In this post I extracted daily data for the year 2016 for the White River at Newport gage from the USGS site and saved it in a csv file.  I then computed the average of the daily values from this csv file using Python.

USGS White River at Newport data

I import the data into a csv file.  A portion of the file is shown below.





To compute the average of the daily values, I use the code shown below.  To create this code, I modified an example given in a lesson from Coursera.

Link to Coursera


The code is shown below and was run using Anaconda available from the following site:

Where I downloaded Anaconda from




The result of running this code is as follows:




Note that this is the average for the entire year and not just for the values shown above.







Friday, June 9, 2017

Microsoft Excel Advanced #6 - Extracting a Value on a Specific Day and Month for Multiple Years

This post will demonstrate how to extract a value on 01 April for multiple years in Microsoft Excel.  I used the coding example from the following link to guide the development of the needed equations.

Example from stackoverflow.com

Below is the data that I am using for this example.  It is in columns A and B of the Excel worksheet.  There are three instances where the date is 01 April.




I write an IF statement that checks if the month is April and the day is 1.  If it is, a number is added to column C that represents the number of occurrences of 01 April that have occurred up to that row.



This IF statement is added to all appropriate rows in column C.  The results are shown below.




I then use the following equation in column E to extract the date if there is a value in column C.



I then use the following equation in column F to extract the value if there is a value in column C.




The results of applying these equations is shown below.



The explanation of the methods used above are as follows (from Excel help menu).
















Wednesday, May 31, 2017

Python Intermediate #9: Additional Text Formatting in Python

In Python Intermediate #8, I showed a method for text formatting.  In this post, I show an alternative method.

The first example in this post takes the values of the variables, "name" and "grade" and uses them in a simple sentence.

The coding is shown below.



The result of this code is below.




The next example uses the same method, however, the information is extracted from a dictionary named, "personal_info".  The coding is shown below.




The result of this code is below.



Tuesday, May 30, 2017

When to Use Multiple Watershed Configurations in HEC-ResSim

For many studies involving ResSim, various operating criteria are applied to an existing system.  In this post, I provide an example of using multiple watershed configurations to study the addition of a new reservoir to the system.

The figure below shows the existing system.  In this system, there is a single reservoir located on the main stem.  This configuration is named "existing system".




We can look at the details of this configuration.  Notice that the reservoir is listed as being an existing reservoir.



To model a proposed reservoir on the tributary, we can save this configuration under the name, "proposed system" and add a reservoir on the tributary.



When looking at the details of this configuration, we notice that the proposed reservoir is not listed as being an existing reservoir.





Monday, May 22, 2017

Example application of HEC-ResSim

This blog post details a study that I performed several years ago using HEC-ResSim.  I presented the results of this analysis at the 2011 U.S. Society on Dams Annual Conference.

This analysis was necessary since two of the six spillway gates at this project had the potential to become inoperable.  If this were to occur, an alternative reservoir operating plan would be needed.



The reservoir has the following pools:

  • Inactive Pool
  • Conservation Pool
  • Flood Pool
  • Surcharge Pool
The top of the flood pool corresponds to the top of the spillway gates in their closed position.  Once the pool level is projected to exceed to the top of the flood pool, the spillway gates are opened creating a surcharge operation.  However, if two gates are stuck in the down position, the surcharge operation is impacted by flow going over the top of the two gates stuck in the down position.


At this project, a family of curves is used to determine the surcharge operation.  As can be seen in the figure below, the release increases much more significantly with pool elevation changes at the higher elevations (shown by the flattening of the curves).  As one would expect, releases are greater for high inflows.  These curves define the minimum release value for a given combination of pool elevation and inflow.

 

To develop the alternative operating plan, I analyzed several combinations of a reduced top of conservation level along with alterations to the surcharge curves.  The alterations lead to a more aggressive release at a given pool elevation.  The curve below shows the original surcharge envelope curve and the revised envelope curve.  For the revised curve, the original curve is dropped down 1 foot.  However, it should also be noted that it is shifted over to the right due to the values being increased by 35%.  The original minimum required release at elevation 636.0 feet is approximately 25,000 cfs while the revised minimum required release is closer to 40,000 cfs.    

I studied historical and synthetic events for this study.  The figure below shows a comparison of results from various alternatives applied to the 1919 inflow event.  Peak pool elevations and peak releases are shown.  

For this study, there were numerous alternatives that would satisfy the desired parameters, however, some were discarded based on their impacts.  For example, in the table above, one alternative involves dropping the top of conservation down to elevation 620.0 feet.  This alternative was not desirable since it left this project with no conservation storage.


Sunday, May 21, 2017

Setting a Release Value based on Conditions on a Specific Date in HEC-ResSim

This post demonstrates the use of state variables to set a maximum release from a dam based on conditions on a specific date.

The first state variable that I created is named "relcode".  In this state variable, I am setting a release code based on the pool elevation on 02 April.  This code can be either 1, 2, or 3.  The code remains at its current value if the date is not 02 April.


The second state variable is named "maxrel".  In this state variable, I receive the value of "relcode".  Based on that value, I then select the maximum release from the list within the state variable.


Since I initialized "relcode" to a value of 1, the maximum release is 400 cfs until the computation on 02 April occurs.  Once this occurs, the pool elevation is high enough to allow for a release of 1,100 cfs.  The use of the state variable in the rule set and the results of the simulation are shown below.


The release is shown by the green line on the bottom plot.  


This is a simple demonstration on setting and holding a release based on the conditions at a given time step.  Caution should be exercised in implementing this type of rule.  In the example above, it should be noted that the maximum release would be held until 02 April occurs again.  If this is the desired operation, the rules are sufficient; however, if it is not, additional rules would need to be written to incorporate the rules of operation.

Sunday, April 23, 2017

Use of Interface with Scripts and State Variables in HEC-ResSim

This post will demonstrate the use of the interface for scripts and state variables in HEC-ResSim.  This will be done by obtaining the day of each time step in a model simulation.

The time step in this model is hourly.

To obtain the day, I look at the methods that are available in the HecTime class.  I notice that there is a day() method available.



To get the details of this method, I look at javadocs (available in the installation of the HEC-ResSim software) under hec.heclib.util.  From the figure below, I can see that this method returns the day of the month in integer format.


I now need to look at how to access this method for the current time step.  Under the RunTimeStep class, I see a method termed getHecTime().


I look in hec.model.RunTimeStep in javadocs to get more information on this method and see that I can access the methods under the class HecTime by using this method.


In the code, I ask to get the day() method under the HecTime class by using the getHecTime() method under the RunTimeStep class.  I also add a print statement to test what this is giving me.


I look in the console log to see the result of this code.  Note that the day is repeated several times since this is an hourly time step model and the code is run at each time step.