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.

MS430F47187 / SD16_A: Phase Angle Calibration by using Conversion Delay



 

Hi,

 

I’m using SD16_A to measure energy. Ch0, 1 and 2 are connected to voltage channels and Ch3, 4, 5 connected to current channels in a system which is 3-phase 4-wire.

 

On the sd16a initialization, I configured ch0 to 4 as grouped and ch5 is the master and interrupt source. And initially I set all preload delay value to 128.

 

Well, I calibrated the meter when power factor = 1. Now the meter is pulsing and the error value is %0.05 for any phase which is good. When I change Power factor to 0.5 which means 60 degree inductive, now the error is around %1.0 for any phases. If I change SD16PRE3 preload value with 110 instead of 128, First phase error disappears, but I didn`t understand why or how.

 

My question is the relation between pulse error at PF=0.5 and PRELOAD values. How can I calculate formula which describes the relation between error and preload values? (for the systems 50Hz and 60 Hz)

 

Actually, I didn`t understand the delay mechanism in grouped mode. In our design, ideally, voltage and current channels for the phase R (Ch0 and Ch3) should be sampled at the same time. And practically, I should be able to specify the time between these samples. There are two preload values, one belongs to Ch0 and the order belongs to Ch3. Which register does exactly describe the time between ch0 and ch3 sampling time?  

 

 

Thank you.

 

void init_sd16a(void)

{

    // ref on, ref buffer on, 1/1 and 1/8 divider, SMCLK, ov interrupt disabled

    SD16CTL   = SD16XDIV_0 + SD16DIV_3 + SD16SSEL_1 + SD16VMIDON + SD16REFON;

   

    // OSR 1024, Bipolar, DF, grouped

    SD16CCTL0 = SD16OSR_1024 + SD16DF + SD16GRP;

 

    // OSR 1024, Bipolar, DF, grouped

    SD16CCTL1 = SD16OSR_1024 + SD16DF + SD16GRP;

 

    // OSR 1024, Bipolar, DF, grouped

    SD16CCTL2 = SD16OSR_1024 + SD16DF + SD16GRP;

 

    // OSR 1024, Bipolar, DF, grouped

    SD16CCTL3 = SD16OSR_1024 + SD16DF + SD16GRP;

 

    // OSR 1024, Bipolar, DF, grouped

    SD16CCTL4 = SD16OSR_1024 + SD16DF + SD16GRP;

 

    // OSR 1024, Bipolar, DF, NOT grouped, interrupt enable

    SD16CCTL5 = SD16OSR_1024 + SD16DF + SD16IE;

   

    SD16PRE0 = 128; // Voltage Ch R

    SD16PRE1 = 128; // Voltage Ch S

    SD16PRE2 = 128; // Voltage Ch T

    SD16PRE3 = 128; // Current Ch R

    SD16PRE4 = 128; // Current Ch S

    SD16PRE5 = 128; // Current Ch T

 

    __delay_cycles(1000);  

}

 

  • BasePointer,

    The setup you posted is correct, as is the way you use the preload-registers. Changing the preload registers will compensate for any phase-shift introduced by the sensors or the system itself in the current path and it actually does not matter, if you change the preload values for either the current or the voltage conversions, as long as you do not change both. In your specific case, you change the preload register for the I1 (current 1) path, so that it samples 8 (modulator-)cycles earlier than the voltage path, compensating for an inductive phase-shift. This phase shift is most visible at 60 deg (power factor of 0.5) as this is the way the math works. Let's say, your CT introduces a shift of 4 deg (inductive), the difference between cos(0deg) and cos(4deg) would be 0.0025, while at 60 deg, the difference between cos(60deg) and cos(64deg), which still has a four deg phase shift added due to the CT, would be 0.0616, i.e. 25 times higher.

    This is the reason, why phase compensation needs to be done with a PF of 0.5.

    There is an application report from TI describing this in more detail than I can here: http://focus.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=slaa409a . Here you can also find the formula to calculate how big the preload values needs to be for any given phase shift.

    Hope this helps,

    Richard

  •  

    Hi Richard,

     

    Thanks for the reply. I understood the calculations. I have another question. In my configuration, the master channel is channel 5. Let’s think on the worst case which is master channel preload value is 0 and all others preload values are near to maximum value. The question is, when I receive SD16A interrupt, all other channels except master will still be in conversion state due to delay. Is it safe to read all channels value in sd16a interrupt when the master channel conversion is done? If not safe, what is the proper way to handle this condition?

     

     

        SD16PRE0 = 128; // Voltage Ch R

        SD16PRE1 = 128; // Voltage Ch S

        SD16PRE2 = 128; // Voltage Ch T

        SD16PRE3 = 255; // Current Ch R

        SD16PRE4 = 255; // Current Ch S

        SD16PRE5 = 0;   // Current Ch T – master

     

    #pragma vector=SD16A_VECTOR

    __interrupt void SD16AISR(void)

    {

        Sample.Ch0 = SD16MEM0;           // Save CH0 results (clears IFG)

        Sample.Ch1 = SD16MEM1;           // Save CH1 results (clears IFG)

        Sample.Ch2 = SD16MEM2;           // Save CH2 results (clears IFG)

        Sample.Ch3 = SD16MEM3;           // Save CH3 results (clears IFG)

        Sample.Ch4 = SD16MEM4;           // Save CH4 results (clears IFG)

        Sample.Ch5 = SD16MEM5;           // Save CH5 results (clears IFG)

       

        SAMPLE_READY = true;

    }

     

    Thank you,

    BP.

  • Hi BasePointer,

    As you correctly pointed out, it is not save to depend on the conversion interrupt of just the master, as the other channels might still not have a valid result. Therefore it is necessary to enable the interrupts of all channels and to react on all interrupts (and still keeping track of the number of words read) individually. It is also not quite possible to only react on the channel, which is configured to have the longest delay, as this might be too close to the master channel end of conversion, which would result in reading all channels with the result n and the master with the result n+1.

    Regards,

    Richard

**Attention** This is a public forum