OMG

OMG: A Scalable and Flexible Simulation and Testing Environment Toolbox for Intelligent Microgrid Control - Published in JOSS (2020)

https://github.com/upb-lea/openmodelica-microgrid-gym

Science Score: 98.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 7 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: arxiv.org, joss.theoj.org
  • Committers with academic emails
    3 of 10 committers (30.0%) from academic institutions
  • Institutional organization owner
    Organization upb-lea has institutional domain (ei.uni-paderborn.de)
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

control electrical-engineering energy-system-modeling engineering machine-learning microgrid modelica openai-gym openai-gym-environments openmodelica power-electronics power-supply power-systems python reinforcement-learning simulation smart-grids

Scientific Fields

Mathematics Computer Science - 37% confidence
Last synced: 4 months ago · JSON representation

Repository

OpenModelica Microgrid Gym (OMG): An OpenAI Gym Environment for Microgrids

Basic Info
  • Host: GitHub
  • Owner: upb-lea
  • License: gpl-3.0
  • Language: Modelica
  • Default Branch: master
  • Homepage:
  • Size: 168 MB
Statistics
  • Stars: 207
  • Watchers: 13
  • Forks: 41
  • Open Issues: 14
  • Releases: 7
Topics
control electrical-engineering energy-system-modeling engineering machine-learning microgrid modelica openai-gym openai-gym-environments openmodelica power-electronics power-supply power-systems python reinforcement-learning simulation smart-grids
Created over 5 years ago · Last pushed over 3 years ago
Metadata Files
Readme Changelog Contributing License Authors

README.rst

==========================
OpenModelica Microgrid Gym
==========================

| |build| |cov| |nbsp| |nbsp| |python| |pypi| |download| |nbsp| |nbsp| |license|
| |doc| |whitepaper| |joss|

.. |nbsp|   unicode:: U+00A0 .. NO-BREAK SPACE

.. |build| image:: https://github.com/upb-lea/openmodelica-microgrid-gym/actions/workflows/build_and_test.yml/badge.svg
    :target: https://github.com/upb-lea/openmodelica-microgrid-gym/actions/workflows/build_and_test.yml

.. |cov| image:: https://codecov.io/gh/upb-lea/openmodelica-microgrid-gym/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/upb-lea/openmodelica-microgrid-gym

.. |license| image:: https://img.shields.io/github/license/upb-lea/openmodelica-microgrid-gym
    :target: LICENSE

.. |python| image:: https://img.shields.io/pypi/pyversions/openmodelica-microgrid-gym
    :target: https://pypi.python.org/pypi/openmodelica_microgrid_gym

.. |pypi| image:: https://img.shields.io/pypi/v/openmodelica_microgrid_gym
    :target: https://pypi.python.org/pypi/openmodelica_microgrid_gym

.. |download| image:: https://img.shields.io/pypi/dw/openmodelica-microgrid-gym
    :target: https://pypistats.org/packages/openmodelica-microgrid-gym

.. |doc| image:: https://img.shields.io/badge/doc-success-success
    :target: https://upb-lea.github.io/openmodelica-microgrid-gym

.. |whitepaper| image:: https://img.shields.io/badge/arXiv-whitepaper-informational
    :target: https://arxiv.org/pdf/2005.04869.pdf
    
.. |joss| image:: https://joss.theoj.org/papers/10.21105/joss.02435/status.svg
   :target: https://doi.org/10.21105/joss.02435



.. figure:: https://github.com/upb-lea/openmodelica-microgrid-gym/raw/develop/docs/pictures/omg_flow.png

**The OpenModelica Microgrid Gym (OMG) package is a software toolbox for the
simulation and control optimization of microgrids based on energy conversion by power electronic converters.**

The main characteristics of the toolbox are the plug-and-play grid design and simulation in OpenModelica as well as
the ready-to-go approach of intuitive reinfrocement learning (RL) approaches through a Python interface.

The OMG toolbox is built upon the `OpenAI Gym`_ environment definition framework.
Therefore, the toolbox is specifically designed for running reinforcement
learning algorithms to train agents controlling power electronic converters in microgrids. Nevertheless, also arbritary classical control approaches can be combined and tested using the OMG interface.

.. _OpenAI Gym: https://gym.openai.com/

* Free software: GNU General Public License v3
* Documentation: https://upb-lea.github.io/openmodelica-microgrid-gym


Video Tutorial
--------------

Following is a short YouTube video introduction, to get a fist impression how to use OMG.



