This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C2000WARE-MOTORCONTROL-SDK: Delay Compensation in FOC algorithm

Part Number: C2000WARE-MOTORCONTROL-SDK

Tool/software:

Hi, I am using F280049 uC for motor control application. I am using sincos encoder and not the fast estimator.

Can you help me understand the use of delay compensation in FOC algorithm and whether should I add it or not? 

I understand that the currents and position sensor is captured at the start of PWM cycle and voltage is applied only at the end of the PWM cycle. Is this why we do a delay compensation? 

Is the compensated angle used for converting Vdq to Vabc or also for converting Iabc to Idq ? 

I am confused. Some explanation will help. 

Thanks in advance.


  • PWM delay is discussed Instaspin user guide PDF, though code snip may help to clarify why it is added.

              
              
    float32_t angleDelayed_sf_sec;      //!< Defines the scale factor for
                                        //!< computing the angle considering
                                        //!< system delay, sec
              
                //
                // run the controller
                //
                CTRL_run(ctrlHandle, (MATH_Vec2 *)&(Vdq_out_V));
    
                //
                // store the Idq reference values used by the controller
                //
                EST_setIdq_ref_A(estHandle, CTRL_getIdq_ref_A_addr(ctrlHandle));
    
                //
                // compute angle with delay compensation
                //
                angleDelta_rad = userParams.angleDelayed_sf_sec *
                                     estOutputData.fm_lp_rps;
    
                angleWithDelay_rad = MATH_incrAngle(estOutputData.angle_rad,
                                                    angleDelta_rad);

  • Hi Genatco, 

    userParams.angleDelayed_sf_sec seems to be intialized to 0.5*CTRL_period_us. Where is the 0.5 factor coming from? 


  • The image suggests a compensation factor of 1.5. Where as the code sent in previous replies uses a factor of 0.5. Could you explain why is there a difference between the two? 

  • Could you explain why is there a difference between the two? 

    Seemingly faster MCU 100MHz clock (SYSCLK) time for ADC peripheral and sample rate. Use of PPB off-loads application samples to the ADC peripheral, CCS see REX project UMCSDK for details.