The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...
The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ... The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...
Next you need to add the c++ function command(..) that allows execution of tcl commands through the compiled shadowobject. For example the otcl command start is used to start a filter application as follows $app start. While commandspublish and subscribe are used to start sender and receiver applications respectively. The command function is added,again with the NS_DIFFUSION scope using ifdef statements, as follows:#ifdef NS_DIFFUSIONint LogFilter::command(int argc, const char*const* argv)if (argc == 2)if (strcmp(argv[1], "start") == 0)run();return TCL_OK;return DiffApp::command(argc, argv);#endif // NS_DIFFUSIONNote how the parent class command function is invoked incase the command string is not found. Look into lib/diffapp.* tosee all otcl commands supported for the DiffApp class.Once these changes made to your c++ code, you would also need to write a tcl script (see the section on test-suite for exampletcl scripts) that uses your diffusion application using the right tcl APIs.20.7 Test-suites for diffusionwe start with a simple testcase of 3 nodes with 1 ping source and 1 ping sender. There are other tests for 2 phase-pull(2pp), 1phase-pull(1pp), push and gear (with 2pp and push) scenarios. In future we plan to extend the test-suite for testing differentcomponents/functionalities of directed diffusion. All diffusion3 related test cases can be found under ~ns/tcl/test/test-suitediffusion3.tcl.20.8 Commands at a glanceFollowing is a list of commands used for diffusion related simulation in ns.$ns_ node-config -adhocRouting $opt(adhocRouting)-llType $opt(ll)...-diffusionFilter $opt(filters)-stopTime $(pre-stop)...where,value of opt(adhocRouting) is set to Directed_DiffusionThis command is used to enable directed diffusion in wireless nodes.value of opt(filters) can be a list of filters that is required to be attached to diffusion nThis command allows adding filter objects to diffusion-enabled nodes.199
value of opt(pre-stop) is usually the time simulation stops when all statistical data is dumpThis command allows dumping of statistical data into an output file after running a diffusionset src [new Application/DiffApp/PingSender]This command is used to create ping-sender application.set snk [new Application/DiffApp/PingReceiver]This command is used to create ping-receiver application.set src [new Application/DiffApp/PushSender]This command is used to create push-sender application.set snk [new Application/DiffApp/PushReceiver]This command is used to create push-receiver application.set src [new Application/DiffApp/GearSenderApp]This command is used to create gear-sender application.set snk [new Application/DiffApp/GearReceiverApp]This command is used to create gear-receiver application.$gearApp push-pull-options This command defines the type of routing algorithm gear is using. Incase the second option is defined as region, allfour co-ordinates should be defined. While if point is chosen, only X1 and Y1 maybe defined.$ns_ attach-diffapp $node_ $src_where the diffusion application $src_ gets attached to the given $node_.$src_(0) publishCommand to start a ping source (sender).$snk_(0) subscribeCommand to start a ping sink (receiver).200
- Page 149 and 150: 16.1.2 Creating Node movementsThe m
- Page 151 and 152: set netif $netif_($t)set mac $mac_(
- Page 153 and 154: the hardware address of a packet’
- Page 155 and 156: destined to itself to the port dmux
- Page 157 and 158: switch(ch->ptype()) {case PT_MAC:br
- Page 159 and 160: 16.1.7 Revised format for wireless
- Page 161 and 162: Packet info at "Application level"
- Page 163 and 164: The main problem facing the wired-c
- Page 165 and 166: target_target_encapsulatorreg_agent
- Page 167 and 168: why: This avoids header clashes bet
- Page 169 and 170: This command is used to create a Go
- Page 171 and 172: Chapter 17Satellite Networking in n
- Page 173 and 174: in counter-rotating planes (where t
- Page 175 and 176: • Position/Sat/Geo A geostationar
- Page 177 and 178: $ns add-isl $ltype $node1 $node2 $b
- Page 179 and 180: $satrouteobject_ compute_routeswher
- Page 181 and 182: This will add an error model to the
- Page 183 and 184: lh_firstnameobj‘‘name’’ is
- Page 185 and 186: from routing agentto Node->entrySat
- Page 187 and 188: $satnode add-isl This method c
- Page 189 and 190: set prop [new Propagation/FreeSpace
- Page 191 and 192: 18.3.2 Using shadowing modelBefore
- Page 193 and 194: Chapter 19Energy Model in nsEnergy
- Page 195 and 196: Chapter 20Directed DiffusionThe dir
- Page 197 and 198: However if we have a large and dens
- Page 199: yr application in the ns context. T
- Page 203 and 204: 21.2 Implementation of XCP in NSIn
- Page 205 and 206: the persistent queue length in the
- Page 207 and 208: Thruput2 0.054024 60000residue_pos_
- Page 209 and 210: Chapter 22DelayBox: Per-Flow Delay
- Page 211 and 212: $ns attach-agent $n_sink $sink# mak
- Page 213 and 214: Chapter 23Changes made to the IEEE
- Page 215 and 216: Part IIISupport214
- Page 217 and 218: endenddocument pargvcPrint out argc
- Page 219 and 220: 24.4.2 Memory Conservation TipsSome
- Page 221 and 222: Chapter 25Mathematical SupportThe s
- Page 223 and 224: set run [lindex $argv 0]}if {$run <
- Page 225 and 226: }$sizeRNG next-substream# print the
- Page 227 and 228: protected:RNG* rng_;};Classes deriv
- Page 229 and 230: ns-random is implemented in ~ns/mis
- Page 231 and 232: Chapter 26Trace and Monitoring Supp
- Page 233 and 234: The monitor-queue function is const
- Page 235 and 236: also used to accumulate packet drop
- Page 237 and 238: }name,th->size(),flags,iph->flowid(
- Page 239 and 240: PT_TORA,PT_DSR,PT_AODV,// insert ne
- Page 241 and 242: The QueueMonitor class is not deriv
- Page 243 and 244: $ns_ trace-all This is the command
- Page 245 and 246: Chapter 27Test Suite SupportThe ns
- Page 247 and 248: ... ...}$ns_ at $opt(stop).1 "$self
- Page 249 and 250: Example: To enable debugging in Que
Next you need to add the c++ function comm<strong>and</strong>(..) th<strong>at</strong> allows execution of tcl comm<strong>and</strong>s through the compiled shadowobject. For example the otcl comm<strong>and</strong> start is used to start a filter applic<strong>at</strong>ion as follows $app start. While comm<strong>and</strong>spublish <strong>and</strong> subscribe are used to start sender <strong>and</strong> receiver applic<strong>at</strong>io<strong>ns</strong> respectively. <strong>The</strong> comm<strong>and</strong> function is added,again with the NS_DIFFUSION scope using ifdef st<strong>at</strong>ements, as follows:#ifdef NS_DIFFUSIONint LogFilter::comm<strong>and</strong>(int argc, co<strong>ns</strong>t char*co<strong>ns</strong>t* argv)if (argc == 2)if (strcmp(argv[1], "start") == 0)run();return TCL_OK;return DiffApp::comm<strong>and</strong>(argc, argv);#endif // NS_DIFFUSIONNote how the parent class comm<strong>and</strong> function is invoked incase the comm<strong>and</strong> string is not found. Look into lib/diffapp.* tosee all otcl comm<strong>and</strong>s supported for the DiffApp class.Once these changes made to your c++ code, you would also need to write a tcl script (see the section on test-suite for exampletcl scripts) th<strong>at</strong> uses your diffusion applic<strong>at</strong>ion using the right tcl APIs.20.7 Test-suites for diffusionwe start with a simple testcase of 3 nodes with 1 ping source <strong>and</strong> 1 ping sender. <strong>The</strong>re are other tests for 2 phase-pull(2pp), 1phase-pull(1pp), push <strong>and</strong> gear (with 2pp <strong>and</strong> push) scenarios. In future we plan to extend the test-suite for testing differentcomponents/functionalities of directed diffusion. All diffusion3 rel<strong>at</strong>ed test cases can be found under ~<strong>ns</strong>/tcl/test/test-suitediffusion3.tcl.20.8 Comm<strong>and</strong>s <strong>at</strong> a glanceFollowing is a list of comm<strong>and</strong>s used for diffusion rel<strong>at</strong>ed simul<strong>at</strong>ion in <strong>ns</strong>.$<strong>ns</strong>_ node-config -adhocRouting $opt(adhocRouting)-llType $opt(ll)...-diffusionFilter $opt(filters)-stopTime $(pre-stop)...where,value of opt(adhocRouting) is set to Directed_DiffusionThis comm<strong>and</strong> is used to enable directed diffusion in wireless nodes.value of opt(filters) can be a list of filters th<strong>at</strong> is required to be <strong>at</strong>tached to diffusion nThis comm<strong>and</strong> allows adding filter objects to diffusion-enabled nodes.199