battery capacity calculation