Added a calculation of average charge for batteries