A study of energy management systems and its failure modes in smart grid power distribution