Energy Function Analysis for Power System Stability