Management of distributed energy resources in energy systems