I use ade7878 to measure electricity.
Conditions are as follows:
fLine = 50 Hz
Vn = 230V
In = 5A
Vfs = 389,9693898V
Ifs = 17,677670
VLEVEL = 833381
calculated gains (REGS):
VGAIN = -311323
IGAIN = -8022457
So, IRMS and VRMS contain the correct data
Next calculated power gain (WGAIN,VA,VAR,FVAR):
Vn = 230, In = 5A, CFDEN = 156, MC = 6400
THR = 140244671 (AN-1076 page 6 (2))
LCYCMODE = 0x27 (C phase using), LINECYC = 200 (1phase = 2 sec), PERIOD = 5120 (use fot WHref calc).
Next connect the load and read RMS, WATTHR, WATT:
VRMS = 2297451, IRMS = 2818. Whref = 35,96787177 * 10^-3(Wh). WATTHRref = 36. But WATTHR reg contains 1 or 2 and WATT reg contains 747.
I reduced the THR register 20 times and WATTHR reg value is changed to 27 (WATT is unchanged)
I calculated WGAIN reg based on the new WATTHR reg.
So WGAIN = 2326840.
Now WATTHR reg looks right, but WATT reg contains 960 (value appears reduced by 20 times the correct: (229.7451 * 0.2818)/(17.677670 * 389.9693898)*(33516139/16) = 19672)
What did I do wrong?