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)
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.
- Weibull Flow-Duration Curve analyzer (
analyze_flow_duration_curve) computingQ50,Q75,Q90,Q95and 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).
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]
See docs/architecture.md for module-level design details.
git clone https://github.com/codesphere-u/microhydro-opt.git
cd microhydro-opt
uv sync --extra devOr install in editable mode with standard pip:
pip install -e ".[dev]"microhydro-opt --head-m 45 --flow-m3s 0.20 --penstock-m 220 --diameter-mm 315
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
uv run ruff check src tests uv run mypy src uv run pytest -v
- Security: See SECURITY.md for responsible disclosure procedures.
- Contributing: See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
- Changelog & Roadmap: See CHANGELOG.md and ROADMAP.md.
MIT License — see LICENSE.
Open an issue on GitHub Issues or contact [email protected].