This paper proposes a novel reference signal generation method for the unified power quality conditioner (UPQC) adopted to compensate current and voltage-quality problems of sensitive loads. The UPQC consists of a shunt and series converter having a common dc link. The shunt converter eliminates current harmonics originating from the nonlinear load side and the series converter mitigates voltage sag/swell originating from the supply side. The developed controllers for shunt and series converters are based on an enhanced phase-locked loop and nonlinear adaptive filter. The dc link control strategy is based on the fuzzy-logic controller. A fast sag/swell detection method is also presented. The efficacy of the proposed system is tested through simulation studies using the Power System Computer Aided Design/Electromagnetic Transients dc analysis program. The proposed UPQC achieves superior capability of mitigating the effects of voltage sag/swell and suppressing the load current harmonics under distorted supply conditions.