1 / 36

Introduction to Network Simulator 2 (NS-2)

Introduction to Network Simulator 2 (NS-2). Outline. Random Walk Mobility Model Random Waypoint Mobility Model Network Simulator Mobile Networking in ns Simulation Scenario Home Work 2. Random Walk Mobility Model.

gerd
Download Presentation

Introduction to Network Simulator 2 (NS-2)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Network Simulator 2 (NS-2)

  2. Outline • Random Walk Mobility Model • Random Waypoint Mobility Model • Network Simulator • Mobile Networking in ns • Simulation Scenario • Home Work 2 Sharif university of Technology

  3. Random Walk Mobility Model • Since many entities in nature move in extremely unpredictable ways, the Random Walk Mobility Model was developed to mimic this erratic movement • In this mobility model, an MN moves from its current location to a new location by randomly choosing a direction and speed in which to travel • The new speed and direction are both chosen from pre-defined ranges, [speedmin; speedmax] and [0;2p] respectively Sharif university of Technology

  4. Random Walk Mobility Model • Each movement in the Random Walk Mobility Model occurs in either a constant time interval t or a constant distance traveled d, at the end of which a new direction and speed are calculated • If an MN which moves according to this model reaches a simulation boundary, it “bounces” off the simulation border with an angle determined by the incoming direction • The MN then continues along this new path Sharif university of Technology

  5. Outline • Random Walk Mobility Model • Random Waypoint Mobility Model • Network Simulator • Mobile Networking in ns • Simulation Scenario • Home Work 2 Sharif university of Technology

  6. Random Waypoint Mobility Model (RWPM) • The Random Waypoint Mobility Model includes pause times between changes in direction and/or speed • An MN begins by staying in one location for a certain period of time (i.e., a pause time) • Once this time expires, the MN chooses a random destination in the simulation area and a speed that is uniformly distributed between [minspeed, maxspeed] Sharif university of Technology

  7. Random Waypoint Mobility Model (RWPM) • The MN then travels toward the newly chosen destination at the selected speed • Upon arrival, the MN pauses for a specified time period before starting the process again • We note that the movement pattern of an MN using the Random Waypoint Mobility Model is similar to the Random Walk Mobility Model if pause time is zero and [minspeed, maxspeed] = [speedmin, speedmax] Sharif university of Technology

  8. Outline • Random Walk Mobility Model • Random Waypoint Mobility Model • Network Simulator • Mobile Networking in ns • Simulation Scenario • Home Work 2 Sharif university of Technology

  9. Network Simulator (NS) • ns is an object oriented simulator, written in C++, with an OTcl interpreter as a frontend • The simulator supports a class hierarchy in C++ (also called the compiled hierarchy in this document), and a similar class hierarchy within the OTcl interpreter (also called the interpreted hierarchy in this document) • The two hierarchies are closely related to each other; from the user’s perspective, there is a one-to-one correspondence between a class in the interpreted hierarchy and one in the compiled hierarchy • The root of this hierarchy is the class TclObject Sharif university of Technology

  10. Network Simulator (NS) • Users create new simulator objects through the interpreter; these objects are instantiated within the interpreter, and are closely mirrored by a corresponding object in the compiled hierarchy • The interpreted class hierarchy is automatically established through methods defined in the class TclClass • user instantiated objects are mirrored through methods defined in the class TclObject Sharif university of Technology

  11. Why two languages? • ns uses two languages because simulator has two different kinds of things it needs to do • On one hand, detailed simulations of protocols requires a systems programming language which can efficiently manipulate bytes, packet headers, and implement algorithms that run over large data sets • For these tasks run-time speed is important and turn-aroundtime (run simulation, find bug, fix bug, recompile, re-run) is less important Sharif university of Technology

  12. Why two languages? • On the other hand, a large part of network research involves slightly varying parameters or configurations, or quickly exploring a number of scenarios • In these cases, iteration time (change the model and re-run) is more important • Since configuration runs once (at the beginning of the simulation), run-time of this part of the task is less important Sharif university of Technology

  13. Why two languages? • ns meets both of these needs with two languages, C++ and OTcl • C++ is fast to run but slower to change, making it suitable for detailed protocol implementation • OTcl runs much slower but can be changed very quickly (and interactively), making it ideal for simulation configuration Sharif university of Technology

  14. Which language for what? • Having two languages raises the question of which language should be used for what purpose • Our basic advice is to use OTcl: • for configuration, setup, and “one-time” stuff • if you can do what you want by manipulating existing C++ objects • and use C++: • if you are doing anything that requires processing each packet of a flow • if you have to change the behavior of an existing C++ class in ways that weren’t anticipated Sharif university of Technology

  15. ImportantNS-2 contents I • 3 OTcl Linkage 9 • II Simulator Basics 27 • 4 The Class Simulator 28 • 4.1 Simulator Initialization . 28 • 4.2 Schedulers and Events . 28 • 4.2.1 The List Scheduler . . . . 29 • 4.2.2 the heap scheduler . . . . 30 • 4.2.3 The Calendar Queue Scheduler . . 30 • 4.2.4 The Real-Time Scheduler 30 • 4.2.5 Precision of the scheduler clock used in ns . 31 • 4.3 Other Methods 31 • 4.4 Commands at a glance . 32 • 5 Nodes and Packet Forwarding 35 • 6 Links: Simple Links 53 • 7 Queue Management and Packet Scheduling 60 • 8 Delays and Links 75 • 9 Differentiated Services Module in ns 77 • 10 Agents 86 • 11 Timers 101 • 12 Packet Headers and Formats 106 • 13 Error Model 116 • 14 Local Area Networks 121 • 14.1 Tcl configuration . . . . 121 • 14.2 Components of a LAN . 122 • 14.3 Channel Class . 123 • 14.3.1 Channel State . . 123 • 14.3.2 Example: Channel and classifier of the physical layer . 123 • 14.3.3 Channel Class in C++ . . 123 • 14.4 MacClassifier Class . . . 124 • 14.5 MAC Class . . 125 • 14.5.1 Mac State . . . . 125 • 14.5.2 Mac Methods . . 125 • 14.5.3 Mac Class in C++ . . . . 125 • 14.5.4 CSMA-based MAC . . . . 126 • 14.6 LL (link-layer) Class . . 127 • 14.6.1 LL Class in C++ 127 • 3 • 14.6.2 Example: Link Layer configuration 127 • 14.7 LanRouterclass. . . . 128 • 14.8 Other Components . . . 128 • 14.9 LANs and ns routing . . 128 • 14.10Commands at a glance . 130 • 15 The (Revised) Addressing Structure in NS 131 • 16 Mobile Networking in ns 134 • 16.1 The basic wireless model in ns . . 134 • 16.1.1 Mobilenode: creating wireless topology . . . 134 • 16.1.2 Creating Node movements 138 • 16.1.3 Network Components in a mobilenode. . . . 139 • 16.1.4 Different MAC layer protocols for mobile networking 142 • 16.1.5 Different types of Routing Agents in mobile networking . . . . 143 • 16.1.6 Trace Support . . 144 • 16.1.7 Revised format for wireless traces . 148 • 16.1.8 Generation of node-movement and traffic-connection for wireless scenarios . . . . 150 • 16.2 Extensions made to CMU’s wireless model 151 • 16.2.1 wired-cum-wireless scenarios . . . 151 • 16.2.2 MobileIP. . . . 152 • 16.3 802.11 MAC protocol . . 155 • 16.4 Lists of changes for merging code developed in older version of ns (2.1b5 or later) into the current version • (2.1b8) . . . . 157 • 16.5 Commands at a glance . 159 • 17 Satellite Networking in ns 161 • 17.1 Overview of satellite models . . . 161 • 17.1.1 Geostationary satellites . . 161 • 17.1.2 Low-earth-orbiting satellites . . . . 162 • 17.2 Using the satellite extensions . . . 164 • 17.2.1 Nodes and node positions 164 • 17.2.2 Satellite links . . 165 • 17.2.3 Handoffs . . . . 167 • 17.2.4 Routing 168 • 17.2.5 Trace support . . 169 • 17.2.6 Error models . . 170 • 17.2.7 Other configuration options . . . . 171 • 17.2.8 nam support . . 171 • 17.2.9 Integration with wired and wireless code . . 171 • 17.2.10 Example scripts . 172 • 17.3 Implementation 172 • 17.3.1 Use of linked lists 173 • 17.3.2 Node structure . 173 • 17.3.3 Detailed look at satellite links . . . 174 • 17.4 Commands at a glance . 176 • 4 • 18 Radio PropagationModels 178 • 19 Energy Model in ns 183 • 20 Directed Diffusion 185 • 21 XCP: eXplicit Congestion control Protocol 192 • 22 DelayBox: Per-Flow Delay and Loss 199 • 23 Changes made to the IEEE 802.15.4 Implementation in NS-2.31 203 • 24 Debugging ns 206 • 25 Mathematical Support 211 • 26 Trace and Monitoring Support 221 • 26.1 Trace Support . 221 • 26.1.1 OTcl Helper Functions . . 222 • 26.2 Library support and examples . . 223 • 26.3 The C++ Trace Class . . 225 • 26.4 Trace File Format . . . . 226 • 26.5 Packet Types . 228 • 26.6 Queue Monitoring . . . . 229 • 26.7 Per-Flow Monitoring . . 231 • 26.7.1 The Flow Monitor . . . . 231 • 26.7.2 Flow Monitor Trace Format . . . . 231 • 26.7.3 The Flow Class . 232 • 26.8 Commands at a glance . 232 • IV Routing 242 • 30 Unicast Routing 243 • 31 Multicast Routing 254 • 32 Network Dynamics 267 • 33 Hierarchical Routing 274 • V Transport 278 • 34 UDP Agents 279 • 35 TCP Agents 281 • 35.1 One-Way TCP Senders . 282 • 35.1.1 The Base TCP Sender (Tahoe TCP) 282 • 35.1.2 Configuration . . 282 • 35.1.3 Simple Configuration . . . 282 • 35.1.4 Other Configuration Parameters . . 283 • 35.1.5 Other One-Way TCP Senders . . . 284 • 35.2 TCP Receivers (sinks) . 285 • 35.2.1 The Base TCP Sink . . . . 285 • 35.2.2 Delayed-ACK TCP Sink . 285 • 35.2.3 Sack TCP Sink . 285 • 35.3 Two-Way TCP Agents (FullTcp) . 286 • 35.3.1 Simple Configuration . . . 286 • 35.3.2 BayFullTcp. . . 287 • 35.4 Architecture and Internals 287 • 35.5 Tracing TCP Dynamics . 289 • 35.6 One-Way Trace TCP Trace Dynamics . . . 289 • 35.7 One-Way Trace TCP Trace Dynamics . . . 289 • 7 • 35.8 Commands at a glance . 290 • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  16. ImportantNS-2 contents II • 5 Nodes and Packet Forwarding 35 • 6 Links: Simple Links 53 • 7 Queue Management and Packet Scheduling 60 • 8 Delays and Links 75 • 9 Differentiated Services Module in ns 77 • 10 Agents 86 • 11 Timers 101 • 12 Packet Headers and Formats 106 • 13 Error Model 116 • 14 Local Area Networks 121 • 14.1 Tcl configuration . . . . 121 • 14.2 Components of a LAN . 122 • 14.3 Channel Class . 123 • 14.3.1 Channel State . . 123 • 14.3.2 Example: Channel and classifier of the physical layer . 123 • 14.3.3 Channel Class in C++ . . 123 • 14.4 MacClassifier Class . . . 124 • 14.5 MAC Class . . 125 • 14.5.1 Mac State . . . . 125 • 14.5.2 Mac Methods . . 125 • 14.5.3 Mac Class in C++ . . . . 125 • 14.5.4 CSMA-based MAC . . . . 126 • 14.6 LL (link-layer) Class . . 127 • 14.6.1 LL Class in C++ 127 • 3 • 14.6.2 Example: Link Layer configuration 127 • 14.7 LanRouterclass. . . . 128 • 14.8 Other Components . . . 128 • 14.9 LANs and ns routing . . 128 • 14.10Commands at a glance . 130 • 15 The (Revised) Addressing Structure in NS 131 • 16 Mobile Networking in ns 134 • 16.1 The basic wireless model in ns . . 134 • 16.1.1 Mobilenode: creating wireless topology . . . 134 • 16.1.2 Creating Node movements 138 • 16.1.3 Network Components in a mobilenode. . . . 139 • 16.1.4 Different MAC layer protocols for mobile networking 142 • 16.1.5 Different types of Routing Agents in mobile networking . . . . 143 • 16.1.6 Trace Support . . 144 • 16.1.7 Revised format for wireless traces . 148 • 16.1.8 Generation of node-movement and traffic-connection for wireless scenarios . . . . 150 • 16.2 Extensions made to CMU’s wireless model 151 • 16.2.1 wired-cum-wireless scenarios . . . 151 • 16.2.2 MobileIP. . . . 152 • 16.3 802.11 MAC protocol . . 155 • 16.4 Lists of changes for merging code developed in older version of ns (2.1b5 or later) into the current version • (2.1b8) . . . . 157 • 16.5 Commands at a glance . 159 • 17 Satellite Networking in ns 161 • 17.1 Overview of satellite models . . . 161 • 17.1.1 Geostationary satellites . . 161 • 17.1.2 Low-earth-orbiting satellites . . . . 162 • 17.2 Using the satellite extensions . . . 164 • 17.2.1 Nodes and node positions 164 • 17.2.2 Satellite links . . 165 • 17.2.3 Handoffs . . . . 167 • 17.2.4 Routing 168 • 17.2.5 Trace support . . 169 • 17.2.6 Error models . . 170 • 17.2.7 Other configuration options . . . . 171 • 17.2.8 nam support . . 171 • 17.2.9 Integration with wired and wireless code . . 171 • 17.2.10 Example scripts . 172 • 17.3 Implementation 172 • 17.3.1 Use of linked lists 173 • 17.3.2 Node structure . 173 • 17.3.3 Detailed look at satellite links . . . 174 • 17.4 Commands at a glance . 176 • 4 • 18 Radio PropagationModels 178 • 19 Energy Model in ns 183 • 20 Directed Diffusion 185 • 21 XCP: eXplicit Congestion control Protocol 192 • 22 DelayBox: Per-Flow Delay and Loss 199 • 23 Changes made to the IEEE 802.15.4 Implementation in NS-2.31 203 • 24 Debugging ns 206 • 25 Mathematical Support 211 • 26 Trace and Monitoring Support 221 • 26.1 Trace Support . 221 • 26.1.1 OTcl Helper Functions . . 222 • 26.2 Library support and examples . . 223 • 26.3 The C++ Trace Class . . 225 • 26.4 Trace File Format . . . . 226 • 26.5 Packet Types . 228 • 26.6 Queue Monitoring . . . . 229 • 26.7 Per-Flow Monitoring . . 231 • 26.7.1 The Flow Monitor . . . . 231 • 26.7.2 Flow Monitor Trace Format . . . . 231 • 26.7.3 The Flow Class . 232 • 26.8 Commands at a glance . 232 • IV Routing 242 • 30 Unicast Routing 243 • 31 Multicast Routing 254 • 32 Network Dynamics 267 • 33 Hierarchical Routing 274 • V Transport 278 • 34 UDP Agents 279 • 35 TCP Agents 281 • 35.1 One-Way TCP Senders . 282 • 35.1.1 The Base TCP Sender (Tahoe TCP) 282 • 35.1.2 Configuration . . 282 • 35.1.3 Simple Configuration . . . 282 • 35.1.4 Other Configuration Parameters . . 283 • 35.1.5 Other One-Way TCP Senders . . . 284 • 35.2 TCP Receivers (sinks) . 285 • 35.2.1 The Base TCP Sink . . . . 285 • 35.2.2 Delayed-ACK TCP Sink . 285 • 35.2.3 Sack TCP Sink . 285 • 35.3 Two-Way TCP Agents (FullTcp) . 286 • 35.3.1 Simple Configuration . . . 286 • 35.3.2 BayFullTcp. . . 287 • 35.4 Architecture and Internals 287 • 35.5 Tracing TCP Dynamics . 289 • 35.6 One-Way Trace TCP Trace Dynamics . . . 289 • 35.7 One-Way Trace TCP Trace Dynamics . . . 289 • 7 • 35.8 Commands at a glance . 290 • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  17. ImportantNS-2 contents III • 14 Local Area Networks 121 • 14.1 Tcl configuration . . . . 121 • 14.2 Components of a LAN . 122 • 14.3 Channel Class . 123 • 14.4 MacClassifier Class . . . 124 • 14.5 MAC Class . . 125 • 14.6 LL (link-layer) Class . . 127 • 14.7 LanRouterclass. . . . 128 • 14.8 Other Components . . . 128 • 14.9 LANs and ns routing . . 128 • 14.10Commands at a glance . 130 • 15 The (Revised) Addressing Structure in NS 131 • 16 Mobile Networking in ns 134 • 16.1 The basic wireless model in ns . . 134 • 16.1.1 Mobilenode: creating wireless topology . . . 134 • 16.1.2 Creating Node movements 138 • 16.1.3 Network Components in a mobilenode. . . . 139 • 16.1.4 Different MAC layer protocols for mobile networking 142 • 16.1.5 Different types of Routing Agents in mobile networking . . . . 143 • 16.1.6 Trace Support . . 144 • 16.1.7 Revised format for wireless traces . 148 • 16.1.8 Generation of node-movement and traffic-connection for wireless scenarios . . . . 150 • 16.2 Extensions made to CMU’s wireless model 151 • 16.2.1 wired-cum-wireless scenarios . . . 151 • 16.2.2 MobileIP. . . . 152 • 16.3 802.11 MAC protocol . . 155 • 16.4 Lists of changes for merging code developed in older version of ns (2.1b5 or later) into the current version • (2.1b8) . . . . 157 • 16.5 Commands at a glance . 159 • 17 Satellite Networking in ns 161 • 17.1 Overview of satellite models . . . 161 • 17.1.1 Geostationary satellites . . 161 • 17.1.2 Low-earth-orbiting satellites . . . . 162 • 17.2 Using the satellite extensions . . . 164 • 17.2.1 Nodes and node positions 164 • 17.2.2 Satellite links . . 165 • 17.2.3 Handoffs . . . . 167 • 17.2.4 Routing 168 • 17.2.5 Trace support . . 169 • 17.2.6 Error models . . 170 • 17.2.7 Other configuration options . . . . 171 • 17.2.8 nam support . . 171 • 17.2.9 Integration with wired and wireless code . . 171 • 17.2.10 Example scripts . 172 • 17.3 Implementation 172 • 17.3.1 Use of linked lists 173 • 17.3.2 Node structure . 173 • 17.3.3 Detailed look at satellite links . . . 174 • 17.4 Commands at a glance . 176 • 4 • 18 Radio PropagationModels 178 • 19 Energy Model in ns 183 • 20 Directed Diffusion 185 • 21 XCP: eXplicit Congestion control Protocol 192 • 22 DelayBox: Per-Flow Delay and Loss 199 • 23 Changes made to the IEEE 802.15.4 Implementation in NS-2.31 203 • 24 Debugging ns 206 • 25 Mathematical Support 211 • 26 Trace and Monitoring Support 221 • 26.1 Trace Support . 221 • 26.1.1 OTcl Helper Functions . . 222 • 26.2 Library support and examples . . 223 • 26.3 The C++ Trace Class . . 225 • 26.4 Trace File Format . . . . 226 • 26.5 Packet Types . 228 • 26.6 Queue Monitoring . . . . 229 • 26.7 Per-Flow Monitoring . . 231 • 26.7.1 The Flow Monitor . . . . 231 • 26.7.2 Flow Monitor Trace Format . . . . 231 • 26.7.3 The Flow Class . 232 • 26.8 Commands at a glance . 232 • IV Routing 242 • 30 Unicast Routing 243 • 31 Multicast Routing 254 • 32 Network Dynamics 267 • 33 Hierarchical Routing 274 • V Transport 278 • 34 UDP Agents 279 • 35 TCP Agents 281 • 35.1 One-Way TCP Senders . 282 • 35.1.1 The Base TCP Sender (Tahoe TCP) 282 • 35.1.2 Configuration . . 282 • 35.1.3 Simple Configuration . . . 282 • 35.1.4 Other Configuration Parameters . . 283 • 35.1.5 Other One-Way TCP Senders . . . 284 • 35.2 TCP Receivers (sinks) . 285 • 35.2.1 The Base TCP Sink . . . . 285 • 35.2.2 Delayed-ACK TCP Sink . 285 • 35.2.3 Sack TCP Sink . 285 • 35.3 Two-Way TCP Agents (FullTcp) . 286 • 35.3.1 Simple Configuration . . . 286 • 35.3.2 BayFullTcp. . . 287 • 35.4 Architecture and Internals 287 • 35.5 Tracing TCP Dynamics . 289 • 35.6 One-Way Trace TCP Trace Dynamics . . . 289 • 35.7 One-Way Trace TCP Trace Dynamics . . . 289 • 7 • 35.8 Commands at a glance . 290 • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  18. ImportantNS-2 contents IV • 15 The (Revised) Addressing Structure in NS 131 • 16 Mobile Networking in ns 134 • 16.1 The basic wireless model in ns . . 134 • 16.1.1 Mobilenode: creating wireless topology . . . 134 • 16.1.2 Creating Node movements 138 • 16.1.3 Network Components in a mobilenode. . . . 139 • 16.1.4 Different MAC layer protocols for mobile networking 142 • 16.1.5 Different types of Routing Agents in mobile networking . . . . 143 • 16.1.6 Trace Support . . 144 • 16.2.2 MobileIP. . . . 152 • 16.3 802.11 MAC protocol . . 155 • 17 Satellite Networking in ns 161 • 17.1 Overview of satellite models . . . 161 • 17.1.1 Geostationary satellites . . 161 • 17.1.2 Low-earth-orbiting satellites . . . . 162 • 17.2 Using the satellite extensions . . . 164 • 17.2.1 Nodes and node positions 164 • 17.2.2 Satellite links . . 165 • 17.2.3 Handoffs . . . . 167 • 17.2.4 Routing 168 • 17.2.5 Trace support . . 169 • 17.2.6 Error models . . 170 • 17.2.7 Other configuration options . . . . 171 • 17.2.8 nam support . . 171 • 17.2.9 Integration with wired and wireless code . . 171 • 17.2.10 Example scripts . 172 • 17.3 Implementation 172 • 17.3.1 Use of linked lists 173 • 17.3.2 Node structure . 173 • 17.3.3 Detailed look at satellite links . . . 174 • 17.4 Commands at a glance . 176 • 4 • 18 Radio PropagationModels 178 • 19 Energy Model in ns 183 • 20 Directed Diffusion 185 • 21 XCP: eXplicit Congestion control Protocol 192 • 22 DelayBox: Per-Flow Delay and Loss 199 • 23 Changes made to the IEEE 802.15.4 Implementation in NS-2.31 203 • 24 Debugging ns 206 • 25 Mathematical Support 211 • 26 Trace and Monitoring Support 221 • 26.1 Trace Support . 221 • 26.1.1 OTcl Helper Functions . . 222 • 26.2 Library support and examples . . 223 • 26.3 The C++ Trace Class . . 225 • 26.4 Trace File Format . . . . 226 • 26.5 Packet Types . 228 • 26.6 Queue Monitoring . . . . 229 • 26.7 Per-Flow Monitoring . . 231 • 26.7.1 The Flow Monitor . . . . 231 • 26.7.2 Flow Monitor Trace Format . . . . 231 • 26.7.3 The Flow Class . 232 • 26.8 Commands at a glance . 232 • IV Routing 242 • 30 Unicast Routing 243 • 31 Multicast Routing 254 • 32 Network Dynamics 267 • 33 Hierarchical Routing 274 • V Transport 278 • 34 UDP Agents 279 • 35 TCP Agents 281 • 35.1 One-Way TCP Senders . 282 • 35.1.1 The Base TCP Sender (Tahoe TCP) 282 • 35.1.2 Configuration . . 282 • 35.1.3 Simple Configuration . . . 282 • 35.1.4 Other Configuration Parameters . . 283 • 35.1.5 Other One-Way TCP Senders . . . 284 • 35.2 TCP Receivers (sinks) . 285 • 35.2.1 The Base TCP Sink . . . . 285 • 35.2.2 Delayed-ACK TCP Sink . 285 • 35.2.3 Sack TCP Sink . 285 • 35.3 Two-Way TCP Agents (FullTcp) . 286 • 35.3.1 Simple Configuration . . . 286 • 35.3.2 BayFullTcp. . . 287 • 35.4 Architecture and Internals 287 • 35.5 Tracing TCP Dynamics . 289 • 35.6 One-Way Trace TCP Trace Dynamics . . . 289 • 35.7 One-Way Trace TCP Trace Dynamics . . . 289 • 7 • 35.8 Commands at a glance . 290 • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  19. ImportantNS-2 contents V • 17 Satellite Networking in ns 161 • 17.1 Overview of satellite models . . . 161 • 17.1.1 Geostationary satellites . . 161 • 17.1.2 Low-earth-orbiting satellites . . . . 162 • 17.2 Using the satellite extensions . . . 164 • 17.2.1 Nodes and node positions 164 • 17.2.2 Satellite links . . 165 • 17.2.3 Handoffs . . . . 167 • 17.2.4 Routing 168 • 17.2.5 Trace support . . 169 • 17.2.6 Error models . . 170 • 18 Radio PropagationModels 178 • 19 Energy Model in ns 183 • 20 Directed Diffusion 185 • 21 XCP: eXplicit Congestion control Protocol 192 • 22 DelayBox: Per-Flow Delay and Loss 199 • 23 Changes made to the IEEE 802.15.4 Implementation in NS-2.31 203 • 24 Debugging ns 206 • 25 Mathematical Support 211 • 26 Trace and Monitoring Support 221 • 26.1 Trace Support . 221 • 26.1.1 OTcl Helper Functions . . 222 • 26.2 Library support and examples . . 223 • 26.3 The C++ Trace Class . . 225 • 26.4 Trace File Format . . . . 226 • 26.5 Packet Types . 228 • 26.6 Queue Monitoring . . . . 229 • 26.7 Per-Flow Monitoring . . 231 • 26.7.1 The Flow Monitor . . . . 231 • 26.7.2 Flow Monitor Trace Format . . . . 231 • 26.7.3 The Flow Class . 232 • 26.8 Commands at a glance . 232 • IV Routing 242 • 30 Unicast Routing 243 • 31 Multicast Routing 254 • 32 Network Dynamics 267 • 33 Hierarchical Routing 274 • V Transport 278 • 34 UDP Agents 279 • 35 TCP Agents 281 • 35.1 One-Way TCP Senders . 282 • 35.1.1 The Base TCP Sender (Tahoe TCP) 282 • 35.1.2 Configuration . . 282 • 35.1.3 Simple Configuration . . . 282 • 35.1.4 Other Configuration Parameters . . 283 • 35.1.5 Other One-Way TCP Senders . . . 284 • 35.2 TCP Receivers (sinks) . 285 • 35.2.1 The Base TCP Sink . . . . 285 • 35.2.2 Delayed-ACK TCP Sink . 285 • 35.2.3 Sack TCP Sink . 285 • 35.3 Two-Way TCP Agents (FullTcp) . 286 • 35.3.1 Simple Configuration . . . 286 • 35.3.2 BayFullTcp. . . 287 • 35.4 Architecture and Internals 287 • 35.5 Tracing TCP Dynamics . 289 • 35.6 One-Way Trace TCP Trace Dynamics . . . 289 • 35.7 One-Way Trace TCP Trace Dynamics . . . 289 • 7 • 35.8 Commands at a glance . 290 • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  20. ImportantNS-2 contents VI • 18 Radio Propagation Models 178 • 19 Energy Model in ns 183 • 20 Directed Diffusion 185 • 21 XCP: eXplicit Congestion control Protocol 192 • 22 DelayBox: Per-Flow Delay and Loss 199 • 23 Changes made to the IEEE 802.15.4 Implementation in NS-2.31 203 • 24 Debugging ns 206 • 25 Mathematical Support 211 • 26 Trace and Monitoring Support 221 • 26.1 Trace Support . 221 • 26.1.1 OTcl Helper Functions . . 222 • 26.2 Library support and examples . . 223 • 26.3 The C++ Trace Class . . 225 • 26.4 Trace File Format . . . . 226 • 26.5 Packet Types . 228 • 26.6 Queue Monitoring . . . . 229 • 26.7 Per-Flow Monitoring . . 231 • 26.7.1 The Flow Monitor . . . . 231 • 26.7.2 Flow Monitor Trace Format . . . . 231 • 26.7.3 The Flow Class . 232 • 26.8 Commands at a glance . 232 • IV Routing 242 • 30 Unicast Routing 243 • 31 Multicast Routing 254 • 32 Network Dynamics 267 • 33 Hierarchical Routing 274 • V Transport 278 • 34 UDP Agents 279 • 35 TCP Agents 281 • 35.1 One-Way TCP Senders . 282 • 35.1.1 The Base TCP Sender (Tahoe TCP) 282 • 35.1.2 Configuration . . 282 • 35.1.3 Simple Configuration . . . 282 • 35.1.4 Other Configuration Parameters . . 283 • 35.1.5 Other One-Way TCP Senders . . . 284 • 35.2 TCP Receivers (sinks) . 285 • 35.2.1 The Base TCP Sink . . . . 285 • 35.2.2 Delayed-ACK TCP Sink . 285 • 35.2.3 Sack TCP Sink . 285 • 35.3 Two-Way TCP Agents (FullTcp) . 286 • 35.3.1 Simple Configuration . . . 286 • 35.3.2 BayFullTcp. . . 287 • 35.4 Architecture and Internals 287 • 35.5 Tracing TCP Dynamics . 289 • 35.6 One-Way Trace TCP Trace Dynamics . . . 289 • 35.7 One-Way Trace TCP Trace Dynamics . . . 289 • 7 • 35.8 Commands at a glance . 290 • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  21. ImportantNS-2 contents VII • 26 Trace and Monitoring Support 221 • 26.1 Trace Support . 221 • 26.1.1 OTcl Helper Functions . . 222 • 26.2 Library support and examples . . 223 • 26.3 The C++ Trace Class . . 225 • 26.4 Trace File Format . . . . 226 • 26.5 Packet Types . 228 • 26.6 Queue Monitoring . . . . 229 • 26.7 Per-Flow Monitoring . . 231 • 26.7.1 The Flow Monitor . . . . 231 • 26.7.2 Flow Monitor Trace Format . . . . 231 • 26.7.3 The Flow Class . 232 • 26.8 Commands at a glance . 232 • IV Routing 242 • 30 Unicast Routing 243 • 31 Multicast Routing 254 • 32 Network Dynamics 267 • 33 Hierarchical Routing 274 • V Transport 278 • 34 UDP Agents 279 • 35 TCP Agents 281 • 35.1 One-Way TCP Senders . 282 • 35.1.1 The Base TCP Sender (Tahoe TCP) 282 • 35.1.2 Configuration . . 282 • 35.1.3 Simple Configuration . . . 282 • 35.1.4 Other Configuration Parameters . . 283 • 35.1.5 Other One-Way TCP Senders . . . 284 • 35.2 TCP Receivers (sinks) . 285 • 35.2.1 The Base TCP Sink . . . . 285 • 35.2.2 Delayed-ACK TCP Sink . 285 • 35.2.3 Sack TCP Sink . 285 • 35.3 Two-Way TCP Agents (FullTcp) . 286 • 35.3.1 Simple Configuration . . . 286 • 35.3.2 BayFullTcp. . . 287 • 35.4 Architecture and Internals 287 • 35.5 Tracing TCP Dynamics . 289 • 35.6 One-Way Trace TCP Trace Dynamics . . . 289 • 35.7 One-Way Trace TCP Trace Dynamics . . . 289 • 7 • 35.8 Commands at a glance . 290 • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  22. ImportantNS-2 contents VIII • IV Routing 242 • 30 Unicast Routing 243 • 31 Multicast Routing 254 • 32 Network Dynamics 267 • 33 Hierarchical Routing 274 • V Transport 278 • 34 UDP Agents 279 • 35 TCP Agents 281 • 35.1 One-Way TCP Senders . 282 • 35.1.1 The Base TCP Sender (Tahoe TCP) 282 • 35.1.2 Configuration . . 282 • 35.2 TCP Receivers (sinks) . 285 • 35.2.1 The Base TCP Sink . . . . 285 • 35.2.2 Delayed-ACK TCP Sink . 285 • 35.2.3 Sack TCP Sink . 285 • 35.3 Two-Way TCP Agents (FullTcp) . 286 • 35.3.1 Simple Configuration . . . 286 • 35.3.2 BayFullTcp. . . 287 • 35.4 Architecture and Internals 287 • 35.5 Tracing TCP Dynamics . 289 • 35.6 One-Way Trace TCP Trace Dynamics . . . 289 • 35.7 One-Way Trace TCP Trace Dynamics . . . 289 • 35.8 Commands at a glance . 290 • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  23. ImportantNS-2 contents IX • 35 TCP Agents 281 • 35.1 One-Way TCP Senders . 282 • 35.1.1 The Base TCP Sender (Tahoe TCP) 282 • 35.1.2 Configuration . . 282 • 35.2 TCP Receivers (sinks) . 285 • 35.2.1 The Base TCP Sink . . . . 285 • 35.2.2 Delayed-ACK TCP Sink . 285 • 35.2.3 Sack TCP Sink . 285 • 35.3 Two-Way TCP Agents (FullTcp) . 286 • 35.3.1 Simple Configuration . . . 286 • 35.3.2 BayFullTcp. . . 287 • 35.4 Architecture and Internals 287 • 35.5 Tracing TCP Dynamics . 289 • 35.6 One-Way Trace TCP Trace Dynamics . . . 289 • 35.7 One-Way Trace TCP Trace Dynamics . . . 289 • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  24. ImportantNS-2 contents X • 36 SCTP Agents 291 • 40 Web cache as an application 334 • 43 Session-level Packet Distribution 365 • 45 Emulation 376 • 45.1 Introduction . . 376 • 45.2 Real-Time Scheduler . . 377 • 45.3 Tap Agents . . 377 • 45.4 Network Objects . . . . 378 • 45.4.1 Pcap/BPF Network Objects . . . . 378 • 45.4.2 IP Network Objects . . . . 379 • 45.4.3 IP/UDP Network Objects . 379 • 45.5 An Example . . 380 • 45.6 Commands at a glance . 381 • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  25. ImportantNS-2 contents XI • IX Visualization with Nam - The Network Animator 382 • 46 Nam 383 • 47 Nam Trace 388

  26. Outline • Random Walk Mobility Model • Random Waypoint Mobility Model • Network Simulator • Mobile Networking in ns • Simulation Scenario • Home Work 2 Sharif university of Technology

  27. Mobile Networking in ns • The functions and procedures described in this subsection can be found in ~ns/mobilenode.{cc,h}, • ~ns/tcl/lib/ns-mobilenode.tcl, ~ns/tcl/mobility/dsdv.tcl, • ~ns/tcl/mobility/dsr.tcl, • ~ns/tcl/mobility/tora.tcl • Example scripts can be found in • ~ns/tcl/ex/wireless-test.tcl and ~ns/tcl/ex/wireless.tcl Sharif university of Technology

  28. Outline • Random Walk Mobility Model • Random Waypoint Mobility Model • Network Simulator • Mobile Networking in ns • Simulation Scenario • Home Work 2 Sharif university of Technology

  29. Simulation Scenario • We start by presenting simple script that run single TCP connection over 3-nodes over an area of size 500m over 400m • The location process is as follow : • The initial locations of nodes 0, 1 and 2 are respectively (5,5), (490,285) and (150,240) • At time 10, node 0 starts moving towards point (250,250) at a speed of 3m/s • At time 15, node 1 starts moving towards point (45,285) at a speed of 5m/s • At time 20, node 0 starts moving towards point (480,300) at a speed of 5m/s • Node 2 is still throughout the simulation • The simulation lasts 150s. At time 10 a TCP connection is initiated between node 0 and node 1 Sharif university of Technology

  30. Writing the TCL script • We begin by specifying some basic parameters for the simulation : • set val(chan) Channel/WirelessChannelset val(prop) Propagation/TwoRayGroundset val(netif) Phy/WirelessPhyset val(mac) Mac/802_11set val(ifq) Queue/DropTail/PriQueueset val(ll) LLset val(ant) Antenna/OmniAntennaset val(ifqlen) 50 ;# max packet in ifqset val(x) 800;# X dimension of the topographyset val(y) 800;# Y dimension of the topographyset val(nn) 30 ;# number of nodes set val(rp) DSDVset val(stop) 150 ;# simulation time • These parameters are used in configuring of the nodes Sharif university of Technology

  31. Configures of a mobile node $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] } Sharif university of Technology

  32. Initial location and movement of nodes • The initial location of node 0 given as follows : • $node_(0) set X_ 5.0 • $node_(0) set Y_ 5.0 • $node_(0) set Z_ 5.0 • A linear movement of a node is generated by specifying the time in which it start, the x and y values of the target point and the speed: $ns at 15.0 “$node_(1) setdest 45.0 285.0 5.0” Sharif university of Technology

  33. Ending the simulation • We need to create the initial node position for nam using For {set $i 0} {$i < $val(nn)} {incr $i} { $ns initial_node_pos $node_($i) 30 } • We tell nodes when the simulation ends with : For {set $i 0} {$i < $val(nn)} {incr $i} { $ns at $val(stop) “node_($i) reset” } Sharif university of Technology

  34. Outline • Random Walk Mobility Model • Random Waypoint Mobility Model • Network Simulator • Mobile Networking in ns • Simulation Scenario • Home Work 2 Sharif university of Technology

  35. Thingsto know • You must look at the mobile node source code and determine which of the mobility models support in it ? • You simulate a scenario and obtain it’s result with mobility model that exist • Then you must change that mobility model to another • You simulate your scenario again with this new mobility model and compare the result of this by previous results • Scenario will be done at 394.127 Sharif university of Technology

  36. Refrence • A collaboration between researchers at UC Berkeley, LBL, USC/ISI, and Xerox PARC, “The NS Manual”, 2005 • Lecture Notes 2003-2004 Univ. de Los andes, Merida, Venezuela, and ESSI, “NS simulator for beginners” • Tracy Camp, Jeff Boleng, Vanessa Davies, “A Survey of Mobility Models for Ad Hoc Network Research” , 2002 Sharif university of Technology

More Related