Resilient Wireless Sensor Networks for Cyber-Physical Systems