Krish Shah Computer Science · Guelph

Case study 01 / 03Stormwater engineering2026

RunoffLab

A stormwater design tool that puts EPA SWMM behind an interactive site plan. Draw rain gardens, permeable pavement or green roofs on a site, then see what they do to runoff, peak flow and water quality — before anything is built.

Year
2026
Type
Stormwater engineering
Links
RunoffLab’s 3D view mid-storm: a campus block with a building roof, two parking lots, lawns, a rain garden strip and permeable pavers, with a storm clock reading 12:00, rain 7.2 mm/h and 0.285 m³/s leaving the site.
Fig. 01RunoffLab replaying a 50 mm design storm from its SWMM time series. 12:00 — 7.2 mm/h of rain, 0.285 m³/s leaving the site.

01The problem

Paved sites send most of their rain straight into storm drains, carrying sediment into creeks and overloading pipes in heavy storms. Green infrastructure helps, but every square metre costs money, and the standard engineering model, EPA’s Storm Water Management Model, is driven by text input files and long reports. RunoffLab asks a practical question of it: which features, where, and how big, give the most benefit for the budget?

02My role

A two-person project joining environmental engineering and computer science. My teammate came up with the idea and built the frontend; I built the backend — the FastAPI service that checks designs and runs them through SWMM — and the SQLite project storage.

03How it works

  1. 01DrawSVG site editor
  2. 02CheckConstraint rules
  3. 03TranslateSWMM .inp file
  4. 04SimulateSWMM 5.2 via PySWMM
  5. 05CompareBaseline vs design

The browser holds the site and the design. On simulate, the backend checks the design against the same rules as the editor, writes it out as a SWMM input file — one subcatchment per surface, one LID control per feature — runs SWMM in a temporary folder and reads its binary output back. The frontend only draws what SWMM returned.

04What it does

  1. 01
    Draw the site

    An SVG editor for roofs, parking, lawns, drains and pipes, plus five kinds of green infrastructure. Constraint checks run as you edit.

  2. 02
    Simulate with SWMM

    Each design becomes a SWMM 5.2 model, run locally through PySWMM: every surface a subcatchment, every feature a native LID control.

  3. 03
    Compare outcomes

    Baseline against design: runoff volume, peak outfall flow, the water balance, flooding, and sediment and phosphorus leaving the site.

  4. 04
    Search for trade-offs

    The Design Explorer runs hundreds of layouts through SWMM in parallel and highlights the cost-versus-runoff Pareto front.

  5. 05
    Look beyond one storm

    Year-long continuous runs, what-if storms and clogged soils, a 3D storm replay and PDF reports with every assumption listed.

RunoffLab site editor: a plan of a campus block with a selected rain garden strip between two parking lots, and a sidebar showing budget, area and “All constraints pass”.
Fig. 02Site editor. Checks run while you draw; this design passes and is ready to simulate.

05Decisions worth noting

  • SWMM is the source of truth. The app never estimates a result itself. Tests check the engine against hand calculations, such as runoff from a roof equalling rain minus depression storage.
  • Invalid designs never reach the engine. The same rules run in the editor while you draw and in the API before a simulation, so a design that couldn’t be built never produces numbers.
  • The 3D view says what is real. Water, runoff paths and pipe flow follow the time series; building heights, trees and thunder are labelled as illustration.
RunoffLab results: runoff 576 m³ (−30%), peak discharge 0.291 m³/s (−13%), a rainfall and outfall hydrograph comparing baseline and design, and a water-balance chart.
Fig. 03Results. Baseline against design, straight from SWMM: 250 m³ less stormwater leaves the site.

06In numbers

200designs
explored in about 5 seconds by the Design Explorer
−30%
runoff for the sample design in a 50 mm storm
128tests
76 pytest, 39 Vitest and 13 Playwright
0API keys
everything runs locally, including the engine

Sample numbers come from the bundled fictional 2.4 ha campus with illustrative unit costs. They show what the tool does; they are not a claim about a real site.

RunoffLab Design Explorer: a scatter plot of cost against runoff volume for 200 simulated designs, with the best trade-offs highlighted as a stepped green frontier.
Fig. 04Design Explorer. 200 layouts through SWMM in 5 s; the green frontier is the best runoff for each budget.

07Limits, stated plainly

The site model is flat and made of rectangles. Costs and pollutant concentrations are illustrative defaults, and the built-in year of rainfall is synthetic unless a measured record is imported. There are no user accounts yet, so it isn’t deployed publicly.

08Built with

  • Python
  • FastAPI
  • EPA SWMM 5.2 / PySWMM
  • SQLite
  • Next.js
  • React
  • TypeScript
  • three.js
  • ReportLab
  • pytest
  • Vitest
  • Playwright
  • Docker