{"id":13722907,"url":"https://github.com/upb-lea/openmodelica-microgrid-gym","last_synced_at":"2025-04-06T22:08:00.900Z","repository":{"id":40250450,"uuid":"255886453","full_name":"upb-lea/openmodelica-microgrid-gym","owner":"upb-lea","description":"OpenModelica Microgrid Gym (OMG): An OpenAI Gym Environment for Microgrids","archived":false,"fork":false,"pushed_at":"2022-06-13T08:01:53.000Z","size":176399,"stargazers_count":177,"open_issues_count":13,"forks_count":35,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-06-11T16:04:19.532Z","etag":null,"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"],"latest_commit_sha":null,"homepage":"","language":"Modelica","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/upb-lea.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":"CONTRIBUTING.rst","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-15T10:45:50.000Z","updated_at":"2024-06-09T10:00:58.000Z","dependencies_parsed_at":"2022-09-14T07:32:20.288Z","dependency_job_id":null,"html_url":"https://github.com/upb-lea/openmodelica-microgrid-gym","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upb-lea%2Fopenmodelica-microgrid-gym","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upb-lea%2Fopenmodelica-microgrid-gym/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upb-lea%2Fopenmodelica-microgrid-gym/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/upb-lea%2Fopenmodelica-microgrid-gym/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/upb-lea","download_url":"https://codeload.github.com/upb-lea/openmodelica-microgrid-gym/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234345428,"owners_count":18817557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"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"],"created_at":"2024-08-03T01:01:34.460Z","updated_at":"2025-01-21T05:06:00.024Z","avatar_url":"https://github.com/upb-lea.png","language":"Modelica","funding_links":[],"categories":["Reinforcement Learning (RL) and Deep Reinforcement Learning (DRL)","Energy Systems","Energy Distribution and Grids"],"sub_categories":["RL/DRL Environments","Grid Management and Microgrid","Hydrogen"],"readme":"==========================\nOpenModelica Microgrid Gym\n==========================\n\n| |build| |cov| |nbsp| |nbsp| |python| |pypi| |download| |nbsp| |nbsp| |license|\n| |doc| |whitepaper| |joss|\n\n.. |nbsp|   unicode:: U+00A0 .. NO-BREAK SPACE\n\n.. |build| image:: https://github.com/upb-lea/openmodelica-microgrid-gym/actions/workflows/build_and_test.yml/badge.svg\n    :target: https://github.com/upb-lea/openmodelica-microgrid-gym/actions/workflows/build_and_test.yml\n\n.. |cov| image:: https://codecov.io/gh/upb-lea/openmodelica-microgrid-gym/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/upb-lea/openmodelica-microgrid-gym\n\n.. |license| image:: https://img.shields.io/github/license/upb-lea/openmodelica-microgrid-gym\n    :target: LICENSE\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/openmodelica-microgrid-gym\n    :target: https://pypi.python.org/pypi/openmodelica_microgrid_gym\n\n.. |pypi| image:: https://img.shields.io/pypi/v/openmodelica_microgrid_gym\n    :target: https://pypi.python.org/pypi/openmodelica_microgrid_gym\n\n.. |download| image:: https://img.shields.io/pypi/dw/openmodelica-microgrid-gym\n    :target: https://pypistats.org/packages/openmodelica-microgrid-gym\n\n.. |doc| image:: https://img.shields.io/badge/doc-success-success\n    :target: https://upb-lea.github.io/openmodelica-microgrid-gym\n\n.. |whitepaper| image:: https://img.shields.io/badge/arXiv-whitepaper-informational\n    :target: https://arxiv.org/pdf/2005.04869.pdf\n    \n.. |joss| image:: https://joss.theoj.org/papers/10.21105/joss.02435/status.svg\n   :target: https://doi.org/10.21105/joss.02435\n\n\n\n.. figure:: https://github.com/upb-lea/openmodelica-microgrid-gym/raw/develop/docs/pictures/omg_flow.png\n\n**The OpenModelica Microgrid Gym (OMG) package is a software toolbox for the\nsimulation and control optimization of microgrids based on energy conversion by power electronic converters.**\n\nThe main characteristics of the toolbox are the plug-and-play grid design and simulation in OpenModelica as well as\nthe ready-to-go approach of intuitive reinfrocement learning (RL) approaches through a Python interface.\n\nThe OMG toolbox is built upon the `OpenAI Gym`_ environment definition framework.\nTherefore, the toolbox is specifically designed for running reinforcement\nlearning 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.\n\n.. _OpenAI Gym: https://gym.openai.com/\n\n* Free software: GNU General Public License v3\n* Documentation: https://upb-lea.github.io/openmodelica-microgrid-gym\n\n\nVideo Tutorial\n--------------\n\nFollowing is a short YouTube video introduction, to get a fist impression how to use OMG.\n\n\n\n- https://www.youtube.com/watch?v=rwBNFvCi_dY\n\nInstallation\n------------\n\n\nInstall Python Environment\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nThis 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!\n\nSince 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.\nAs of now, only Windows and Linux are supported officially.\n\n- If conda is NOT installed on your PC, install miniconda_ for python 3.8\n- Create a new conda environment (e.g. in PyCharm)\n- Install PyFMI from the conda-forge channel in the terminal::\n\n    $ conda install -c conda-forge pyfmi\n\n\n- Install OpenModelica MicrogridGym from PyPI (recommended)::\n\n    $ pip install openmodelica_microgrid_gym\n\n.. _OpenModelica: https://openmodelica.org/download/download-mac\n.. _miniconda: https://conda.io/en/latest/miniconda.html\n.. _PyFMI: https://github.com/modelon-community/PyFMI\n\nInstallation of OpenModelica\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nOMG was create by using OMEdit_ v1.16\n\nIn case of installation issues you can resort to their pre-built `virtual machine`_.\n\n.. _OMEdit: https://openmodelica.org/download/download-windows\n.. _virtual machine: https://openmodelica.org/download/virtual-machine\n\nGetting started\n---------------\n\nThe environment is initialized and run like any other OpenAI Gym\n\n.. code-block:: python\n\n    import gym\n\n    if __name__ == '__main__':\n        env = gym.make('openmodelica_microgrid_gym:ModelicaEnv-v1',\n                   max_episode_steps=None,\n                   net='../net/net.yaml',\n                   model_path='../omg_grid/grid.network.fmu')\n\n        env.reset()\n        for _ in range(1000):\n            env.render()\n            env.step(env.action_space.sample())  # take a random action\n        env.close()\n\n\n\n\nOMG uses the `FMI standard`_ for the exchange of the model between OpenModelica and Python.\n\n.. _FMI standard: https://fmi-standard.org/\n\nAn example network consisting out of two inverters, three filters and an inductive load.\n\n.. figure:: https://github.com/upb-lea/openmodelica-microgrid-gym/raw/master/docs/pictures/omedit.jpg\n\nYou 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::\n\n    openmodelica_microgrid_gym\\fmu\u003e omc create_fmu.mos\n\nWindows users might need to open the terminal out of OpenModelica by clicking 'tools' =\u003e 'OpenModelica Command Prompt' to make sure that the command 'omc' gets recognized.\n\nRunning the ``staticctrl.py`` starts a simulation with a manually tuned cascaded PIPI controller\n\n.. figure:: https://github.com/upb-lea/openmodelica-microgrid-gym/raw/master/docs/pictures/control.jpg\n    :scale: 70%\n    :align: center\n\nA save Bayesian approach of a reinforcement learning agent is provided under examples/berkamkamp.py.\n\n.. figure:: https://github.com/upb-lea/openmodelica-microgrid-gym/raw/master/docs/pictures/kp_kp_J.png\n    :figwidth: 60%\n    :align: center\n\nUsing pytest\n^^^^^^^^^^^^\n\nOMG provides a big range of tests to ensure correct working toolbox after changes are done.\nOn some windows machines, the tests can only be started from the terminal via 'pytest'.\n\nThe 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.\nSince on Linux everything works fine, it seems to be a numerical issue connected with the FMUs.\n\n\nCitation \u0026 white paper\n----------------------\n\nPlease find a white paper on the OMG toolbox including an exemplary usage scenario here:\n\n- https://arxiv.org/abs/2005.04869\n\nPlease use the following BibTeX entry for citing us::\n\n    @article{OMG-code2020,\n        title = {OMG: A Scalable and Flexible Simulation and Testing Environment Toolbox for Intelligent Microgrid Control},\n        author = {Stefan Heid and Daniel Weber and Henrik Bode and Eyke Hüllermeier and Oliver Wallscheid},\n        year = {2020},\n        doi = {10.21105/joss.02435},\n        url = {https://doi.org/10.21105/joss.02435},\n        publisher = {The Open Journal},\n        volume = {5},\n        number = {54},\n        pages = {2435},\n        journal = {Journal of Open Source Software}\n    }\n\n    @article{OMG-whitepaper2020,\n        title={Towards a Scalable and Flexible Simulation and\n               Testing Environment Toolbox for Intelligent Microgrid Control},\n        author={Henrik Bode and Stefan Heid and Daniel Weber and Eyke Hüllermeier and Oliver Wallscheid},\n        year={2020},\n        eprint={http://arxiv.org/abs/2005.04869},\n        archivePrefix={arXiv},\n        primaryClass={eess.SY}\n    }\n\n\nContributing\n------------\n\nPlease refer to the `contribution guide`_.\n\n.. _`contribution guide`: https://github.com/upb-lea/openmodelica-microgrid-gym/blob/master/CONTRIBUTING.rst\n\n\nCredits\n-------\n\nThis package was created with Cookiecutter_ and the `audreyr/cookiecutter-pypackage`_ project template.\n\n.. _Cookiecutter: https://github.com/audreyr/cookiecutter\n.. _`audreyr/cookiecutter-pypackage`: https://github.com/audreyr/cookiecutter-pypackage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupb-lea%2Fopenmodelica-microgrid-gym","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fupb-lea%2Fopenmodelica-microgrid-gym","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fupb-lea%2Fopenmodelica-microgrid-gym/lists"}