  Microgrids are integrated systems that gather and operate energy production
units to satisfy consumers demands. This paper details different mathematical
methods to design the Energy Management System (EMS) of domestic microgrids. We
consider different stocks coupled together - a battery, a domestic hot water
tank - and decentralized energy production with solar panel. The main challenge
of the EMS is to ensure, at least cost, that supply matches demand for all
time, while considering the inherent uncertainties of such systems. We
benchmark two optimization algorithms to manage the EMS, and compare them with
a heuristic. The Model Predictive Control (MPC) is a well known algorithm which
models the future uncertainties with a deterministic forecast. By contrast,
Stochastic Dual Dynamic Programming (SDDP) models the future uncertainties as
probability distributions to compute optimal policies. We present a fair
comparison of these two algorithms to control microgrid. A comprehensive
numerical study shows that i) optimization algorithms achieve significant gains
compared to the heuristic, ii) SDDP outperforms MPC by a few percents, with a
reasonable computational overhead.
