Optimal system sizing in grid-connected photovoltaic applications