Scripting is the process of automating the actions of an interactive program for the purpose of being able to execute a prescribed set of actions with a simple selection. Scripting can simplify user operations and abstract complexity, ensure repeatability and consistency of results, reduce time required to generate results, and schedule an operation to occur one or more times in the future.

Scripting in ResSim takes two forms: The first form is represented by scripts that compute a value during each timestep of a simulation which will be used to influence the operation of one or more reservoirs; these are State Variables and Scripted Rules. State Variables and Scripted Rules were covered in "State Variables" and "Scripted Rules", respectively. The second form is represented by scripts that perform actions outside of the compute of an alternative; these scripts are often referred to as utility scripts because they perform such tasks as producing a custom plot of results, generating custom reports, and pre– or post–processing of output to produce additional information not directly generated by ResSim. This chapter will describe how to create, use, and manage this second form of scripting in ResSim, the utility scripts.

Both forms of scripting in ResSim use the Jython scripting language. Jython is a special implementation of the Python scripting language that enables scripts written in Jython to interact with programs written in Java. For further details on how to write Jython utility scripts that utilize the Java classes from ResSim and HEC-DSSVue, see the scripting chapter in the HEC-DSSVue User's Manual (HEC, 2009 or later).

Two interfaces are provided in ResSim for working with your scripts. Both are available from the Tools menu of any ResSim module:

Figure: Tools Menu Scripts...

  • Scripts…—The first option, Scripts…, opens the Scripts window, where you can collect buttons for launching your scripts. In addition, there are options available from the Scripts window for scheduling the launch of a utility script and for monitoring the status of a scheduled script.
  • Script Editor…—The second option, Script Editor… opens the interface you will use to create, edit, and test your scripts. Use the Script Editor to perform all your script file management.