A New Algorithm for Optimal Parameters & Safety Operation of Power Systems under Normal and Contingency Condition