A detailed model for the optimal management of a multigood microgrid. (15th September 2015)