Académique Documents
Professionnel Documents
Culture Documents
+ =?
Contents
1. What is HEC-RAS? (brief intro)
2. The HECRASController API
3. Excel VBA Demos
1. Multi-Model Run
2. RAS Output Extraction
3. Mannings n Calibration (sort of)
4. Tips
5. Conclusion
2
1. What is HEC-RAS?
Hydrologic
Engineering
Centers
River
Analysis
System
3
2. The HECRASController API
What is an API?
Their Program
Your
Program API
4
2. The HECRASController API (contd)
The HECRASController API
The current version of the HECRASController has a wealth of
procedures that will allow a programmer to manipulate HEC-RAS
externally by setting input data, retrieving input or output data, and
performing common [HEC-RAS] functions
- Christopher Goodell, PE, D.WRE, Breaking the HEC-RAS Code, 2014
HEC-RAS
Excel
API
5
2. The HECRASController API (contd)
Accessing the API from Microsoft Excel
1. Click the Visual Basic button (on the Developer tab)
2. Create a new VBA module
3. Go to Tools > References, check HEC River Analysis System,
and click OK.
4. Write code!
6
2. The HECRASController API (contd)
A simple program
Sub RunHECRAS()
' Opens and runs a HEC-RAS model
End Sub
7
2. The HECRASController API (contd)
Some example HECRASController
fuctions and subroutines:
Project_Open Geometry_SetMann
Opens a HEC-RAS model. Sets the Mannings n values for
Compute_CurrentPlan a cross section, horizontally
Runs the current flow/geometry varied.
regime. Add_BC
ExportGIS Adds a bridge/culvert.
Exports an *.sdf file that can be Edit_BC
read into ArcGIS using HEC- Opens the Bridge/Culvert Editor
GeoRAS. and displays the selected station.
Output_NodeOutput PlotPF
Returns an output value for a Displays the water surface profile
given node and profile. for a given River/Reach.
8
3. Excel VBA Demos
1. Multi-Model Run
2. RAS Output Extraction
3. Mannings n Calibration (sort of)
9
4. Tips
Breaking the HEC-RAS Code
by Christopher Goodell, PE, D.WRE
The API is a little rough around the edges.
Provides a lot of functionality, but not everything
Inconsistencies:
Parameter names and types
Function / subroutine behavior
No official API documentation
HEC-RAS is public domain software, but not open source
HEC-RAS project (*.prj), geometry (*.g##), flow (*.f##), and plan
(*.p##) files are plain text.
Sometimes thats easier than using the API.
HEC-RAS output files (*.O##) are binary.
10
5. Conclusion
Questions?
Contact Info
Thomas Williams, PE
Amec Foster Wheeler
thomas.williams@amecfw.com
11