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.

TMS320F28379S: POWER_MEAS_SINE_ANALYZER jitter detection (bug?)

Expert 2730 points

Part Number: TMS320F28379S

Hi,

I'm just testing the POWER_MEAS_SINE_ANALYZER library and noticed, that when jitter is detected, only the sample is counter is set back to 0. This brings the problem that when the next zero crossing is detected, the count of samples is usually correct but all the sum variables not. Shouldn't these also be set 0 at the same time as sample counter?

Original:
if (v->nSamplesMin < v->nSamples) { ... } else { // // otherwise it may be jitter ignore this reading // but count the number of jitters you are getting // but do not count to infinity as then when the grid comes back // it will take too much time to wind down the jitter count // if (v->jitterCount < 30) { v->jitterCount++; } v->nSamples = 0; }

Should be?
if (v->nSamplesMin < v->nSamples) { ... } else { // // otherwise it may be jitter ignore this reading // but count the number of jitters you are getting // but do not count to infinity as then when the grid comes back // it will take too much time to wind down the jitter count // if (v->jitterCount < 30) { v->jitterCount++; } v->nSamples = 0; v->vSum = 0; v->vSqrSum = 0; v->iSqrSum = 0; v->pSum = 0; }

JHi

  • Hi,

    Thanks for pointing this out. You are correct to reset those variables. Another suggestion would be to select a narrower frequency range to reduce noise. I have filed an enhancement request to review the feature request.

    Regards,

    Ozino

  • Hi,

    I would also suggest to add hysteresis to zero cross detection. I'm driving my board with signal generator which gives gives quite pure sine wave. But I still have sometimes problems that the algorithm will detect zero crossing when it is going to negative direction. My suggestion for sign detection:

    if (v->prevSign == 0)
    {
        v->currSign = (v->v > v->threshold) ? 1 : 0;
    }
    else
    {
        v->currSign = (v->v < (v->threshold * (float32_t)-1.0)) ? 0 : 1;
    }

    To add the hysteresis do not affect to calculation because only the change from negative to positive half cycle will trigger the calculations.

    JHi

  • JHi,

    Thanks for the information. I'll update the ticket i filed for enhancement with this additional information.

    Regards,

    Ozino

  • correct a hysteresis around the decision for the sign shall help with noise immunity.