The operation principle and control strategies of the APF and the DVR are introduced. Digital simulations are employed to validate the feasibility and validity of the harmonics detection method and voltage dip detection method by using MATLAB/SIMULINK.