{"id":1294,"date":"2014-04-04T10:26:56","date_gmt":"2014-04-04T07:26:56","guid":{"rendered":"http:\/\/www.water-simulation.com\/wsp\/?p=1294"},"modified":"2014-04-04T10:26:56","modified_gmt":"2014-04-04T07:26:56","slug":"running-hec-ras-from-visual-basic-6-and-excel-vba","status":"publish","type":"post","link":"http:\/\/www.water-simulation.com\/wsp\/2014\/04\/04\/running-hec-ras-from-visual-basic-6-and-excel-vba\/","title":{"rendered":"Running HEC-RAS from Visual Basic 6 and Excel VBA"},"content":{"rendered":"<p><a title=\"HEC-RAS\" href=\"http:\/\/www.hec.usace.army.mil\/software\/hec-ras\/\">HEC-RAS<\/a> is free a software by the\u00a0<a href=\"http:\/\/www.hec.usace.army.mil\/\">Hydrologic Engineering Center<\/a>\u00a0(HEC) at the US Army Corp of Engineers which\u00a0allows you to perform one-dimensional steady flow, unsteady flow, sediment transport\/mobile bed computations, and water temperature modeling.\u00a0<span style=\"font-size: 14px; line-height: 1.5em;\">Recently I needed to run HEC-RAS from my custom software and interact with the data and results. An example use would be making batch HEC-RAS runs with different parameters. At the HEC-RAS web-site I could not find any information about running the software as a server or from the command line. Searching around I found the Italian site of\u00a0<a href=\"http:\/\/www.ruwa.it\/index.php\/it\/modellistica-idraulica\/formazione-hec?id=56\">RUWA Ltd.<\/a> with a link to a utility named\u00a0<strong>RasClient<\/strong> (available for download at the bottom of this page).<\/span><\/p>\n<p>The\u00a0RasClient utility cames with a Visual Basic 6 source code example, Excel demo file and a Word document. The document seems to be written by\u00a0Mark Jensen who is, according to the HEC-RAS user manual, is the programmer of the user interface and graphics of HEC-RAS. So I guess the RasClient utility is by HEC. The document states that &#8220;<em>HEC-RAS is compiled as a server application and can be called from another program that supports ActiveX<\/em>&#8220;. The demo is a Visual Basic 6 program and shows how to:<\/p>\n<ul>\n<li>Dimension a new HEC-RAS object<\/li>\n<li><span style=\"font-size: 14px; line-height: 1.5em;\">Load a specific project<\/span><\/li>\n<li><span style=\"font-size: 14px; line-height: 1.5em;\">Execute the computations<\/span><\/li>\n<li><span style=\"font-size: 14px; line-height: 1.5em;\">Plot Results<\/span><\/li>\n<li><span style=\"font-size: 14px; line-height: 1.5em;\">Export the computed results<\/span><\/li>\n<\/ul>\n<p style=\"text-align: center;\"><a href=\"http:\/\/www.water-simulation.com\/wsp\/wp-content\/uploads\/2014\/04\/hec-ras-in-vb6.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-1297\" alt=\"hec-ras-in-vb6\" src=\"http:\/\/www.water-simulation.com\/wsp\/wp-content\/uploads\/2014\/04\/hec-ras-in-vb6.png\" width=\"242\" height=\"401\" \/><\/a><\/p>\n<p style=\"text-align: left;\">The VB6 program interacts with the HEC-RAS application server via a\u00a0HECRASController object which have many properties and method. Unfortunately I could not find the documentation for these option so a lot of\u00a0trial and error there. Some HEC-RAS GUI screens may be called as well:<\/p>\n<p style=\"text-align: left;\"><a href=\"http:\/\/www.water-simulation.com\/wsp\/wp-content\/uploads\/2014\/04\/hec-ras-output1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-1300\" alt=\"hec-ras-output1\" src=\"http:\/\/www.water-simulation.com\/wsp\/wp-content\/uploads\/2014\/04\/hec-ras-output1.png\" width=\"421\" height=\"327\" \/><\/a>Download RasClient <a href=\"http:\/\/www.water-simulation.com\/wsp\/wp-content\/uploads\/2014\/04\/RasClientExample4_0.zip\">here<\/a> (ZIP file ~62KB)<\/p>\n<p style=\"text-align: center;\">\n","protected":false},"excerpt":{"rendered":"<p>HEC-RAS is free a software by the\u00a0Hydrologic Engineering Center\u00a0(HEC) at the US Army Corp of Engineers which\u00a0allows you to perform one-dimensional steady flow, unsteady flow, sediment transport\/mobile bed computations, and water temperature modeling.\u00a0Recently I needed to run HEC-RAS from my &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"http:\/\/www.water-simulation.com\/wsp\/2014\/04\/04\/running-hec-ras-from-visual-basic-6-and-excel-vba\/\"> <span class=\"screen-reader-text\">Running HEC-RAS from Visual Basic 6 and Excel VBA<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,7,13],"tags":[82,204,207,206,205],"class_list":["post-1294","post","type-post","status-publish","format-standard","hentry","category-free-software","category-programming","category-storm-sewer-software","tag-excel","tag-hec-ras","tag-rasclient","tag-vb6","tag-vba"],"_links":{"self":[{"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/posts\/1294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/comments?post=1294"}],"version-history":[{"count":2,"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/posts\/1294\/revisions"}],"predecessor-version":[{"id":1304,"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/posts\/1294\/revisions\/1304"}],"wp:attachment":[{"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/media?parent=1294"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/categories?post=1294"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.water-simulation.com\/wsp\/wp-json\/wp\/v2\/tags?post=1294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}