Pages

Showing posts with label HECRASController. Show all posts
Showing posts with label HECRASController. Show all posts

Tuesday, January 2, 2018

Considerations of River Ice Breakup Uncertainties in HEC-RAS

A fantastic blog post by Mr. Juha Aaltonen of the Freshwater Centre of Finnish Environment Institute SYKE.  In his post, Mr. Aaltonen discusses river ice breakups and the advantages of incorporating uncertainty into river ice modeling in HEC-RAS.  He was able to do this by harnessing the power of the HECRASController as detailed in "Breaking the HEC-RAS Code".

While his post is specific to river ice breakup modeling, uncertainty can be used for just about any HEC-RAS application.  Give Mr. Aaltonen's post a read here:

http://www.hyokyaaltonen.fi/consideration-of-river-ice-breakup-uncertainties-in-hec-ras/


Friday, December 29, 2017

River Ice Modeling using HEC-RAS. New Forum!


Image courtesy JLH3Photography via Creative Commons.
license
Hello to everyone in the international River Ice Community! The RAS Solution has a new forum dedicated to river ice modeling with HEC-RAS.  This forum was developed for those who use HEC-RAS to simulate river ice covers and river ice jams. Please post your questions, comments, and insights in the HEC-RAS River Ice Modeling sub-forum which can be found here.  The RAS Solution is especially interested to hear how you have addressed difficult ice problems with HEC-RAS. 



HEC-RAS allows the user to model ice-covered channels with known ice properties, or to simulate wide-river jams. In the first case, the user specifies the ice cover thickness and roughness at each cross section. Different ice cover thicknesses and roughnesses can be specified for the main channel and for each overbank, and both can vary along the channel. In the second case, the ice jam thickness is determined at each section by solving the ice jam force balance equation. The ice jam can be confined to the main channel or can include both the main channel and the overbanks. The material properties of the wide-river jam can be selected by the user and can vary from cross section to cross section. The user can specify the hydraulic roughness of the ice jam or HEC-RAS will estimate the hydraulic roughness on the basis of empirical data. 


Image courtesy of Steven F.Daly, Ph.D., USACE ERDC/CRREL

The river ice capabilities of HEC-RAS were developed over 20 years ago through a joint effort by the HEC-RAS team at HEC and the Corps of Engineers’ Cold Regions Research and Engineering Laboratory (CRREL). Since that time, HEC-RAS with ice has been applied in rivers all around the world. It has been applied in river systems larger and more extensive than were imagined at the start. Recently, the HECRASController has been used to systematically vary the ice parameters over the course of hundreds (if not thousands) of separate simulations. 

Image courtesy of Steven F.Daly, Ph.D., USACE ERDC/CRREL




Thursday, June 23, 2016

Tips and Tricks for Modeling Irrigation Canals and Structures in HEC-RAS

Written by Brian Wahlin, Ph.D., P.E., D.WRE | WEST Consultants
Copyright © The RAS Solution 2016.  All rights reserved.

In an earlier blog post, we discussed some details regarding modeling overflow gates in HEC-RAS.

These gates are typically used in irrigation canals. This blog post generated many interesting questions and comments regarding modeling irrigation canals in general using HEC-RAS. Thus, we felt it might be interesting to address some of these questions in a blog post devoted solely to modeling irrigation canals and structures using HEC-RAS.


One of the questions from the overflow gates blog post was:

“I have a question about external data interface for canal automation (EDI). I wanted to know if the project was success full [sic] and could simulate the real canal system.
I have seen in some articles that using Saint Venant equations is too complicated for canal automation purposes and needs lots of data. Instead they suggest to use industrial control system approach. Furthermore, in a book which has been published by ASCE http://www.asce.org/templates/publications-book-detail.aspx?id=6965, they suggest that to use similar approaches. I want to know your opinion.”

This question covers many topics from modeling irrigation canals using HEC-RAS to designing automatic controllers for irrigation canals.  It also references a project we completed several years ago where we linked an unsteady HEC-RAS model of the Central Arizona Project (CAP) Canal to a Supervisory Control and Data Acquisition (SCADA) program so that the operators of the CAP Canal could be trained using a hydraulic model rather than by operating the real canal.  CAP has an extensive SCADA system that allows them to monitor and control the entire 336-mile canal from their central control room.  

