• Stars
    star
    271
  • Rank 147,319 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 4 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Gym Electric Motor

Overview paper | Reinforcement learning 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.

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:
    • Supply voltage
    • 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)
  • 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}}

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.

More Repositories

1

reinforcement_learning_course_materials

Lecture notes, tutorial tasks including solutions as well as online videos for the reinforcement learning course hosted by Paderborn University
Jupyter Notebook
900
star
2

Inkscape_electric_Symbols

Electrical symbol library for the vector graphics program Inkscape.
320
star
3

openmodelica-microgrid-gym

OpenModelica Microgrid Gym (OMG): An OpenAI Gym Environment for Microgrids
Modelica
175
star
4

awesome-open-source-power-electronics

Lists open source power electronic tools
136
star
5

FEM_Magnetics_Toolbox

An Open-Source FEM Magnetics Toolbox for Power Electronic Magnetic Components
Python
51
star
6

transistordatabase

A unified software engineering tool for managing and evaluating power transistors
Python
42
star
7

ElectricGrid.jl

A time domain electrical energy grid modeling and simulation tool with a focus on the control of power electronics converters
Julia
30
star
8

control-block-diagram

Python Toolbox to draw Control Block Diagrams
Python
15
star
9

PSOAS

Particle Swarm Optimization Assisted by Surrogates
Python
13
star
10

gem-control

Python
10
star
11

meta_RL_PMSM

Meta Reinforcement Learning-Based CurrentControl of Permanent Magnet Synchronous MotorDrives for a Wide Range of Power Classes
Python
10
star
12

transistordatabase_File_Exchange

Data exchange for transistor objects generated and managed with Transistor_Database
Python
9
star
13

OpenModelica_Microgrids

OpenModelica_Microgrids is a library to simulate three phase AC Microgrids. Usable as stand-alone version or part of the toolbox OpenModelica Microgrid Gym (https://github.com/upb-lea/openmodelica-microgrid-gym).
Modelica
9
star
14

hardcore-magnet-challenge

Winning solution to the IEEE PELS MagNet challenge 2023 (1st Place Model Performance Category)
Jupyter Notebook
8
star
15

thesis_latex_template

LaTeX template for writing a report or thesis at LEA.
TeX
7
star
16

mag-net-hub

MagNet Toolkit - Certified Models of the MagNet Challenge
Python
7
star
17

materialdatabase

A database for ferrite core materials to store datasheet information and self-measured data.
Jupyter Notebook
6
star
18

LCB-CCB-01_LEA_Control_Board

Control board for power electronics usage.
5
star
19

ConverterSweepStore

Python
5
star
20

LCB-Software

Software examples for LEA Control Board (LCB)
C
2
star
21

LCB-CPB-01_Pin_Board

Pin board for LEA control board
2
star
22

LEA_KiCad_Library

LEA KiCad library for own projects
2
star
23

LCB-CTB-01_Test_Board

Test board for the LEA Control Board (LCB).
2
star