Resilience of the power grid is most challenged at power blackouts since the issues that led to it may not be fully resolved by the time the power is back. In this paper, a Real-Time Energy Management Algorithm (RTEMA) has been developed to increase the resilience of power systems based on the controlled delivery grid (CDG) concept. In a CDG, loads communicate with a central controller, periodically sending requests for power. The central controller runs an algorithm, based on which it may decide whether to grant the requested energy fully or partially. Therefore, the CDG limits loads discretionary access to electric energy until all problems are resolved. The developed algorithm aims at granting most or all of the requested loads, while maintaining the health of the power system (i.e. the voltage at each bus, and the line loading are within acceptable limits), and minimizing the overall losses. An IEEE 30-bus standard Test Case, encountering a blackout condition, with high penetration of microgrids, has been used to test the developed algorithm. Results proved that the developed algorithm with the CDG have the potential to substantially increase the resilience of power systems.