Battery capacity calculation for solar power generation and energy storage system