A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Gym Electric Motor

An OpenAI Gym Environment for Electric Motors.
https://github.com/upb-lea/gym-electric-motor

Category: Consumption
Sub Category: Mobility and Transportation

Keywords

benchmark converters electric-drive electrical-engineering gym-environment machinelearning motor-models openai openai-gym openai-gym-environments pmsm reinforcement-learning

Keywords from Contributors

control latex course-materials lecture lecture-notes online-learning online-videos open-education open-education-resources open-educational-resources

Last synced: about 7 hours ago
JSON representation

Repository metadata

Gym Electric Motor (GEM): An OpenAI Gym Environment for Electric Motors

README.md

Gym Electric Motor

Overview paper
| Reinforcement learning paper
| GEM control paper
| Quickstart
| Install guide
| Reference docs
| Release notes

Build Status
codecov
PyPI version shields.io
License
DOI Zenodo
DOI JOSS

Overview

The gym-electric-motor (GEM) package is a Python toolbox for the simulation and control of various electric motors.
It is built upon Faram Gymnasium Environments, and, therefore, can be used for both, classical control simulation and reinforcement learning experiments. It allows you to construct a typical drive train with the usual building blocks, i.e., supply voltages, converters, electric motors and load models, and obtain not only a closed-loop simulation of this physical structure, but also a rich interface for plugging in any decision making algorithm, from linear feedback control to Deep Deterministic Policy Gradient agents.
In addition, an automated framework for classical control structures based on PI controllers is provided.

Getting Started

An easy way to get started with GEM is by playing around with the following interactive notebooks in Google Colaboratory. Most important features of GEM as well as application demonstrations are showcased, and give a kickstart for engineers in industry and academia.

There is a list of standalone example scripts as well for minimalistic demonstrations.

A basic routine is as simple as:

import gym_electric_motor as gem

if __name__ == '__main__':
    env = gem.make("Finite-CC-PMSM-v0")  # instantiate a discretely controlled PMSM
    env.reset()
    for _ in range(10000):
        (states, references), rewards, done, _ =\ 
        	env.step(env.action_space.sample())  # pick random control actions
        if done:
            (states, references), _ = env.reset()
    env.close()

Installation

  • Install gym-electric-motor from PyPI (recommended):
pip install gym-electric-motor
  • Install from Github source:
git clone [email protected]:upb-lea/gym-electric-motor.git 
cd gym-electric-motor
# Then either
python setup.py install
# or alternatively
pip install -e .

Building Blocks

A GEM environment consists of following building blocks:

  • Physical structure:
    • Voltage supply
    • Converter
    • Electric motor
    • Load model
  • Utility functions for reference generation, reward calculation and visualization

Information Flow in a GEM Environment

Among various DC-motor models, the following AC motors - together with their power electronic counterparts - are available:

  • Permanent magnet synchronous motor (PMSM)
  • Synchronous reluctance motor (SynRM)
  • Externally exited synchronous motor (EESM)
  • Squirrel cage induction motor (SCIM)
  • Doubly-fed induction motor (DFIM)

The converters can be driven by means of a duty cycle (continuous control set) or switching commands (finite control set).

Citation

A white paper for the general toolbox in the context of drive simulation and control prototyping can be found in the Journal of Open Sorce Software (JOSS). Please use the following BibTeX entry for citing it:

