SPRAD24 august 2023 AM2631 , AM2632 , AM2632-Q1 , AM2634 , AM2634-Q1 , AM263P4 , AM263P4-Q1
The inputs to SVPWM generator is Vd and Vq. The following lines need to be called for assignment of the values. Motor1 is a structure stored in TCM. More details on its definition can be found in the program files. Couple simple Ctrl + left click on the variable name will help trace the location where is defined. The code shares the same logic as the C28 program for TIDM-02014. Vd and Vq are in real value other than per unit value.
Motor speed and motor angle are generated by the following lines. Lines 1 to 4 setup ramp controller, rc1, and ramp generator, rg1. SpdRef is per unit value between 0 and 1. The generated omega and theta are assigned to motor1 in lines 5 and 6. Line 7 limits the theta to a range from 0 to TWO_PI. The TWO_PI value is defined in the files. Couple simple "Ctrl + left click" on the variable name will help trace the location where is defined. It is worth attention that rc1, rg1, and motor1 need to be initialized accordingly before starting hardware interrupt.
The next couple lines are to feed the inputs into SVPWM generator and keep the output in per unit values. Line 1 keeps inputs within limits. Line 2 is inverse park transformation. Similar functions can be found in CMSIS DSP library and others. The angle information is already included in the structure of motor1. Line 3 is SVPWM generator. The logic is the same as C28 program for TIDM-02014. There are other implementations in previous C28 libraries. It is worth attention that there is a real value to per unit value conversion in this version. Line 4 keeps per unit output within limits.
After SVPWM generated, the per unit outputs are passed to EPWM Counter Compare by the function in following line 1. Line 2 gives details on setting EPWM0 Counter Compare. EPWM_setCounterCompareValue is the name of SDK API to set Counter Compare value. Here, the value is computed for Up-Down mode or Center-line mode.