Main Content

Design Field-Oriented Control Algorithm

To implement the speed control algorithm for a motor, perform these tasks:

  • Current scaling — Convert current from ADC counts to PU.

  • Quadrature encoder position decoding — Read the quadrature encoder position counts and calculate the rotor electrical position.

  • Torque control — Implement current control in the d-q axis.

  • Speed control — Implement speed control.

These steps help you implement the speed control algorithm for a PMSM using Motor Control Blockset™ and are related to the model mcb_pmsm_foc_qep_f28379d used in the example Field-Oriented Control of PMSM Using Quadrature Encoder. They explain the procedure to tune the control parameters for d-axis and q-axis current controllers and the speed controller.

In these steps, variables are used to define datatypes and execution times of the current and speed controllers. See the initialization script linked to the example model mcb_pmsm_foc_qep_f28379d for details about the variables defined in these steps.


A basic understanding of Simulink® is a prerequisite for following this workflow as these workflow steps do not provide details on tasks like defining a datatype in a constant block or using math operations blocks in Simulink.

See Estimate PMSM Parameters Using Recommended Hardware for estimating the motor parameters. Then, see Creating Plant Model Using Motor Control Blockset to design a plant model. This helps you verify the control algorithm in simulation.