Comprehensive Approach to Modeling and Simulation of PV arrays