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.

TIEVM-VIENNARECT: Some problems about routines of TIEVM-VIENNARECT Suite

Part Number: TIEVM-VIENNARECT

Dear team:

One of my customers would like help with some problems in the use of the suite:

offsetCalCounter=0;
    *iL1MeasOffset=0;
    *iL2MeasOffset=0;
    *iL3MeasOffset=0;

    *v1MeasOffset=0;
    *v2MeasOffset=0;
    *v3MeasOffset=0;

    while(offsetCalCounter<25000)
    {
        if(EPwm1Regs.ETFLG.bit.INT==1)
        {
            if(offsetCalCounter>1000)
            {
                // offset of the inductor current sense
                *iL1MeasOffset = k1*(*iL1MeasOffset) + k2*(IL1_ADC_READ1+IL1_ADC_READ2+IL1_ADC_READ3+IL1_ADC_READ4)*0.25*ADC_PU_SCALE_FACTOR;
                *iL2MeasOffset = k1*(*iL2MeasOffset) + k2*(IL2_ADC_READ1+IL2_ADC_READ2+IL2_ADC_READ3+IL2_ADC_READ4)*0.25*ADC_PU_SCALE_FACTOR;
                *iL3MeasOffset = k1*(*iL3MeasOffset) + k2*(IL3_ADC_READ1+IL3_ADC_READ2+IL3_ADC_READ3+IL3_ADC_READ4)*0.25*ADC_PU_SCALE_FACTOR;

                // offset of the inductor current sense
                *v1MeasOffset = k1*(*v1MeasOffset) + k2*(V1_ADC_READ1+V1_ADC_READ2+V1_ADC_READ3+V1_ADC_READ4)*0.25*ADC_PU_SCALE_FACTOR;
                *v2MeasOffset = k1*(*v2MeasOffset) + k2*(V2_ADC_READ1+V2_ADC_READ2+V2_ADC_READ3+V2_ADC_READ4)*0.25*ADC_PU_SCALE_FACTOR;
                *v3MeasOffset = k1*(*v3MeasOffset) + k2*(V3_ADC_READ1+V3_ADC_READ2+V3_ADC_READ3+V3_ADC_READ4)*0.25*ADC_PU_SCALE_FACTOR;
            }
            EPwm1Regs.ETCLR.bit.INT=1;
            offsetCalCounter++;
        }
    }

1, In the above procedure, how are the coefficients K1 and K2 taken?

2, *iL1MeasOffset = k1*(*iL1MeasOffset) + k2*(IL1_ADC_READ1+IL1_ADC_READ2+IL1_ADC_READ3+IL1_ADC_READ4)*0.25*ADC_PU_SCALE_FACTOR;

The first term in the above expression is always zero. What is the point of putting it in the expression?

3, Why does it only start when offsetcalcounter is between 1000 and 25000?

{
    /*offset165 = ((float32) (VREF165_FB))*ADC_PU_SCALE_FACTOR;*/

    iL1Meas = (((float32)(IL1_ADC_READ1+IL1_ADC_READ2+IL1_ADC_READ3+IL1_ADC_READ4))*ADC_PU_SCALE_FACTOR*0.25 - iL1MeasOffset )*2.0;
    iL2Meas = (((float32)(IL2_ADC_READ1+IL2_ADC_READ2+IL2_ADC_READ3+IL2_ADC_READ4))*ADC_PU_SCALE_FACTOR*0.25 - iL2MeasOffset )*2.0;
    iL3Meas = (((float32)(IL3_ADC_READ1+IL3_ADC_READ2+IL3_ADC_READ3+IL3_ADC_READ4))*ADC_PU_SCALE_FACTOR*0.25 - iL3MeasOffset )*2.0;

    v1Meas = (((float32)(V1_ADC_READ1+V1_ADC_READ2+V1_ADC_READ3+V1_ADC_READ4))*ADC_PU_SCALE_FACTOR*0.25 - v1MeasOffset )*2.0;
    v2Meas = (((float32)(V2_ADC_READ1+V2_ADC_READ2+V2_ADC_READ3+V2_ADC_READ4))*ADC_PU_SCALE_FACTOR*0.25 - v2MeasOffset )*2.0;
    v3Meas = (((float32)(V3_ADC_READ1+V3_ADC_READ2+V3_ADC_READ3+V3_ADC_READ4))*ADC_PU_SCALE_FACTOR*0.25 - v3MeasOffset )*2.0;

    vBusPMMeas = (((float32)(VBUSPM_ADC_READ1+VBUSPM_ADC_READ2+VBUSPM_ADC_READ3+VBUSPM_ADC_READ4))*ADC_PU_SCALE_FACTOR*0.25 )*VDCBUS_MAX_SENSE/VAC_MAX_SENSE;
    vBusMNMeas = (((float32)(VBUSMN_ADC_READ1+VBUSMN_ADC_READ2+VBUSMN_ADC_READ3+VBUSMN_ADC_READ4))*ADC_PU_SCALE_FACTOR*0.25 )*VDCBUS_MAX_SENSE/VAC_MAX_SENSE;

  1) vBusPMMeas = m_VBusPMMeas*vBusPMMeas + b_VBusPMMeas; // y= mx+ b equation used to reduce offset and gain error
  2)  vBusMNMeas = m_VBusMNMeas*vBusMNMeas + b_VBusMNMeas;

  3)  vBusMeas= vBusPMMeas+vBusMNMeas;
   4) vBusHalfMeas = (vBusMeas)*0.5;
    // clamp the vBusHalfMeas before dividing to avoid NaN
    vBusHalfMeas = (vBusHalfMeas<0.2)?0.2:vBusHalfMeas;
}

4, When the above program is simulated, the pointer will not execute in the order of 1) > 2) > 3) > 4), is this the expected execution effect of the program?

Best Regards

  • Hi Green,

    1) Offset filter coefficient K1: 0.05/(T+0.05);

    2)It will not always be zero.

    3)

    You can refer to the thread below.  

    4) you can disable the optimization and check the sequence. I think that might have an impact.

    Regards,

    Chen