Improving microgrid performance by cooperative control of distributed energy sources