PowerGym is a Gym-like environment for Volt-Var control in power distribution systems.

Overview

Overview


PowerGym is a Gym-like environment for Volt-Var control in power distribution systems.

The Volt-Var control targets minimizing voltage violations, control loss, and power loss under physical networked constraints and device constraints. The networked constraints are maintained by the power distribution system simulator, OpenDSS. The device constraints are usually integer constraints on the actions.

Below is a description of observation and action spaces. {} denotes a finite set and [] denote a continuous interval.

Observation Space
Variable Range
Bus voltage [0.8, 1.2]
Capacitor status {0, 1}
Regulator tap number {0, ..., 32}
State-of-charge (soc) [0, 1]
Discharge power [-1, 1]
Action Space
Variable Range
Capacitor status {0, 1}
Regulator tap number {0, ..., 32}
Discharge power (disc.) {0, ..., 32}
Discharge power (cont.) [-1, 1]

There are two kinds of batteries. Discrete battery has discretized choices on the discharge power (e.g., choose from {0,...,32}) and continuous battery chooses the normalized discharge power from the interval [-1,1]. The user should specify the battery's kind upon calling the environment.

The reward function is a combination of three losses: voltage violation, control error, and power loss. The control error is further decomposed into capacitor's & regulator's switching cost and battery's discharge loss & soc loss. The weights among these losses depends on the circuit system and is listed in the Appendix of our paper.

The implemented circuit systems are summerized as follows.

System # Caps # Regs # Bats
13Bus 2 3 1
34Bus 4 6 2
123Bus 4 7 4
8500Node 10 12 10

Requirements


  • Python 3.8 or higher

For the complete installation

pip install -r requirements.txt

Usage


Run options

random_agent.py gives a minimal example of PowerGym usage. The option --mode can choose various running mode

To run PowerGym in a single episode

python random_agent.py

To run PowerGym for parallel environments

python random_agent.py --mode=parallele

To run PowerGym for multiple episodes

python random_agent.py --mode=episodic

To run PowerGym using OpenDSS controllers defined in the circuit files (if any)

python random_agent.py --mode=dss

Environment name options

The option --env_name can choose various environments. Below, we take 123Bus as an example.

Run a vanilla environment

python random_agent.py --env_name 123Bus

Run a scaled environment

python random_agent.py --env_name 123Bus_s1.5

Run an environment with soc error

python random_agent.py --env_name 123Bus_soc

Run a scaled environment with soc error

python random_agent.py --env_name 123Bus_soc_s1.5

Citation

To cite PowerGym, please cite the following paper:

@article{fan2021powergym,
  title={PowerGym: A Reinforcement Learning Environment for Volt-Var Control in Power Distribution Systems},
  author={Fan, Ting-Han and Lee, Xian Yeow and Wang, Yubo},
  journal={arXiv preprint arXiv:2109.03970},
  year={2021}
}

License

This project is licensed under MIT License. See LICENSE.md for more details.

