using a copy of the EMON software in Arduino i wanted to understand better how the calculation works.
pls find at www.editgrid.com/user/kll/EMONsimulation
a online spreadsheet what simulates a voltage and current signal
and does the same calculations as EMON.
pls look and play ( yellow fields INPUT )
for more changes pls get your own (free) account and copy the spreadsheet to your own workspace,
or just download it to your local PC .
Re: EMON Simulation
i found
1. EMON use a digital high pass filter to shift the signal down to a AC without the OFFSET.
if i just subtract 512 instead of that filter calculation,
i get very close to the same results.
2. EMON use a phase shift calibration called "V shifted"
even both signals ( volt and current ) are "measured" by transformers, there can be a different phase error.
also the time difference (0.187 millis?) between the volt and the currentmeasurement adds to this.
but in the simulation i see following effect:
if there is a noise signal ( example 600Hz, 10% amplitude )
and a setting of PHASECAL of 2.3, there is a amplification of the noise to see in the "V shifted" signal!
not if PHASECAL = 1.
so, i think there is a lowpassfilter required between V filtered and V shifted,
and because a lowpassfilter again has a phase error, the same filter must be applied to the currentsignal too.
But if we want to calculate real power by using harmonics, we should not filter them away,
so a different phase shift algorithm is required. May be instead of the recursive approach use just a sample buffer.
if a 50Hz sinus is read by 53 samples, a array buffer of 14 would allow 90deg phase shift back.
( but only in 6.4deg steps / not very analog )