rl-testbed-for-energyplus
Reinforcement Learning Testbed for Power Consumption Optimization using EnergyPlus
Science Score: 49.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
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, springer.com -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.7%) to scientific vocabulary
Keywords from Contributors
Repository
Reinforcement Learning Testbed for Power Consumption Optimization using EnergyPlus
Basic Info
Statistics
- Stars: 212
- Watchers: 21
- Forks: 79
- Open Issues: 28
- Releases: 0
Metadata Files
README.md
Project Description
Reinforcement Learning Testbed for Power Consumption Optimization.
Contributing to the project
We welcome contributions to this project in many forms. There's always plenty to do! Full details of how to contribute to this project are documented in the CONTRIBUTING.md file.
Maintainers
The project's maintainers: are responsible for reviewing and merging all pull requests and they guide the over-all technical direction of the project.
Supported platforms
We have tested on the following platforms. - macOS High Sierra (Version 10.13.6) - macOS Catalina (Version 10.15.3) - Ubuntu 20.04 LTS
Installation
Docker
The easiest way to setup a training environment is to use the docker image. See instructions here. For manual installation, see below.
Building from source
Installation of rl-testbed-for-energyplus consists of three parts:
- Install EnergyPlus prebuilt package
- Build patched EnergyPlus
- Install built executables
Install EnergyPlus prebuilt package
First, download pre-built package of EnergyPlus and install it. This is not for executing normal version of EnergyPlus, but to get some pre-compiled binaries and data files that can not be generated from source code.
Supported EnergyPlus versions:
| | Linux | MacOS | |-------|--------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------| | 8.8.0 | EnergyPlus-8.8.0-7c3bbe4830-Linux-x86_64.sh | EnergyPlus-8.8.0-7c3bbe4830-Darwin-x86_64.dmg | | 9.1.0 | EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64.sh | EnergyPlus-9.1.0-08d2e308bb-Darwin-x86_64.dmg | | 9.2.0 | EnergyPlus-9.2.0-921312fa1d-Linux-x86_64.sh | EnergyPlus-9.2.0-921312fa1d-Darwin-x86_64.dmg | | 9.3.0 | EnergyPlus-9.3.0-baff08990c-Linux-x86_64.sh | EnergyPlus-9.3.0-baff08990c-Darwin-x86_64.dmg | | 9.4.0 | EnergyPlus-9.4.0-998c4b761e-Linux-Ubuntu20.04-x86_64.sh | EnergyPlus-9.4.0-998c4b761e-Darwin-macOS10.15-x86_64.dmg | | 9.5.0 | EnergyPlus-9.5.0-de239b2e5f-Linux-Ubuntu20.04-x86_64.sh | EnergyPlus-9.5.0-de239b2e5f-Darwin-macOS11.2-arm64.dmg |
and up to EnergyPlus 22.2.0. See EnergyPlus folder which provides a list of available patches.
You can also download the installer at https://github.com/NREL/EnergyPlus/releases/.
Ubuntu
- Go to the web page shown above.
- Right click on relevant link in supported versions table and select
Save link Asto from the menu to download installation image. - (9.1.0, Linux only) Apply patch on downloaded file (EnergyPlus 9.1.0 installation script unpacks in /usr/local instead of /usr/local/EnergyPlus-9.1.0)
$ cd <DOWNLOAD-DIRECTORY> $ patch -p0 < rl-testbed-for-energyplus/EnergyPlus/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64.sh.patch - Execute installation image. Below example is for EnergyPlus 9.1.0
$ sudo bash <DOWNLOAD-DIRECTORY>/EnergyPlus-9.1.0-08d2e308bb-Linux-x86_64.sh
Enter your admin password if required.
Specify /usr/local for install directory.
Respond with /usr/local/bin if asked for symbolic link location.
The package will be installed at /usr/local/EnergyPlus-<EPLUS_VERSION>.
macOS
- Go to the web page shown above.
- Right click in supported versions table and select
Save link Asto from the menu to download installation image. - Double click the downloaded package, and follow the instructions.
The package will be installed in
/Applications/EnergyPlus-<EPLUS_VERSION>.
Build patched EnergyPlus
Download source code of EnergyPlus and rl-testbed-for-energyplus. In below scripted lines, replace <EPLUS_VERSION>
by the one you're using (for instance, 9.3.0)
$ cd <WORKING-DIRECTORY>
$ git clone -b v<EPLUS_VERSION> git@github.com:NREL/EnergyPlus.git
$ git clone git@github.com:ibm/rl-testbed-for-energyplus.git
Apply patch to EnergyPlus and build. Replace <EPLUS_VERSION>
by the one you're using (for instance, 9-3-0)
$ cd <WORKING-DIRECTORY>/EnergyPlus
$ patch -p1 < ../rl-testbed-for-energyplus/EnergyPlus/RL-patch-for-EnergyPlus-<EPLUS_VERSION>.patch
$ mkdir build
$ cd build
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/EnergyPlus-<EPLUS_VERSION> .. # Ubuntu case (please don't forget the two dots at the end)
$ cmake -DCMAKE_INSTALL_PREFIX=/Applications/EnergyPlus-<EPLUS_VERSION> .. # macOS case (please don't forget the two dots at the end)
$ make -j4
Install built executables
$ sudo make install
Install Python dependencies
Python3 >= 3.8 is required.
OpenAI Baselines
$ pip3 install -r requirements/baselines.txt
Main dependencies:
- tensorflow 2.5
- baselines 0.1.6
- gym 0.15.7
Note on baselines dependency:
- baselines 0.1.5 fails to install when MuJoCo can't be found. Reason why 0.1.6 is required (available from sources only)
- if baselines 0.1.6 installation fails because TensorFlow is missing, install tensorflow manually first, then retry.
For more information on baselines requirements, see https://github.com/openai/baselines for details.
Older versions:
To run on Ubuntu 18.04, you'll need the following pip dependencies:
scipy==1.5.4
tensorflow==1.15.4
Ray RLlib
$ pip3 install -r requirements/ray.txt
How to run
Set up
Some environment variables must be defined. ENERGYPLUS_VERSION must be adapted to your version.
In $(HOME)/.bashrc
```
Specify the top directory
TOP=
if [ uname == "Darwin" ]; then
energyplusinstdir="/Applications"
else
energyplusinstdir="/usr/local"
fi
ENERGYPLUS_VERSION="8-8-0"
ENERGYPLUS_VERSION="9-1-0"
ENERGYPLUS_VERSION="9-2-0"
ENERGYPLUS_VERSION="9-3-0"
ENERGYPLUSDIR="${energyplusinstdir}/EnergyPlus-${ENERGYPLUSVERSION}" WEATHERDIR="${ENERGYPLUSDIR}/WeatherData" export ENERGYPLUS="${ENERGYPLUSDIR}/energyplus" MODELDIR="${TOP}/EnergyPlus/Model-${ENERGYPLUSVERSION}"
Weather file.
Single weather file or multiple weather files separated by comma character.
export ENERGYPLUSWEATHER="${WEATHERDIR}/USACASan.Francisco.Intl.AP.724940_TMY3.epw"
export ENERGYPLUSWEATHER="${WEATHERDIR}/USACOGolden-NREL.724666_TMY3.epw"
export ENERGYPLUSWEATHER="${WEATHERDIR}/USAFLTampa.Intl.AP.722110_TMY3.epw"
export ENERGYPLUSWEATHER="${WEATHERDIR}/USAILChicago-OHare.Intl.AP.725300_TMY3.epw"
export ENERGYPLUSWEATHER="${WEATHERDIR}/USAVASterling-Washington.Dulles.Intl.AP.724030_TMY3.epw"
export ENERGYPLUSWEATHER="${WEATHERDIR}/USACASan.Francisco.Intl.AP.724940TMY3.epw,${WEATHERDIR}/USACOGolden-NREL.724666TMY3.epw,${WEATHERDIR}/USAFLTampa.Intl.AP.722110_TMY3.epw"
Ouput directory "openai-YYYY-MM-DD-HH-MM-SS-mmmmmm" is created in
the directory specified by ENERGYPLUS_LOGBASE or in the current directory if not specified.
export ENERGYPLUS_LOGBASE="${HOME}/eplog"
Model file. Uncomment one.
export ENERGYPLUSMODEL="${MODELDIR}/2ZoneDataCenterHVACwEconomizerTemp.idf" # Temp. setpoint control
export ENERGYPLUSMODEL="${MODELDIR}/2ZoneDataCenterHVACwEconomizerTemp_Fan.idf" # Temp. setpoint and fan control
Run command (example)
$ time python3 -m baselinesenergyplus.trpompi.run_energyplus --num-timesteps 1000000000
Monitoring (example)
$ python3 -m common.plot_energyplus
```
Running
Simulation process starts by the following command. The only applicable option is --num-timesteps
OpenAI Baselines
$ time python3 -m baselines_energyplus.trpo_mpi.run_energyplus --num-timesteps 1000000000
Ray RLlib
$ time python3 -m ray_energyplus.ppo.run_energyplus --num-timesteps 1000000000
Output files are generated under the directory ${ENERGYPLUS_LOGBASE}/openai-YYYY-MM-DD-HH-MM-SS-mmmmmm. These include:
- log.txt Log file generated by baselines Logger.
- progress.csv Log file generated by baselines Logger.
- output/episode-NNNNNNNN/ Episode data
Epsiode data contains the following files: - 2ZoneDataCenterHVACwEconomizerTempFan.idf A copy of model file used in the simulation of the episode - USACASan.Francisco.Intl.AP.724940TMY3.epw A copy of weather file used in the simulation of the episode - eplusout.csv.gz Simulation result in CSV format - eplusout.err Error message. You need make sure that there are no Severe errors - eplusout.htm Human readable report file
Monitoring
You can monitor the progress of the simulation using plot_energyplus utility.
$ python3 -m common.plot_energyplus
Options:
- -l <log_dir> Specify log directory (usually openai-YYYY-MM-DD-HH-MM-SS-mmmmmm)
- -c <csv_file> Specify single CSV file to view
- -d Dump every timestep in CSV file (dump_timesteps.csv)
- -D Dump episodes in CSV file (dump_episodes.dat)
If neither -l nor -c option is specified, plotenergyplus tries to open the latest directory under `${ENERGYPLUSLOG}directory.
If none of-dor-D` is specified, the progress windows is opened.

