Theoretical framework for integrating distributed energy resources into distribution systems