# Water Network Analyzer: EPANET Pressure, Fire Flow, Criticality (`jumblemog/water-network-analyzer`) Actor

Analyze water distribution networks with EPANET 2.2: .inp files from EPANET, WaterGEMS, InfoWater or QGIS by link, upload or paste. Get pressures, tanks, pump energy, fire flow at every junction, pipe-break criticality, water age, findings, maps, CSV, Excel and GeoJSON. For engineers and AI agents.

- **URL**: https://apify.com/jumblemog/water-network-analyzer.md
- **Developed by:** [Jumble Mog](https://apify.com/jumblemog) (community)
- **Categories:** Developer tools, AI, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Water Network Analyzer: EPANET Pressure, Fire Flow, Criticality

**Analyze a water distribution network in one API call.** Give an EPANET input file (an `.inp` file from EPANET, or exported for EPANET by WaterGEMS, WaterCAD, InfoWater, WNTR or a QGIS plugin) as a link, a ZIP or GitHub folder of them, an upload or pasted text, or name one of the built-in example networks. The tool runs it in EPANET 2.2 the way the file sets it up (a single steady state, or days of demand patterns, controls and tanks filling and draining), then tests it the way a utility engineer would. For each network you get back:

- **Hydraulics**: the lowest and highest pressure at every junction over the run, the junctions below your minimum service pressure or above your maximum, negative pressures, the fastest pipes and the steepest headloss, and the demand over the run. Every tank's levels: does it run empty, fill up, keep up over the day? Every pump's running time, power, efficiency and energy per day, and its cost when the file gives energy prices. EPANET's own warnings come along.
- **Available fire flow** at every junction with demand, or the ones you name: the most a hydrant there can draw, on top of the demand at the busiest hour, while the residual pressure (20 psi or 14 m unless you set it) holds at that junction and at every other junction that had it before. Junctions short of the required flow (1,000 gpm or 60 L/s unless you set it) are flagged, each with the junction whose pressure sets its limit.
- **Pipe criticality**: every open pipe closed in turn, largest first, with pressure-driven demand, so a closure that cuts customers off or starves them of pressure shows up as demand left unmet: the share of all demand, the junctions pushed below the minimum pressure and the junctions cut off.
- **Water age**: EPANET's own age simulation over at least a week, averaged over the last day, with the junctions over your limit (72 hours unless you set it) and those still getting older. For a steady-state model, the travel time from the sources along the flows.
- **Findings and a verdict**: each problem in a sentence that names the place and the number, worst first, plus checks of the model itself: Hazen-Williams C values that look like Darcy-Weisbach roughness, diameters in the wrong unit, every elevation at zero, no demand at all, missing coordinates.
- **Files**: maps of pressure, water age, fire flow and criticality, a chart of tank levels and demand, CSV tables of every node and link with their results, the pressure at every junction over time, an Excel workbook, the network as GeoJSON for QGIS or a web map, and EPANET's report.

![Map of EPANET example network 3 with each junction coloured by the fire flow it can deliver with 20 psi left, from about 1,000 to 5,000 gpm; junctions 15 (663 gpm) and 143 (956 gpm) in the north-east are ringed in red](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/water-network-analyzer-fire-flow.png?signature=KetR0XoFzZ3xZNXN9t1j)

*EPANET's example network 3 at its busiest hour: 57 of the 59 junctions with demand can draw 1,000 gpm with 20 psi left. Junction 15 manages 663 gpm and junction 143 956 gpm, both limited by the pressure at junction 15.*

![The same network with each pipe coloured by the share of demand left unmet when it alone is closed: pipe 233 stands out at 33%, pipe 193 at 12% and pipe 229 at 8%](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/water-network-analyzer-criticality.png?signature=oRUXtj8kfZWfGfWCkQKH)

*Pipe criticality on the same network: closing pipe 233, the only pipe to junction 203, leaves 33% of the demand unmet, since junction 203 draws a third of it at that hour.*

![Tank levels in percent of full and the network's demand in gpm over 168 hours: the three tanks rise and fall with the daily demand, tank 3 between about 83% and full](https://api.apify.com/v2/key-value-stores/Km5b4PG3kYHdZSb1E/records/water-network-analyzer-tanks.png?signature=Hdlgk68i0YHf2GO47bfq)

*The network's three tanks over its week settle into the same daily cycle after the first day, and tank 3 tops out each day.*

The hydraulics are those of [EPANET 2.2](https://www.epa.gov/water-research/epanet), the US Environmental Protection Agency's open-source solver for water distribution networks, in the build that comes with the US EPA's [WNTR](https://github.com/USEPA/WNTR) package. Every build of this tool checks it against WNTR's own, independent solver. You install nothing: no Windows, no EPANET, no licence.

It's made for:

- Water utility and consulting engineers who want a second opinion on a model, or fire flow and pipe-break checks across many models, without opening the desktop software.
- Developers of water network apps, digital twins and dashboards who need EPANET results by API, as JSON, CSV and GeoJSON.
- Students and teachers: the pressures, fire flow and water age of a textbook network in seconds.
- Researchers running many networks or scenarios (growth, a maximum day) in batches.
- AI agents asked "can this network deliver fire flow?" or "which pipe break hurts most?". A language model can't solve the network's equations; this tool hands it the numbers, findings and pictures as JSON and PNG.

### How to use it

1. Give **Networks**: a link to an `.inp` file (or a ZIP or GitHub folder of them), or an example network's name. Uploads and pasted files work too.
2. If you like, set the **design criteria** (minimum and maximum pressure, the fire flow and its residual pressure, the velocity and water age limits), choose the **analyses**, or set a **demand multiplier** or the **run length**.
3. Click **Start**. The dataset has a row per network with the verdict, a headline, every number and the findings. The maps, tables and files are in the run's key-value store, and `OUTPUT` sums up the run.

### How-to examples

The result lines come from runs of these inputs. The linked `.inp` files are EPANET's example networks as they're kept in the [WNTR](https://github.com/USEPA/WNTR) repository on GitHub; the tool downloads them from their links and they aren't part of it. Net1, Net2, Net3, Net6, ky4 and ky10 also come with the tool and can be given by name.

#### How to run an EPANET .inp file online

Put the link to the `.inp` file in `networks`. A GitHub or GitLab file page works, and so do raw links, Google Drive and Dropbox. To run a file from your computer, use `upload`; to paste one, `inpText`.

```json
{
  "networks": ["https://github.com/USEPA/WNTR/blob/main/examples/networks/Net3.inp"]
}
```

Result: EPANET's example network 3 (92 junctions, 3 tanks, 2 pumps, a lake and a river as sources) over its 168-hour week. The pressure at junctions with demand stays between 38.7 and 75.4 psi; one junction without demand, 10 at the lake pump's outlet, dips to -0.9 psi. The fastest pipe, 60, runs at 9.37 ft/s, and the two pumps use 2,626 kWh a day. At the busiest hour, 23:00, 57 of the 59 junctions with demand can deliver 1,000 gpm of fire flow with 20 psi residual. Closing pipe 233 alone leaves 33% of the demand unmet, and the average water age is 20 hours (73 at junction 131). 10 seconds, 1 event.

#### How to find where fire flow falls short

Every junction with demand is tested unless you name hydrant junctions in `fireFlowNodes`. Give the required flow and the residual pressure with their units, or leave the defaults (1,000 gpm and 20 psi, or 60 L/s and 14 m for metric networks).

```json
{
  "networks": ["ky10"],
  "fireFlowRequired": "1000 gpm",
  "fireResidualPressure": "20 psi"
}
```

Result: ky10, a Kentucky benchmark network of 920 junctions, 13 tanks and 13 pumps, modelled as a steady state. In normal use no junction with demand is below 35 psi (44.4 to 148.5 psi), yet 423 of its 871 junctions with demand can't deliver 1,000 gpm with 20 psi left. The weakest, J-517, manages 22 gpm, and the median junction 1,122 gpm. The fire flow map rings the short junctions, and `fireFlow.lowest` lists the 20 weakest with the junction whose pressure sets each limit. 33 seconds with every analysis, 2 events.

#### How to find the pipes whose failure hurts most

Pipe criticality runs by default. Each open pipe is closed alone at the busiest hour (or `analysisHour`), and the network is solved with pressure-driven demand.

```json
{
  "networks": ["Net2"]
}
```

Result: Net2, 35 junctions fed by a tank and an inflow at junction 1. At its busiest hour, 18:00, the tank carries the whole supply, so closing pipe 29, the tank's only connection, leaves 100% of the demand unmet and cuts off 32 junctions. Closing any one of 12 of the 40 pipes leaves 10% or more unmet: next come 28 (87%) and 26 (85%), further along the line to the tank. The criticality map colours each pipe by what its closure costs. 3 seconds, 1 event.

#### How to check water age

Water age runs by default; set `waterAgeLimitHours` to your own limit.

```json
{
  "networks": ["Net2"],
  "waterAgeLimitHours": 72
}
```

Result: EPANET's age simulation runs Net2 for a week, past the file's own 55 hours (the demand patterns repeat), and the age averaged over the last day is 45 hours across the junctions with demand. Six of them are over 72 hours, the oldest junction 30 at 97 hours, and at four the age was still rising at the end of the week: fresh water hardly reaches them. The water age map shows where they are. 3 seconds, 1 event.

#### How to see what a maximum day does to the network

`demandMultiplier` scales every demand: 1.5 for a maximum day, 2.5 for a peak hour, or a growth factor.

```json
{
  "networks": ["Net3"],
  "demandMultiplier": 1.5
}
```

Result: with every demand 50% higher, the lowest pressure at a junction with demand drops from 38.7 to 18.4 psi (junction 15, day 7, 1:00), and 5 junctions fall below 35 psi. Tanks 1 and 2 run empty, and all three end the week lower than they began (tank 3 from 79% to 50% full), so supply doesn't keep up. Pump 335 now runs all the time, and the pumps' energy rises from 2,626 to 8,261 kWh a day. Junction 15's fire flow drops from 663 to 382 gpm, and closing pipe 123, a 30-inch main, now leaves 24% of the demand unmet and pushes 75 junctions below 35 psi. 4 seconds, 1 event.

#### How to check a whole folder of models at once

Link to a GitHub folder (or a ZIP), and add `#text` to take only the files whose path holds the text. For a quick health check, leave the slower analyses out with `"analyses": []`: the run, the findings, the maps and the files remain.

```json
{
  "networks": ["https://github.com/USEPA/WNTR/tree/main/examples/networks"],
  "analyses": []
}
```

Result: the 6 networks of WNTR's examples folder in 44 seconds, 1 event each. The largest, Net6 (3,323 junctions, 32 tanks and 61 pumps over 4 days), took 22 seconds: 24 of its junctions with demand drop below 35 psi (to 4.1 psi at JUNCTION-2540), EPANET warns that pump PUMP-3867 runs past the end of its curve, and 24 of its pumps never run. Net1 and ky4 come out with a verdict of ok: only notes, such as junctions above 100 psi.

#### How to let an AI agent check a water network

Add the tool to the agent through Apify's MCP server at `https://mcp.apify.com/?tools=jumblemog/water-network-analyzer`. Asked whether a network can fight fires, the agent sends `{"networks": ["https://.../town.inp"]}` and reads `headline`, `findings` and `fireFlow`. The headline is a sentence it can pass on as it is: "Pressures 38.7 to 75.4 psi over the 168 h run; every junction with demand at or above 35 psi; fastest pipe 9.37 ft/s; 57 of 59 junctions deliver 1,000 gpm of fire flow; the worst single pipe closure (233) leaves 33% of demand unmet; average water age 20 h." `fireFlowMapPngUrl` is a picture it can show.

### FAQ

**Which files can it read?**

- **EPANET input files** (`.inp`) as EPANET 2.0 and 2.2 save them: US or metric units, any headloss formula, patterns, curves, simple and rule-based controls, and pressure-driven demand.
- **Exports for EPANET** from other programs: WaterGEMS and WaterCAD, InfoWater, WNTR and the EPANET-based QGIS plugins all write `.inp` files. Files are told apart from others by their content, so ZIPs and folders with other files in them work.
- **EPA SWMM files**, which are `.inp` files too, are recognised and turned away with a clear message: they're stormwater and sewer models.
- Not read: EPANET-MSX multi-species files, and the native project files of other programs (export them to EPANET first).

**How accurate is it?**
It's EPANET 2.2 itself: the pressures, flows and tank levels are EPANET's, read from its own binary results file. Every build of the tool solves EPANET's Net1 with WNTR's solver too, an independent implementation, and the two agree within 0.1 mm of pressure head over 225 junction pressures; the tool's tests also step through a run with EPANET's toolkit and compare the pressures, heads and flows at every reporting time. Fire flow and criticality are EPANET solves of a steady-state copy of the network at the chosen hour, and `snapshotGap` says how closely that copy reproduces the run (0 in the examples above).

**How is the available fire flow worked out?**
At the busiest hour (or `analysisHour`) the network is frozen as a steady state: that hour's tank levels, pump states and demands, with the controls switched off. At each tested junction an extra demand is raised until the pressure there, or at any other junction that had the residual pressure before, falls to the residual pressure. The search interpolates on the flow to the power 1.852, where headloss is close to linear, to within 0.5% of the flow, up to five times the required flow; a junction that still holds the residual pressure there is reported at the cap (`atCap`). It's the flow the modelled network can supply at the junction, not a field hydrant test, and it leaves out losses in the hydrant's own lateral and nozzle.

**How is pipe criticality worked out?**
In the same frozen copy, each open pipe is closed in turn, largest first, and the network is solved with EPANET's pressure-driven demand: a junction gets its full demand at the minimum service pressure, none at zero, and a share in between (exponent 0.5). The demand delivered is compared with the intact network's: `unmetPercent` is the share of all demand lost, `junctionsShort` counts the junctions newly below the minimum pressure, and `junctionsCutOff` those left with almost nothing. Pumps and valves aren't closed, and pipes with a check valve can't be closed through EPANET's toolkit, so they're left out with a note.

**What's water age, and why a week?**
The hours since the water left a reservoir, counting its time in tanks, from EPANET's own age simulation. Tanks take days to reach a repeating pattern, so the simulation lasts at least 168 hours (repeating the file's demand patterns) and the age reported is the average over its last 24 hours. Junctions whose age rose more than 12 hours from the day before get water so seldom that a week isn't enough to settle them; they're counted in `junctionsStillRising`. For a steady-state model there's no time to simulate, so the age is the travel time from the reservoirs and tanks along the steady flows.

**Can it design, calibrate or optimise a network?**
No, it analyses the network you give as it is. To compare options, give each variant as its own file, or try scenarios with `demandMultiplier`, `durationHours` and `analysisHour`.

**Is my network kept?**
Each network is read and simulated by a separate process with no access to your Apify token, in a temporary folder that's deleted when the run ends. The results and files stay in your own Apify storage.

### Input

| Field | What it does |
|---|---|
| `networks` | One per line: a link to an `.inp` file (a GitHub or GitLab file page, a raw link, Google Drive or Dropbox), a ZIP archive or a GitHub folder of them, or an example network by name: `Net1`, `Net2`, `Net3`, `Net6`, `ky4` or `ky10`. `#text` after a ZIP or folder link takes only the files whose path holds the text (several, comma-separated; `*.inp` patterns work). Up to 100. |
| `upload` | An `.inp` file (or a ZIP of them) from your computer. |
| `inpText` | An `.inp` file pasted in. |
| `analyses` | `waterAge`, `fireFlow`, `criticality` (all three). The hydraulic run and the model checks always run. |
| `analysisHour` | Hours from the start of the run at which fire flow and criticality are tested (the busiest hour). |
| `durationHours` | The run's length, overriding the file's: 0 for a single steady state. |
| `demandMultiplier` | Scales every demand: 1.5 for a maximum day, 2.5 for a peak hour. |
| `fireFlowNodes` | Junction IDs to test for fire flow, such as hydrant locations (every junction with demand). |
| `pressureUnit` | `auto` (psi for US flow units, metres of water for metric ones), `psi`, `m`, `kPa` or `bar`. |
| `minPressure`, `maxPressure` | The service pressure range (35 to 100 psi, or 25 to 70 m), with a unit or in the pressure unit: `40 psi`, `28 m`, `280 kPa`, `2.8 bar`. |
| `fireResidualPressure` | The pressure that must remain during a fire (20 psi, or 14 m). |
| `fireFlowRequired` | The fire flow each junction should deliver (1,000 gpm, or 60 L/s): `1500 gpm`, `95 L/s`, `340 m3/h`. A bare number is in the network's flow unit. |
| `maxVelocity` | Pipes faster than this are flagged (5 ft/s, or 1.5 m/s). |
| `waterAgeLimitHours` | Junctions with older water are flagged (72). |
| `outputs` | `pictures`, `tables`, `excel`, `geojson`, `report` (all five). |
| `timeLimitSeconds` | Downloading and analysing stop after this long (300 s). Fire flow and criticality tests that don't fit are cut short and say so. |

### Output

- **Dataset**: one row per network, with `network`, `source`, `kind` (`file`, `pasted` or `example`), `status`, `error`, `verdict`, `headline`, `description`, the model (`title`, `flowUnits`, `flowUnit`, `pressureUnit`, `unitSystem`, `headlossFormula`, `junctions`, `tanks`, `reservoirs`, `pipes`, `pumps`, `valves`, `pipeLengthKm`, `pipeLengthMiles`), the run (`durationHours`, `steadyState`, `periods`, `averageDemand`, `peakDemand`, `peakDemandTime`, `minimumDemand`), the criteria (`minimumPressure`, `maximumPressure`, `velocityLimit`), pressures (`pressureMin` and `pressureMax` with their junctions and times, `junctionsBelowMinimum`, `junctionsAboveMaximum`, `junctionsNegative`), pipes (`velocityMax`, `velocityMaxPipe`, `pipesOverVelocity`, `headlossMax`, `headlossMaxPipe`), `tankResults`, `pumpResults`, `energyKwhPerDay`, `energyCostPerDay`, `quality` (the file's own quality run), `waterAge`, `analysisTime`, `analysisTimeChosen`, `fireFlow`, `criticality`, `snapshotGap`, `epanetWarnings`, `findings`, `notes`, the file links, `seconds` and `events`.
- Each finding has a `severity` (`critical`, `warning` or `info`) and a `text`.
- **Key-value store**: `pressure-map.png`, `tanks-and-demand.png`, `water-age-map.png`, `fire-flow-map.png`, `criticality-map.png`, `nodes.csv`, `links.csv`, `pressures-over-time.csv`, `results.xlsx`, `network.geojson` and `epanet-report.txt`. With several networks, the second one's files start with `network2-`, the third's with `network3-`, and so on.
- **OUTPUT**: the run as one JSON object, with every network's row (without the tank and pump rows when there are more than 10) and, for a single network, its file links at the top.

### How it works

1. Links are downloaded and uploads fetched; ZIPs and GitHub folders are unpacked, and EPANET files are told apart from other files, SWMM files among them, by their content.
2. Each network is run by a separate process, as an unprivileged user, in a throwaway folder. EPANET 2.2 solves it as the file sets it up, keeping the results of every hydraulic step (up to 2,000 reporting times), and writes its report.
3. Water age is a second EPANET run of at least a week. Fire flow and criticality use a steady-state copy of the network at the chosen hour, checked against the run.
4. The findings compare the results with the design criteria. The maps use the file's coordinates and pipe vertices, or a drawn layout when it has none.

### Pricing

You pay per network analysed, at the price shown on this page. One event covers a network analysed within 30 seconds at the default 2 GB memory (15 seconds at 4 GB, since the platform's cost follows memory); a longer one costs an event for each further started 30 seconds.

Each network's `events` says what it counted for. In the runs above every network counted 1 event, except ky10 with every analysis (33 seconds, 2 events). A large network with every analysis costs more: Net6, with fire flow at all 1,621 of its junctions with demand, all 3,828 open pipes closed in turn and a week of water age, took 654 seconds, 22 events. Networks that can't be downloaded, read or simulated are never charged.

### Speed

Times at the default 2 GB memory, which has half a CPU core, from the runs above:

| Network | What ran | Time |
|---|---|---|
| Net3 (92 junctions, a week) at 1.5 times demand | everything | 4 s |
| Net2 (35 junctions, 55 hours) | everything | 3 s |
| Net3 from its GitHub link | everything, with the download | 10 s |
| ky10 (920 junctions, steady state) | everything | 33 s |
| Net6 (3,323 junctions, 4 days) | hydraulics and checks | 22 s |
| Net6 (3,323 junctions, 4 days) | everything, with `timeLimitSeconds` 900 | 654 s |
| WNTR's examples folder (6 networks) | hydraulics and checks | 44 s |

Fire flow and criticality take the most time, since they solve the network again for every junction and pipe: fire flow several times per junction. On networks of thousands of junctions they take minutes (on Net6, about 10), so name the hydrant junctions in `fireFlowNodes`, raise `timeLimitSeconds`, or give the run more memory (a CPU core per 4 GB). The run's status message shows how far each test has got. A test that runs out of time keeps what it has and says so in `notes`; criticality goes largest pipes first, so a cut-short run has tested the mains.

### Tips and limits

- Fire flow and criticality freeze the chosen hour: its tank levels, pump states and controlled valves. Controls that would act during a fire or a break aren't modelled then, and `snapshotGap` shows how well the frozen copy matches the run.
- Results are kept at every hydraulic step, up to 2,000 reporting times; a longer run keeps every n-th step, while EPANET still solves them all.
- Up to 100,000 nodes a network and 100 networks a run.
- EPANET files carry no coordinate system: the GeoJSON uses the file's coordinates as they are, so set the right system in QGIS or your map.
- The file's own water quality run, a chemical or a source trace, is run and summed up in `quality`. EPANET-MSX isn't run.
- Junctions without demand (pump suctions, high points, dead ends) are left out of the service pressure checks and the fire flow test unless you name them; negative pressures are reported everywhere.

### For AI agents and developers

- **Input**: `networks` (links or example names), and optionally `fireFlowRequired`, `minPressure`, `demandMultiplier` and `analyses`.
- **Output**: in the dataset, each network's `verdict`, `headline`, `findings` and the numbers behind them; `OUTPUT` has every network with its file links.
- **Errors**: a network that can't be read or simulated gets `status: "failed"` and an `error` that says why, with EPANET's own message and the line of the file it refers to, such as `Error 203: undefined node J9 in [PIPES] section (the line: P3 J2 J9 1000 100 130)`. Failed networks cost nothing.

Add the tool to an agent through Apify's MCP server at `https://mcp.apify.com/?tools=jumblemog/water-network-analyzer`. Or get the results from one HTTP call:

```bash
curl -X POST "https://api.apify.com/v2/acts/jumblemog~water-network-analyzer/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"networks": ["Net3"], "fireFlowRequired": "1500 gpm"}'
```

### Credits

- [EPANET 2.2](https://www.epa.gov/water-research/epanet), the US Environmental Protection Agency's software for modelling water distribution systems, developed with the Open Water Analytics community.
- [WNTR](https://github.com/USEPA/WNTR), the Water Network Tool for Resilience by the US EPA and Sandia National Laboratories: its build of the EPANET 2.2 library, its example networks (EPANET's Net1, Net2 and Net3, Net6, and the Kentucky networks ky4 and ky10) and the independent solver the self-test checks against.
- NumPy, pandas, NetworkX, Matplotlib and openpyxl.

# Actor input Schema

## `networks` (type: `array`):

One network per line. A link to an EPANET .inp file (as EPANET, WaterGEMS, InfoWater, WNTR and the QGIS plugins export them), a ZIP archive or a GitHub folder of .inp files (add #net3 to take only the files whose path holds net3), a GitHub or GitLab file page, Google Drive or Dropbox. Or an example network by name: Net1, Net2 or Net3 (EPANET's own examples), Net6 (3,323 junctions), ky4 or ky10 (Kentucky benchmark networks).

## `upload` (type: `string`):

An EPANET .inp file (or a ZIP of them) from your computer, analysed together with the networks above.

## `inpText` (type: `string`):

The text of an EPANET input file: \[JUNCTIONS], \[RESERVOIRS], \[TANKS], \[PIPES], \[PUMPS], \[PATTERNS], \[OPTIONS], \[TIMES] and the other sections, ending with \[END].

## `analyses` (type: `array`):

The hydraulic run itself (pressures, velocities, tanks, pumps and energy, EPANET's warnings) and the model checks always run. Fire flow and criticality solve the network again for every junction or pipe: on networks of thousands of junctions they take a few minutes, so raise the time limit there.

## `analysisHour` (type: `number`):

Hours from the start of the run (to the nearest reporting time). Tank levels, pump states and demands of that hour are frozen for the fire flow and pipe tests. Empty: the busiest hour (the most demand).

## `durationHours` (type: `number`):

Overrides the file's duration: 0 for a single steady state, 24 or 168 for a day or a week of demand patterns, controls and tanks filling and draining. Empty: as the file says.

## `demandMultiplier` (type: `number`):

Scales every demand, such as 1.5 for a maximum day or 2.5 for a peak hour, or 1.2 for growth. Empty: the file's own (usually 1).

## `fireFlowNodes` (type: `array`):

Junction IDs to test, such as hydrant locations. Empty: every junction with a demand.

## `pressureUnit` (type: `string`):

The unit of every pressure in the results, and of the criteria below when they're given as bare numbers.

## `minPressure` (type: `string`):

Junctions with demand below this are flagged, and pipe criticality takes it as the pressure for full service (pressure-driven demand: full demand at this pressure, none at zero). A number in the pressure unit, or with its own unit: 40 psi, 28 m, 280 kPa, 2.8 bar. Empty: 35 psi (US units) or 25 m.

## `maxPressure` (type: `string`):

Junctions with demand above this are flagged as candidates for pressure-reducing valves. Empty: 100 psi (US units) or 70 m.

## `fireResidualPressure` (type: `string`):

The fire flow test keeps the pressure at the hydrant junction, and at every junction that starts above it, at or above this. Empty: 20 psi (US units) or 14 m (about 140 kPa).

## `fireFlowRequired` (type: `string`):

The flow each tested junction should deliver: 1500 gpm, 95 L/s, 340 m3/h. A bare number is in the network's flow unit. The search goes up to five times this, so the results show the full available flow. Empty: 1,000 gpm (US units) or 60 L/s.

## `maxVelocity` (type: `string`):

Pipes faster than this are flagged: 5 ft/s or 1.5 m/s. A bare number is in ft/s for US units, m/s for metric. Empty: 5 ft/s or 1.5 m/s.

## `waterAgeLimitHours` (type: `number`):

Junctions with demand whose average water age (or travel time) is older than this are flagged. Empty: 72 hours.

## `outputs` (type: `array`):

The dataset row with the main numbers and the findings is always made.

## `timeLimitSeconds` (type: `integer`):

Downloading and analysing stop after this long; what was done is kept. Fire flow and criticality tests that wouldn't fit are cut short and say so. Each network is billed for its own time.

## Actor input object example

```json
{
  "networks": [
    "Net3"
  ],
  "analyses": [
    "waterAge",
    "fireFlow",
    "criticality"
  ],
  "pressureUnit": "auto",
  "outputs": [
    "pictures",
    "tables",
    "excel",
    "geojson",
    "report"
  ],
  "timeLimitSeconds": 300
}
```

# Actor output Schema

## `networks` (type: `string`):

A row per network: verdict, headline, pressures and the main counts.

## `hydraulics` (type: `string`):

Demand, pressures, velocities, headloss and pump energy.

## `resilience` (type: `string`):

Available fire flow, pipe closures and water age per network.

## `findings` (type: `string`):

Every finding, EPANET's warnings and the notes.

## `pressureMap` (type: `string`):

The first network coloured by each junction's lowest pressure.

## `fireFlowMap` (type: `string`):

Available fire flow at each tested junction.

## `criticalityMap` (type: `string`):

Demand left unmet when each pipe is closed.

## `waterAgeMap` (type: `string`):

Water age or travel time at each junction.

## `timeSeries` (type: `string`):

Tank levels and demand over the run.

## `excel` (type: `string`):

The first network's workbook: summary, findings, junctions, pipes, tanks, pumps, fire flow and criticality.

## `nodesCsv` (type: `string`):

Every node with its results.

## `linksCsv` (type: `string`):

Every pipe, pump and valve with its results.

## `geojson` (type: `string`):

The network with its results for QGIS or a web map.

## `summary` (type: `string`):

Networks analysed and failed, the message, and the first network's file links.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "networks": [
        "Net3"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("jumblemog/water-network-analyzer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "networks": ["Net3"] }

# Run the Actor and wait for it to finish
run = client.actor("jumblemog/water-network-analyzer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "networks": [
    "Net3"
  ]
}' |
apify call jumblemog/water-network-analyzer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,jumblemog/water-network-analyzer"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/8iLS1cHz7e5E0tIUQ/builds/GZP5dbiMwcJodboQK/openapi.json
