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.

Voltage and Current RMS scale factor in energy library

Other Parts Discussed in Thread: MSP430AFE253

Hello,

We are using Energy library version 2 to measure power consumption of AC devices. We are using MSP430AFE253 to measure power consumption. CCS version 5.1 is used to compile energy library and successfully compiled also.

Now problem is that we got wrong values of Vrms, Irms and so Active power also. My question is related to constant scale factor, VOLTAGE_RMS_SCALE_FACTOR and CURRENT_RMS_SCALE_FACTOR. Are these values depends on our firmware and Hardware? Is there anyone that explain how to calculate these Scale factors?

Any help in this case is appreciated.

Thanks,

Nipam

  • Hello,

    Is there any update of above post?

    Please help us on understanding of Emeter Scale Factors.

    Thanks,

    Nipam

  • I was doing this for my own project using the F67791 EVM. Here is what I have found out about Voltage Scaling Factors....

    int32_t voltage(struct phase_parms_s *phase, struct phase_nv_parms_s const *phase_nv) { int16_t i; int32_t x; /* Calculate the RMS voltage in 10mV increments. Return -1 for overrange (i.e. ADC clip). */ if ((phase->status & V_OVERRANGE)) return -1; x = div_sh48(phase->metrology.dot_prod_logged.V_sq, 26 - 2*ADC_BITS, phase->metrology.dot_prod_logged.sample_count); //ADC_BITS for our application is 16. /* Now this function div_sh48 takes three arguments. First is V_sq. It is 48 bit number stored in an 3 member array of 16 bit each. As I was debugging I found that it's value was 10238, 19060,238. Now the binary representation of these numbers is 0010011111111110 //10238 0100101001110100 //19060 0000000011101110 //238 Now we need to make the 48 bit number out of these. The most significant 16 bits are 238. So the final number will be 000000001110111001001010011101000010011111111110 In Decimal it is 1023451342846 Now I have found that the function div_sh48(48bit number, Shift No of bits, Divide) will first shift and then divide. So I shifted the number by -6 (i.e Shift Right) -6 is basically 26-2*16 = -6 Shift Right by 6 and the answer is 15991427231 Now the sample_count for this particular samplpe was 4137 So Divide 15991427231 by 4137 the answer is 3865464. Square Root of this number is Square Root 1966.0783 Now the isqrt32 function returns the number as 0xZZZZYYYY where ZZZZ is hex of 1966 and YYYY is hex of 0783 So the answer would be 07AE030F. Now x>>12 will truncate the last three and we will get 0x7AE0 i.e 31456 in decimal. Now we multiply this with the scaling factor i.e 12300 31456 x 12344 = 388292864 Now when we shift right by 14 this number we get Shift Right By 14 = 23699 which is 236.99V Next step is to find the relationship between scaling factor and Vrequired and Vobserved. So I tested using different scaling factors and the result is If scaling factor is 10,000 then Vrms=191.99v If scaling factor is 11,000 then Vrms=211.19v If scaling factor is 12,000 then Vrms=230.39v If scaling factor is 13,000 then Vrms=249.58v So I noted that Vrms/scaling_factor is a constant. So I concluded that the formula for scaling factor can be deducted by If Voltage calculated by meter is 236.99 then scaling factor is 12300 If voltage is 1 then scaling factor = 12300/236.99 If voltage is Vreq then scaling factor is 123000 * Vreq/VObs As an example lets say I have supplied 230V to the meter but it is showing 236.99V and the scaling factor is 12300 then New_scaling_factor = old_scaling_factor * Vreq/VObs i.e 12300 * 230/236.99 = 11937. Now to confirm this we put this scaling factor in the calculation x = (x >> 12)*i; x >>= 14; return x; x is 31456 and now i is 11937 31456 * 11937 = 375490272 Now >>14 of this number is 22918 */ i = phase_nv->V_rms_scale_factor; x = isqrt32(x); x = (x >> 12)*i; x >>= 14; return x; /*----------------------------------------------*/ // This is where scaling of voltage is done. It reads //the current voltage /*----------------------------------------------*/ }

  • Hello Imran,

    Thanks for your kind response.

    It works fine. Thank you for giving explanation.

    One more question is does it work for Current RMS scale factor and Power Scale Factor?

    Thanks,

    Nipam

  • I want to ask if you can calibrate your board using calibrator.exe found at the folder of Energy Library. I could not yet, although there is a green comm button
  • If the button is green then this means the communication is established... Just click on that button and another form appears with live data from the meter... Here you can find the Manual calibration button (which will open another form)....

  • Well..not always...I click the Manual Calibration button..put the error percentanges..and only Fund Volt changes for a few secs.
    Have you managed to calibrate yours successfully the manual way?Me not
    Please have a look here and help me if you can .

    https://e2e.ti.com/support/microcontrollers/msp430/f/166/t/394677

**Attention** This is a public forum