motulator-export#
motulator-export turns drive systems and grid converter systems built in motulator into ready-to-run PLECS and Simulink models, and simulates them natively in C. 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) # Simulink model
res = native.Simulation(mdl, ctrl).simulate(t_stop=1.2) # Native simulation
PLECS model of a 2.2-kW IPMSM drive with sensorless flux-vector control.
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 masked block with the arguments of its class, nested as in motulator. The parameters are set as in a motulator script, and they can be changed without Python.
Verified. 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.
To start, see Getting started. The user guide then covers the PLECS models, the Simulink models, and the native simulation.
Note
The package supports motulator 0.16. A new release of motulator is supported after it has been tested.