Transient security enhancement of power systems using pattern recognition