This is similar to the concept of how pilots are trained using a flight simulator instead of flying a real plane.  In a way, we created a “flight simulator” for canal operators.  To make this project successful, we had utilized many of the HECRASController routines and had to create a program that linked HEC-RAS to the SCADA system.  We called this program the External Data Interface (EDI).  We are also pleased that the question references the newly published ASCE Manual of Practice (MOP)131 Canal Automation for Irrigation Systems. This new publication is intended to be an update on recent advances in canal automation.  On a side note, I was one of the editors for MOP 131, so thanks for the plug on the book!

In reading this question, we first need to clarify something. As the reader points out, it is true that using the St. Venant equations to design a controller is not a good idea because of the non-linearity of those equations. Thus, controllers are typically designed using some sort of linearized approximations of the system (i.e., industrial control system approach).

However, when testing the performance of a designed controller, it is no problem to test them via simulations using the full St. Venant equations using unsteady HEC-RAS. In fact, you want to do this to make sure that the designed controller (designed using simplified linear approximations) will behave as expected in the real nonlinear world.

The EDI program that the reader refers to did work successfully. We were able to model the unsteady hydraulics of the CAP Canal successfully and had calibration data to verify the model performance. In this particular project, we did not actually design feedback controllers or test the controllers via hydraulic simulation as that was not the goal of the project. Instead, we used the EDI as an interface between the HEC-RAS model of the canal and the SCADA system used to manually monitor and control the canal (manual-centralized control). As mentioned earlier, the EDI program was crucial in making the canal operator “flight simulator” work. A schematic diagram of how the “flight simulator” for irrigation canals is set up and how the EDI program fits into this scheme is shown below. Note that the SimSuite program in the figure is a program that emulated field hardware and maintained physical information such as gate positions, water levels, and turnout flows.  SimProctor is a program used to assist in the training of the canal operators.



After posting the above response, the reader came back with a series of questions.  So, let’s go through these follow-up questions:

1.   “I was wondering if there is any publication available for the methodology which has been implemented in this project.”

      Yes, the results of our “flight simulator” project for the CAP was published in the proceedings for a US Committee on Irrigation and Drainage conference a few years ago.  We will also be speaking about this topic again at the upcoming ISHS conference in Portland in June 2016.  A link to the ISHS conference paper is given here:  https://drive.google.com/file/d/0B0bpiyLiUeRXRzBoUW9IRlpLQ28/view?usp=sharing
    
      2.  “How did you calibrate the model?”

      CAP collects data for the canal on a regular basis.  These data include water depths, gate openings, and flow rate estimates.  We used this information to adjust gate discharge coefficients and Manning’s roughness coefficients to perform the calibration of our model of the canal.  If you are doing an unsteady calibration, you will want to have the initial conditions start off at a steady state condition.
   
      3.   “Did you calibrate the pools one by one or calibrated [sic] couple of pools together?”

      Adjusting the gate discharge coefficients and Manning’s roughness coefficients can affect the water levels upstream and downstream if the gates are submerged.  Thus, we adjusted the gates one at a time, but always checked to make sure that the entire system calibration looked good as we were moving from one gate to the other.

      4.  “How did you model turnouts in HEC-RAS? Did you have instability issues in the turnouts?”

      Yes, we modeled turn outs.  The turnouts on the CAP Canal are locally automated to deliver a constant flow rate to the turnout regardless of the water level or flow rate in the canal.  Thus, the turnouts were modeled as constant outflow hydrographs (unsteady).  If you are doing a steady model, the turnouts would be modeled as a flow change location.  If you want your turnout to have the flow vary as a function of head in the canal, then you can place a lateral structure where the turnout is located and then put a gate on that lateral structure.  RAS will then calculate the flow through the gate based on the head from the water surface in the main canal.  If you are not modeling the water after it leaves the turnout, just have RAS remove the water from the system.  If you are modeling the water after it leaves the turnout, you will have to create another reach in RAS to model the lateral canal that the water from the turnout flows into.  You should not see instability issues due to turnouts. The photo above shows a typical turnout structure on an irrigation canal.

      5.   “Can HEC-RAS model water levels with +/- 5 centimeter accuracy in irrigation canals?”

      That really depends on how accurate your data are.  If you have poor information about your canal (e.g., you don’t have as-built plans or there has been settlement in the lining or there is lots of seepage), then you may not be able to get 5 cm accuracy.  Probably the largest uncertainty in the canals will be the flow rates.  You most likely will not know the flows in the canal to with +/- 5% unless you have very accurate flow measurement devices installed.  One suggestion would be to run a sensitivity test on the canal by varying the flows to get an idea regarding how much the water surfaces will fluctuate due to the uncertainty in your flow rates.

      Typically in an irrigation system, the water level upstream of a check gate is the “most important” depth.  The predicted water level at this location heavily depends on the gate discharge coefficient and the Manning’s roughness coefficient.  So if you do not know the gate discharge coefficient (and don’t have any calibration data to determine what it should be), then the water levels upstream of the check can be off by quite a bit.  The plot below shows the calibration results for an irrigation canal, where the diamond shapes indicate observed water levels. You can see from this plot that our calibrated model agrees well with some of the observed data points.  For other data points, there is some difference between the computed results in HEC-RAS and the observed data. Most likely, the areas where our calibration did not agree well were a result of the uncertainty in the observed data or flow rates.



