Title: Stability Analysis, Flexible Control and Optimal Operation of Microgrid