After setting up WaterObjects.NET in HAMMER to adjust parameters, run a model and view results, a looping procedure is not allowing for subsequent runs

Applies To
Product(s): WaterObjects.NET, HAMMER
Original Author: Scott Kampa, Bentley Technical Support Group


After setting up a WaterObjects.NET tool to adjust parameters of a HAMMER model and run the HAMMER engine and extract data, it only seems to work once. The looping procedure is not allowing for subsequent runs.


In at least one case, the problem was that the output files for the HAMMER engine weren’t closed after retrieving the results.  The second time the engine tried to run it complained the output file was in use.

When using the TransientResultsProjectContext class, you need to make sure it gets properly disposed before attempting to access HAMMER results via result fields or if you run the HAMMER engine after using the class.  To dispose the class, call the methods ResetHOFResultsDictionary and ResetHMRREsultsDictionary methods passing in true for the parameter.  Internally this will close any open HAMMER result files that were opened when using the class.  The class does not implement IDispose so calling these two methods is important to avoid any “file in use” issues that may occurs.

See Also

Waterobjects.NET - Extending the capabilities of your OpenFlows product