Realizing the potential of distributed energy resources and peer-to-peer trading through consensus-based coordination and cooperative game theory