Reg for Energy measurement

Hi All,

       I have been using ADE9078 for my project. we are trying to read Energy, i connected with load of (185 W power, 0.78 A load current (Resistive load)) to ADE9078. While reading for User Energy register(xAWATTHR_HI) iam getting this value( 0x8D44 ),after conversion iam getting energy in wrong and  different values. Still i did not understand for configuring EGY TIME register for setting period of time for reading energy and in energy conversion constant also i have a probelm. i tried three different constants but iam not getting proper energy.

particularity for energy, time configurations and energy conversion constant i need a guidance and examples.

If any mistakes i done for following  initial configuration code, please let me know.

#define VOLTAGE_GAIN        0x00000000
#define CURRENT_GAIN       0x00000000
#define POWER_GAIN           0x00000000 

#define VOLTAGE_CONVERSION_CONSTANT       75000
#define POWER_CONVERSION_CONSTANT          416.667
#define CURRENT_CONVERSION_CONSTANT      74776.28

#define ENERGY_CONVERSION_CONSTANT          203152.7652        //45180.16396         //229.7861         

void ADE9078_Regs_init(uint8_t slave_select)
{
uint32_t rst_done = 0;
const uint32_t VlevelData = 0x117514;
const uint16_t run_data = 0x1;
const uint16_t ep_cfg_data = 0x0011; //energy over a defined number of samples(EGY_LD_ACCUM = 1 and EGY_PWR_EN = 1)
const uint32_t config_0_data = 0x0;
const uint16_t egy_time_data = 0x0F9F; // for 3999 samples

spi_read_32(STATUS1_32,&rst_done,slave_select);
while(!(check_bit(rst_done,16)));        //wait until 16th bit (rst_done) to set

spi_write_32(AVGAIN_32, VOLTAGE_GAIN, slave_select);
spi_write_32(BVGAIN_32, VOLTAGE_GAIN, slave_select);
spi_write_32(CVGAIN_32, VOLTAGE_GAIN, slave_select);

spi_write_32(AIGAIN_32, CURRENT_GAIN, slave_select);
spi_write_32(BIGAIN_32, CURRENT_GAIN, slave_select);
spi_write_32(CIGAIN_32, CURRENT_GAIN, slave_select);

spi_write_32(APGAIN_32, POWER_GAIN, slave_select);
spi_write_32(BPGAIN_32, POWER_GAIN, slave_select);
spi_write_32(CPGAIN_32, POWER_GAIN, slave_select);
spi_write_16(PGA_GAIN_16, 0x0000, slave_select);             // VA,VB,VC,IN,IA,IB,IC gain set to 1
spi_write_32(VLEVEL_32, VlevelData, slave_select);           // select frequency as 50Hz
spi_write_32(CONFIG0_32, config_0_data, slave_select);   // If current transformers are used, INTEN and ININTEN in the CONFIG0 register must = 0
spi_write_16(RUN_16, run_data, slave_select);                  //Write 1 to Run register
spi_write_16(EP_CFG_16, ep_cfg_data, slave_select); 
spi_write_16(EGY_TIME_16, egy_time_data, slave_select);

}

void energy_conversion(ENE_Value *temp_value,uint8_t energy_meter_sel)
{


uint32_t egy_rdy_bit = 0;
uint32_t temp_reg_A[2] = {0} ,temp_reg_B[2] = {0} ,temp_reg_C[2] = {0};
spi_read_32(STATUS0_32,&egy_rdy_bit,energy_meter_sel);
if((egy_rdy_bit & 0x1))
{
spi_read_32(AWATTHR_HI_32,&temp_reg_A[1],energy_meter_sel);
spi_read_32(BWATTHR_HI_32,&temp_reg_B[1],energy_meter_sel);
spi_read_32(CWATTHR_HI_32,&temp_reg_C[1],energy_meter_sel);

spi_read_32(AWATTHR_LO_32,&temp_reg_A[0],energy_meter_sel);
spi_read_32(BWATTHR_LO_32,&temp_reg_B[0],energy_meter_sel);
spi_read_32(CWATTHR_LO_32,&temp_reg_C[0],energy_meter_sel);

}
temp_value->Phase_A_energy = ((float)temp_reg_A[1] * ENERGY_CONVERSION_CONSTANT);
temp_value->Phase_B_energy = ((float)temp_reg_B[1] * ENERGY_CONVERSION_CONSTANT);
temp_value->Phase_C_energy = ((float)temp_reg_C[1] * ENERGY_CONVERSION_CONSTANT);

temp_value->energy = temp_value->Phase_A_energy + temp_value->Phase_B_energy + temp_value->Phase_C_energy;
}

