Seol mar théacs é seo: Forecast-Based Energy Management for Optimal Energy Dispatch in a Microgrid