Metadata-Version: 2.4
Name: tempregpy
Version: 0.3.0.post0
Summary: Temperature regulation optimization for hydropower operations
Author-email: "M. Pavicevic" <mpavicevic@anl.gov>, "Q. Ploussard" <qploussard@anl.gov>
Maintainer: Argonne National Laboratory Energy Modelling Hub
License: MIT
Project-URL: Homepage, https://github.com/energy-modelling-hub/TempRegPy
Project-URL: Documentation, https://github.com/energy-modelling-hub/TempRegPy
Project-URL: Repository, https://github.com/energy-modelling-hub/TempRegPy
Project-URL: Issues, https://github.com/energy-modelling-hub/TempRegPy/issues
Keywords: hydropower,optimization,temperature-regulation,water-resources,energy-systems
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.21.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: matplotlib>=3.4.0
Requires-Dist: scipy>=1.7.0
Requires-Dist: ortools>=9.14.0
Requires-Dist: openpyxl>=3.0.0
Requires-Dist: typer>=0.9.0
Requires-Dist: tqdm>=4.60.0
Provides-Extra: color
Requires-Dist: colorlog>=6.0.0; extra == "color"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Dynamic: license-file

## TempRegPy
Temperature-constrained hydropower dispatch optimization using Mixed-Integer Linear Programming (MILP).

## Overview
TempRegPy optimizes hydropower release schedules to maximize energy revenue while maintaining downstream water temperatures within ecological limits. It uses selective withdrawal from thermally stratified reservoirs, market-based dispatch, and configurable operational constraints within a MILP framework solved via HiGHS (OR-Tools MathOpt).

## Installation
uv pip install:

```Bash
uv pip install tempregpy
```
Or with pip:


```Bash
pip install tempregpy
```
For development:


```Bash
git clone https://github.com/energy-modelling-hub/TempRegPy.git
cd TempRegPy
uv pip install -e ".[dev]"
```

## Quick Start
Generate a synthetic configuration file:

```Bash
python examples/generate_config.py
```
Run the optimizer:

```Bash
python -m tempregpy run -c examples/config.xlsx
```
See examples/README.md for details on the synthetic test case.

## Features
- MILP-based temperature-constrained hydropower dispatch
- Selective withdrawal from thermally stratified reservoirs
- Multiple bilinear term linearization methods (McCormick, triangles, polygons, sum-of-convex)
- Configurable ramping, cycling, and operating range constraints
- Market-based dispatch with locational marginal prices
- HiGHS solver via OR-Tools MathOpt (open-source)
- Excel-based configuration input
- CLI interface

## Citation
If you use TempRegPy in your research, please cite:

```Code snippet
@article{pavicevic2025tempregpy,
  title={TempRegPy: An Open-Source MILP Framework for Temperature-Constrained Hydropower Dispatch with Application to Glen Canyon Dam},
  author={Pavicevic, Matija and Usis, Maris Andris and Yu, Ao and Henriquez, Walter Antonio and Wilhite, Jerry and Ploussard, Quentin},
  journal={Environmental Modelling \& Software},
  year={2025},
  doi={DOI_PLACEHOLDER}
}
```
## License
MIT License. See LICENSE for details.

# Developers guide (compile .exe file)
```commandline
python -m venv ./env
./env/scripts/activate
pip install -r requirements2.txt
pyinstaller runwapasim.spec
```
RunWAPASim.exe can be found in the /dist folder
