Giter Site home page Giter Site logo

mingzhe37 / alphabuilding-medoffice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from walterzwang/alphabuilding-medoffice

0.0 0.0 0.0 192.44 MB

This is the official repository of AlphaBuilding MedOffice: a realistic OpenAI Gym environment that can be used to train, test and benchmark controllers for medium size office (1AHU + 9VAV boxes)

License: BSD 3-Clause "New" or "Revised" License

Python 3.39% Jupyter Notebook 96.38% Dockerfile 0.18% Makefile 0.04%

alphabuilding-medoffice's Introduction

AlphaBuilding-MedOffice

This is the official repository of AlphaBuilding MedOffice: a realistic OpenAI Gym environment that can be used to train, test and benchmark controllers for medium size office (1AHU + 9VAV boxes)

Overview

We developed AlphaBuilding MedOffice, a virtual testbed of medium size office that is wrapped up with OpenAI Gym. The building model is developed from [EnergyPlus model of medium size office of DOE Commercial Reference Building type]. We are controlling the second floor of this building, which has 1 ATU serving 9 VAV boxes (2 for conference rooms, 3 for closed offices, 4 for open offices).

In addition to the virtual environment, we also implement and open source several RL algorithms (Deep Deterministic Policy Gradient (DDPG)), which could be used as benchmarks for algorithm comparison.

Code Usage

Clone repository

git clone https://github.com/WalterZWang/AlphaBuilding-MedOffice.git
cd AlphaBuilding-MedOffice

Test the environment

  1. Pull the docker image: $ docker pull walterzwang/drl_eplus:9.2
  2. $ cd AlphaBuilding/docker/drl, revise parameter VOLUMN_PATH in the makefile, then $ make run
  3. Run scripts:
    • test fmu: $ cd gym_AlphaBuilding, runpython fmuModel/test_fmu.py
    • test gym: $ cd gym_AlphaBuilding, runpython test_gym.py
  4. Run DRL algorithms:
    • All scripts must be run from the root repository

Repository structure

analysis: code to analyze the result

docker: scripts to develop the docker image

docs: Manuscript submitted version, figs in the paper, and documentation of this environment

gym_AlphaBuilding: scripts to develop the virtual simulation environment

lib: DRL models and utility functions

log: log files for TensorBoard visualization

RL: scripts for DRL

Running

Interface

The co-simulation workflow between the environment and the controller is:

Environment initialization

The first step is to initiate the environment. A list of input parameters to set up the environment is shown as follows:

Input Parameter Description Data Type Default Value
building_path Path to the FMU model str
sim_days Number of days for simulation, start from Jan. 01 int
step_size Size of each time step for control and simulation, unit [s] int
sim_year Year for simulation, used to create time index int 2015
tz_name Thermal Time Constant, mean and std tuple 'America/Los_Angeles'
eprice_path Path to the utility price signal, not used for energy conservation str None

States, actions, and info/comments

Then at each time step, the environment consumes acts (determined by the controller), runs a single time step simulation, and returns states and comments. The contents of acts, states, and comments are shown as follows:

HourOfDay: in the range of 0 to 23

DayOfWeek: in the range of 0 to 6, 0 is Monday, 6 is Sunday

Methods

A list of methods provided by the environment is as follows:

Methods Example Input Returns
Initiate the env env=AlphaResEnv(*args) Env parameters An environment instance
Reset the env obs=env.reset() \ Observations (Initial conditions)
One step simulation obs,r,d,c=env.step(a_scaled) Control actions New observations, reward, done flag, comments
Scale states to [-1,1] s_scaled = env.scale_state(s_raw) Raw states Scaled states
Scale actions to [-1,1] a_scaled = env.scale_action(a_raw) Raw actions Scaled actions
Rescale states to raw s_raw = env.rescale_state(s_scaled) Scaled states Raw states
Rescale actions to raw a_raw = env.rescale_action(a_scaled) Scaled actions Raw actions

The input of the step function needs to be scaled to [-1, 1]. Users can use the env.rescale method to get the actual value

Application

AlphaBuilding MedOffice can be used to train controllers for commercial buildings. As an example, we demonstrate four applications here:

Feedback

Feel free to send any questions/feedback to: Zhe Wang or Tianzhen Hong

Citation

If you use our code, please cite us as follows:

alphabuilding-medoffice's People

Contributors

walterzwang avatar tsbyq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.