Kindly give suggestions.

Regards,

Karthikeyan.S.

    •  Analog Employees 
    on Jul 27, 2020 4:16 PM 4 months ago

    Have you used the calibration document link I sent you in the other post you have. Please use one discussion and don't jump around it will be easier to help.  

  • Hi Dave,

    Thanks for your response,

    I used the calibration document , in that i got a energy conversion constant.But, iam always getting constant energy value from AWATTHR_HI register.

    The following configuration only im done.

    const uint16_t ep_cfg_data = 0x0011; //energy over a defined number of samples(EGY_LD_ACCUM = 1 and EGY_PWR_EN = 1)
    const uint32_t config_0_data = 0x0;
    const uint16_t egy_time_data = 0x0F9F; // for 3999 samples

    i tried to read energy for every 1 sec time period interval based on EGY RDY bit in STATUS0 register,

    void energy_conversion(ENE_Value *temp_value,uint8_t energy_meter_sel)
    {


    uint32_t egy_rdy_bit = 0;
    uint32_t temp_reg_A[2] = {0} ,temp_reg_B[2] = {0} ,temp_reg_C[2] = {0};
    spi_read_32(STATUS0_32,&egy_rdy_bit,energy_meter_sel);
    if((egy_rdy_bit & 0x1))
    {
    spi_read_32(AWATTHR_HI_32,&temp_reg_A[1],energy_meter_sel);
    spi_read_32(BWATTHR_HI_32,&temp_reg_B[1],energy_meter_sel);
    spi_read_32(CWATTHR_HI_32,&temp_reg_C[1],energy_meter_sel);

    spi_read_32(AWATTHR_LO_32,&temp_reg_A[0],energy_meter_sel);
    spi_read_32(BWATTHR_LO_32,&temp_reg_B[0],energy_meter_sel);
    spi_read_32(CWATTHR_LO_32,&temp_reg_C[0],energy_meter_sel);

    }

    but every time im getting constant energy,i expecting every 1 sec energy added into previous energy value,but not happening this, so what i need to do.

    kindly give suggestions,

    Karthikeyan S.

    •  Analog Employees 
    on Jul 29, 2020 2:18 PM 4 months ago in reply to karthiece

    It looks like you are using linecycle accumulation the value will remain until the next update(3999 samples) that will over write the previous. If you read on the egy time flag and accumulate in your micro each reading you will get you accumulated energy over time. You can shutoff accumulation and you will see the register accumulate but eventually it will over flow. 

    const uint16_t ep_cfg_data = 0x0001   will accumulate on samples until you read with 

    const uint16_t ep_cfg_data = 0x0011   will accumulate over time on samples and update every  EGY_TIME

    https://www.analog.com/media/en/technical-documentation/data-sheets/ADE9078.pdf

    pg 43 should be useful

    User Energy Register Use Models There are three main use models for energy accumulation, as follows:

     Read the energy register with reset

     Accumulate energy over a defined number of line cycles

     Accumulate energy over a defined number of samples

  • Hi Dave,

    Thanks for quick response,

      iam using Energy Register Use Model as "Accumulate energy over a defined number of samples", but im not getting a energy at over period of time, getting always constant.

    this is the configuration what iam done already,

    const uint16_t ep_cfg_data = 0x0011; //energy over a defined number of samples(EGY_LD_ACCUM = 1 and EGY_PWR_EN = 1)
    const uint16_t egy_time_data = 0x0F9F; // for 3999 samples

    i have a another doubt also. actually for our project application the energy meter( ADE9078 ) is continuously on for 1 to 2 days, so the energy meter is possible to track the time of entire full day energy and it is possible to that user energy register (AWATTHR_HI) can maintain the entire full day energy or it have any limitations for this much time of energy only it can be store or maintained?

    kindly give suggestions,

    Karthikeyan S.

    •  Analog Employees 
    on Jul 29, 2020 10:58 PM 4 months ago in reply to karthiece

    Accumulate over a defined number of sample will give you the same value over and over if load is the same.

    You are get the accumulated energy over the last second 3999 + 1 samples. The micro needs to read this value and accumulate every egyrdy irq.

      You can only accumulate so much energy in the ADE9078 and it is suggested you read and accumulate in the micro every one sec in case of power outage. You would only lose 1 sec of energy not a full day or 2. 

    Do you have a micro ? Why would you not accumulate in the micro? You can store you accumulation in flash before the power goes out. 

    You can store 200 sec of energy at fullscale power before overflow.  

    Dave