6.  “What parameters did you put from [sic] designed controller in HEC-RAS?”

      Feedback controller design for irrigation canals in a complex topic.  We like to design the controllers for an irrigation canal using a linear approximation of the real canal using something called the integrator-delay model.  Using this model, the only two parameters needed to design the controller would be the delay time and the backwater surface area behind the pool. Both of these parameters can easily be obtained using your HEC-RAS model. These parameters are needed for each pool in your system.  Of course, these parameters can change as the flow rate changes, so if you design your controller for one flow rate and operate it at a completely different flow rate, the controller performance will not be as expected.  For canal pools that are completely under backwater, controller design is more complicated because of resonance that results from reflection waves. Details on modeling canals for controller design can be found in the ASCE MOP 131.  To actually design the controller, you can use techniques like Linear Quadratic Regulator or Model Predictive Control.  All of these topics are described in the ASCE MOP 131.

      7.  “Is it possible to use such approach for earthen canals? Do I need to re-calibrate the model after couple of years due to sediment and weeds?”

      Yes, you can use HEC-RAS to model an earthen canal.  Sediment and weeds can influence the Manning’s roughness coefficients.  Thus, the canal may respond differently over time due to weed growth and sediment, so this is something that you should consider. The figure below shows weeds growing along the banks of an earthen irrigation canal as well as along the bottom of the canal. These weeds were seasonal and only appeared in the summer months.  Another issue would be canal seepage in earthen canals.  If you performed a seepage test on a canal pool, you could get an estimate of the rate of water loss from the pool.  You could then model this seepage from the canal using unsteady outflow hydrographs or possibly the groundwater interflow internal boundary condition.  Without performing a seepage test, you would really need very good (and detailed) calibration data to determine the seepage losses.


8.  “Do you have any instability issues due to sudden opening/closing of the gates?”

      You can have instabilities any time you make a sudden change in RAS while using unsteady flow.  However, we have typically been able to get around these problems by adjusting the time step, the cross-sectional spacing, and the HTABs.  The CAP Canal model we mentioned had an inverted siphon immediately downstream of the check gates.  When the gates were slammed shut, the siphon would dry up and crash the model.  In this unique situation, pilot channels helped eliminate the instability.

      9.  “Have you built any physical model in a lab for irrigation canals and made a HEC-RAS model of the same canal and then compared the results?” 

      No, we have not done that and do not know of any situations where this has been done.

      10.  “Is it possible to use HEC-RAS to model sediment transport in irrigation canals? Is this model reliable?”

      Yes, it is possible to use HEC-RAS for sediment transport in irrigation canals.  A sediment transport model for an irrigation canal would be just as reliable as any other sediment transport model, which means it really depends on how the model is set up, what data are available, etc.  Care needs to be taken to use the correct sediment transport function for the canal.  Alternatively, there is a model developed specifically for sediment transport in irrigation canals called SETRIC, which was developed by IHE in the Netherlands.  If you are concerned about modeling the sediment transport in an irrigation canal, SETRIC may be a good option for you.



