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), induction motors, and brushless DC motors (BLDC). Use these example models to test and verify your algorithm design in closed-loop simulation, and then 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.

Control Algorithm Design

Use Park, Clarke, PI controller, space vector generator, maximum torque per ampere (MTPA), field weakening, and induction motor slip speed estimator blocks to create field-oriented control algorithms for PMSM and induction motors in Simulink. Use the six-step commutation block to control BLDC motors.

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.

Explore gallery (2 images)

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 PMSMs and induction motors 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).

Motor Parameter Estimation

Automatically identify motor parameters.

Prebuilt Instrumented Tests

Identify stator resistance, d-axis and q-axis inductance, back-EMF, inertia, and friction parameters for your PMSM motor by using provided reference examples that run predefined tests on your motor. You can use Hall sensor, quadrature encoder, or sensorless observers for these tests.

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 PMSMs, interior PMSMs, and induction motors 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.

Explore gallery (2 images)

Latest Features

Induction Motors

Design and implement field-oriented control algorithms for three-phase induction machines

Induction Motors

Model and simulate three-phase induction machines

BLDC Motors

Design and implement trapezoidal control using Six Step Commutation Block

Motor Parameter Estimation

Identify PMSM parameters using quadrature encoder or flux observer

Vector Plot Block

Visualize current and voltage in the phasor diagram and verify the controller in different operating modes

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