Skip to main content

motulator-export

Export of motulator drive and grid converter systems to PLECS and Simulink, and their native simulation in C

PyPI version

Documentation: https://aalto-electric-drives.github.io/motulator-export/

Build the system in motulator as usual, then:

from motulator_export import native, plecs, simulink

plecs.write_model("drive.plecs", mdl, ctrl, t_stop=1.2)  # PLECS model
simulink.write_model("drive.slx", mdl, ctrl, t_stop=1.2)  # Script of the Simulink model
res = native.Simulation(mdl, ctrl).simulate(t_stop=1.2)  # Native simulation
PLECS model of a 2.2-kW IPMSM drive

PLECS model of a 2.2-kW IPMSM drive with sensorless flux-vector control, written by examples/ipmsm_2kw_fvc.py.

  • One control code everywhere. The control algorithms of motulator are ported to C. The same code runs in PLECS, in Simulink, and in the native simulation.
  • The structure of motulator. Each class of the control system is a block, nested as in motulator, by default with a mask of the arguments of its class. The parameters are set as in a motulator script, and they can be changed without Python. The blocks are also in libraries for PLECS and Simulink, and the Simulink models are built from the library by MATLAB scripts that read as motulator scripts.
  • Self-contained Simulink models. With MATLAB Function blocks, a Simulink model needs no C compiler, no library, and not even this package, only the m-files of its functions and parameters saved next to it: the model, or a single subsystem of its control system, can be copied with them, e.g., to a model of a real-time target in the laboratory.
  • Verified. In the comparisons of the examples, the PLECS and Simulink models agree with motulator to about 1e-6 relative to the signal magnitudes, and the native simulation to the rounding errors.
  • Fast. The native simulation is 30 to 40 times faster than motulator, which is useful, e.g., for parameter sweeps.

Installation

Install the package from PyPI in a virtual environment (motulator is installed as a dependency). On Linux and macOS:

python3 -m venv .venv
source .venv/bin/activate
pip install motulator-export

On Windows, the environment is created and activated with py -m venv .venv and .venv\Scripts\activate. The requirements of PLECS, Simulink, and the native simulation, e.g., a C compiler, and the examples of the repository are described in Getting started.

For development, clone the repository and install the package with pip install -e ".[dev]"; see Development.

Contributors

Marko Hinkkanen
Marko Hinkkanen

💻 🤔
Mikko Sarén
Mikko Sarén

🤔
Hannu Hartikainen
Hannu Hartikainen

🤔
Eleftherios Kontodinas
Eleftherios Kontodinas

🤔

Metadata

Release files for motulator-export 0.19.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-export 0.19.0
File Size Uploaded Provenance Actions
motulator_export-0.19.0.tar.gz 632.7 kB Without provenance Details for motulator_export-0.19.0.tar.gz

Built distribution (wheel)

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

Total release size: 1.7 MB

Release files / motulator_export-0.19.0.tar.gz

Download URL motulator_export-0.19.0.tar.gz
Size 632.7 kB
Tags Source
SHA-256 checksum
How to use checksums
93331a75d1e28c2ed5a57a7c37aec9403da6c1ee10122f91622b99881479cda4
BLAKE2b-256 checksum
How to use checksums
4686c2571109da0d5363217c56b9ab841e46f39a78b325e2d304080c99e5a8cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Release files / motulator_export-0.19.0-py3-none-any.whl

Download URL motulator_export-0.19.0-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
128ceced9ea1a58f60c3725cfb95241332eb9156efac417435e4ded16aabc776
BLAKE2b-256 checksum
How to use checksums
44e7ce72ac14c48f10b871337de46b9c28b664281fde7e56fd30d2b2c42954fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.16

Security for motulator-export 0.19.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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