Resilient Data Aggregation and Aggregator Node Election in Sensor Networks