Algorithm could help detect and reduce power grid faults