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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file gym_electric_motor-0.3.0.tar.gz.

File metadata

  • Download URL: gym_electric_motor-0.3.0.tar.gz
  • Upload date:
  • Size: 118.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.7

File hashes

Hashes for gym_electric_motor-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4b91d943ca26bd951b4d6c17fb0b8dc24d6e3c97eaa61c85615fefea9fd596d6
MD5 cc08c74965e0169bd93ba2873b24cef2
BLAKE2b-256 8637703b72dc6b441dc0318d3b3a7a6a1a8a08a67dc84dad79e047083f7397fb

See more details on using hashes here.

File details

Details for the file gym_electric_motor-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: gym_electric_motor-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 151.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.7

File hashes

Hashes for gym_electric_motor-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee284ad896ed41eb578639cd3e376d167ad15724ead6ea9d63d11825101367a7
MD5 b4e9f244e6f8dca5e33be97271f6955c
BLAKE2b-256 9988d2b814a2f00ea6c83f9a11023c5a61dce77f6e0516bf2ed96500f6f420ba

See more details on using hashes here.

Supported by

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