Design of Optimal Energy Management System in a Residential Microgrid Based on Smart Control | Synapse