ADE7953 sample code question

Hi,

I was able to download below sample code for ADE7953 in ADI website.

Can anyone answer to my questions?

Q1. Meaning of 662/6330 in ActivePower EQ?

Q2. Meaning of 200/16836 in IrmsA EQ?

Q3. Meaning of 1/84 in IrmsB EQ?

Q4. Meaning of 1/200 in Vrms EQ.

Q5. For FrequencyA, I think it should be 223Khz/DATA_PERIOD.wordL.low. Am I correct?

Q6. Why Multiply 1000/32768 for PowerFactor?

= Downloaded sample code(Metering.c) =

 ActivePowerA = DATA_AWATT.F_DATA;
 if(ActivePowerA & 0xff800000) ActivePowerA = 0 - ActivePowerA;
 ActivePowerA = ActivePowerA * 662/6330;
 ActivePowerB = DATA_BWATT.F_DATA;
 if(ActivePowerB & 0xff800000) ActivePowerB = 0 - ActivePowerB;
 ActivePowerB = ActivePowerB * 662/6330;
 
 ReactivePowerA = DATA_AVAR.F_DATA;
 if(ReactivePowerA & 0xff800000) ReactivePowerA = 0 - ReactivePowerA;
 ReactivePowerB = DATA_BVAR.F_DATA;
 if(ReactivePowerB & 0xff800000) ReactivePowerB = 0 - ReactivePowerB;
 IrmsA = DATA_IRMSA.F_DATA*200/16836;
 IrmsB = DATA_IRMSB.F_DATA/84;
 Vrms = DATA_VRMS.F_DATA / 200;
 FrequencyA = 22375000 / DATA_PERIOD.wordL.low;
 PowerFactorA = DATA_PFA.wordL.low;
 if(PowerFactorA > 0x8000)PowerFactorA = PowerFactorA - 0x8000;
 PowerFactorA = (unsigned long)PowerFactorA*1000/32768 ;
 PowerFactorB = DATA_PFB.wordL.low;
 if(PowerFactorB > 0x8000)PowerFactorB = PowerFactorB - 0x8000; 
 PowerFactorB = (unsigned long)PowerFactorB*1000/32768 ;

Parents
  • 0
    •  Analog Employees 
    on Jan 11, 2017 7:41 PM over 4 years ago

    Hi,

    I apologize for the delay, let me answer your questions now if they haven't been already.

    These are all basically constant that the registers are multiplied by in order to get the real world value for the registers. Many of these area specific to the meter design that this code was taken from and your constants will be different.

    1. Specific to this meter design, you will have to find your own conversion factor to get to real world Watts. You have to perform a calibration to get these constants.
    2. Again same thing, except for Current RMS.
    3. Same as number 2.
    4. Same as number 2 except for Voltage RMS.
    5. That equation follows the equation from the data sheet using the clock frequency
    6. The value of 1000/32768 is used to translate the register value to PF*1000, which means a PF = 0.955 will show up as 955 when multiplied by that value.

    Regards,

    Dlath

Reply
  • 0
    •  Analog Employees 
    on Jan 11, 2017 7:41 PM over 4 years ago

    Hi,

    I apologize for the delay, let me answer your questions now if they haven't been already.

    These are all basically constant that the registers are multiplied by in order to get the real world value for the registers. Many of these area specific to the meter design that this code was taken from and your constants will be different.

    1. Specific to this meter design, you will have to find your own conversion factor to get to real world Watts. You have to perform a calibration to get these constants.
    2. Again same thing, except for Current RMS.
    3. Same as number 2.
    4. Same as number 2 except for Voltage RMS.
    5. That equation follows the equation from the data sheet using the clock frequency
    6. The value of 1000/32768 is used to translate the register value to PF*1000, which means a PF = 0.955 will show up as 955 when multiplied by that value.

    Regards,

    Dlath

Children
No Data