A Reactive Power Controller to Optimize Performance of Dynamic Reactive Power Compensation Devices