The distribution system operator as flexibility manager of distributed energy resources