This document presents a novel control strategy for improving power quality in large-scale grid-connected photovoltaic (PV) systems using MATLAB/Simulink. The strategy prioritizes active power generation while ensuring reactive power compensation and active filtering, optimizing the inverter's performance within its power capacity limits. Simulation results demonstrate the effectiveness of this approach in enhancing power quality and system stability.