A simulation for an Energy Management System