Skip to main content

motulator

Motor drive and grid converter simulator in Python

PyPI version Python versions Build Status License DOI All Contributors

Documentation · Drive examples · Grid examples · Installation

Simulated sensorless flux-vector control of a 2.2-kW IPMSM drive: speed step, load-torque step, and phase currents

motulator provides simulation models and control algorithms for electric machine drives and grid converter systems. The system models are simulated in the continuous-time domain, while the control algorithms run in discrete time, as they would in a real converter.

Features

  • Machine models: induction machines, synchronous reluctance machines, and permanent-magnet synchronous machines, including magnetic saturation and two-mass mechanics
  • Grid converter models: L and LCL filters, inductive-resistive grids, and DC-bus dynamics
  • Drive control: V/Hz control, current-vector and flux-vector control, sensorless observers, and signal injection
  • Grid converter control: grid-following and grid-forming control, including disturbance-observer-based and power-synchronization methods
  • Ready-to-run examples as Python scripts and Jupyter notebooks, including neural-network-based flux maps learned from measured data

Installation

pip install motulator

To develop motulator itself, clone the repository as described in the installation guide.

Quick start

A complete simulation takes about 20 lines. This example runs sensorless flux-vector control of a 2.2-kW interior permanent-magnet synchronous machine drive:

import motulator.drive.control.sm as control
from motulator.drive import model, utils

# Continuous-time system model: 2.2-kW IPMSM, mechanics, and converter
par = model.SynchronousMachinePars(n_p=3, R_s=3.6, L_d=0.036, L_q=0.051, psi_f=0.545)
mdl = model.Drive(
    model.SynchronousMachine(par),
    model.MechanicalSystem(J=0.015),
    model.VoltageSourceConverter(u_dc=540),
)

# Discrete-time control system: sensorless flux-vector control
cfg = control.FluxVectorControllerCfg(i_s_max=6.5, sensorless=True)
ctrl = control.VectorControlSystem(
    control.FluxVectorController(par, cfg), control.SpeedController(J=0.015, alpha_s=25)
)

# Speed reference and load torque
ctrl.set_speed_ref(lambda t: (t > 0.1) * 50)  # rad/s
mdl.mechanics.set_external_load_torque(lambda t: (t > 0.7) * 10)  # Nm

res = model.Simulation(mdl, ctrl).simulate(t_stop=1.2)
utils.plot(res)

To go further, start from the drive examples and grid examples. New system models and controllers can be developed using the existing ones as templates.

From simulation to the laboratory

Laboratory test bench: a permanent-magnet synchronous machine coupled to a load machine through a torque sensor, with the converter cabinet in the background

Almost all control methods in the examples have also been implemented and tested on laboratory test benches at Aalto University, such as the one shown here. The simulation models aim to capture the dynamics that matter for control design.


Contributing

If you would like to help us develop motulator, see these guidelines first.

Contributors

Thanks go to these wonderful people:

Lauri Tiitinen
Lauri Tiitinen

💻 🤔 💡 🧑‍🏫
HannuHar
HannuHar

💻 🐛
Marko Hinkkanen
Marko Hinkkanen

💻 🤔 💡 🧑‍🏫
silundbe
silundbe

💻 💡
JoonaKukkonen
JoonaKukkonen

💻 🚇
jarno-k
jarno-k

🤔 👀 🧑‍🏫
angelicaiaderosa
angelicaiaderosa

💻 💡
Luca Peretti
Luca Peretti

🤔 📣
GianmarioPellegrinoPolito
GianmarioPellegrinoPolito

🔣
Simone Ferrari
Simone Ferrari

🔣
Jialed0303
Jialed0303

🤔
murgui
murgui

🐛
Nithin Valiyaveettil Sadanandan
Nithin Valiyaveettil Sadanandan

🐛
saarela
saarela

🐛
Ushnish
Ushnish

🐛
Francesco-Lelli
Francesco-Lelli

💻 💡 🤔
Mikko Sarén
Mikko Sarén

💻 💡 🤔
Juho Määttä
Juho Määttä

💻 💡 🤔
rayanmour
rayanmour

💻 💡 🤔 👀 🧑‍🏫
Cosimo Bassi
Cosimo Bassi

🚇
Junyi Li
Junyi Li

💻 💡 🤔
Tim Foißner
Tim Foißner

🔣 🤔

This project follows the all-contributors specification. Contributions of any kind welcome!

Acknowledgement

This project has been sponsored by ABB Oy and by the Research Council of Finland Centre of Excellence in High-Speed Electromechanical Energy Conversion Systems. The example control methods included in this repository are based on published algorithms (available in textbooks and scientific articles). They do not present any proprietary control software.

Metadata

Release files for motulator 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for motulator 0.9.0
File Size Uploaded
motulator-0.9.0.tar.gz 31.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for motulator 0.9.0
File Interpreter ABI Platform
motulator-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 MB

Release files / motulator-0.9.0.tar.gz

Download URL motulator-0.9.0.tar.gz
Size 31.2 MB
Tags Source
SHA-256 checksum
How to use checksums
4d626ee57cf339bcaaf8e17cfbd720468aaa8b7b6fd82bd3682afb473c70fad8
BLAKE2b-256 checksum
How to use checksums
e55bc5148e0039d6503e91cfe5d512079a54da8a12c78eb62c59904c1dd338b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / motulator-0.9.0-py3-none-any.whl

Download URL motulator-0.9.0-py3-none-any.whl
Size 141.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2ab1b9ba8784992f2235bc48fbd0fc90dc5f2484cbaca7246273bca815ce3528
BLAKE2b-256 checksum
How to use checksums
64b6a623e6976d90d3a912ddc7674e9d32ff06832eda817603b7c81b4761feaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

0.13.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.0

2 release files

This release

0.9.0 This release

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.8

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page