HEC-WAT provides a built-in scripting interface for defining a more complex time window modifier. The user can create a Jython script to adjust the simulation time window. The scripted adjustment is the final modification if any other modification is specified in the Model tab. An example script is available on GitHub.

To set up a script modification select the Scripts tab from the Time Window Modifier Alternative Editor.

Time Window Modifier Alternative Editor, Script tab.

To define a script, check the Use Script check box.

The Script File text box box displays the location of where the file is stored.

The API (Application Programming Interface) Pane, presents the available APIs available to script. The user will decide which API needs to be included in the script, expand the folder for that API (click the plus sign). From the expanded list, the user will select the appropriate item that needs to be included in the script. Once an item is selected, click Insert in Script, and the format for the selected item will appear in the Text Editor Pane.

The Text Editor Pane provides the ability to edit the script. The editor supports the standard Windows® keys for Select All (Ctrl-A), Cut (Ctrl-X), Copy (Ctrl-C) and Paste (Ctrl-V) operations. A shortcut menu is provided through right click on the Text Editor Pane presents previously listed operations, Undo and Redo. The Compile Script option below the Text Editor Pane allows the user to check the script for Jython code syntax errors.

Using the API Pane the user can add items to the script in several ways. One way is described above through clicking Insert in Script. The user can also double-click on an item in the API Pane, the format for the selected item will be inserted at the current cursor position in the text editor. Another way is by dragging an API item to a position in the Text Editor Pane.

Arguments are placeholders for variables that the user must supply in the script. The user needs to replace the placeholders (red parentheses) with an argument of appropriate variables/objects that the user has created within the script. By hovering over an item in the API Pane, tooltip displays the signature and general definition of the API function.


API Pane – Displaying Information about an API Item

More detailed information can be viewed by selecting an API item and then pressing the F1 key, which displays the JavaDocs in a JavaDoc window.


JavaDoc Window – Displaying More Detailed Information about an API Item


When the script has been completed, click OK, the Time Window Modifier Alternative Editor will close.