Skip to main content

An OpenAI gym environment for electric motor control.

Project description

Gym Electric Motor

Paper | Quickstart | Install guide | Reference docs | Release notes

Build Status codecov PyPI version shields.io License

Overview

The gym-electric-motor (GEM) package is a Python toolbox for the simulation and control of various electric motors.

It is built upon OpenAI Gym 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 PI-controllers 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("PMSMDisc-v1")  # instantiate a discretely controlled PMSM
    env.reset()
    for _ in range(1000):
        env.render()  # visualize environment
        (states, references), rewards, done, _ =\ 
        	env.step(env.action_space.sample())  # pick random control actions
    env.close()

Installation

  • Install gym-electric-motor from PyPI (recommended):
pip install gym-electric-motor
  • Install from Github source:
git clone git@github.com: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 three-phase 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 mode) or switching commands (discrete mode).

Citation

A whitepaper for this framework is available under arxiv.org/abs/1910.09434. Please use the following BibTeX entry for citing us:

@misc{traue2019reinforcement,
    title={Towards a Reinforcement Learning Environment Toolbox for Intelligent Electric Motor Control},
    author={Arne Traue and Gerrit Book and Wilhelm Kirchgässner and Oliver Wallscheid},
    year={2019},
    eprint={1910.09434},
    archivePrefix={arXiv},
    primaryClass={eess.SY}
}

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gym_electric_motor-0.3.0.tar.gz (118.2 kB view hashes)

Uploaded Source

Built Distribution

gym_electric_motor-0.3.0-py3-none-any.whl (151.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page