130 likes | 230 Views
Network Simulator 2 Source Code Analysis Method. SungKyunKwan-Univ Mobile Computing LAB (http://csn.skku.ac.kr) 안혜환 hyehwan@ece.skku.ac.kr. Contents. The Important Concepts in NS-2 The Very Progressive Source Analysis Tools (ref. WinCam demo) Starting from the Tcl Example
E N D
Network Simulator 2 Source Code Analysis Method SungKyunKwan-Univ Mobile Computing LAB(http://csn.skku.ac.kr) 안혜환hyehwan@ece.skku.ac.kr
Contents • The Important Concepts in NS-2 • The Very Progressive Source Analysis Tools (ref. WinCam demo) • Starting from the Tcl Example • Tracking Member Variances between Otcl and C++ • Tracking from a Start Scheduler • Tracking Packet Processing • There are Three Part of NS Simulation Codes • You Must Have the Point Of View Event and Packet Scheduling Concept • Don’t Forget the Important Concepts in NS-2 • Reference
The Important Concepts in NS-2 • Scheduler is the core of NS-2 • NS-2 Doesn’t Have MAIN() Function like Windows Programming, Please Don’t Find Continuous Procedures. • Always Running a Packet Scheduler • Always Running a Event Scheduler • There are Shadow Objects between Otcl and C++
The Very Progressive Source Analysis Tools (ref. WinCam demo) • Doxygen- It can make the Documents from various source codes or directory • Graphviz- It doesn’t work operations by itself - Added in Doxygen to make Map of source code
Starting from the Tcl Example • Default example tcl source positoin in ns-2. - “ns-allinone-2.xx/ns-2.xx/tcl/ex” • Whatever You make start from the simulation tcl. • The architecture of simulation tcl source code in ns-2 or yours. Set ns [new Simulator] To schedule Event and Packet Node-config Or binding To setup Node configurations and Binding variances Making Topology To make simulation topology $ns at 0.1 “cbr start” To run reserved simulation time $ns run To run all of the simulation elements
Tracking Member Variable between Otcl and C++ • There are shadow objects between Otcl and C++ Object • Shadow object can bind variances between Otcl and C++ • We cannot see shadow objects, just knowing in there. Tcl Object Shadow Object Set node0 [$ns node] Set node1 [$ns node] Set node2 [$ns node] Set node3 [$ns node] Set node4 [$ns node] Tcl Object Shadow Object C++ Object Tcl Object Shadow Object Tcl Object Shadow Object Tcl Object Shadow Object
Tracking from a Start Scheduler OS Scheduler Node 1 Node 2 • There isn’t main function like Windows programming • There aren’t continuous procedures • Just depend on “call scheduler” and “called by scheduler” 7 7 6 6 5 5 NS Scheduler 4 4 3 3 2 2 Call Scheduler Called by Scheduler 1 1
Tracking Packet Processing Just schedule Event and Packet Scheduler Part of the Packet Scheduling Part of the Packet Scheduling 7 7 6 6 5 5 Node 2 Node 1 4 4 3 3 2 2 1 1
There are Three Part of NS Simulation Codes This level conforms that the Object Initiated states Otcl initiate Set ns [new Simulator] Node-config …… set node [$ns node] $ns at 1.0 “cbr start” $ns run C++ initiate Making Topology By using elements Level of Node setup Otcl are changed by processing Level of Running C++ are changed by processing
You Must Have the Point Of View Event and Packet Scheduling Concept Just schedule Event and Packet Scheduler Part of the Packet Scheduling Part of the Packet Scheduling 7 7 Created Events by Ns user like you, Such as “$ns at 0.1 “cbr start” 6 6 5 5 Node 2 Node 1 4 4 3 3 Part of the Event Scheduling 2 2 1 1
Don’t Forget the Important Concepts in NS-2 • Scheduler is the core of NS-2 • NS-2 Doesn’t Have MAIN() Function like Windows Programming, Please Don’t Find Continuous Procedures. • Always Running a Packet Scheduler • Always Running a Event Scheduler • There are Shadow Objects between Otcl and C++
Reference • Ns Manual- http://www.isi.edu/nsnam/ns/ns-documentation.html • Tcl - uist course: http://www.cs.huji.ac.il/~uist • Otcl- http://www.isi.edu/nsnam/otcl/README.html • NS-2 - http://www.isi.edu/nsnam/ns/tutorial/index.html - http://www.isi.edu/nsnam/ns/ • Doxygen- http://www.stack.nl/~dimitri/doxygen/ • Graphviz- http://www.research.att.com/sw/tools/graphviz/