[ns] Problem with an Example (AODV)
Dear NS2 Users السلام عليكم/پہ خیرراغلے/Hello/안녕하세요. I am executing a simple tcl script given below. it contains 3 nodes and using AODV protocol. I cannot see node2 to get any packet. Can somebody help me what is wrong with that? I think node2 is in between node0 and node1, so it should get packets but it is not. It is urgent, i will be thankful if somebody can tell me about that. Regards # A 3-node example for ad-hoc simulation with AODV # Define options set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(ifq) Queue/DropTail/PriQueue ;# interface queue type set val(ll) LL ;# link layer type set val(ant) Antenna/OmniAntenna ;# antenna model set val(ifqlen) 50 ;# max packet in ifq set val(nn) 3 ;# number of mobilenodes set val(rp) AODV ;# routing protocol set val(x) 500 ;# X dimension of topography set val(y) 400 ;# Y dimension of topography set val(stop) 150 ;# time of simulation end set ns [new Simulator] set tracefd [open simple.tr w] set windowVsTime2 [open win.tr w] set namtrace [open simwrls.nam w] $ns trace-all $tracefd $ns namtrace-all-wireless $namtrace $val(x) $val(y) # set up topography object set topo [new Topography] $topo load_flatgrid $val(x) $val(y) create-god $val(nn) # # Create nn mobilenodes [$val(nn)] and attach them to the channel. # # configure the nodes $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -channelType $val(chan) \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace ON for {set i 0} {$i < $val(nn) } { incr i } { set node_($i) [$ns node] } # Provide initial location of mobilenodes $node_(0) set X_ 5.0 $node_(0) set Y_ 5.0 $node_(0) set Z_ 0.0 $node_(1) set X_ 490.0 $node_(1) set Y_ 285.0 $node_(1) set Z_ 0.0 $node_(2) set X_ 150.0 $node_(2) set Y_ 240.0 $node_(2) set Z_ 0.0 # Generation of movements $ns at 10.0 "$node_(0) setdest 250.0 250.0 3.0" $ns at 15.0 "$node_(1) setdest 45.0 285.0 5.0" $ns at 110.0 "$node_(0) setdest 480.0 300.0 5.0" # Set a TCP connection between node_(0) and node_(1) set tcp [new Agent/TCP/Newreno] $tcp set class_ 2 set sink [new Agent/TCPSink] $ns attach-agent $node_(0) $tcp $ns attach-agent $node_(1) $sink $ns connect $tcp $sink set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 10.0 "$ftp start" # Printing the window size proc plotWindow {tcpSource file} { global ns set time 0.01 set now [$ns now] set cwnd [$tcpSource set cwnd_] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file" } $ns at 10.1 "plotWindow $tcp $windowVsTime2" # Define node initial position in nam for {set i 0} {$i < $val(nn)} { incr i } { # 30 defines the node size for nam $ns initial_node_pos $node_($i) 30 } # Telling nodes when the simulation ends for {set i 0} {$i < $val(nn) } { incr i } { $ns at $val(stop) "$node_($i) reset"; } # ending nam and the simulation $ns at $val(stop) "$ns nam-end-wireless $val(stop)" $ns at $val(stop) "stop" $ns at 150.01 "puts \"end simulation\" ; $ns halt" proc stop {} { global ns tracefd namtrace $ns flush-trace close $tracefd close $namtrace } $ns run After running this and looking at the file "simple.tr", i cannot find node2 to get any packet. Regards Rasheed
Re: [ns] Implementing a new protocol in NS2
Hi, I don't mean to discourage you. But I think learning NS2 within its scope is easy. But when you want to go beyond that, you've got a lot of work to do. If you really want to know NS2, here is the step that I would suggest you should learn. 1. Learn how NS2 pass packets from one object to another. The simplest one is from a Node to a SimpleLink. 2. Learn how to bind C++ and OTcl. This is a hard one. It will be easier when you understand the first step. 3. Learn the module you are interested in. Really, it's quite hard if you don't have the basic in NS2, and want to jump start to do your own work. It's like a baby trying to jump before learning how to crawl. 4. Modify, include, and build. This would be the final thing that you need to learn. In fact, this step is quite easy you can actually learn it first. You just have to change a few thing in the make file. If you are interested. Here is a book from springer: T. Issaraiyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2009. http://www.amazon.com/gp/product/0387717595?ie=UTF8&tag=ns2ultteeiss-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=0387717595 You may also find lecture notes and other resource at the following website: http://www.ece.ubc.ca/~teerawat/NS2.htm Best Regards, Teerawat Issariyakul http://www.ns2ultimate.com/ http://www.ece.ubc.ca/~teerawat http://www.t-issariyakul.blogspot.com On 3/6/2010, "The Learner" wrote: > > >Hi all. >I am a newbie in NS2. >I need your help in guiding me as to how should I implement my own protocol >in Wireless sensor networks in NS2. How should I proceed ? >What is it that I need to know priori implementation of new protocol. >I know the scripting in tcl by reading the document - >http://www.isi.edu/nsnam/ns/tutorial/ >but I am not clear with the C code it uses to implement the new protocol in >NS2. > >Kindly guide me with the same asap. > >Thank You. >Regards, >The Learner... >-- >View this message in context: >http://old.nabble.com/Implementing-a-new-protocol-in-NS2-tp27803359p27803359.html >Sent from the ns-users mailing list archive at Nabble.com. >
Re: [ns] Implementing a new protocol in NS2
Sorry I can't attach any files. http://masimum.dif.um.es/nsrt-howto/pdf/nsrt-howto.pdf Le 6 mars 2010 à 14:52, The Learner a écrit : > > > Hi all. > I am a newbie in NS2. > I need your help in guiding me as to how should I implement my own protocol > in Wireless sensor networks in NS2. How should I proceed ? > What is it that I need to know priori implementation of new protocol. > I know the scripting in tcl by reading the document - > http://www.isi.edu/nsnam/ns/tutorial/ > but I am not clear with the C code it uses to implement the new protocol in > NS2. > > Kindly guide me with the same asap. > > Thank You. > Regards, > The Learner... > -- > View this message in context: > http://old.nabble.com/Implementing-a-new-protocol-in-NS2-tp27803359p27803359.html > Sent from the ns-users mailing list archive at Nabble.com. >
Re: [ns] Implementing a new protocol in NS2
Hi, I attached a file that I found a few weeks ago. See you Aurélien Le 6 mars 2010 à 14:52, The Learner a écrit : > > > Hi all. > I am a newbie in NS2. > I need your help in guiding me as to how should I implement my own protocol > in Wireless sensor networks in NS2. How should I proceed ? > What is it that I need to know priori implementation of new protocol. > I know the scripting in tcl by reading the document - > http://www.isi.edu/nsnam/ns/tutorial/ > but I am not clear with the C code it uses to implement the new protocol in > NS2. > > Kindly guide me with the same asap. > > Thank You. > Regards, > The Learner... > -- > View this message in context: > http://old.nabble.com/Implementing-a-new-protocol-in-NS2-tp27803359p27803359.html > Sent from the ns-users mailing list archive at Nabble.com. >
[ns] Implementing a new protocol in NS2
Hi all. I am a newbie in NS2. I need your help in guiding me as to how should I implement my own protocol in Wireless sensor networks in NS2. How should I proceed ? What is it that I need to know priori implementation of new protocol. I know the scripting in tcl by reading the document - http://www.isi.edu/nsnam/ns/tutorial/ but I am not clear with the C code it uses to implement the new protocol in NS2. Kindly guide me with the same asap. Thank You. Regards, The Learner... -- View this message in context: http://old.nabble.com/Implementing-a-new-protocol-in-NS2-tp27803359p27803359.html Sent from the ns-users mailing list archive at Nabble.com.