ugr-sail / sinergym

Gym environment for building simulation and control using reinforcement learning
https://ugr-sail.github.io/sinergym/
MIT License
134 stars 36 forks source link
building-control building-energy buildings energyplus framework python reinforcement-learning reinforcement-learning-environments simulation


Github latest release Github last commit pypi version pypi downloads GitHub Contributors Github issues GitHub pull requests Github license pypi Python version DockerHub last version



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:

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

Alt

Citing Sinergym

If you use Sinergym in your work, please cite our paper:

@article{campoy2024sinergym,
  title     = {Sinergym--A virtual testbed for building energy optimization with Reinforcement Learning},
  author    = {Campoy-Nieves, Alejandro and Manjavacas, Antonio and Jim{\'e}nez-Raboso, Javier and Molina-Solana, Miguel and G{\'o}mez-Romero, Juan},
  journal   = {Energy and Buildings},
  pages     = {115075},
  year      = {2024},
  publisher = {Elsevier}
}