Skip to main content

A simulation of a building to optimize energy storage utilization.

Project description

Building Energy Storage Simulation

Documentation Status

isolated

The Building Energy Storage Simulation serves as open Source OpenAI gym (now gymnasium) environment for Reinforcement Learning. The environment represents a building with an energy storage (in form of a battery) and a solar energy system. The aim is to control the energy storage in such a way that the energy of the solar system can be used optimally.

The inspiration of this project and the data profiles come from the CityLearn environment. Anyhow, this project focuses on the ease of usage and the simplicity of its implementation.

Documentation

The documentation is available at https://building-energy-storage-simulation.readthedocs.io/

Installation

By using pip just:

pip install building-energy-storage-simulation

or if you want to continue developing the package:

git clone https://github.com/tobirohrer/building-energy-storage-simulation.git && cd building-energy-storage-simulation
pip install -e .[docs,tests]

Cotribute & Contact

As i just started with this project, I am very happy for any kind of contribution! In case you want to contribute, or if you have any questions, contact me via discord.

Usage

from building_energy_storage_simulation import Environment
env = Environment()
env.reset()
env.step(42)
...

Important note: This environment is implemented by using gymnasium (the proceeder of OpenAI gym). Meaning, if you are using a reinforcement learning library like Stable Baselines3 make sure it supports gymnasium environments.

Task Description

The simulation contains a building with an energy consumption profile attached to it. The resulting electricity demand is always automatically covered by

  • primarily using electricity generated by the solar energy system,
  • and secondary by using electricity provided by the grid to cover the full demand.

The simulated building has a battery which can be used to store energy. You can think of using the battery as shifting the electricity demand. By storing energy, you are increasing the energy demand of the building and by discharging/obtaining energy from the battery you are decreasing the energy demand of the building. The task is to choose when to charge and when to discharge the battery. Hereby, the goal is to utilize the battery so energy usage from the solar energy system is maximized and usage of the energy grid is minimized. Note, that excess energy from the solar energy system which is not used by the electricity load or used to charge the battery is considered lost. So better use the solar energy to charge the battery in this case ;-)

Action Space

Action Min Max
Charge -1 1

The actions lie in the interval of [-1;1]. The action represents a fraction of the maximum energy which can be retrieved from the battery (or used to charge the battery) per time step.

  • 1 means maximum charging the battery. The maximum charge per time step is defined by the parameter max_battery_charge_per_timestep.
  • -1 means maximum discharging the battery, meaning "gaining" electricity out of the battery
  • 0 means don't charge or discharge

Observation Space

Index Observation Min Max
0 State of Charge (in kWh) 0 Max Battery Capacity
[1; n] Forecast Electric Load (in kWh) 0 Max Load in Profile
[n+1; 2*n] Forecast Solar Generation (in kWh) 0 Max Solar Generation in Profile

The length of the observation depends on the length of the forecast used. By default, the simulation uses a forecast length of 4. This means 4 time steps of an electric load forecast and 4 time steps of a solar generation forecast are included in the observation. In addition to that, the information about the current state of charge of the battery is contained in the observation.

The length of the forecast can be defined by setting the parameter num_forecasting_steps of the Environment().

Reward

As our goal is to use as less energy as possible, the reward is defined by the energy consumed at every time step (times -1):

$$ r_t = -1 * electricity_consumed_t $$

It is important to note, that the term electricity_consumed cannot be negative. This means, excess energy from the solar energy system which is not consumed by the electricity load or by charing the battery is considered lost (electricity_consumed is 0 in this case).

Episode Ends

The episode ends if the max_timesteps of the Environment() are reached.

Project details


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

File details

Details for the file building_energy_storage_simulation-0.5.2.tar.gz.

File metadata

File hashes

Hashes for building_energy_storage_simulation-0.5.2.tar.gz
Algorithm Hash digest
SHA256 fc3e8ac9a7a6a25eb1108603ed3ae4e4505f42915bbb85d7024f35bd8698b80c
MD5 0f24395886c89972daed3426c5cfa514
BLAKE2b-256 06c93a64d0adf50190d3fabc2a78cc0691c701e711d97dc13996306968f74392

See more details on using hashes here.

File details

Details for the file building_energy_storage_simulation-0.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for building_energy_storage_simulation-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ccb0ea88a46311740cc6dcf3cf5c9b0f8ba420a00c40b9ee1096225e61c67713
MD5 930d58c76eb6b5156733c5e7dc0aced3
BLAKE2b-256 41e4bdfb160375cff007e7940cb4fea76b1752d12a7c672bbe91b687b911f986

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page