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 ;
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.