You can start with Implementation of Rounting Protocols, Distribute Scheduling Algorithms, clock synchronization protocols, and distributed key management for wireless sensor network in NS2.
Take a reaserch paper from any of the above mentioned area and implement that paper in NS2 to confirm the claimed performance by the other.