battery capacity calculation formula