@article{Balakrishna2021,
    doi = {10.21105/joss.02498},
    url = {https://doi.org/10.21105/joss.02498},
    year = {2021},
    publisher = {The Open Journal},
    volume = {6},
    number = {58},
    pages = {2498},
    author = {Praneeth {Balakrishna} and Gerrit {Book} and Wilhelm {Kirchgässner} and Maximilian {Schenke} and Arne {Traue} and Oliver {Wallscheid}},
    title = {gym-electric-motor (GEM): A Python toolbox for the simulation of electric drive systems},
    journal = {Journal of Open Source Software}
}

A white paper for the utilization of this framework within reinforcement learning is available at IEEE-Xplore (preprint: arxiv.org/abs/1910.09434). Please use the following BibTeX entry for citing it:

@article{9241851,  
  author={Traue, Arne and Book, Gerrit and Kirchgässner, Wilhelm and Wallscheid, Oliver},
  journal={IEEE Transactions on Neural Networks and Learning Systems}, 
  title={Toward a Reinforcement Learning Environment Toolbox for Intelligent Electric Motor Control}, 
  year={2022},
  volume={33},
  number={3},
  pages={919-928},
  doi={10.1109/TNNLS.2020.3029573}}

A white paper for the classical control approaches of gym-electric-motor control is available at IEEE-Xplore. Please use the following BibTeX entry for citing it:

@INPROCEEDINGS{10239044,
  author={Book, Felix and Traue, Arne and Schenke, Maximilian and Haucke-Korber, Barnabas and Wallscheid, Oliver},
  booktitle={2023 IEEE International Electric Machines & Drives Conference (IEMDC)}, 
  title={Gym-Electric-Motor (GEM) Control: An Automated Open-Source Controller Design Suite for Drives}, 
  year={2023},
  volume={},
  number={},
  pages={1-7},
  doi={10.1109/IEMDC55163.2023.10239044}}

Running Unit Tests with Pytest

To run the unit tests ''pytest'' is required.
All tests can be found in the ''tests'' folder.
Execute pytest in the project's root folder:

>>> pytest

or with test coverage:

>>> pytest --cov=./

All tests shall pass.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 890
Total Committers: 21
Avg Commits per committer: 42.381
Development Distribution Score (DDS): 0.707

Commits in past year: 76
Committers in past year: 6
Avg Commits per committer in past year: 12.667
Development Distribution Score (DDS) in past year: 0.553

Name Email Commits
Arne a****e@g****e 261
wkirgsn w****r@g****e 109
Felix Book 6****8 96
Maximilian Schenke m****e@m****e 75
GitPascalP p****6@g****m 74
Darius d****t@w****e 65
Stefan Arndt s****t@m****e 38
S.A 8****t 34
wallscheid 5****d 34
RohithCharanD r****0@o****m 28
Praneeth Balakrishna b****h@g****m 24
KoehlerM173 k****s@o****e 22
HauckeBa b****r@i****g 15
Maximilian Schenke m****e 6
Marvin Meyer 2****r 2
Stefan Heid s****d@w****e 2
Deployment Bot (from Travis CI) d****y@t****g 1
Joni Airaksinen a****o@g****m 1
Pramod_Mahajan p****m@m****e 1
Gerrit Book g****k@m****e 1
unknown r****5@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 146
Total pull requests: 125
Average time to close issues: 3 months
Average time to close pull requests: 10 days
Total issue authors: 32
Total pull request authors: 19
Average comments per issue: 2.29
Average comments per pull request: 1.08
Merged pull request: 98
Bot issues: 0
Bot pull requests: 0

Past year issues: 19
Past year pull requests: 16
Past year average time to close issues: 4 months
Past year average time to close pull requests: 14 days
Past year issue authors: 5
Past year pull request authors: 7
Past year average comments per issue: 0.37
Past year average comments per pull request: 0.38
Past year merged pull request: 12
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/upb-lea/gym-electric-motor

Top Issue Authors

  • wallscheid (21)
  • wkirgsn (18)
  • XyDrKRulof (17)
  • atra94 (17)
  • bhk11 (16)
  • max-schenke (13)
  • GitPascalP (10)
  • stheid (3)
  • vapemaster-kz (2)
  • berkhizarci (2)
  • jmailloux (2)
  • soumava11 (2)
  • Priyadharshan2001 (2)
  • fbook98 (2)
  • KoehlerM173 (2)

Top Pull Request Authors

  • atra94 (42)
  • max-schenke (17)
  • XyDrKRulof (13)
  • fbook98 (13)
  • wkirgsn (8)
  • devandt (6)
  • bhk11 (5)
  • RohithCharanD (3)
  • ranil345 (3)
  • MarvinMeyer (2)
  • wallscheid (2)
  • GitPascalP (2)
  • stheid (2)
  • praneeth-b (2)
  • maxpape (1)

Top Issue Labels

  • enhancement (27)
  • bug (13)
  • documentation (3)
  • agenda/meeting (3)

Top Pull Request Labels


Package metadata

pypi.org: gym-electric-motor

A Farama Gymnasium environment for electric motor control.

  • Homepage: https://github.com/upb-lea/gym-electric-motor
  • Documentation: https://gym-electric-motor.readthedocs.io/
  • Licenses: MIT License
  • Latest release: 3.0.2 (published 5 months ago)
  • Last Synced: 2025-04-26T12:34:18.990Z (1 day ago)
  • Versions: 15
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 671 Last month
  • Rankings:
    • Stargazers count: 4.192%
    • Forks count: 5.453%
    • Dependent packages count: 7.31%
    • Average: 12.153%
    • Downloads: 21.722%
    • Dependent repos count: 22.088%
  • Maintainers (2)

Dependencies

.github/workflows/build_and_test.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • ad-m/github-push-action master composite
  • ammaraskar/sphinx-action master composite
.github/workflows/pypi-publish.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • pypa/gh-action-pypi-publish 27b31702a0e7fc50959f5ad993c78deac1bdfc29 composite
requirements.txt pypi
  • gym <0.24.0,>=0.15.4
  • matplotlib >=3.1.2
  • numpy >=1.16.4
  • pytest >=5.2.2
  • pytest-cov *
  • scipy >=1.4.1
setup.py pypi

Score: 15.44663050696861