Thursday, October 29, 2015

Breaking the HEC-RAS Code – 1 Year!

Well it’s been one year since I published “Breaking the HEC-RAS Code”.  It was a lot of work, but I am very pleased to see how many people are making use of the book controlling and automating HEC-RAS with their own codes.

 

For those of you who haven’t discovered it yet, this book introduces the HECRASController, an API that gives you the ability to control HEC-RAS from an external application.  If you have HEC-RAS installed on your computer, you already have the HECRASController!  The book is written around Visual Basic for Applications (VBA), since most HEC-RAS users have Excel and many are already at least somewhat familiar with the VBA programming language embedded within.  However, many readers of my book have expanded the concepts presented to other programming codes like Python, R, C#, Matlab, etc with great success. 

“Breaking the HEC-RAS Code” unlocks the secrets to using the HECRASController.  If you would like more information about this book, or the companion Excel workbook that contains code written for every HECRASController procedure plus example code for a variety of applications, follow the link below or shoot me an email. 

Breaking the HEC-RAS Code

For those of you already making use of the HECRASController, let me suggest visiting The RAS Solution forum and posting examples and/or questions about your experience to the HECRAS Controller sub-forum.  Good luck breaking the HEC-RAS code!

Monday, January 26, 2015

HECRASController VBA Code-Companion to “Breaking the HEC-RAS Code”

Written by Christopher Goodell, P.E., D.WRE  |  WEST Consultants
Copyright © The RAS Solution 2015.  All rights reserved.

There has been a lot of demand from new owners of the book “Breaking the HEC-RAS Code” for example code in VBA form.  So…here it is!  Aside from the obvious fact that you wont have to re-type code from the book into your own Excel VBA modules, this Excel Workbook provides the benefit of seeing how each and every procedure in the HECRASController works.

 image
That’s right, every subroutine, and every function are documented in this workbook, along with example code from a wide range of HEC-RAS automation procedures and some code snippets for error catching and string manipulation-very important when reading/writing HEC-RAS input files.  In total, there are over 150 procedures and over 8000 lines of code for you to use for help while you create your own HEC-RAS automation projects.


Each procedure from the HECRASController is demonstrated in either a subroutine or function in this Excel Workbook.  Each demonstration provides up-front commentary including the procedure's name, what it does, cautions and pitfalls to look out for, as well as what standard HEC data set it was tested with (i.e. Bald Eagle Creek, Beaver Creek, etc.). 


image
There’s also commentary all throughout each demonstration so that you’ll know exactly what each block of code does.  

The HECRASController VBA Code Excel Workbook will make a valuable companion to “Breaking the HEC-RAS Code”.  Every bit of code presented in the book is available in digital form in the Excel Workbook.  The HECRASController VBA Code is optimized for Version 5.0 of HEC-RAS. It will work right now with the current beta release, and will work with the official version when it is released.  

The HECRASController VBA Code Excel Workbook is available here:



Wednesday, January 7, 2015

Updated Errata Sheet for Breaking the HEC-RAS Code.

For all of you who have a copy or are planning to get a copy of "Breaking the HEC-RAS Code", there's an updated Errata Sheet on the bottom of the "Book" page of this blog.  Although I spent a LOT of time hunting down and correcting errors before publishing, it's inevitable that some of these will show up.  As always, please let me know if you find any more.

And also, many of you have already emailed me with examples of code you've written by using the techniques presented in the book.  I love it!  Thanks.  Keep up the good work and if you've written something you think will be useful to others, or you just want to show off :-), please post it in the forum under the HECRASController sub-forum.

Wednesday, December 31, 2014

New HECRASController Forum

Happy New Year RAS Modelers-

I've added a new sub-forum for HECRASController users to post questions and comments specific to the HECRASController and to submit sample code that you would like to share with others.  As you do more and more programming with the HECRASController, please consider sharing some of your useful code with others.  I plan to periodically post code both from the book "Breaking the HEC-RAS Code", and from real projects I've worked on.  A good primer for controlling HEC-RAS using the HECRASController is located here.

