Declaration:
void EnergyCalculation (volatile unsigned long *energy, unsigned long *energyrem, unsigned long power, unsigned long coef);
Parameters:
energy - pointer to the active/reactive, import/export energy with resolutionn 0.1 Wh or 0.1 VARh, i.e. 1000=100.0 Wh/VARh.
energyrem - pointer to the energy remainder (decimal point of the energy)
power - instantaneous power (active or reactive)
coef - 'hour' coefficient = line frequency*3600, with mHz frequency resolution, i.e. 50000=50.000Hz
Description: The function upgrades both the energy and energy remainder values (addressed by respective pointers) by a new values. This function should be called after the 'PowerCalculation' processing in the user code.
Note: I will add the function description into the AN4255 soon. Currently I am preparing a new FFT metering library (METERLIBFFT 2.3.1) with different API and with different functions name (unified with the 'Filter-based' metering library).