Motor Control Blockset™ provides Simulink® blocks for creating and tuning field-oriented control and other algorithms for brushless motors. Blocks include Park and Clarke transforms, sensorless observers, field weakening, a space-vector generator, and an FOC autotuner. You can verify control algorithms in closed-loop simulation using the motor and inverter models included in the blockset.
The blockset parameter estimation tool runs predefined tests on your motor hardware for accurate estimation of stator resistance, d-axis and q-axis inductance, back EMF, inertia, and friction. You can incorporate these motor parameter values into a closed-loop simulation to analyze your controller design.
Reference examples show how to verify control algorithms in desktop simulation and generate compact C code that supports execution rates required for production implementation. The reference examples can also be used to implement algorithms for motor control hardware kits supported by the blockset.
Get Started:
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.
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.
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.
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.
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.
Observers
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.
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).
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).
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.
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.
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.