NGCI-DHN: District Heating Network Analysis
Tools for creating and analyzing district heating networks from building footprints and road networks. Provides a CLI.
Two commands over one engine:
ngci-dhn create: the creator. Builds a network from footprints and roads, sizes its pipes, renders and exports it for the front-end (the API callsrun_create).ngci-dhn run: the pipeline. One configuration file runs screen, demand, layout, size, simulate, check and evaluate and writes a workspace with a manifest (input hashes, versions, per-stage status, artefact hashes, KPIs).
Both are built on the same stage functions and the data contract of docs/CONTRACT.md
(ngci_dhn.model, ngci_dhn.ports), one feature package per stage: road_processing (screen), creation
(layout), sizing (reduce, size), operation (simulate, check), economics (evaluate), with adapters in
data_fetching and demand.
ngci-dhn validate-config tests/fixtures/toy_district/config.json
ngci-dhn run --config tests/fixtures/toy_district/config.json --workspace outputs/toy
docs/CONFIG.md describes both configuration schemas, docs/OUTPUTS.md the workspace and the conventions behind
the KPI block, docs/CONTRACT.md the types, ports and every engineering decision with its date. Fixtures:
tests/fixtures/toy_district (a synthetic year), tests/fixtures/st_jerome (real roads with 0.25 m vertices),
tests/fixtures/destest_ce1 (the IBPSA DESTEST pipe classes).
Overview
This project builds a district heating network by:
- Selecting buildings within a radius around a center point.
- Validating building attributes and deriving heights.
- Preparing a road network (from a file or OSM download).
- Creating a network graph (exported as image and/or GeoJSON) and sizing pipes.
Quickstart
- Create a virtual environment and install dependencies.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -r requirements-dev.txt
- Install the package (to enable the
ngci-dhnCLI entrypoint).
pip install -e ".[dev]"
- Run the example workflow.
ngci-dhn create --config configs/dhn_creator_example.json --output outputs/dhn_creator_demo --plot
CLI Usage
- Main workflow:
ngci-dhn create --config configs/dhn_creator_example.json --output outputs/dhn_creator_demo
- Alternative (no editable install):
python -m ngci_dhn create --config configs/dhn_creator_example.json --output outputs/dhn_creator_demo
- Output directory and log level:
ngci-dhn create --config configs/dhn_creator_example.json --output outputs/run_01 --log-level DEBUG
Notes:
pip install -e .is only needed once per environment, and only if you want thengci-dhncommand.
Documentation
docs/CONFIG.md: configuration reference with fields and defaults.docs/OUTPUTS.md: output files and logs.docs/METHODS.md: how each stage works: assumptions, typical values and the reasons behind them.configs/dhn_creator_example.json: working example configuration.
Configuration
Creator inputs
The JSON config is organized into creator, city, and factory steps. city and factory are optional; if omitted they are skipped. The output directory is provided via CLI --output. See the example at configs/dhn_creator_example.json.
Legacy config keys (inputs, selection, roads_download, etc.) are no longer supported.
Key sections:
creator: inputs, selection, building validation, plants, and roads settings.city: EnergyPlus settings (optional).factory: pipe sizing settings (optional).
Dataset note:
- If you want Montreal buildings/roads data, you can download the dataset here:
https://ngci.encs.concordia.ca/ckan/dataset/dhn-building-and-road-data
- Once downloaded, point
creator.inputs.buildingsandcreator.inputs.roadsinconfigs/dhn_creator_example.jsonto the local files.
Overpass API
The ngci-dhn downloads road network open data through osmnx, which depends on a public Overpass API instance (https://overpass-api.de). This is perfect for small, experimental use because it requires no environment setup. However, for high-volume use, we strongly recommend you run a local Overpass API instance with Docker. To use in ngci-dhn, please set the environment variable OVERPASS_URL. For example, in Linux:
export OVERPASS_URL="https://your_overpass_instance"
Python API
You can use the ngci-dhn package via CLI or API. See https://ngci.encs.concordia.ca/gitea/CERC/district_heating_network_api
Project Structure
src/ngci_dhn/: core package, CLI, workflow, and utilities.configs/: example configuration files.docs/: configuration and outputs documentation.scripts/: helper scripts for data prep and rendering.tests/: pytest suite and fixtures.
Testing
Run the tests from the repo root:
pytest
Notes:
- If
creator.inputs.roadsis missing or not found, the workflow downloads roads from OpenStreetMap via OSMnx (when enabled). - Plot output is saved as
network-graph.pngwhen--plotis enabled.
Citation
If you use this software in your research, please cite it. A CITATION.cff file is included; you can also use the BibTeX entry below:
@software{rezaei_dhn_analysis,
author = {Rezaei, Abolfazl},
title = {District Heating Network Analysis},
year = {2026},
version = {0.0.0},
license = {LGPL-3.0-or-later},
url = {https://ngci.encs.concordia.ca/gitea/a_rezaei/district_heating_network_analysis}
}
License
This project is licensed under the GNU Lesser General Public License v3.0 or later (LGPL-3.0-or-later). The LGPL incorporates the terms of the GNU GPL v3.0 by reference. See LICENSE for the LGPL text and LICENSE.GPL for the GPL text.
Copyright © 2025-2026 Next-Generation Cities Institute, Concordia University.
Metadata
Release files for ngci-dhn 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ngci_dhn-0.5.0.tar.gz | 115.7 kB | Without provenance | Details for ngci_dhn-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ngci_dhn-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for ngci_dhn-0.5.0-py3-none-any.whl |
Total release size: 272.9 kB
Release files / ngci_dhn-0.5.0.tar.gz
| Download URL | ngci_dhn-0.5.0.tar.gz |
|---|---|
| Size | 115.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
568b0b57d5a1a22fe056baea996b9d1693e02921f4809c31e9d62e730560f539
|
|
BLAKE2b-256 checksum How to use checksums |
cf7fb95030be28ca9e486132d680fc2817a160d4f05602c203abd6676d6b10ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|
Release files / ngci_dhn-0.5.0-py3-none-any.whl
| Download URL | ngci_dhn-0.5.0-py3-none-any.whl |
|---|---|
| Size | 157.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87ccf53e90ef7f74d946dd4e7248a3820c9ba4a21efc5cf4de4072548b3ff96c
|
|
BLAKE2b-256 checksum How to use checksums |
612b6eb1a302c24c80ce2f1756293cc26329a41cf451eec9164180dc8215ea86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|
Security for ngci-dhn 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.