A microgrid is a system that integrates energy generation, energy storage, and loads and it is able to operate either in interconnected or islanded mode. Energy resources should be scheduled to supply the load properly in order to coordinate optimally the power exchange within the microgrid according to a defined objective function. In this paper, an optimal power scheduling for generation and demand side is presented to manage an islanded hybrid PV-wind-battery microgrid implemented in Shanghai-China. The optimization is addressed through a Mixed-Integer Linear Programming (MILP) mathematical model, wherein the disconnection of the load and not charging the battery when there is surplus of energy are penalized while physical constraints and requirements for a feasible deployment in the real system are considered. The proposed scheduling scheme is tested using a real-time control platform (dSPACE1006) in which a scaled down model of this microgrid is emulated.