Skip to content

About

Zero-dependency run-of-river micro-hydro engineering toolkit: Flow-Duration Curve (Q75/Q90), Darcy-Weisbach penstock sizing, Joukowsky water-hammer surge pressure, turbine selection, and village LCOE.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

microhydro-opt

CI License: MIT Python 3.11+ Zero Dependencies

Zero-dependency run-of-river micro-hydro engineering toolkit: Flow-Duration Curve (Q75/Q90), Darcy-Weisbach penstock sizing, Joukowsky water-hammer surge pressure, turbine selection, and village LCOE.

  • Mission Domain: Renewable Energy & Rural Micro-Hydro Engineering
  • Stack: Pure Python 3.11+ (zero runtime third-party dependencies, mypy --strict, ruff, pytest)
  • Maintainer: Codesphere Innovations (U) Limited (codesphere-u)

Problem Solved

Rural highland micro-hydro schemes fail when penstocks burst from uncalculated water-hammer pressure surges or lose 25%+ head to undersized pipes during peak flows.

Key Features

  • Weibull Flow-Duration Curve analyzer (analyze_flow_duration_curve) computing Q50, Q75, Q90, Q95 and mandatory river environmental reserve flows.
  • Darcy-Weisbach + Swamee-Jain penstock head loss and Joukowsky water-hammer surge pressure check (analyze_penstock) with PN6–PN25 pipe class selection and rapid-valve-closure warnings.
  • Automatic turbine runner selector (Pelton, Turgo, Banki-Michell Crossflow, Kaplan), annual energy kWh, electrified household count, and 20-year village LCOE (design_micro_hydro).

Architecture Overview

flowchart LR
  Q[River Stream Flows] --> F[analyze_flow_duration_curve<br/>Q75/Q90 & Env Flow]
  F --> P[analyze_penstock<br/>Friction Loss + Joukowsky Surge]
  P --> T[design_micro_hydro<br/>Turbine Runner, kW & Village LCOE]
Loading

See docs/architecture.md for module-level design details.

Installation

git clone https://github.com/codesphere-u/microhydro-opt.git
cd microhydro-opt
uv sync --extra dev

Or install in editable mode with standard pip:

pip install -e ".[dev]"

Quick Start (CLI)

microhydro-opt --head-m 45 --flow-m3s 0.20 --penstock-m 220 --diameter-mm 315

Quick Start (Python API)

from microhydro_opt import SiteSpec, design_micro_hydro

res = design_micro_hydro(SiteSpec('KISORO-1', gross_head_m=65.0, design_flow_m3_s=0.15, penstock_length_m=260.0, penstock_diameter_mm=315.0))
assert res.turbine_type == 'Pelton' and res.electrical_power_kw > 50.0

Testing & Quality Gates

uv run ruff check src tests
uv run mypy src
uv run pytest -v

Security, Contributing & Roadmap

License

MIT License — see LICENSE.

Support & Contact

Open an issue on GitHub Issues or contact codesphereinnovationz@gmail.com.

About

Zero-dependency run-of-river micro-hydro engineering toolkit: Flow-Duration Curve (Q75/Q90), Darcy-Weisbach penstock sizing, Joukowsky water-hammer surge pressure, turbine selection, and village LCOE.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages