Science Score: 46.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: researchgate.net
  • Committers with academic emails
    1 of 5 committers (20.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary
Last synced: 6 months ago · JSON representation

Repository

Basic Info
  • Host: GitHub
  • Owner: ibpsa
  • License: other
  • Language: Python
  • Default Branch: master
  • Size: 48.7 MB
Statistics
  • Stars: 51
  • Watchers: 3
  • Forks: 21
  • Open Issues: 21
  • Releases: 5
Created over 5 years ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

BOPTEST-Gym

BOPTESTS-Gym is the Gymnasium environment of the BOPTEST framework. This repository accommodates the BOPTEST API to the Gymnasium standard in order to facilitate the implementation, assessment and benchmarking of reinforcement learning (RL) algorithms for their application in building energy management. RL algorithms from the Stable-Baselines 3 repository are used to exemplify and test this framework.

The environment is described in this paper.

Structure

  • boptestGymEnv.py contains the core functionality of this Gymnasium environment.
  • environment.yml contains the dependencies required to run this software.
  • /examples contains prototype code for the interaction of RL algorithms with an emulator building model from BOPTEST.
  • /testing contains code for testing this software.

Quick-Start

1) Create an environment from the environment.yml file provided (instructions here). You can also see our Dockerfile in testing/Dockerfile that we use to define our testing environment. 2) Run the example below that uses the Bestest hydronic case with a heat-pump and the DQN algorithm from Stable-Baselines:

```python from boptestGymEnv import BoptestGymEnv, NormalizedObservationWrapper, DiscretizedActionWrapper from stable_baselines3 import DQN

url for the BOPTEST service.

url = 'https://api.boptest.net'

Decide the state-action space of your test case

env = BoptestGymEnv( url = url, testcase = 'bestesthydronicheatpump', actions = ['oveHeaPumYu'], observations = {'time':(0,604800), 'reaTZony':(280.,310.), 'TDryBul':(265,303), 'HDirNor':(0,862), 'InternalGainsRad[1]':(0,219), 'PriceElectricPowerHighlyDynamic':(-0.4,0.4), 'LowerSetp[1]':(280.,310.), 'UpperSetp[1]':(280.,310.)}, predictiveperiod = 243600, regressive_period = 63600, randomstarttime = True, maxepisodelength = 243600, warmup_period = 243600, step_period = 3600)

Normalize observations and discretize action space

env = NormalizedObservationWrapper(env) env = DiscretizedActionWrapper(env,nbinsact=10)

Instantiate an RL agent

model = DQN('MlpPolicy', env, verbose=1, gamma=0.99, learningrate=5e-4, batchsize=24, buffersize=365*24, learningstarts=24, train_freq=1)

Main training loop

model.learn(total_timesteps=10)

Loop for one episode of experience (one day)

done = False obs, _ = env.reset() while not done: action, _ = model.predict(obs, deterministic=True) obs,reward,terminated,truncated,info = env.step(action) done = (terminated or truncated)

Obtain KPIs for evaluation

env.get_kpis()

```

In this tutorial you can find more details on how to use BOPTEST-Gym and on RL applied to buildings in general.

Note 1: on running BOPTEST in the server vs. locally

The previous example interacts with BOPTEST in a server at https://api.boptest.net which is readily available anytime. Interacting with BOPTEST from this server requires less configuration effort but is slower because of the communication overhead between the agent and the test case running in the cloud. Use this approach when you want to quickly check out the functionality of this repository.

If you prioritize speed (which is usually the case when training RL agents), running BOPTEST locally is substantially faster. You can do so by downloading the BOPTEST repository and running: ```bash docker compose up web worker provision

```

Further details in the BOPTEST GitHub page.

