for your eyes only
Knowledge Hurts – a blog of thoughts, things and stuff.

Simulating Wireless Sensor Networks (or pretty much anything) on NS2

Hi to all students and researchers out there who are left to wonder “how should I do this – how can I simulate something using NS2?”!

I have an answer for you, but you will NOT like it: You will have to implement your simulation.

Simply using what comes along in the ns2 package is not enough. You have to understand and adapt the simulator in order to have good results.  Otherwise you will not be able to understand the simulation results you are getting.

And yes, by implement, I mean program. Yes. In TCL and C…

A quick explanation why I am writing this here: A simulation always derives from reality. It can never achieve 100% accuracy. So you have to know where you cut corners and why. If you don’t know the limitations of the simulation, you will not know why you see certain results. And what do you really want? Good results. Unfortunatelly, You cannot get good results without changing the simulators source code. Even if a certain protocol, standard or technology is already included in NS2, be vigilent! It was implemented for a certain purpose and has probably bugs all over it. Take the simulation of energy consumption  in the IEEE 802.15.4 implementation in NS2 as an example: It is quite basic (certain actions have a certain cost, which is deduced from an initial power level). Does this include battery aging? Does this include standby current? Don’t be too sure that it does. Are those things relevant for your thesis? Probably. Do you have to find a way to include what you consider important into your simulation? I bet you do.

So here are the steps you need to take to perform a simulation that is worth its computing time:

  • Think what you want to simulate in what detail (3 weeks)
  • Look into the source code of the main technology that you are using, find out what it does and look if the things you want are included. (2 weeks)
  • Look into the source over and over again, make yourself drawings, try to understand what happens in a simulation. (3 months)
  • Implement what you additionally need (2 months)
  • Simulate (2 weeks)
  • Verify, think, verify. Debug. (1 month)

Please don’t forget to share your code afterwards using GIThub and if you achieved something, share it with the NS2 mailing list!


9 Responses to “Simulating Wireless Sensor Networks (or pretty much anything) on NS2”

  1. i want ns2 codings to simulate wireless sensor networks

  2. i want ns2 coding to simulate wireless multimedia sensor network(EEQAR)

  3. i want ns2 coding to simulate traffic management in wireless sensor network

  4. Pls I am working on simulating a wireless sensor network that monitors enviromental conditions.pls can somebody post the codings to simulate a WSN

  5. I need to simulate my work. but I am bigginer and I don’t have time. please if someone know and can help. I appreciate for helping

  6. Is it possible to generate message authentication code for wireless sensor nodes using ns2?

  7. i need code for location service in manet send code through my mail

  8. I need some guidance regarding the threshold settings for simulating a wireless sensor network!It is a cross layer concept and the initial phase is to set a threshold,which the author himself specifies is very critical!! I tried many ways to get the idea but in vain.The threshold is set such that when the BS sends the broadcast msg,those nodes with RSSI more that THR-high will become first level CH and then they in turn send CH-msgs,which is received by nodes,whose RSSI is compared with THr-High and if RSSI is more than thr-high,they become group members for first level CH and those nodes with RSSI between thr-high and thr-low will become second level CH.for those receiving CH-msgs below thr-low,the msgs are ignored! Please help with any idea to set these two parameters,as it is the first criteria for simulation!!!!I’m stuck up!!!! please help!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: