Optimal sizing and management of a smart Microgrid for prevailing self-consumption