An Algorithm for DC Segmentation of AC Power Systems to Mitigate Electromechanical Oscillations