1. Introduction
Urban areas are expanding globally to accommodate a growing population and migration to cities [
1,
2,
3]. This results in increases in impervious surfaces, disrupting the hydrologic cycle, causing increased runoff from the landscape into streams and rivers, more severe urban flooding, and degrading water quality throughout inland waters [
4,
5,
6,
7] and estuaries [
8,
9]. These rapid and spatially variable changes in urban hydrology increase the complexity of accurately simulating and calibrating models, particularly under conditions that are both dynamic and spatially heterogeneous.
The effectiveness of strategies for controlling runoff quantity and quality in urban areas relies heavily on computational hydraulic, hydrologic, and water quality (H/H/WQ) modeling that simulates runoff, defines flood and/or water quality treatment scenarios, and assesses the efficacy of proposed stormwater management strategies. Among the available models, the Storm Water Management Model (SWMM), an open-source model developed by the United States Environmental Protection Agency (USEPA), stands out as one of the most widely used models for simulating both the quantity and quality of urban runoff [
10,
11,
12].
The effectiveness of SWMM in representing the complex relationship between rainfall and runoff largely depends on the characteristics of the watershed, the drainage network, and numerous input parameters. SWMM input data can be categorized into hydrological and hydraulic parameters [
13]. Some of these parameters are derived from direct measurements using appropriate technical methods, while others are initially estimated and subsequently refined through the calibration process [
14]. Calibration involves minimizing the differences between observations and model predictions. Calibration is crucial for achieving reliable simulation results, especially in the context of a rapidly changing urban environment [
15,
16].
The calibration of SWMM parameters can be accomplished using manual or automatic methods. Manual calibration, using a “trial-and-error,” method that relies heavily on the expertise and judgment of the model user to iteratively adjust parameters until an acceptable fit is achieved. This process is time-consuming, labor-intensive, and requires a high level of expertise, making it less suitable for calibrating large-scale models [
17,
18]. Manual calibration also tends to overlook the complex interactions between parameters and their collective impact on model results [
19]. In contrast, automatic calibration employs computational methods such as genetic algorithms (GAs) [
20], non-dominated sorting genetic algorithms (NSGAs) [
21,
22,
23], and dynamically dimensioned search (DDS) methods [
7,
24] to efficiently explore a wide range of parameter combinations. These algorithms can quickly identify near-optimal parameter datasets, enhancing the accuracy and robustness of the model being calibrated [
25,
26].
The SWMM computational engine was primarily developed in the C programming language [
27,
28]. Various enhancements and commercial adaptations of SWMM have introduced advanced graphical user interfaces (GUIs) and expanded functionalities, including PCSWMM [
29], Innovyze [
30] and SWMM GUI [
31]. The SWMM model has limitations in directly manipulating data and creating custom files or plots due to its lack of built-in tools for advanced data handling and visualization [
32,
33,
34]. These constraints complicate automatic calibration, necessitating additional programming or the use of external tools to streamline the calibration process and effectively interpret results. In 2020, the Open Water Analytics organization released PySWMM, a third-party open-source package, which integrates the SWMM interface with Python and the SWMM application [
34]. This package leverages SWMM’s computational engine to simulate the rainfall-runoff process, but it does not include an automatic calibration procedure.
A review of the recent literature was conducted to investigate state-of-the-art techniques for the automatic calibration of SWMM models. These previous studies commonly utilized heuristic algorithms that emulate biological processes and mimic aspects of natural systems for automatic model parameter optimization reduces human influence, thereby improving modeling efficiency and credibility [
35,
36,
37,
38,
39]. Recent studies have employed single-objective and multi-objective optimization approaches. Single-objective optimization focuses on minimizing the error between simulation and observation using a single objective function, such as root mean square error (RMSE) [
40,
41] or Nash-Sutcliffe Efficiency (NSE) [
42,
43]. In multi-objective optimization for model calibration, commonly used objectives include minimizing NSE, RMSE, PBIAS, and the correlation coefficient, R
2 [
44,
45,
46].
Current research outcomes have improved precision and efficiency in automatic parameter calibration, thereby enhancing the overall applicability and effectiveness of the hydrologic model. However, these heuristic algorithms have improved calibration efficiency, most existing studies do not fully leverage multi-objective optimization, lack support for parallel computing to efficiently handle complex models, and have not fully exploited the potential of global search algorithms. As a result, they often face challenges with the high computational demands of complex multi-objective optimization and tend to focus on single-objective calibration instead [
47,
48,
49].
Another limitation of recent studies in model calibration is the restricted number of parameters considered, which can lead to incomplete calibration, overlook interactions between parameters, and result in a model that lacks robustness and fails to generalize effectively across different scenarios [
50,
51]. Influential parameters can vary from one basin to another, so identifying these parameters for the specific area under study is crucial. Current research in model calibration often fails to integrate sensitivity analysis with the calibration process, which can result in overlooking parameters and their interactions for the case under study [
52,
53].
Several automated calibration tools have been developed and applied to hydrologic models, including parameter estimation (PEST) [
14] and SWMM calibration using python (SWMMCALPY) [
23]. PEST is a widely used general-purpose optimization tool, but its application to SWMM typically requires extensive external scripting and does not natively support multi-objective optimization. SWMMCALPY is an automated calibration tool for SWMM developed in Python that streamlines the calibration process using genetic algorithms and other heuristic methods. While it is a valuable resource, it supports modification of only a limited set of parameters and lacks built-in support for parallelization, which restricts its scalability and efficiency in large-scale or high-performance computing applications. In contrast, the tool developed in this study, integrating PySWMM and Pymoo, allows dynamic control over all SWMM parameters via Python APIs, supports a wide range of evolutionary algorithms, and facilitates both single-objective and multi-objective optimization within a flexible and scalable framework. Additionally, the tool incorporates parallelization capabilities, which significantly improve computational efficiency and convergence speed, particularly in large-scale or high-dimensional calibration problems. These capabilities position our approach as a practical and extensible advancement in the automated calibration of SWMM.
Despite advancements in automated calibration techniques, several limitations persist in existing tools and recent studies. One major gap is the limited application of multi-objective optimization, which restricts the ability to balance competing performance criteria during calibration. In addition, another limitation relates to the exploration methods used in optimization algorithms. Parameter space exploration is often inefficient, relying on simplistic or locally confined search strategies that may fail to identify optimal or near-optimal solutions in high-dimensional calibration problems. Moreover, many tools also suffer from an absence of built-in parallel computing capabilities, which limits their scalability and increases computational burden, especially for large-scale urban models.
Another significant limitation is the restricted number of parameters available for calibration, along with the lack of embedded sensitivity analysis modules to help users prioritize influential variables. Furthermore, many tools lack integration with modern APIs, making it difficult to dynamically update model parameters without regenerating input files, which reduces overall flexibility and automation potential. The lack of simplicity and user-friendliness in tool design also creates a barrier for broader adoption, particularly among practitioners. Lastly, limited visualization capabilities make it challenging to interpret optimization progress, understand parameter performance, or compare calibration results.
To improve the reliability and efficiency of stormwater model calibration, we developed a tool that integrates PySWMM with Pymoo and supports single-objective and multi-objective calibration using commonly adopted performance metrics such as NSE, RMSE, and PBIAS, and it is compatible with a broad range of optimization algorithms. Built-in sensitivity analysis was incorporated in the tool to assist in identifying the most influential parameters, allowing for more targeted and effective calibration. The objective of this paper is to demonstrate the application of the developed calibration tool by applying it to the calibration of a SWMM model across selected test cases. The tool’s effectiveness is then evaluated based on its ability to enhance model accuracy and streamline the workflow for stormwater system modeling.
2. Materials and Methods
2.1. PYSWMM-PYMOO Linkage
PySWMM (version 2.0.1) is a Python wrapper for the Storm Water Management Model (SWMM) developed by McDonnell et al. (2020) [
34]. PySWMM provides an easy-to-use interface for interacting with the SWMM engine, enabling users to control, modify, and extend SWMM simulations directly using Python code, facilitating automation of tasks, integration with other Python libraries, and enhanced flexibility in conducting complex simulations Application Programming Interfaces (APIs) in SWMM are highly efficient, enabling users to programmatically modify model input parameters and retrieve output results, which facilitates dynamic interaction with the simulation process. Using the PySWMM API, all input parameters can be systematically extracted and adjusted, allowing full control over the model configuration during automated calibration. This feature allows users to read and write SWMM input files (.inp), enabling the manipulation of the model structure and modification of input data. Additionally, running the model through PySWMM produces binary output files (out), which can be accessed for extracting simulation results and further analysis.
Pymoo is a Python package designed for multi-objective optimization, offering a wide range of algorithms for solving complex optimization problems. It is particularly well-suited for problems where multiple objectives may compete and must be balanced. Pymoo provides a highly customizable and extendable framework, allowing users to define their own optimization problems, choose from various optimization algorithms (like GA, NSGA-II, or differential evolution), and visualize the trade-offs between objectives through identification and visualization of Pareto fronts. The integration of Pymoo with Python makes it an ideal tool for solving challenging optimization problems [
54,
55,
56].
The integration between PySWMM and Pymoo, as illustrated in
Figure 1, enables a seamless and dynamic exchange of data between the two modules. The calibration process using the integrated PySWMM–Pymoo framework follows the steps outlined below, which systematically link parameter generation, model execution, and performance evaluation in an automated loop.
Step 1: Model Setup and Parameter Identification
The SWMM model is developed using meteorological, geomorphological, and geographic data, followed by identification of influential parameters through sensitivity analysis for calibration.
Step 2: Generation of Candidate Parameters using Pymoo
The Pymoo optimization algorithm generates candidate parameter sets that represent potential combinations of influential parameters likely to improve model performance.
Step 3: Parameter Update via PySWMM API
Each parameter set is dynamically applied to the SWMM model using PySWMM’s API, enabling real-time updates without manual file editing and improving automation efficiency.
Step 4: Model Execution and Output Evaluation
The updated SWMM model is run using PySWMM, and simulated outputs are evaluated against observed data using objective functions.
Step 5: Performance-Based Optimization Search
The Pymoo optimization algorithm evaluates each solution using performance metrics and iteratively refines the search by favoring better-performing parameter sets.
Step 6: Convergence Check and Final Solution
The calibration iterates until termination criteria are met, returning an optimal parameter set that minimizes error between observed and simulated flows.
The presented automated calibration links model execution with optimization algorithms to improve simulation accuracy. It begins with defining objective functions, which are evaluated through repeated simulations as the optimizer explores parameter combinations. By iteratively adjusting parameters to minimize error, the process yields a well-calibrated model and offers a faster, more objective alternative to manual calibration, especially for complex, large-scale systems.
This study employs a single objective and multi-objective function for automatic calibration to assess the effectiveness of the PySWMM-Pymoo tool for calibrating SWMM. Of the several single-objective optimization algorithms available in the Pymoo package, (Particle Swarm Optimization) PSO and NSGAII were chosen for their ability to avoid local optima, adaptively adjust the search space, and globally optimize complex nonlinear functions, along with their robust convergence properties. This tool also leverages parallel computing to improve the convergence rate of the SWMM calibration process.
PSO is well-suited for single-objective problems involving nonlinear and continuous parameter spaces, offering efficient convergence and relatively low computational cost. NSGA-II was chosen for multi-objective calibration due to its ability to maintain solution diversity and generate a well-distributed Pareto front, making it ideal for balancing competing objectives such as NSE, PBIAS, and RSR. Both algorithms have been widely applied in environmental and hydrologic applications and are supported natively within the Pymoo framework, making them practical and effective choices for this study.
2.2. Case Study Description
The study area lies within the City of Fredericksburg, VA (see
Figure 2a) in northeastern Virginia that is tributary to the Rappahannock River and the Chesapeake Bay estuary. Fredericksburg is a relatively compact urban center located at the transition between Virginia’s Piedmont and Coastal Plain physiographic provinces. Within the City is the historic Virginia Electric Power Company (VEPCO) canal. Originally, the canal extended from a water intake on the Rappahannock River, upstream of the former site of Embry Dam, and discharged back into the river at a now defunct hydropower station. While the canal still follows its original course, the upstream dam has been removed, thus all inflows from the river have been blocked, so the only water entering the canal comes from either runoff from the contributing drainage area of the canal or it is pumped from the Rappahannock River. A pump station is present at the canal outlet to provide this capability. The contributing drainage area is known as the Canal sewershed. The location and boundary of the sewershed, along with the monitoring station, are shown in
Figure 2b. Monitoring locations were established just upstream of the watershed outlet and at the point where the mainstream discharges into the canal. A sewershed is like a watershed, except it is in an urban area; often drainage boundaries are determined by roof lines and/or storm drains and conveyance.
The canal sewershed spans 5.20 km
2 of highly urbanized area (
Figure 3), featuring a mix of land uses including residential (30.2%), transportation (17.6%), commercial and medical center (12.2%), and industrial (7.1%). Breakdown of land use in the City of Fredericksburg is provided in
Table 1.
Long-term precipitation data from the nearby Corbin, VA station (USC00442009) indicate that the area experiences its wet season during late spring through summer. Monthly average precipitation from May to July is relatively high, ranging from 101 mm to 105 mm, and coincides with frequent convective storm activity. These months also record the highest number of days with rainfall ≥ 2.5 mm, occurring between 6.1 and 7.1 days per month, which reflects the frequency of storm events during this period. In contrast, the dry season begins around August, with average monthly precipitation decreasing and continuing to decline through November (85 mm) and December (92 mm), accompanied by fewer rainfall days and lower intensity. This seasonal variation allows the selected April–December period to capture a wide range of hydrological conditions, from high-intensity, short-duration events during the wet season to drier conditions with less frequent rainfall. Therefore, using this period for the study ensures that the model is calibrated for both storm runoff and base flow conditions under realistic seasonal variability.
2.3. Monitoring
Several monitoring stations were installed within the sewershed and in nearby Fredericksburg to measure the quantity and quality of runoff during and immediately after storm events. For a complete description of these sites and results, the reader is referred to [
7,
57].
The monitoring locations used for model calibration are shown in
Figure 4. These monitoring stations include just upstream of the watershed outlet, at the point where the main stream discharges into the canal, and within a subcatchment characterized by commercial land use.
2.4. Base SWMM Model
A SWMM model of the canal sewershed was developed based upon GIS data provided by the City of Fredericksburg, supplemented by field data of the conveyance network collected in summer of 2021. The model includes 74 sub-catchments, 156 conduits (links), and 156 nodes (junctions) [
58]. ArcGIS Pro 2.8.2 was used to delineate the subcatchments based on a 1-m resolution Digital Elevation Model (DEM) supplied by the City of Fredericksburg [
59].
The SWMM model also requires various inputs including precipitation, temperature, soil properties, hydraulic systems and infrastructure specifications, land use, and topography. Rainfall data were loaded into the model as a time series, demonstrating the rainfall volume recorded by rain gauges at the monitoring station. Temperature data were obtained from the closest NOAA station—Corbin, VA (station ID: USC00442009)—located approximately 15 km from Fredericksburg, VA, using recent records from the National Climatic Data Center (NCDC) [
60]. The model simulates evaporation rates based on daily minimum and maximum air temperature.
The rainfall time series used for model input had a 5-min time step, which was selected to match the resolution of flow monitoring data and to accurately capture the short-duration, high-intensity rainfall events typical of urban stormwater systems.
The infiltration mechanism in SWMM was simulated using the Green-Ampt approach [
61] and the parameters included in this method, such as suction head, hydraulic conductivity, and initial moisture deficit, were obtained from the Web Soil Survey Geographic (SSURGO) database provided by the U.S. Department of Agriculture Natural Resources Conservation Service [
62].
The dynamic wave algorithm was chosen for flow routing in SWMM because it provides the most detailed and physically realistic simulation of flow hydraulics in urban drainage systems. Groundwater flow and interaction with surface water are simulated by a simplified Darcy’s law, which is driven by the aquifer bottom elevation, factors of groundwater-surface water interaction, unsaturated upper zone depth, saturated groundwater table elevation, aquifer porosity, and hydraulic conductivity in the saturated zone [
63]. The elevation of the groundwater table was quantified using Digital Geologic Data for City of Fredericksburg and Spotsylvania County [
64]. These parameters drive the flow between the aquifer and the stream, calculating the groundwater movement based on both the levels of the ground and surface water.
The model incorporated measured sub-hourly rainfall data and daily temperature data as input. The base model underwent partial manual calibration before starting automatic calibration.
2.5. Sensitivity Analysis
In this study, the integrated PySWMM-Pymoo tool was employed to perform sensitivity analysis and automated calibration of the SWMM model for both single and multi-objective scenarios. Sensitivity analysis was conducted to identify the most impactful parameters, which were subsequently utilized in the calibration process by targeting these influential parameters.
Parameter sensitivity analysis was conducted using the one-at-a-time (OAT) approach, which involves varying each input parameter individually while keeping the others fixed. This method allows for the assessment of the impact of each parameter on the results, specifically examining the total flow over the entire simulation period and peak flow. By measuring and comparing these effects, we evaluated how each parameter influences overall flow behavior.
where:
= Sensitivity of the total flow to the input Pi parameter
= Sensitivity of the peak flow to the input Pi parameter
Qmean = Overall average of the flow rate over the simulation period
Qpeak = Maximum flow rate over the simulation period
Pi = Input Parameter
∆Pi = Increment applied to Pi
Pj0 = Baseline (original) values of all other input parameters Pj where j ≠ i
The range of each parameter used in the sensitivity analysis was determined based on a combination of sources, including recommendations from the SWMM user manual, parameter values commonly reported in peer-reviewed studies, and practical modeling experience from previous applications in urban watersheds with similar land use and hydrologic characteristics.
While the OAT sensitivity analysis method has known limitations, particularly its inability to account for interactions between parameters, we selected it for this study due to its computational efficiency, simplicity, and ease of interpretation, which make it well-suited for the initial development and demonstration of the calibration tool.
2.6. Hydrologic Calibration and Validation
The model was calibrated using flow data collected from 15 April to 30 December 2021—a period that encompasses both the wet and dry seasons in the study area. This timeframe includes months characterized by frequent, high-intensity storm events as well as periods with lower-intensity but more sustained rainfall. As a result, the calibration captures a wide spectrum of hydrologic conditions, enabling the model to simulate both peak storm flows and base flow conditions with greater accuracy and reliability. Calibration is a critical step in enhancing the accuracy and reliability of hydrological simulations, as it involves adjusting model parameters to closely match observed data. To guide this process, a sensitivity analysis was first performed to identify the parameters that have the greatest influence on model performance. Once these key parameters were identified, optimization techniques were used to refine them. Depending on the calibration goals, either single-objective or multi-objective optimization methods can be applied. Single-objective optimization focuses on improving one performance metric, while multi-objective optimization considers multiple metrics simultaneously to achieve a more balanced and comprehensive calibration. In this study, the NSGA-II algorithm was applied for multi-objective optimization, while the PSO algorithm was used for single-objective optimization tasks.
The objective formulation considered in this study was minimizing total flow volume error. NSE, PBIAS, and RSR have been employed as metrics that assess aspects of the performance of the calibrated model. The near-optimal results represent a balance among these metrics [
65].
where:
Oi = Observed flow at time
Pi = Predicted flow at time
= Mean of the observed flow
n = Number of observations
After completing calibration, the model was run for a validation period to assess its performance and ensure its accuracy. Validating a SWMM model after calibration is essential to ensure it performs reliably. This involves testing the model using independent datasets that were not part of the calibration process. By applying the same metrics including NSE, PBIAS and RSR, the validation process checks whether the model can accurately reproduce observed data under different conditions.
2.7. Stepwise Calibration Approach
In this study, a systematic and robust stepwise calibration approach was employed to calibrate the SWMM model for a large and complex urban sewershed. The sewershed consists of multiple drainage paths and subcatchments, which collectively form smaller sub-sewersheds, each contributing uniquely to the overall hydrologic response. To manage model complexity and improve efficiency, calibration began by selecting a representative subset of subcatchments, those directly contributing to the mainstream flow and supported by available monitoring data. This subset was used to calibrate key hydrologic parameters, particularly those governing infiltration and base flow, under observed conditions.
Once satisfactory calibration was achieved for this subset, the calibrated parameters, especially those related to base flow and infiltration, were transferred to similar subcatchments throughout the rest of the sewershed. This transfer was justified based on comparable land use, soil characteristics, and drainage patterns across subcatchments. Although spatial variability exists, this assumption is common in urban hydrologic modeling where monitoring data are limited. It allows for hydrologic consistency across the watershed while reducing computational burden and calibration time. The final model was then refined by calibrating influential parameters at the full sewershed scale to ensure accurate representation of both localized responses and cumulative watershed behavior. This stepwise method not only streamlines the calibration process but also enhances model reliability and efficiency.
In the optimization approach, the calibration process is enhanced by transitioning from a floating-point format to an integer-based representation for certain parameters. This technique effectively reduces the search domain by discretizing real-valued parameters to integers or restricting them to a specific number of decimal places. By doing so, the optimization process becomes more efficient, as it focuses on a narrower, predefined parameter space. This method not only simplifies the computational process but also ensures that the calibration aligns more closely with realistic, practical values, improving the overall accuracy and reliability of the model.
4. Conclusions
This study introduces a novel calibration tool for SWMM by integrating PySWMM with Pymoo. This tool capitalizes on the capabilities of PySWMM, Pymoo, and Python for automated calibration. This developed tool is designed to leverage PySWMM’s API capabilities for systematic adjustments of SWMM model parameters, while utilizing Pymoo’s advanced optimization algorithms to be able to use parallel search techniques to efficiently identify near-optimal values. The PySWMM-Pymoo tool supports both single and multi-objective automated calibration, making it suitable for event-based and continuous simulations. Furthermore, the tool performs sensitivity analysis prior to calibration, identifying influential parameters specific to the study area.
The PySWMM-Pymoo tool was applied in a case study sewershed in Fredericksburg, VA, demonstrating its feasibility and applicability. The developed tool was applied to calibrate a single subcatchments using multi-objective calibration and an entire catchment’s sewershed using single-objective calibration.
In single-objective optimization, the PSO algorithm was employed to maximize the NSE value. Calibrating the SWMM model for the entire sewershed followed a systematic and efficient approach, starting with a smaller section of the sewershed comprising a group of subcatchments that are the primary contributors to runoff. The parameters were fine-tuned for this group of subcatchments and then extended to the entire sewershed for comprehensive calibration. The NSE values from this test case for the calibration and validation phases were 0.68 and 0.73, respectively, demonstrating the reliability of the tool in achieving accurate calibration of the SWMM model.
For multi-objective optimization, the NSGA-II algorithm was employed to calibrate the SWMM model, focusing on three objectives: NSE, PBIAS, and RSR. These objectives were used to calibrate a subcatchment within a larger sewershed. The NSE, PBIAS, and RSR values obtained for the calibration period were 0.73, 17.1, and 0.52, respectively, while for the validation period, they were 0.86, 13.1, and 0.37. These results demonstrated the model’s capability to effectively calibrate the SWMM model.
While the developed tool demonstrates strong potential for automating SWMM calibration, several limitations should be acknowledged. The sensitivity analysis relied on OAT method, which does not capture interactions between parameters and may limit comprehensive understanding of parameter influence. Additionally, the calibration was based on a relatively short monitoring period due to data availability. Future research should explore the use of global sensitivity analysis methods to better quantify parameter interactions, extend the tool to support stormwater quality calibration, and investigate hybrid or adaptive optimization strategies to enhance performance across a wider range of hydrologic and watershed conditions.
Overall, the results indicate that this tool is particularly well-suited for calibrating storm runoff simulations in urban sewersheds, where complex drainage networks and spatial variability in hydrologic responses require sophisticated and adaptable modeling approaches. By streamlining and automating the calibration process, the tool helps improve model accuracy and efficiency, supporting better-informed decisions in urban stormwater planning and management. Overall, it offers a practical and extensible framework for developing and applying more robust models in urban stormwater systems.