A New Adaptive Detection Algorithm For Power Quality Improvement