Friday, June 17, 2016

Error message of "Start Date must be after Lookback Date" (Windows date and language settings)

Special thanks to HEC for providing me with additional information regarding this error message:

"Many international users get that error because ResSim only understands dates when the Windows date and language settings are set to US English.  So, even when they set up their dates properly, ResSim may return that error unless they make a change to the Windows date and language setting."

Below is a link to instructions on how to make that change:

Tuesday, June 14, 2016

Using Python Dictionary Script in ResSim

This post shows how to use the Python dictionary script created in the 29 April 2016 post within HEC-ResSim.

The model used to show this example is a simple one reservoir model with 1,500 cfs entering the model at its upstream end (CP1).

The top of conservation is at 50 ft.

This model utilizes a scripted rule that is applied to both the Flood Control zone and the Conservation zone.

When you create a scripted rule, the script editor appears.  Your code will be entered after the "# add your code here" comment.

The code looks very similar to the Python script shown in the earlier post.  However, in the earlier post, I showed pool_elev as a constant since it was not connected to the ResSim model.  Now that the script is in the ResSim model, I can access the pool elevation at each time step of the simulation.  It is performed with two lines of code explained in more detail below.  The pool elevation and release are related in the rating dictionary.  So, for instance, a release of 1,000 cfs is related to elevation 50 ft while a release of 1,200 cfs is related to elevation 60 ft.

To get the pool elevation at each time step, I first need to access the pool elevation time series.  This is done by double-clicking "Pool Elev" for the reservoir of interest in the interface found to the left of the code.  

 The following appears in the code after double clicking "Pool Elev".

This is indicating that I want to access the pool elevation time series for "reservoir one".  I then make it an object by assigning that statement to pool_ts (this can be any name that you decide).


I then obtain the value at the previous time step of that object.  I prefer to extract the previous value on computed values such as the pool elevation since the current value may not have been computed.

Other than the two lines of code shown above, the code should look very similar to what I developed in the 29 April 2016 posting.  With it already having been tested outside of ResSim, the incorporation into ResSim was relatively easy.

The value of the rule at each time step and the type of rule are then sent to ResSim via the line of code shown below.  It is already present in ResSim when you initially create a scripted rule.  You simply need to indicate if it is a minimum release rule (RULETYPE_MIN), maximum release rule (RULETYPE_MAX), or specified release rule (RULETYPE_SPEC).  Additionally, the value of the rule is also indicated.  For this script, the value of "project_rel" is used as the value of the scripted rule.

The results of the simulation are shown below.  After the lookback period, the release drops to zero since the pool is in the conservation zone and no minimum release is required.  Once it rises into the flood pool (above 50 ft), ResSim wants to release as much as possible, however, the script limits this release.  Since the maximum release is interpolated based on the pool values provided in the dictionary, the release increases with increasing pool elevation.