Model predictive control for optimum integration of active and passive energy sources