Optimum Integration of Solar Energy With Battery Energy Storage Systems