In microgrids, distributed energy resources share information through sensor and communication systems, which are vulnerable to cyber attacks. This article addresses safety and control challenges in microgrid systems, particularly against network attacks like random denial-of-service. It introduces an adaptive gain elastic controller to ensure system stability by disconnecting communication links with excessive delays and restoring connections through optimization. Additionally, the article presents federated learning as a privacy-preserving method that allows microgrids to collaboratively tra...