PCSWMM Support: Articles
PCSWMM Support: Articles
PCSWMM Support
Articles
Back
Scripting
Creating, editing and executing scripts provide a powerful way to extend PCSWMM
functionality when working with model data, GIS layers, time series files and more.
PCSWMM's out-of-the-box support for IronPython (version 2.7.8) eliminates the need
for any additional configuration or setup after your PCSWMM installation. Scripts can be
created, managed and executed directly within the Script Editor, and scripting examples
are provided to get you started.
By providing direct access to all GIS, model and time series data, Python scripts in
PCSWMM can be used to accomplish virtually anything: from automating the model
development process and performing real-time flood forecasting, to supporting reading
from and writing to 3rd party file formats. You no longer have to wait for CHI to add
support for your needed processes.
Some example tasks that can be performed with scripting include:
editing SWMM and EPANET models input parameters
interacting with the panels (e.g. select/deselect entities meeting user criteria on
the Map panel)
criteria-based notifications via text messages and/or emails (e.g. sending model
status upon completion of a long model run).
importing user-specific file formats (e.g. using csv IronPython library to work with
CSV files)
PCSWMM scripting inherits both the advantages and limitations of IronPython. All
libraries supported by IronPython may be used in PCSWMM's scripts. IronPython
currently does not support libraries with a C extension, such as numpy, scipy, and
matplotlib. However, similar functionalities may be found in .NET libraries, which are
supported.
Additional information
The links below provide details and references for scripting in PCSWMM. Additionally,
there are many Python scripting learning resources available online, including videos,
step-by-step tutorials, courses, examples and more.
Script Editor
Scripting class diagram
SWMM model classes
EPANET model classes
Generic classes
Scripting examples
Scripting tools
Scripting libraries
Script errors
Class property abbreviations