AC Power Theory - Advanced maths

This page covers the mathematics behind calculating real power, apparent power, power factor, RMS voltage and RMS current from instantaneous Voltage and Current measurements of single phase AC electricity. Discreet time equations are detailed since the calculations are carried out in the Arduino in the digital domain. 

For a much nicer arduino code snippet version of this page see: AC Power theory - Arduino maths

Real power

Real power (also known as active power) is defined as the power used by a device to produce useful work.

Mathematically it is the definite integral of voltage, u(t), times current, i(t), as follows:

 

Equation 1. Real Power Definition.

U - Root-Mean-Square (RMS) voltage.

I - Root-Mean-Square (RMS) current.

cos(φ) - Power factor.

The discrete time equivalent is:

 

Equation 2. Real Power Definition in Discrete Time.

u(n) - sampled instance of u(t)

i(n) - sampled instance of i(t)

N - number of samples.

Real power is calculated simply as the average of N voltage-current products. It can be shown that this method is valid for both sinusoidal and distorted waveforms.

RMS Voltage and Current Measurement

An RMS value is defined as the square root of the mean value of the squares of the instantaneous values of a periodically varying quantity, averaged over one complete cycle. The discrete time equation for calculating voltage RMS is as follows:

 

Equation 3. Voltage RMS Calculation in Discrete Time Domain.

Current RMS is calculated using the same equation, only substituting voltage samples, u(n), for current samples, i(n).

Apparent Power and Power Factor

Apparent power is calculated, as follows:

Apparent power = RMS Voltage x RMS current

and the power factor:

Power Factor = Real Power / Apparent Power

This page is based on Atmel's AVR465 appnote page 12-15 which can be found here

umdl's picture

Re: AC Power Theory - Advanced maths

hello there

I am from Nepal and trying to implement this in three phase system. I have some queries.

i> Is arduino capable to sample 6 parameters ( 3 voltage and 3 currents). I just found that 24 samples per cycle (for 50 hz) will be good enough for accuracy( theoritically).

ii> "for (n=0) to (numberOfSamples-1) loop"... How to determine exaxt number of samples in real coding?

iii> In real life voltage doesn't change but what abt current which really swings( from few mA to 10s of ampere)?? Do I need extra circuitry as in AVR465.?

Please help me out.

Thanks,

Umdl 

Terry's picture

Re: AC Power Theory - Advanced maths

Should "Irms = sqrt(sumV / numberOfSamples);" actually be "Irms = sqrt(sumI / numberOfSamples);"? Otherwise as written Vrms and Irms are equal? Most likely this is just a typo, but I wouldn't want someone to rely on the wrong equation.

TrystanLea's picture

Re: AC Power Theory - Advanced maths

 Thanks Terry, yes your quite right, didnt see that, will change it now