This report will focus on strategies for energy management as well at the building level and at the microgrid level. The designed energy management controller will manage energy flow such that generated power in the microgrid is mainly consumed by local consumers and the power trade between the microgrid and the grid is shrunk to minimum. Buildings’ role is to provide flexibility to the energy management controller so that this controller can use this flexibility to enhance the local use of the local produced energy and by that mean lower the energy bill for each house in the microgrid. The Optimization of building loads are based on electricity price signal and shedding, shifting or rescheduling the power consumption pattern. The main shiftable loads are the HVAC systems. This system will be the primary controllable load for the energy management controller but also curtailable load and non-controllable loads will be taken into account when designing the controller. The flexibility, with respect to the HVAC system, is based on the heat capacity of the house and a thermal tolerance that users give permission for. The wider the thermal tolerance is, the more flexibility will be provided to the energy management controller. Load management strategies will be devised such that thermal comfort and other user-predefined preferences will be satisfied.