Extending ns2 to include a contention avoidance protocol for wireless sensor networks.