Sinergym provides a Gymnasium-based interface to interact with building simulations. This allows control in simulation time through custom controllers, including reinforcement learning agents
Project description
About Sinergym
Sinergym provides a Gymnasium-based interface to interact with simulation engines such as EnergyPlus. This allows control in simulation time through custom controllers, including reinforcement learning agents.
For more information about Sinergym, refer to its documentation.
Main features
⚙️ Simulation engines compatibility. Sinergym is currently compatible with the EnergyPlus Python API for controller-building communication.
📊 Benchmark environments. Similar to Atari or Mujoco, Sinergym allows the use of benchmarking environments to test and compare RL algorithms or custom control strategies.
🛠️ Custom experimentation. Sinergym enables effortless customization of experimental settings. Users can create their own environments or customize pre-configured ones within Sinergym. Select your preferred reward functions, wrappers, controllers, and more!
🏠 Automatic building model adaptation. Automatic adaptation of building models to align with user-defined settings.
🪛 Automatic actuator control. Seamless management of building actuators via the Gymnasium interface. Users only need to specify actuator names, and Sinergym will do the rest.
🤖 Stable Baselines 3 integration. Sinergym is highly integrated with Stable Baselines 3 algorithms, wrappers and callbacks.
✅ Controller-agnostic. Any controller compatible with the Gymnasium interface can be integrated with Sinergym.
☁️ Google Cloud execution. Sinergym provides several features to execute experiments in Google Cloud.
📈 Weights & Biases logging. Automate the logging of training and evaluation data, and record your models in the cloud. Sinergym facilitates reproducibility and cloud data storage through Weights and Biases integration.
📒 Notebook examples. Learn how to get the most out of Sinergym through our notebooks examples.
📚 Extensive documentation, unit tests, and GitHub actions workflows. Sinergym follows proper development practices facilitating community contributions.
Project structure
This repository is organized into the following directories:
sinergym/: the source code of Sinergym.docs/: Sinergym's documentation sources.examples/: notebooks with several examples illustrating how to use Sinergym.tests/: Sinergym tests code.scripts/: auxiliar and help scripts.
Available environments
For a complete and up-to-date list of available environments, please refer to our documentation.
Installation
Read INSTALL.md for detailed installation instructions.
Usage example
This is a simple script using Sinergym:
import gymnasium as gym
import sinergym
# Create environment
env = gym.make('Eplus-datacenter-mixed-continuous-stochastic-v1')
# Initialization
obs, info = env.reset()
truncated = terminated = False
# Run episode
while not (terminated or truncated):
action = env.action_space.sample() # random action selection
obs, reward, terminated, truncated, info = env.step(action)
env.close()
Several usage examples can be consulted here.
Contributing
To report questions and issues, open an issue following the provided templates. We appreciate your feedback!
Check out CONTRIBUTING.md for specific details on how to contribute.
Projects using Sinergym
The following are some of the projects using Sinergym:
📝 If you want to appear in this list, feel free to open a pull request and include the following badge in your repository:
Repository activity
Citing Sinergym
If you use Sinergym in your work, please cite our paper:
@article{Campoy2025sinergym,
title = {Sinergym – A virtual testbed for building energy optimization with Reinforcement Learning},
author = {Alejandro Campoy-Nieves and Antonio Manjavacas and Javier Jiménez-Raboso and Miguel Molina-Solana and Juan Gómez-Romero},
journal = {Energy and Buildings},
volume = {327},
articleno = {115075},
year = {2025},
issn = {0378-7788},
doi = {10.1016/j.enbuild.2024.115075},
url = {https://www.sciencedirect.com/science/article/pii/S0378778824011915},
}
For detailed information, please refer to the documentation.
Installation
Sinergym relies on several dependencies, the specifics of which vary by version.
The table below provides a summary of the dependencies versions supported by Sinergym across its releases:
| Sinergym version | Ubuntu version | Python version | EnergyPlus version | Building model file |
|---|---|---|---|---|
| 0.0 | 18.04 LTS | 3.6 | 8.3.0 | IDF |
| 1.1.0 | 18.04 LTS | 3.6 | 9.5.0 | IDF |
| 1.7.0 | 18.04 LTS | 3.9 | 9.5.0 | IDF |
| 1.9.5 | 22.04 LTS | 3.10.6 | 9.5.0 | IDF |
| 2.4.0 | 22.04 LTS | 3.10.6 | 9.5.0 | epJSON |
| 2.5.0 | 22.04 LTS | 3.10.6 | 23.1.0 | epJSON |
| 3.3.6 | 24.04 LTS | 3.12.3 | 23.1.0 | epJSON |
| 3.5.8 | 24.04 LTS | 3.12.3 | 24.1.0 | epJSON |
We recommend to always use the latest version of Sinergym that is supported by the container. This will help you to avoid the complexities of manual installation. However, if you prefer to manually install Sinergym on your computer, we provide the necessary documentation in the subsequent sections.
Docker container
We provide a Dockerfile to install all dependencies and prepare the image for running Sinergym. This is the recommended option, since it ensures that all dependencies and versions are correctly installed and configured.
This Dockerfile installs the compatible operating system, EnergyPlus, Python, and Sinergym, along with the necessary dependencies for its proper functioning.
If you have cloned the repository, run the following command:
$ docker build -t <tag_name> .
Sinergym has a set of optional dependencies that enhance its usage. These dependencies can be installed in the following way when building the image:
$ docker build -t <tag_name> --build-arg SINERGYM_EXTRAS="drl notebooks gcloud" .
These optional dependencies allow you to use stable-baselines3, wandb, notebooks and gcloud. For more information, please refer to the pyproject.toml file at the root of the repository ([tool.poetry.extras] section).
If you want to install all optional packages, use extras in the SINERGYM_EXTRAS argument.
:memo: Note: the container can also be directly installed from the Docker Hub repository. It contains all the project's releases with secondary dependencies or lite versions.
Once the container image is ready, you can execute any command as follows:
$ docker run -it --rm <tag_name> <command>
By default, the command executed is python scripts/try_env.py, which is a minimal working example.
If you want to run a DRL experiment, for example, you can do it like this:
$ docker build -t example/sinergym:latest --build-arg SINERGYM_EXTRAS="drl" .
$ docker run -e WANDB_API_KEY=$WANDB_API_KEY -it --rm example/sinergym:latest python scripts/train/train_agent.py -conf scripts/train/train_agent_PPO.json
If the script you want to use requires a Weights and Biases account, remember to include the corresponding API token in a container environment variable.
It is also possible to keep an open session in the image. For more information, please refer to the official Docker documentation. This may help to run your own scripts in the container.
$ docker run -it <tag_name> /bin/bash
:memo: Note: For Visual Studio Code users, simply open the root directory and click the Reopen in container pop-up button. This will automatically install all dependencies and enable you to run Sinergym in an isolated environment. For more details about this feature, refer to the VSCode Containers extension documentation.
Manual installation
If you prefer not to use containers and install it natively on your system, we provide some guidance on how to do it.
First, ensure that your system meets the previously specified software compatibility requirements. Without this, we cannot provide support or guarantees of functionality.
Configure Python Environment
Start by installing the desired version of Python and pip. It is recommended to set up a working environment for Python. Finally, install the necessary dependencies of Sinergym in that environment:
$ pip install sinergym
You can also install the optional packages by running:
$ pip install sinergym[extras]
To directly install Sinergym from the cloned repository, run:
$ poetry install --no-interaction --only main --extras <optional_extras>
# or
$ pip install .[<optional_extras>]
Now the correct Python version and the necessary modules to run Sinergym will be installed.
Let's now proceed with the installation of external software.
Install EnergyPlus
We have tested and confirmed compatibility with EnergyPlus version 24.1.0. Sinergym might not work with other non-tested versions.
Follow the instructions detailed here to install it in Linux (we only guarantee proper testing and support for Ubuntu).
After installation, the folder Energyplus-24-1-0 should appear in the selected location.
Include EnergyPlus Python API in Python path
Sinergym relies on the Energyplus Python API. The modules of this API are located in the EnergyPlus folder that was created in the previous step. You must add this installation path to the PYTHONPATH environment variable so that the interpreter can access these modules.
Develop in Sinergym
Whether you have chosen to use Docker or a manual installation, we offer facilities for developing and contributing to Sinergym.
-
If you have used a container, Visual Studio Code will set up a development environment with all the necessary packages automatically configured, including documentation, tests, etc.
-
If you have decided to use a container without Visual Studio Code, you can use the Dockerfile available in the
.devcontainerfolder instead of the one in the root of the repository. If you create your own Dockerfile, make sure to perform the following installation so that all development modules are available:
RUN poetry install --no-interaction
The default installation includes all development packages. To avoid this, you should specify --only main or --without <develop_groups>. The development groups can also be found
in pyproject.toml.
If you have manually installed the project, you can install the development packages from poetry in the same way. Once the repository is cloned, run:
$ poetry install --no-interaction
The command is similar to the one shown in the manual installation section, but without specifying groups or extras, so that all development packages are installed. In this case, it is not possible to use pip because it does not include information about development dependencies (except those listed in extras).
:memo: For more information about how poetry dependencies work, visit its official documentation.
Verify Installation
This project is automatically monitored using tests. To verify that Sinergym has been installed correctly, execute pytest tests/ -vv from the repository root directory. Tests dependencies should have been previously installed.
Each time the Sinergym repository is updated, the tests are automatically executed in a remote container built using the Dockerfile. This task is performed via Github actions (refer to the Github actions documentation section for additional details).
Cloud Computing
We provide some features to execute experiments in Google Cloud. For more information visit the Google Cloud integration section of the documentation.
Contributor Covenant Code of Conduct
Our Pledge
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
Our Standards
Examples of behavior that contributes to a positive environment for our community include:
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community
Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting
Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
Scope
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at [INSERT CONTACT METHOD]. All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
1. Correction
Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
2. Warning
Community Impact: A violation through a single incident or series of actions.
Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
3. Temporary Ban
Community Impact: A serious violation of community standards, including sustained inappropriate behavior.
Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
4. Permanent Ban
Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
Consequence: A permanent ban from any sort of public interaction within the community.
Attribution
This Code of Conduct is adapted from the Contributor Covenant, version 2.0, available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by Mozilla's code of conduct enforcement ladder.
For answers to common questions about this code of conduct, see the FAQ at https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
MIT License
Copyright (c) 2025, A. Campoy, A. Manjavacas, J. Jiménez, M. Molina, J. Gómez
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sinergym-3.8.4.tar.gz.
File metadata
- Download URL: sinergym-3.8.4.tar.gz
- Upload date:
- Size: 3.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81ba5bd80056f8beaaf47f79ca759e04240eb108295765e80651e575f961675a
|
|
| MD5 |
a911141d61c90363aa9bfcfadff5dc04
|
|
| BLAKE2b-256 |
d1d30cc0cfbb6abe28ba5d3a81689fd84ccb6e15f2d58315b43b1cc8e73c28c6
|
Provenance
The following attestation bundles were made for sinergym-3.8.4.tar.gz:
Publisher:
create_release.yml on ugr-sail/sinergym
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sinergym-3.8.4.tar.gz -
Subject digest:
81ba5bd80056f8beaaf47f79ca759e04240eb108295765e80651e575f961675a - Sigstore transparency entry: 200628526
- Sigstore integration time:
-
Permalink:
ugr-sail/sinergym@4ae5986c5130eb485c81cc0fefaaa12ac1bce769 -
Branch / Tag:
refs/tags/v3.8.4 - Owner: https://github.com/ugr-sail
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
create_release.yml@4ae5986c5130eb485c81cc0fefaaa12ac1bce769 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sinergym-3.8.4-py3-none-any.whl.
File metadata
- Download URL: sinergym-3.8.4-py3-none-any.whl
- Upload date:
- Size: 3.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c7aa98e5af059cf7a2dedd7c8ca52ee401c3def6259d972938d1bb168fc1931
|
|
| MD5 |
fdf882a2e9fb1b93f8395b1fa1953e77
|
|
| BLAKE2b-256 |
329cb5d19f20c344703da309e1f96a9ce4a8a99c67b9654b16e8d45e497d686a
|
Provenance
The following attestation bundles were made for sinergym-3.8.4-py3-none-any.whl:
Publisher:
create_release.yml on ugr-sail/sinergym
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sinergym-3.8.4-py3-none-any.whl -
Subject digest:
3c7aa98e5af059cf7a2dedd7c8ca52ee401c3def6259d972938d1bb168fc1931 - Sigstore transparency entry: 200628531
- Sigstore integration time:
-
Permalink:
ugr-sail/sinergym@4ae5986c5130eb485c81cc0fefaaa12ac1bce769 -
Branch / Tag:
refs/tags/v3.8.4 - Owner: https://github.com/ugr-sail
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
create_release.yml@4ae5986c5130eb485c81cc0fefaaa12ac1bce769 -
Trigger Event:
release
-
Statement type: