Predictive Energy Management For Wireless Sensor Nodes