The new forum can be found in the forum tab on the top of this page, or by following this link.  "Breaking the HEC-RAS Code" is available from my e-store and from Amazon and other on-line book retailers.

Have fun!

Friday, October 31, 2014

New Book - “Breaking the HEC-RAS Code” now available!

FrontCover 
One of the most powerful, yet relatively unknown features available in HEC-RAS is the HECRASController.
The HECRASController API has a wealth of procedures which allow a programmer to manipulate HEC-RAS externally by setting input data, retrieving input or output data, and performing common functions such as opening and closing HEC-RAS, changing plans, running HEC-RAS, and plotting output. HECRASController applications are seemingly endless.  Not only can the retrieval and post-processing of output be automated, but with the HECRASController, real-time modeling and probabilistic experiments are possible. If you have HEC-RAS on your computer, you already have the HECRASController!
Breaking the HEC-RAS Code” explains how the HECRASController works, provides example applications of the HECRASController, and catalogs the vast array of programming procedures (with explanations and examples on how to use them) embedded in the HECRASController.
This is a "must-have" book for all HEC-RAS users.

Tuesday, October 28, 2014

Automating HEC-RAS!

Written by Chris Goodell, P.E., D.WRE  |  WEST Consultants
Copyright © The RAS Solution 2014.  All rights reserved.

Are you an HEC-RAS user?  Yes?  OK, try this out:

1.  If you haven’t already done so, install the HEC-RAS example projects to the default location.

image
image

2.  Open up a blank workbook in Excel.

Thursday, May 8, 2014

Controlling HEC-RAS

Written by Christopher Goodell, P.E., D.WRE  |  WEST Consultants
Copyright © The RAS Solution 2014.  All rights reserved.

So you want to control HEC-RAS from a external program.  Perhaps, you have a lot of plans to run and want to run in batch mode.  Maybe you wish to run HEC-RAS, evaluate the results, make some changes, and rerun HEC-RAS-all automatically, on its own, while you’re at home with the family.  The good news is it can be done.  The bad news is there is really no documentation on how to do this. However I will be publishing a book on this topic this year, so keep checking back for more information on that.  The book, "Breaking the HEC-RAS Code" is now available here.

In the meantime, here’s a quick way to open HEC-RAS, select the plan you want to run, and then run it, all through Visual Basic for Applications in Excel.  If you have HEC-RAS, and you have Excel, you can do this. 

To begin, open Excel and enter the VBA Environment by pressing Alt-F11 or by clicking on the Visual Basic button under the DEVELOPER tab. If the DEVELOPER tab is not already present in your list of menu items, you can add it by accessing the Excel Options under the File menu item and selecting Customize Ribbon. Check the box next to the Developer tab so that it shows up on in your list of menu items. The DEVELOPER tab provides quick access to the VBA Code Editor as well as a host of other programming options and tools. The VBA editor will look like this when it’s opened for the first time.

image
Visual Basic for Applications Editor.
 
If a module doesn’t already exist, add one by clicking INSERT…Module from the Visual Basic Editor. A new module will be added and the space to the right of the window will be ready for programming code. You can change the name of the module if you like in the properties window (see figure below).

image
Visual Basic for Applications Editor with a New Module.

Before you can begin accessing the RAS Dynamic Link Library (RAS DLL), it must be added as a reference. In the Visual Basic for Applications window, select Tools…References from the menu items. A window that lists all of the available reference libraries will come up as shown in the “Add Reference” window. Look for the HEC River Analysis System reference and check the box next to it.

image
Add Reference Window.

If you don’t see a reference for HEC River Analysis System, you need to install HEC-RAS on your computer. If you have multiple versions of HEC-RAS installed on your computer, you’ll see multiple entries for HEC River Analysis System. Make sure to check the one for the version of HEC-RAS you wish to use.

Now that you’ve added the RAS DLL as a reference, you have access to it’s library of commands that can control HEC-RAS.  Click on the module (Module 1) and type the following code:

image

Now, it should open and run whatever project you have listed in cell C4 on your Excel Sheet. 
Next, you might want to explore the RC.Plan_SetCurrent() subroutine and a Do-Loop block in your code to run through multiple plans in batch mode. 

Have Fun!