resqdb is a Python package designed to run energy system simulations using oemof-tabular and upload the results to a PostgreSQL database.
It automates the process of simulating energy scenarios defined in data packages and storing both scalar results and time-series flows in a structured database format,
allowing for further analysis and visualization.
Key features include:
- Simulation of energy systems defined in
oemof-tabulardata packages. - Automated database schema setup and management using SQLAlchemy.
- Support for storing scenario-specific results (scalars and flows).
- Geographical mapping of results to clusters.
- Automated creation of materialized views in DB for further usage in visualization tool (i.e. Apache Superset)
- Python 3.13 or higher.
- A PostgreSQL database with the PostGIS extension enabled.
- uv for dependency management (recommended).
Clone the repository and install the dependencies using uv:
uv syncThe application is configured via environment variables. Create a .env file in the root directory with the following variables:
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=your_db_host
DB_PORT=5432
DB_NAME=your_db_name
DB_SCHEMA=resqenergy
OEMOF_SCENARIO=investmentBefore running simulations, you need to set up the database schema and default data:
uv run models.py setupTo delete the database schema (CAUTION: this will remove all data):
uv run models.py deleteTo run the main simulation and export the results to the database:
uv run main.pyThis will:
- Run an
oemof-tabularsimulation for the scenario specified inmain.py(default: "investment"). - Create a new scenario entry in the database.
- Export simulation results (scalars and flows) to the database.