- https://www.youtube.com/watch?v=rwBNFvCi_dY

Installation
------------


Install Python Environment
^^^^^^^^^^^^^^^^^^^^^^^^^^

This is the short installation guide for Windows and Linux. OpenModelica_ is hardly supported for Mac, they suggest to install in a Linux VM. For this reason, running OMG in a Linux VM is strongly recommended for Mac users!

Since it is not possible to install PyFMI_, a package which is necessary for the communication between the python interface and the environment, via pip, we recommend to install this package in advance in a conda environment.
As of now, only Windows and Linux are supported officially.

- If conda is NOT installed on your PC, install miniconda_ for python 3.8
- Create a new conda environment (e.g. in PyCharm)
- Install PyFMI from the conda-forge channel in the terminal::

    $ conda install -c conda-forge pyfmi


- Install OpenModelica MicrogridGym from PyPI (recommended)::

    $ pip install openmodelica_microgrid_gym

.. _OpenModelica: https://openmodelica.org/download/download-mac
.. _miniconda: https://conda.io/en/latest/miniconda.html
.. _PyFMI: https://github.com/modelon-community/PyFMI

Installation of OpenModelica
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

OMG was create by using OMEdit_ v1.16

In case of installation issues you can resort to their pre-built `virtual machine`_.

.. _OMEdit: https://openmodelica.org/download/download-windows
.. _virtual machine: https://openmodelica.org/download/virtual-machine

Getting started
---------------

The environment is initialized and run like any other OpenAI Gym

.. code-block:: python

    import gym

    if __name__ == '__main__':
        env = gym.make('openmodelica_microgrid_gym:ModelicaEnv-v1',
                   max_episode_steps=None,
                   net='../net/net.yaml',
                   model_path='../omg_grid/grid.network.fmu')

        env.reset()
        for _ in range(1000):
            env.render()
            env.step(env.action_space.sample())  # take a random action
        env.close()




OMG uses the `FMI standard`_ for the exchange of the model between OpenModelica and Python.

.. _FMI standard: https://fmi-standard.org/

An example network consisting out of two inverters, three filters and an inductive load.

.. figure:: https://github.com/upb-lea/openmodelica-microgrid-gym/raw/master/docs/pictures/omedit.jpg

You can either use one of the provided FMUs (Windows and Linux, 64-bit, both included in the grid.network.fmu) or create your own by running::

    openmodelica_microgrid_gym\fmu> omc create_fmu.mos

Windows users might need to open the terminal out of OpenModelica by clicking 'tools' => 'OpenModelica Command Prompt' to make sure that the command 'omc' gets recognized.

Running the ``staticctrl.py`` starts a simulation with a manually tuned cascaded PIPI controller

.. figure:: https://github.com/upb-lea/openmodelica-microgrid-gym/raw/master/docs/pictures/control.jpg
    :scale: 70%
    :align: center

A save Bayesian approach of a reinforcement learning agent is provided under examples/berkamkamp.py.

.. figure:: https://github.com/upb-lea/openmodelica-microgrid-gym/raw/master/docs/pictures/kp_kp_J.png
    :figwidth: 60%
    :align: center

Using pytest
^^^^^^^^^^^^

OMG provides a big range of tests to ensure correct working toolbox after changes are done.
On some windows machines, the tests can only be started from the terminal via 'pytest'.

The standard test OS for the development is Linux. In some cases, we have noticed that the test_modelica.py on windows PCs might throw an error.
Since on Linux everything works fine, it seems to be a numerical issue connected with the FMUs.


Citation & white paper
----------------------

Please find a white paper on the OMG toolbox including an exemplary usage scenario here:

- https://arxiv.org/abs/2005.04869

