Optimal Control of an Energy-Storage System in a Microgrid for Reducing Wind-Power Fluctuations