Temoa
Tools for Energy Model Optimization and Analysis (Temoa) is an open source modeling framework for conducting energy system analysis.
https://github.com/TemoaProject/temoa
Category: Energy Systems
Sub Category: Energy System Modeling Frameworks
Keywords from Contributors
energy-system-model scenario-analysis temoa
Last synced: about 3 hours ago
JSON representation
Repository metadata
Tools for Energy Model Optimization and Analysis
- Host: GitHub
- URL: https://github.com/TemoaProject/temoa
- Owner: TemoaProject
- License: mit
- Created: 2015-01-10T19:22:06.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2026-04-22T02:43:45.000Z (about 8 hours ago)
- Last Synced: 2026-04-22T04:39:11.103Z (about 6 hours ago)
- Language: Python
- Homepage: https://docs.temoaproject.org/en/latest/
- Size: 43.8 MB
- Stars: 102
- Watchers: 14
- Forks: 64
- Open Issues: 2
- Releases: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Citation: CITATION.cff
README.md
TEMOA
Overview
TEMOA (Tools for Energy Model Optimization and Analysis) is a sophisticated energy systems optimization framework that supports various modeling approaches including perfect foresight, myopic planning, uncertainty analysis, and alternative generation.
Quick Start
Standard Installation
# Install from PyPI in a virtual environment
python -m venv .venv
# Activate virtual environment
# On Linux/Mac:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate
# Install temoa
pip install temoa
Get Started in 30 Seconds
In a virtual env with temoa installed, run:
# Create tutorial files in the current directory
# Creates tutorial_config.toml and tutorial_database.sqlite
temoa tutorial
# Run the model
temoa run tutorial_config.toml
Package Structure
The Temoa package is organized into clear modules:
temoa.core- Public API for end users (TemoaModel, TemoaConfig, TemoaMode)temoa.cli- Command-line interface and utilitiestemoa.components- Model components and constraintstemoa.data_io- Data loading and validationtemoa.extensions- Optional extensions for different modeling approachesmodeling_to_generate_alternatives- MGA analysismethod_of_morris- Sensitivity analysismonte_carlo- Uncertainty quantificationmyopic- Sequential decision making
temoa.model_checking- Model validation and integrity checkingtemoa.data_processing- Output analysis and visualizationtemoa.utilities- Helper scripts and migration tools
Installation & Setup
Development Installation
For users who want to contribute to or modify Temoa should install in development mode using uv:
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone repository
git clone https://github.com/TemoaProject/temoa.git
cd temoa
# Setup development environment with uv
uv sync --all-extras --dev
# Install pre-commit hooks
uv run pre-commit install
# Run tests
uv run pytest
# Run type checking
uv run mypy
Command Line Interface
Temoa provides a modern, user-friendly CLI built with Typer:
Basic Commands
Run a model:
temoa run tutorial_config.toml
temoa run tutorial_config.toml --output results/
temoa run tutorial_config.toml --build-only # Build without solving
Validate configuration:
temoa validate tutorial_config.toml
temoa validate tutorial_config.toml --debug
Database migration:
temoa migrate old_database.sql --output new_database.sql
temoa migrate old_database.db --type db
temoa migrate old_database.sqlite --output migrated_v4.sqlite
Generate tutorial files:
temoa tutorial # Creates tutorial_config.toml and tutorial_database.sqlite
temoa tutorial my_model my_db # Custom names
Global Options
temoa --version # Show version information
temoa --how-to-cite # Show citation information
temoa --help # Full help
Using with uv
When working with the source code, use uv run to ensure you're using the correct dependencies:
uv run temoa run tutorial_config.toml # Run with project dependencies
uv run temoa validate tutorial_config.toml # Validate configuration
uv run temoa tutorial # Create tutorial files
Programmatic Usage
You can use Temoa as a Python library:
import temoa
from pathlib import Path
from temoa import TemoaModel, TemoaConfig, TemoaMode
# Create configuration
config = TemoaConfig(
scenario="my_scenario",
scenario_mode=TemoaMode.PERFECT_FORESIGHT,
input_database=Path("path/to/input.db"),
output_database=Path("path/to/output.db"),
output_path=Path("path/to/output"),
solver_name="appsi_highs"
)
# Build and solve model
model = TemoaModel(config)
result = model.run() # Equivalent to: temoa run tutorial_config.toml
# Check if run was successful
if result:
print("Model solved successfully!")
else:
print("Model failed to solve")
Database Setup
Quick Setup with Tutorial
The fastest way to get started:
temoa tutorial
This creates:
tutorial_config.toml- Configuration file with example settingstutorial_database.sqlite- Sample database for learning
Migration from older versions:
# Migrate from v3.1 to v4
temoa migrate old_database_v3.1.sql --output new_database_v4.sql
# or for SQLite databases
temoa migrate old_database_v4.sqlite --output new_database_v4.sqlite
Configuration Files
A configuration file is required to run the model. The tutorial command creates a complete example:
scenario = "tutorial"
scenario_mode = "perfect_foresight"
input_database = "tutorial_database.sqlite"
output_database = "tutorial_database.sqlite"
solver_name = "appsi_highs"
Configuration Options
| Field | Notes |
|---|---|
| Scenario Name | Name used in output tables (cannot contain '-' symbol) |
| Temoa Mode | Execution mode (PERFECT_FORESIGHT, MYOPIC, MGA, etc.) |
| Input/Output DB | Source and output database paths |
| Price Checking | Run pricing analysis on built model |
| Source Tracing | Verify commodity flow network integrity |
| Plot Network | Generate HTML network visualizations |
| Solver | Solver executable name (appsi_highs, cbc, gurobi, cplex, etc.) |
| Save Excel | Export core output to Excel files |
| Save LP | Save LP model files for external solving |
Supported Modes
Perfect Foresight
Solves the entire model at once. Most common mode for optimization.
Myopic
Sequential solving through iterative builds. Required for stepwise decision analysis.
MGA (Modeling to Generate Alternatives)
Explores near cost-optimal solutions for robustness analysis.
SVMGA (Single Vector MGA)
Two-solve process focusing on specific variables in the objective.
Method of Morris
Limited sensitivity analysis of user-selected variables.
Build Only
Builds model without solving. Useful for validation and troubleshooting.
Typical Workflow
-
Setup: Create configuration and database files:
temoa tutorial -
Configure: Edit the configuration file to match your scenario
-
Validate: Check configuration before running:
temoa validate tutorial_config.toml -
Run: Execute the model:
temoa run tutorial_config.toml -
Review: Check results in
output_files/YYYY-MM-DD_HHMMSS/ -
Iterate: Modify configuration and run again
Advanced Features
Extensions
Temoa includes optional extensions for advanced analysis:
- Monte Carlo: Uncertainty quantification
- Stochastic Programming: Scenario-based optimization
- Method of Morris: Sensitivity analysis
Data Processing
- Excel output generation
- Graphviz network visualization
- Interactive network diagrams
Model Validation
- Built-in validation checks
- Commodity flow verification
- Price consistency analysis
Solver Dependencies
TEMOA requires at least one optimization solver:
-
Free: HiGHS
- Included via the
highspyPython package (automatically installed with Temoa) - Default solver for tutorial and testing
- Included via the
-
Free: CBC
- Requires separate installation (see CBC documentation)
- Alternative free solver option
-
Commercial: Gurobi, CPLEX, or Xpress
- Requires separate license and installation
- See individual solver documentation
Troubleshooting
Solver Issues
If you encounter solver errors:
# For commercial solvers (Gurobi, CPLEX)
pip install ".[solver]" # Include specific solver packages
# For free solver
temoa run tutorial_config.toml --debug # Get detailed error information
Documentation & Support
- Full Documentation: Built by following docs/README.md
- API Reference: See
temoa.coremodule for public API - GitHub Issues: Report bugs and request features
- Tutorials: Run
temoa tutorialfor guided examples
Code Style & Quality
For contributors:
- Ruff: Code formatting and linting
- mypy: Type checking
- pytest: Testing framework
- Pre-commit: Automated quality checks
See CONTRIBUTING.md for detailed development guidelines.
Citation
If you use Temoa in your research, please cite:
@article{hunter2013modeling,
title={Modeling for insight using Tools for Energy Model Optimization and Analysis (Temoa)},
journal={Energy Economics},
volume={40},
pages={339--349},
year={2013},
doi={10.1016/j.eneco.2013.07.014}
}
Or use: temoa --how-to-cite
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-name: "Hunter"
given-names: "Kevin"
- family-name: "Sreepathi"
given-names: "Sarat"
- family-name: "DeCarolis"
given-names: "Joseph F."
title: "Modeling for insight using Tools for Energy Model Optimization and Analysis (Temoa)"
journal: "Energy Economics"
volume: "40"
pages: "339-349"
year: 2013
month: 11 # November
doi: "10.1016/j.eneco.2013.07.014"
url: "https://doi.org/10.1016/j.eneco.2013.07.014"
Owner metadata
- Name: An open source energy system model
- Login: TemoaProject
- Email:
- Kind: user
- Description:
- Website: http://temoaproject.org
- Location: Raleigh, NC
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/10479169?u=d02dfcc3f3ab7a2d8b7ba671b9e0ffd7511c786f&v=4
- Repositories: 5
- Last ynced at: 2024-06-11T15:59:18.499Z
- Profile URL: https://github.com/TemoaProject
GitHub Events
Total
- Release event: 1
- Delete event: 52
- Member event: 1
- Pull request event: 181
- Fork event: 8
- Issues event: 27
- Watch event: 15
- Issue comment event: 86
- Push event: 263
- Pull request review event: 203
- Pull request review comment event: 400
- Create event: 52
Last Year
- Delete event: 52
- Member event: 1
- Pull request event: 172
- Fork event: 6
- Issues event: 26
- Watch event: 8
- Issue comment event: 84
- Push event: 259
- Pull request review event: 203
- Pull request review comment event: 400
- Create event: 50
Committers metadata
Last synced: 2 days ago
Total Commits: 1,897
Total Committers: 32
Avg Commits per committer: 59.281
Development Distribution Score (DDS): 0.802
Commits in past year: 591
Committers in past year: 7
Avg Commits per committer in past year: 84.429
Development Distribution Score (DDS) in past year: 0.508
| Name | Commits | |
|---|---|---|
| Jeff H | j****f@w****s | 376 |
| Davey Elder | i****r@g****m | 297 |
| ParticularlyPythonicBS | a****l@a****v | 269 |
| Kevin Hunter | h****e@e****u | 215 |
| jdecarolis | j****s@g****m | 202 |
| kevin | k****n@3****2 | 144 |
| Aranya Venkatesh | 4****h | 82 |
| Cameron Wade | c****n@s****a | 80 |
| binghui89 | b****6@n****u | 40 |
| Ankur Garg | c****g@g****m | 37 |
| spkanung | s****o@g****m | 35 |
| Hadi Eshraghi | h****g@n****u | 31 |
| Hadi Eshraghi | E****n@H****l | 28 |
| Joseph Decarolis | j****s@l****l | 8 |
| An open source energy system model | j****s@n****u | 7 |
| Katie Jordan | 5****n | 7 |
| Davey Elder | i****r@m****a | 6 |
| spkanung | s****g@n****u | 6 |
| Daniel Huppmann | dh@d****t | 5 |
| Anderson Rodrigo de Queiroz | a****z@A****l | 4 |
| CANOE-main | c****h@g****m | 3 |
| root | c****g@m****m | 2 |
| jdecarolis | j****s@3****2 | 2 |
| Suyash | s****h@S****l | 2 |
| Joseph Decarolis | j****s@l****u | 2 |
| pre-commit-ci[bot] | 6****] | 1 |
| A. Rodrigo de Queiroz | a****z@R****l | 1 |
| Binghui Li | b****i@B****l | 1 |
| Jeff Thomas | j****3@c****u | 1 |
| tesadmin | t****n@t****m | 1 |
| and 2 more... | ||
Committer domains:
- ncsu.edu: 4
- samitsolutions.com: 1
- test.temoacloud.com: 1
- ccee-hpc.ce.ncsu.edu: 1
- l-jfdecaro-01.ce.ncsu.edu: 1
- mgmail.com: 1
- dergelbesalon.at: 1
- mail.utoronto.ca: 1
- sutubra.ca: 1
- earlham.edu: 1
- anilr.dev: 1
- westernspark.us: 1
Issue and Pull Request metadata
Last synced: 2 days ago
Total issues: 23
Total pull requests: 244
Average time to close issues: about 1 year
Average time to close pull requests: 26 days
Total issue authors: 14
Total pull request authors: 18
Average comments per issue: 2.13
Average comments per pull request: 0.68
Merged pull request: 150
Bot issues: 1
Bot pull requests: 2
Past year issues: 7
Past year pull requests: 136
Past year average time to close issues: about 2 months
Past year average time to close pull requests: 11 days
Past year issue authors: 4
Past year pull request authors: 7
Past year average comments per issue: 3.14
Past year average comments per pull request: 0.99
Past year merged pull request: 79
Past year bot issues: 1
Past year bot pull requests: 2
Top Issue Authors
- idelder (3)
- gschivley (3)
- samgdotson (3)
- TemoaProject (2)
- ParticularlyPythonicBS (2)
- SutubraResearch (2)
- coderabbitai[bot] (1)
- christiancodes (1)
- Riccardo-sus (1)
- EnergyModels (1)
- DJDIAA (1)
- AaronHolm (1)
- codeyash (1)
- jdecarolis (1)
Top Pull Request Authors
- idelder (82)
- jeff-ws (63)
- ParticularlyPythonicBS (43)
- SutubraResearch (27)
- kathjordan (5)
- aranyavenkatesh (5)
- jdecarolis (3)
- matteo-nicoli (3)
- github-actions[bot] (2)
- PatwaUmang (2)
- danielhuppmann (2)
- kerodkibatu (1)
- iankurgarg (1)
- TemoaProject (1)
- yashsamit (1)
Top Issue Labels
- bug (1)
- Maintenance (1)
Top Pull Request Labels
- Maintenance (15)
- bugfix (8)
- Feature (8)
- docs (7)
- refactor (5)
- enhancement (5)
- type-safety (4)
- database-schema (3)
- dependencies (2)
- model_changes (2)
- automated-pr (2)
- Infra (2)
- bug (1)
- LICENSE (1)
Package metadata
- Total packages: 2
-
Total downloads:
- pypi: 749 last-month
- Total dependent packages: 0 (may contain duplicates)
- Total dependent repositories: 0 (may contain duplicates)
- Total versions: 22
- Total maintainers: 2
proxy.golang.org: github.com/temoaproject/temoa
- Homepage:
- Documentation: https://pkg.go.dev/github.com/temoaproject/temoa#section-documentation
- Licenses: gpl-2.0
- Latest release: v4.0.0+incompatible (published 9 days ago)
- Last Synced: 2026-04-16T05:49:51.861Z (6 days ago)
- Versions: 9
- Dependent Packages: 0
- Dependent Repositories: 0
-
Rankings:
- Dependent packages count: 6.999%
- Average: 8.173%
- Dependent repos count: 9.346%
pypi.org: temoa
Tools for Energy Model Optimization and Analysis
- Homepage: https://temoaproject.org
- Documentation: https://temoaproject.github.io/temoa
- Licenses: MIT
- Latest release: 4.0.0 (published 9 days ago)
- Last Synced: 2026-04-16T05:49:50.304Z (6 days ago)
- Versions: 13
- Dependent Packages: 0
- Dependent Repositories: 0
- Downloads: 749 Last month
-
Rankings:
- Dependent packages count: 7.834%
- Downloads: 18.224%
- Average: 23.449%
- Dependent repos count: 44.29%
- Maintainers (2)
Dependencies
- deprecated
- gravis
- gurobi
- ipykernel
- ipython
- joblib
- jupyter
- jupyter_contrib_nbextensions
- matplotlib
- networkx
- numpy
- openpyxl
- pandas
- plotly
- pyam
- pydoe
- pyomo 6.7
- pytest
- python 3.12
- python-graphviz
- pyutilib
- salib
- scipy
- seaborn
- sphinx
- sphinx_rtd_theme
- sphinxcontrib-bibtex
- sphinxcontrib-htmlhelp
- sphinxcontrib-serializinghtml
- tabulate
- xlsxwriter
- xlwt
- Deprecated *
- graphviz *
- gravis *
- gurobipy *
- highspy *
- ipykernel *
- ipython *
- joblib *
- jupyter *
- jupyter_contrib_nbextensions *
- matplotlib *
- networkx *
- numpy *
- openpyxl *
- pandas *
- plotly *
- pyam-iamc *
- pydoe *
- pyomo *
- pytest *
- pyutilib *
- salib *
- scipy *
- seaborn *
- sphinx *
- sphinx-rtd-theme *
- sphinxcontrib-bibtex *
- sphinxcontrib-htmlhelp *
- sphinxcontrib-serializinghtml *
- tabulate *
- xlsxwriter *
- 195 dependencies
Score: 14.731532453705233