Recently, shunt active power filters (SAPFs) have demonstrated their excellent performance and high efficiency in compensating harmonics and improving the power factor (PF) in power systems, whether LV or MV. The controller of a SAPF determines in real-time the compensation currents and leads the power circuit to inject the compensation currents into the electrical grid at the PCC. As a result, a sinusoidal current waveform on the source side is free of harmonics with a perfect PF equal to 1. In the first part of this chapter, the authors present an in-depth study of SAPFs, including their various topologies and control algorithms. In the second part, they integrate this SAPF into a highly distorted installation powered by a renewable energy-based photovoltaic generator (GPV). Simulation tests using Simulink and Matlab are conducted and discussed to investigate the effectiveness of the entire system in improving power quality and reducing the THD of the source.