Please use the following BibTeX entry for citing us::

    @article{OMG-code2020,
        title = {OMG: A Scalable and Flexible Simulation and Testing Environment Toolbox for Intelligent Microgrid Control},
        author = {Stefan Heid and Daniel Weber and Henrik Bode and Eyke Hüllermeier and Oliver Wallscheid},
        year = {2020},
        doi = {10.21105/joss.02435},
        url = {https://doi.org/10.21105/joss.02435},
        publisher = {The Open Journal},
        volume = {5},
        number = {54},
        pages = {2435},
        journal = {Journal of Open Source Software}
    }

    @article{OMG-whitepaper2020,
        title={Towards a Scalable and Flexible Simulation and
               Testing Environment Toolbox for Intelligent Microgrid Control},
        author={Henrik Bode and Stefan Heid and Daniel Weber and Eyke Hüllermeier and Oliver Wallscheid},
        year={2020},
        eprint={http://arxiv.org/abs/2005.04869},
        archivePrefix={arXiv},
        primaryClass={eess.SY}
    }


Contributing
------------

Please refer to the `contribution guide`_.

.. _`contribution guide`: https://github.com/upb-lea/openmodelica-microgrid-gym/blob/master/CONTRIBUTING.rst


Credits
-------

This package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage

Owner

  • Name: Paderborn University - LEA
  • Login: upb-lea
  • Kind: organization
  • Location: Paderborn, Germany

Department of power electronics and electrical drives

JOSS Publication

OMG: A Scalable and Flexible Simulation and Testing Environment Toolbox for Intelligent Microgrid Control
Published
October 05, 2020
Volume 5, Issue 54, Page 2435
Authors
Stefan Heid
Chair of Intelligent Systems and Machine Learning, Paderborn University, Paderborn, Germany
Daniel Weber
Chair of Power Electronics and Electrical Drives, Paderborn University, Paderborn, Germany
Henrik Bode
Chair of Power Electronics and Electrical Drives, Paderborn University, Paderborn, Germany
Eyke Hüllermeier
Chair of Intelligent Systems and Machine Learning, Paderborn University, Paderborn, Germany
Oliver Wallscheid ORCID
Chair of Power Electronics and Electrical Drives, Paderborn University, Paderborn, Germany
Editor
David Hagan ORCID
Tags
OpenModelica Microgrids Reinforcement Learning Energy Systems Simulation Testing Control

GitHub Events

Total
  • Watch event: 27
  • Fork event: 4
Last Year
  • Watch event: 27
  • Fork event: 4

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 557
  • Total Committers: 10
  • Avg Commits per committer: 55.7
  • Development Distribution Score (DDS): 0.575
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Stefan Heid s****d@u****e 237
Daniel Weber w****r@l****e 159
Oliver Wallscheid 5****d 45
Stefan Heid s****d@w****e 36
hbode b****e@l****e 33
h-bode 6****e 27
Webbah D****o@g****e 10
Wilhelm Kirchgässner 1****n 7
Stefan Helmut Heid s****d@m****e 2
David H Hagan d****d@d****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 84
  • Total pull requests: 55
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 2 days
  • Total issue authors: 9
  • Total pull request authors: 4
  • Average comments per issue: 2.8
  • Average comments per pull request: 0.42
  • Merged pull requests: 53
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Webbah (26)
  • stheid (23)
  • h-bode (21)
  • wallscheid (8)
  • marvpick (2)
  • JvPost (1)
  • linyunfeng201203 (1)
  • gituser789 (1)
  • elliottower (1)
Pull Request Authors
  • stheid (29)
  • h-bode (13)
  • Webbah (12)
  • dhhagan (1)
Top Labels
Issue Labels
enhancement (22) bug (9) documentation (8) help wanted (7) question (7) wontfix (1) good first issue (1) invalid (1)
Pull Request Labels
bug (2) enhancement (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 35 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 6
  • Total maintainers: 1
pypi.org: openmodelica-microgrid-gym

OpenModelica Microgrid Gym

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 35 Last month
Rankings
Stargazers count: 5.7%
Forks count: 6.8%
Dependent packages count: 7.4%
Average: 17.8%
Dependent repos count: 22.2%
Downloads: 47.1%
Maintainers (1)
Last synced: 4 months ago

Dependencies

requirements.txt pypi
  • GPy >=1.9.9
  • PyFMI >=2.5
  • future *
  • gym >=0.15.3
  • matplotlib >=3.1.1
  • more_itertools >=7
  • numexpr >=2.7.1
  • numpy >=1.17.2
  • pandas >=1.0.1
  • pytest *
  • pyyaml *
  • safeopt >=0.16
  • scipy >=1.3.1
  • setuptools *
  • stochastic >=0.6.0
  • tables >=3.6.1
  • tqdm >=4
requirements_dev.txt pypi
  • GPy >=1.9.9 development
  • Sphinx ==3.1 development
  • bump2version ==0.5.11 development
  • pytest >=5.2.2 development
  • pytest-cov * development
  • pytest-runner ==5.1 development
  • safeopt >=0.16 development
  • sphinx-autodoc-typehints >=1.11 development
  • sphinx_rtd_theme * development
  • tables >=3.4.1 development
  • twine ==1.14.0 development
  • watchdog ==0.9.0 development