Optimized Two-Level Control of Islanded Microgrids to Reduce Fluctuations