An analytical approach to the design of photovoltaic system