Several graphs are shown. 1. Zone temperature and outdoor temperature 2. West zone return air temperature and west zone setpoint temperature 3. Mixed air, fan, and DEC outlet temperatures 4. IEC, CW, DEC outlet temperatures 5. Electric demand power (whole building, facility, HVAC) 6. Reward
Only the current episode is shown in the graph 1 to 5. The current episode is specified by pushing one of "First", "Prev", "Next", or "Last" button, or directly clicking the appropriate point on the episode bar at the bottom. If you're at the last episode, the current episode moves automatically to the latest one as new episode is completed.
Note: The reward value shown in the graph 6 is retrieved from "progress.csv" file generated by TRPO baseline, which is not necessarily same as the reward value computed by our reward function.
You can pan or zoom each graph by entering pan/zoom mode by clicking cross-arrows on the bottom left of the window.
When new episode is shown on the window, some statistical information is show as follow:
episode 362
read_episode: file=/home/moriyama/eplog/openai-2018-07-04-10-48-46-712881/output/episode-00000362/eplusout.csv.gz
Reward ave= 0.77, min= 0.40, max= 1.33, std= 0.22
westzone_temp ave=22.93, min=21.96, max=23.37, std= 0.19
eastzone_temp ave=22.94, min=22.10, max=23.51, std= 0.17
Power consumption ave=102,243.47, min=65,428.31, max=135,956.47, std=18,264.50
pue ave= 1.27, min= 1.02, max= 1.63, std= 0.13
westzone_temp distribution
degree 0.0-0.9 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
-------------------------------------------------------------------------
18.0C 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0%
19.0C 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0%
20.0C 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0%
21.0C 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0%
22.0C 50.8% 0.0% 0.1% 0.7% 3.4% 5.6% 2.2% 0.7% 1.0% 0.9% 36.4%
23.0C 49.2% 49.0% 0.2% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0%
24.0C 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0%
25.0C 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0%
26.0C 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0%
27.0C 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0% 0.0%
The reward value shown above is computed by applying reward function to the simulation result.
License
The Reinforcement Learning Testbed for Power Consumption Optimization Project uses the MIT License software license.
How to cite
For citing the use or extension of this testbed, you may cite our paper at AsiaSim 2018, which can be found at Springer or as a slightly revised version at Arxiv. You may use the following BibTeX entry:
@InProceedings{10.1007/978-981-13-2853-4_4,
author="Moriyama, Takao and De Magistris, Giovanni and Tatsubori, Michiaki and Pham, Tu-Hoa and Munawar, Asim and Tachibana, Ryuki",
title="Reinforcement Learning Testbed for Power-Consumption Optimization",
booktitle="Methods and Applications for Modeling and Simulation of Complex Systems",
year="2018",
publisher="Springer Singapore",
address="Singapore",
pages="45--59",
isbn="978-981-13-2853-4"
}
Related information
- A pre-print version of AsiaSim2018 paper on arXiv: https://arxiv.org/abs/1808.10427
- EnergyPlus: https://github.com/NREL/EnergyPlus
- OpenAI Gym: https://github.com/OpenAI/gym
- OpenAI Baselines: https://github.com/OpenAI/baselines
- Ray: https://github.com/ray-project/ray
Owner
- Name: International Business Machines
- Login: IBM
- Kind: organization
- Email: awesome@ibm.com
- Location: United States of America
- Website: https://www.ibm.com/opensource/
- Twitter: ibmdeveloper
- Repositories: 3,152
- Profile: https://github.com/IBM
GitHub Events
Total
- Issues event: 2
- Watch event: 24
- Issue comment event: 2
- Pull request event: 1
- Fork event: 2
- Create event: 1
Last Year
- Issues event: 2
- Watch event: 24
- Issue comment event: 2
- Pull request event: 1
- Fork event: 2
- Create event: 1
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| antoine_galataud | a****e@f****o | 129 |
| Takao Moriyama | m****a@j****m | 21 |
| Julien Marrec | j****c@g****m | 6 |
| dependabot[bot] | 4****] | 6 |
| cclauss | c****s@b****h | 3 |
| Michiaki Tatsubori | m****h@j****m | 2 |
| Darío Hereñú | m****a@g****m | 2 |
| Doug Davis | d****g@u****m | 1 |
| ImgBotApp | I****p@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 69
- Total pull requests: 53
- Average time to close issues: 3 months
- Average time to close pull requests: about 2 months
- Total issue authors: 37
- Total pull request authors: 10
- Average comments per issue: 2.99
- Average comments per pull request: 0.58
- Merged pull requests: 44
- Bot issues: 0
- Bot pull requests: 15
Past Year
- Issues: 2
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 2
- Pull request authors: 2
- Average comments per issue: 2.0
- Average comments per pull request: 0.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 2
Top Authors
Issue Authors
- antoine-galataud (9)
- yashviagrawal (6)
- khoderj (5)
- takaomoriyama (4)
- xiaonanchong (4)
- WynnCJF (3)
- minjeong-sim (3)
- revathij (2)
- ZHANG-QINGANG (2)
- myndtrust (2)
- abhishm (2)
- luckypipitao (2)
- vermouth1992 (1)
- RuihangWang (1)
- FrancisBases (1)
Pull Request Authors
- antoine-galataud (28)
- dependabot[bot] (14)
- takaomoriyama (3)
- kant (2)
- jmarrec (2)
- renovate[bot] (2)
- cclauss (1)
- imgbot[bot] (1)
- tatsubori (1)
- rogeramy (1)
Top Labels
Issue Labels
Pull Request Labels
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- ubuntu 20.04 build
- gym ==0.15.7
- matplotlib ==3.2.1
- mpi4py ==3.1.3
- numpy ==1.19.5
- pandas ==1.0.3
- scipy ==1.8.0
- tensorflow ==2.7.2
- gym ==0.21.0
- matplotlib ==3.2.1
- numpy ==1.19.5
- pandas ==1.0.3
- ray ==1.12.1
- scipy ==1.8.0
- tensorflow ==2.7.2
- tqdm *