Improving the Safety and Security of Wide-Area Cyber-Physical Systems Through a Resource-Aware