The consumed energy is then calculated based on the active power value for each frame, similar to the way the energy pulses are generated in the background process except that:
EACT = PACT × Sample count
For reactive energy, use the 90° phase shift approach for two reasons:
• It allows accurate measurement of the reactive power with very small currents.
• It conforms to international specified measurement method.
Because the frequency of the mains varies, it is important to first measure the mains frequency accurately and then phase shift the voltage samples accordingly. This is discussed in Section 4.3.3.
The phase shift consists of an integer part and a fractional part. The integer part is realized by providing an N samples delay. The fractional part is realized by a fractional delay filter (see Section 4.3.2).