Transient Stability and Cost Analysis of a System with Distributed Generation and Energy Storage Devices