Comments
  • bug

    bug

    An error occurred while running random_agent.py ,as

    Traceback (most recent call last): File "E:/powergym-master/random_agent.py", line 225, in run_random_agent(args, worker_idx=None, use_plot=args.use_plot, print_step=False) File "E:/powergym-master/random_agent.py", line 53, in run_random_agent env = make_env(args.env_name, worker_idx=worker_idx) File "E:\powergym-master\powergym\env_register.py", line 287, in make_env return Env(folder_path, base_info, dss_act) File "E:\powergym-master\powergym\env.py", line 240, in init self.load_profile = LoadProfile(
    File "E:\powergym-master\powergym\loadprofile.py", line 24, in init for f in os.listdir(self.loadshape_path): FileNotFoundError: [WinError 3] 系统找不到指定的路径。: 'E:\powergym-master\systems\13Bus\loadshape'

    How to solve this problem?

    opened by zly987 6
  • How to handle change in distribution system after training?

    How to handle change in distribution system after training?

    I was going through the paper "PowerGym: A Reinforcement Learning Environment for Volt-Var Control in Power Distribution Systems" again! The reinforcement learning allows to enable online training which is an advantage of the model I guess. But I was wondering what would be the solution if we add or remove components like bus, voltage regulator, capacitor bank to the trained power distribution system.
    My Idea: Say there is an addition of load bus. We will simulate it's active power and reactive power and concatenate this data to the historical data of the remaining distribution system. Then train the model with additional load bus. We can hope that this would not effect the overall performance badly. Such simulation can be made for the controller devices also, like we consider to had that capacitor bank at the historical data and start training. While training the AI will turn the switch on or off the load bus. And finally we will learn to operate such devices.

    Kindly, tell me if my idea is promising or not. It would be helpful if you please share your thoughts regarding this issue.

    opened by sahasubhajit 3
  • Proximal Policy Optimization (PPO) and Soft Actor-Critic (SAC) implementation

    Proximal Policy Optimization (PPO) and Soft Actor-Critic (SAC) implementation

    I have just gone through the paper "PowerGym: A Reinforcement Learning Environment for Volt-Var Control in Power Distribution Systems". I have found it insightful and thanks for sharing this repository. I have understood that the file random_agent.py performs random actions but I was also looking for agents trained by Proximal Policy Optimization (PPO) and Soft Actor-Critic (SAC) and the training implementation (as mentioned in the paper) codes. Do I need to code those or other reinforcement learning by myself using the action space and observation space mentioned at env.py ? Or I have missed those training codes?

    opened by sahasubhajit 3
  • About  training data

    About training data

    Sorry, I have some problems again. I noticed that you wrote 'the load profiles are randomly partitioned into two haves, one for training and the other for testing.'For example, there are only 24 data in powergym master \ systems \ 13bus \ loadshape \ 000 \ 611.csv. Even if there are 73 folders like this, the amount of data is not enough. So I'd like to ask how your training data is composed? What the time scale about the load data? Thank you very much for your reply.

    opened by zhangdahua1 2
  • A request

    A request

    Thanks for this PowerGym provided by the author. This is very useful to me. But as a novice in programming, there are still some difficulties to understand. Can the author upload a simple supporting training algorithm to help me learn?

    Thank you very much if you can reply.

    opened by zhangdahua1 2
  • Bump numpy from 1.20.3 to 1.22.0

    Bump numpy from 1.20.3 to 1.22.0

    Bumps numpy from 1.20.3 to 1.22.0.

    Release notes

    Sourced from numpy's releases.

    v1.22.0

    NumPy 1.22.0 Release Notes

    NumPy 1.22.0 is a big release featuring the work of 153 contributors spread over 609 pull requests. There have been many improvements, highlights are:

    • Annotations of the main namespace are essentially complete. Upstream is a moving target, so there will likely be further improvements, but the major work is done. This is probably the most user visible enhancement in this release.
    • A preliminary version of the proposed Array-API is provided. This is a step in creating a standard collection of functions that can be used across application such as CuPy and JAX.
    • NumPy now has a DLPack backend. DLPack provides a common interchange format for array (tensor) data.
    • New methods for quantile, percentile, and related functions. The new methods provide a complete set of the methods commonly found in the literature.
    • A new configurable allocator for use by downstream projects.

    These are in addition to the ongoing work to provide SIMD support for commonly used functions, improvements to F2PY, and better documentation.

    The Python versions supported in this release are 3.8-3.10, Python 3.7 has been dropped. Note that 32 bit wheels are only provided for Python 3.8 and 3.9 on Windows, all other wheels are 64 bits on account of Ubuntu, Fedora, and other Linux distributions dropping 32 bit support. All 64 bit wheels are also linked with 64 bit integer OpenBLAS, which should fix the occasional problems encountered by folks using truly huge arrays.

    Expired deprecations

    Deprecated numeric style dtype strings have been removed

    Using the strings "Bytes0", "Datetime64", "Str0", "Uint32", and "Uint64" as a dtype will now raise a TypeError.

    (gh-19539)

    Expired deprecations for loads, ndfromtxt, and mafromtxt in npyio

    numpy.loads was deprecated in v1.15, with the recommendation that users use pickle.loads instead. ndfromtxt and mafromtxt were both deprecated in v1.17 - users should use numpy.genfromtxt instead with the appropriate value for the usemask parameter.

    (gh-19615)

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Owner
Siemens
Responsible, excellent and innovative
Siemens
A lightweight python module for building event driven distributed systems

Eventify A lightweight python module for building event driven distributed systems. Installation pip install eventify Problem Developers need a easy a

Eventify 16 Aug 18, 2022
A general-purpose, flexible, and easy-to-use simulator alongside an OpenAI Gym trading environment for MetaTrader 5 trading platform (Approved by OpenAI Gym)

gym-mtsim: OpenAI Gym - MetaTrader 5 Simulator MtSim is a simulator for the MetaTrader 5 trading platform alongside an OpenAI Gym environment for rein

Mohammad Amin Haghpanah 184 Dec 31, 2022
A script that publishes power usage data of iDrac enabled servers to an MQTT broker for integration into automation and power monitoring systems

iDracPowerMonitorMQTT This script publishes iDrac power draw data for iDrac 6 enabled servers to an MQTT broker. This can be used to integrate the pow

Lucas Zanchetta 10 Oct 6, 2022
Multi-Agent Reinforcement Learning for Active Voltage Control on Power Distribution Networks (MAPDN)

Multi-Agent Reinforcement Learning for Active Voltage Control on Power Distribution Networks (MAPDN) This is the implementation of the paper Multi-Age

Future Power Networks 83 Jan 6, 2023
Automatically build ARIMA, SARIMAX, VAR, FB Prophet and XGBoost Models on Time Series data sets with a Single Line of Code. Now updated with Dask to handle millions of rows.

Auto_TS: Auto_TimeSeries Automatically build multiple Time Series models using a Single Line of Code. Now updated with Dask. Auto_timeseries is a comp

AutoViz and Auto_ViML 519 Jan 3, 2023
A Tool that provides automatic kerning for ligature based OpenType fonts in Microsoft Volt

Kerning A Tool that provides automatic kerning for ligature based OpenType fonts in Microsoft Volt There are three stages of the algorithm. The first

Sayed Zeeshan Asghar 6 Aug 1, 2022
Volt is yet another discord api wrapper for Python. It supports python 3.8 +

Volt Volt is yet another discord api wrapper for Python. It supports python 3.8 + How to install [Currently Not Supported.] pip install volt.py Speed

Minjun Kim (Lapis0875) 11 Nov 21, 2022
vartests is a Python library to perform some statistic tests to evaluate Value at Risk (VaR) Models

vartests is a Python library to perform some statistic tests to evaluate Value at Risk (VaR) Models, such as: T-test: verify if mean of distribution i

RAFAEL RODRIGUES 5 Jan 3, 2023
gym-anm is a framework for designing reinforcement learning (RL) environments that model Active Network Management (ANM) tasks in electricity distribution networks.

gym-anm is a framework for designing reinforcement learning (RL) environments that model Active Network Management (ANM) tasks in electricity distribution networks. It is built on top of the OpenAI Gym toolkit.

Robin Henry 99 Dec 12, 2022
Control System Packer is a lightweight, low-level program to transform energy equations into the compact libraries for control systems.

Control System Packer is a lightweight, low-level program to transform energy equations into the compact libraries for control systems. Packer supports Python ?? , C ?? and C++ ?? libraries.

mirnanoukari 31 Sep 15, 2022
Reinforcement Learning with Q-Learning Algorithm on gym's frozen lake environment implemented in python

Reinforcement Learning with Q Learning Algorithm Q learning algorithm is trained on the gym's frozen lake environment. Libraries Used gym Numpy tqdm P

null 1 Nov 10, 2021
An OpenAI Gym environment for Super Mario Bros

gym-super-mario-bros An OpenAI Gym environment for Super Mario Bros. & Super Mario Bros. 2 (Lost Levels) on The Nintendo Entertainment System (NES) us

Andrew Stelmach 1 Jan 5, 2022
Uses Open AI Gym environment to create autonomous cryptocurrency bot to trade cryptocurrencies.

Crypto_Bot Uses Open AI Gym environment to create autonomous cryptocurrency bot to trade cryptocurrencies. Steps to get started using the bot: Sign up

null 21 Oct 3, 2022
Raspberry Pi Power Button - Wake/Power Off/Restart(Double Press)

Control Raspberry pi with physically attached button. Wake, Power Off, and Restart (Double Press) . Python3 script runs as a service with easy installation.

Stas Yakobov 16 Oct 22, 2022
JupyterLite is a JupyterLab distribution that runs entirely in the browser power by wasm

JupyterLite is a JupyterLab distribution that runs entirely in the browser built from the ground-up using JupyterLab components and extensions.

Jeremy Tuloup 76 Dec 13, 2022
Algorithms for calibrating power grid distribution system models

Distribution System Model Calibration Algorithms The code in this library was developed by Sandia National Laboratories under funding provided by the

Sandia National Laboratories 2 Oct 31, 2022
A "gym" style toolkit for building lightweight Neural Architecture Search systems

A "gym" style toolkit for building lightweight Neural Architecture Search systems

Jack Turner 12 Nov 5, 2022
Jiminy, fast and portable Python/C++ simulator of poly-articulated systems with OpenAI Gym interface for reinforcement learning.

Jiminy is a fast and portable cross-platform open-source simulator for poly-articulated systems. It was built with two ideas in mind: provide a fast y

Alexis DUBURCQ 122 Dec 29, 2022
Distribution Analyser is a Web App that allows you to interactively explore continuous distributions from SciPy and fit distribution(s) to your data.

Distribution Analyser Distribution Analyser is a Web App that allows you to interactively explore continuous distributions from SciPy and fit distribu

Robert Dzudzar 46 Nov 8, 2022
A simple application that calculates the probability distribution of a normal distribution

probability-density-function General info An application that calculates the probability density and cumulative distribution of a normal distribution

null 1 Oct 25, 2022