Modeling the Grid for Decentralized Energy