The FWC and MTPA functions are added and called in the motor drive ISR to calculate current angle, and then compute the reference currents of the d-axis and q-axis.
- Adding the pre-define symbols MOTOR1_FWC and MOTOR1_MTPA in the build configuration of the project as described in Section 3.2.2 for enabling the FWC and MTPA, respectively.
- In the user_mtr1.h file, make sure the motor parameters are known and correctly set. In mtpa.h, make sure the tables are set properly for and calculations are set according to the specification of the motor.
- Add the variables VsRef_pu, Kp_fwc, and Ki_fwc to the Expressions window in CCS Debug Perspective, and tune these parameters to achieve the expected performance for the field weakening control according to the motor and the system.
- After tuning and fixing these variables, record the watch window values with the newly-defined parameters in user_mtr1.h file.
USER_M1_FWC_VREF = VsRef_pu's value. The factor of the reference voltage for Field Weakening Control.
USER_M1_FWC_KP = Kp_fwc's value. The Kp gain of PI regulator for Field Weakening Control
USER_M1_FWC_KI = Ki_fwc's value. The Ki gain of PI regulator for Field Weakening Control
- MTPA control parameters are calculated according to the motor parameters, , , and , so there are not any additional parameters to be tuned online.