The implementation of speed control algorithm for a motor involves these tasks:
Current scaling - Read the current from ADC counts and convert to PU
QEP position decoding - Read the QEP position counts and calculate the rotor electrical position
Torque control - Current control in d-q axis
Speed control
The below steps can help you to implement speed control algorithm for a PMSM using
Motor Control Blockset™. These guidelines to build speed control algorithm are also related to the
example model mcb_pmsm_foc_qep_f28379d
and explains the steps to tune
the control parameters for d-axis and q-axis current controllers and the speed controller.
In these workflow steps, variables are used for defining datatypes, execution
time of current controller, and execution time of speed controller. Refer to the
initialization script of the example model
mcb_pmsm_foc_qep_f28379d
for the details of 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 about tasks like defining datatype in a constant block or usage of math operations blocks in Simulink.
Refer to the section Estimate Motor Parameters by Using Motor Control Blockset Parameter Estimation Tool for estimating the motor parameters, and then refer to Creating Plant Model Using Motor Control Blockset to design a plant model, which helps to verify the control algorithm in simulation.