Then you only need to change the url to point to your local BOPTEST service deployment instead of the remote server (`url = 'http://127.0.0.1').

Note 2: on running BOPTEST locally in a vectorized environment

BOPTEST allows the deployment of multiple test case instances using Docker Compose. Running a vectorized environment enables the deployment of as many BoptestGymEnv instances as cores you have available for the agent to learn from all of them in parallel. See here for more information, we specifically use SubprocVecEnv. This can substantially speed up the training process.

To do so, deploy BOPTEST with multiple workers to spin multiple test cases. See the example below that prepares BOPTEST to spin two test cases.

bash docker compose up --scale worker=2 web worker provision

Then you can train an RL agent with parallel learning with the vectorized BOPTEST-gym environment. See /examples/run_vectorized.py for an example on how to do so.

Versioning and main dependencies

Current BOPTEST-Gym version is v0.7.0 which is compatible with BOPTEST v0.7.0 (BOPTEST-Gym version should always be even with the BOPTEST version used). The framework has been tested with gymnasium==0.28.1 and stable-baselines3==2.0.0. You can see testing/Dockerfile for a full description of the testing environment.

Citing the project

Please use the following reference if you used this repository for your research.

``` @inproceedings{boptestgym2021, author = {Javier Arroyo and Carlo Manna and Fred Spiessens and Lieve Helsen}, title = {{An OpenAI-Gym environment for the Building Optimization Testing (BOPTEST) framework}}, year = {2021}, month = {September}, booktitle = {Proceedings of the 17th IBPSA Conference}, address = {Bruges, Belgium}, }

```

Owner

  • Name: IBPSA
  • Login: ibpsa
  • Kind: organization
  • Email: president@ibpsa.org
  • Location: Worldwide

International Building Performance Simulation Association

GitHub Events

Total
  • Create event: 1
  • Release event: 2
  • Issues event: 7
  • Watch event: 10
  • Issue comment event: 2
  • Push event: 21
  • Pull request event: 4
Last Year
  • Create event: 1
  • Release event: 2
  • Issues event: 7
  • Watch event: 10
  • Issue comment event: 2
  • Push event: 21
  • Pull request event: 4

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 557
  • Total Committers: 5
  • Avg Commits per committer: 111.4
  • Development Distribution Score (DDS): 0.171
Past Year
  • Commits: 92
  • Committers: 2
  • Avg Commits per committer: 46.0
  • Development Distribution Score (DDS): 0.076
Top Committers
Name Email Commits
Javier Arroyo j****o@k****e 462
Javier Arroyo j****o@d****m 85
Aniket Dixit 3****2 7
XiangweiW 8****W 2
Michael Wetter m****r@l****v 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 92
  • Total pull requests: 74
  • Average time to close issues: 3 months
  • Average time to close pull requests: 3 days
  • Total issue authors: 13
  • Total pull request authors: 5
  • Average comments per issue: 0.47
  • Average comments per pull request: 0.28
  • Merged pull requests: 69
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 12
  • Pull requests: 11
  • Average time to close issues: 8 days
  • Average time to close pull requests: 12 days
  • Issue authors: 6
  • Pull request authors: 2
  • Average comments per issue: 0.25
  • Average comments per pull request: 0.91
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • JavierArroyoBastida (68)
  • javiarrobas (8)
  • ozanbarism (3)
  • IamAniket12 (2)
  • dhblum (2)
  • seb0908 (1)
  • billtubbs (1)
  • vadim0x60 (1)
  • irmakakyeli (1)
  • kevin-vanvaerenbergh (1)
  • alexandrecuer (1)
  • SebsCubs (1)
Pull Request Authors
  • JavierArroyoBastida (59)
  • javiarrobas (15)
  • IamAniket12 (4)
  • XiangweiW (2)
  • Learner0x5a (1)
Top Labels
Issue Labels
enhancement (4) good first issue (3) wontfix (1) bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 7
proxy.golang.org: github.com/ibpsa/project1-boptest-gym
  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.4%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago

Dependencies

.github/workflows/github-actions.yml actions
  • actions/checkout v3 composite
testing/Dockerfile docker
  • ubuntu 20.04 build
environment.yml pypi
  • cloudpickle ==2.2.1
  • cmake ==3.26.4
  • contourpy ==1.1.0
  • cycler ==0.11.0
  • farama-notifications ==0.0.4
  • filelock ==3.12.2
  • fonttools ==4.40.0
  • gym ==0.26.2
  • gym-notices ==0.0.8
  • gymnasium ==0.28.1
  • jax-jumpy ==1.0.0
  • jinja2 ==3.1.2
  • kiwisolver ==1.4.4
  • lit ==16.0.6
  • markupsafe ==2.1.3
  • matplotlib ==3.7.1
  • mpmath ==1.3.0
  • networkx ==3.1
  • numpy ==1.25.0
  • nvidia-cublas-cu11 ==11.10.3.66
  • nvidia-cuda-cupti-cu11 ==11.7.101
  • nvidia-cuda-nvrtc-cu11 ==11.7.99
  • nvidia-cuda-runtime-cu11 ==11.7.99
  • nvidia-cudnn-cu11 ==8.5.0.96
  • nvidia-cufft-cu11 ==10.9.0.58
  • nvidia-curand-cu11 ==10.2.10.91
  • nvidia-cusolver-cu11 ==11.4.0.1
  • nvidia-cusparse-cu11 ==11.7.4.91
  • nvidia-nccl-cu11 ==2.14.3
  • nvidia-nvtx-cu11 ==11.7.91
  • packaging ==23.1
  • pandas ==2.0.3
  • pillow ==10.0.0
  • pyparsing ==3.1.0
  • python-dateutil ==2.8.2
  • pytz ==2023.3
  • scipy ==1.11.1
  • shimmy ==1.1.0
  • six ==1.16.0
  • stable-baselines3 ==2.0.0
  • sympy ==1.12
  • torch ==2.0.1
  • triton ==2.0.0
  • typing-extensions ==4.7.1
  • tzdata ==2023.3