A Diagnostic Approach for Calculation of Threshold Points of a PR Controller for Single-Phase Grid Connected PV System