Design of resilient processing plants—II Design and control of energy management systems