Correct calculation of power and energy