Battery quantity calculation