Energy conscious online architecture adaptation for varying latency constraints in sensor network applications