Motor Control Blockset

Design and implement motor control algorithms


Motor Control Blockset™ provides reference examples and blocks for developing field-oriented control algorithms for brushless motors. The examples show how to configure a controller model to generate compact and fast C code for any target microcontroller (with Embedded Coder®). You can also use the reference examples to generate algorithmic C code and driver code for specific motor control kits.

The blockset includes Park and Clarke transforms, sliding mode and flux observers, a space-vector generator, and other components for creating speed and torque controllers. You can automatically tune controller gains based on specified bandwidth and phase margins for current and speed loops (with Simulink Control Design™).

The blockset lets you create an accurate motor model by providing tools for collecting data directly from hardware and calculating motor parameters. You can use the parameterized motor model to test your control algorithm in closed-loop simulations.

Get Started:

Reference Examples

Jumpstart your motor control design with fully-assembled example models.

Simulation and Code Generation

Use fully-assembled reference examples as a starting point for designing and implementing field-oriented control algorithms for surface-mount and interior permanent magnet synchronous motors (PMSM). Use these example models to test and verify your algorithm design in closed-loop simulation and reuse the same models to generate and deploy embedded code.

Motor Control Kits

Use reference examples to quickly generate compact and fast C code to implement motor control algorithms for several supported motor control hardware kits. Automatically build and deploy applications to your target microprocessor directly from a Simulink model to test algorithms on the motor hardware. Communicate with and control these target applications from the host machine.

Motor Control Algorithms

Design motor control algorithms using blocks optimized for code generation.

Field-Oriented Control

Use Park, Clarke, PI controller, space vector generator, maximum torque per ampere (MTPA), and field weakening blocks to create field-oriented control algorithms in Simulink.

Field-oriented control algorithm implemented with Motor Control Blockset blocks.

Code Generation

Generate fast and compact floating- or fixed-point code for implementation on an embedded microcontroller (with Embedded Coder). Assess current loop performance with real-time execution profiling.

Generated code for implementing a sliding mode observer.

Rapid Control Prototyping

Test control algorithms in real-time with Simulink Real-Time and the Speedgoat electric motor control kit. The kit consists of a complete software/hardware package to run and test brushless DC motor control algorithms developed with Motor Control Blockset on Speedgoat real-time target hardware using analog and digital I/O.

Speedgoat electric motor control kit.

Sensor Decoders and Observers

Implement sensored and sensorless motor control algorithms.

Sensor Decoders

Use reference examples to calibrate offsets for Hall sensors and quadrature encoders. Then use sensor decoder blocks to process signals from Hall sensors, quadrature encoders, and resolvers to compute rotor position and speed.

Sensor decoders library in Motor Control Blockset.


Implement sensorless field-oriented control using Sliding Mode Observer and Flux Observer blocks. Use these blocks to compute the rotor electrical position and mechanical speed of a PMSM from measured voltages and currents. Estimate magnetic flux and mechanical torque. Adjust observer parameters and verify observer operation in simulation before generating embedded code.

Position and speed estimation using the Sliding Mode Observer block.

Controller Autotuning

Automatically tune current and speed loop gains.

Initial Controller Tuning

Automatically compute initial PI controller gains for speed and current loops based on motor and inverter parameters. Provided scripts help you analyze current loop dynamics in time and frequency domains by computing and plotting the root locus, Bode diagram, and step response of your current loop (with Control System Toolbox).

Testing computed controller gains on motor hardware.

Field-Oriented Control Autotuner

Use the Field-Oriented Control Autotuner block to tune speed and current loop gains of field-oriented controllers to achieve specified bandwidth and phase margin for each loop (with Simulink Control Design). Tune the gains in simulation against a plant model. You can also tune the gains in real-time against motor drive hardware using a Speedgoat target computer (with Simulink Real-Time).

Field-Oriented Controller Autotuner block.

Motor Parameter Estimation

Automatically identify motor parameters.

Prebuilt Instrumented Tests

Identify the stator resistance, d-axis and q-axis inductance, back-EMF constant, inertia, and friction constant for your motor by using provided reference examples that run predefined tests on your motor.

Parameter Estimation Dashboard

Initiate and control parameter estimation from a Simulink model on a host computer. Save the estimated values to parameterize motor models and to compute controller gains.

Parameter estimation dashboard.

Motor Models

Model linear average-value motor and inverter dynamics.

Motor and Inverter Models

Model and simulate your surface-mount and interior PMSMs using blocks that implement linear lumped-parameter motor models. Parameterize these models with values determined from instrumented tests. Combine your controller model with a motor model and a provided average-value inverter model for fast closed-loop simulations.

Modeling a PMSM and inverter.

Higher Fidelity Modeling with Simscape Electrical

Model and simulate nonlinear motor dynamics and ideal or detailed switching in the inverter using Simscape Electrical™. Test your field-oriented control algorithms against these high-fidelity motor and inverter models with simulations that incorporate nonlinearities and switching effects.

Inverter switching dynamics modeled with Simscape Electrical.

Latest Features

Motor Control Algorithms

Design field-oriented control using Park, Clarke, space-vector generator, field weakening, and other blocks

Reference Examples

Simulate field-oriented control and generate compact and fast C code for implementation on microcontroller (with Embedded Coder®)

Reference Examples

Spin a motor with several motor control hardware kits

Sensor Decoders and Sensorless Estimators

Implement sensored and sensorless motor control

Controller Autotuning

Automatically tune current and speed loops (with Simulink Control Design)

Motor Parameter Estimation

Identify motor parameters from experiments with motor hardware

Motor Models

Verify controls algorithms in closed-loop simulation with linear surface-mount and interior permanent magnet synchronous machine (PMSM) models

See the release notes for details on any of these features and corresponding functions.