Hydrology epanet django wntr case-study simulation

Case Study: Interactive Pump Dynamics with EPANET and Django

By Jason Lillywhite, PE March 10, 2026

When designing or analyzing a water distribution system, static reports and spreadsheets often fail to capture the true dynamic nature of the network. Engineers need to see how levels drop, how flows shift, and how pressures respond when a pump kicks on or off.

At Lillywhite Water Solutions, we bridge the gap between heavy-duty engineering engines and intuitive, interactive web applications. One of our flagship live demos is the Pump Dynamics Simulator.

The Engineering Challenge

Typical hydraulic engines like EPANET are extremely powerful but notoriously difficult for non-modelers to interact with. They require specialized desktop software, massive input files, and a deep understanding of the engine's syntax just to run a simple scenario.

Our goal was to take an existing, complex, multi-node EPANET pump and tank model and expose only the most critical operational parameters—Pump ON elevation, Pump OFF elevation, and Initial Tank Level—directly to the user in a safe, sandboxed web browser environment.

The Architecture: Bringing EPANET to the Browser

To achieve this, we architected a system that seamlessly connects a modern, responsive frontend layout with a heavy Python computation backend.

Here is the schematic diagram showing how our app (LWS) orchestrates the entire simulation process behind the scenes:

graph TD
    %% Define Classes
    classDef user fill:#e0f2fe,stroke:#0284c7,stroke-width:2px;
    classDef server fill:#fef3c7,stroke:#d97706,stroke-width:2px;
    classDef engine fill:#fee2e2,stroke:#dc2626,stroke-width:2px;

    %% Define Nodes
    User1["💻 Engineer's Laptop"]:::user
    User2["📱 Remote Stakeholder"]:::user
    User3["🖥️ City Planner PC"]:::user

    subgraph LWS_Cloud ["Lillywhite Water Solutions (LWS) Secure Cloud Environment"]
        LWS["🌐 LWS Web Server"]:::server
        EPANET["⚙️ Hydraulic Engine (EPANET)"]:::engine
        LWS <-->|"Simultaneous Executions"| EPANET
    end

    %% Define Connections
    User1 -->|"Runs Scenario A"| LWS
    User2 -->|"Runs Scenario B"| LWS
    User3 -->|"Runs Scenario C"| LWS

Abstracting the Complexity

As shown in the diagram above, the user never touches the raw .inp (EPANET input) file.

  1. The Request: The user simply types numbers into clean HTML input fields on the LWS dashboard.
  2. The Override: The Django backend intercepts this data, opens the base model using the WNTR (Water Network Tool for Resilience) Python package, and strategically overrides the pump control logic in memory.
  3. Execution & Translation: The EPANET engine runs the simulation in the background. The raw, complex matrix of results is then parsed back into simple JSON arrays by our Python layer.
  4. Visualization: Finally, the frontend Javascript utilizes powerful visualization libraries like Chart.js to animate the head, flow, and tank levels over a 72-hour period.

By abstracting away the desktop software, we allow stakeholders, city planners, and operators to instantly run and visualize complex hydraulic scenarios from their phones or laptops, democratizing access to critical engineering insights!