MPC-based Management of Energy Resources in Smart Microgrids