21
Part I: NS Part I: NS2 2 Basics Basics Part I: NS Part I: NS2 2 Basics Basics Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008. 1

Simulation of ns2

Embed Size (px)

DESCRIPTION

Simulation of ns2

Citation preview

Page 1: Simulation of ns2

Part I: NSPart I: NS2 2 BasicsBasicsPart I: NSPart I: NS2 2 BasicsBasics

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.1

Page 2: Simulation of ns2

Simulation of Computer NetworksSimulation of Computer NetworksSimulation of Computer NetworksSimulation of Computer Networks

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.2

Page 3: Simulation of ns2

Outline• Computer NetworksComputer Networks• Network Simulation

E l• Example• Summaryy

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.3

Page 4: Simulation of ns2

• Computer + NetworkingComputer Networks

Computer + Networking

Networking

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.4

Page 5: Simulation of ns2

Computer Networks• Generally there are so many tasksGenerally, there are so many tasks• Layering Concept: Separate

functionalityfunctionality– OSI Model - TCP/IP Model

SessionPresentationApplication

Application

NetworkTransportSession

NetworkTransport

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.PhysicalData Link

PhysicalData Link

5

Page 6: Simulation of ns2

Outline• Computer NetworksComputer Networks• Network Simulation

E l• Example• Summaryy

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.6

Page 7: Simulation of ns2

A Study of Computer Networks• Suppose you devise a great protocol Suppose you devise a great protocol.

How do you show that it’s great?Study approaches:• Study approaches:– Experiment: Put all routers together

and let people use themand let people use them– Mathematic model: Model routers using

a graph theorya graph theory– Simulation: Use programming (e.g., C++

or NS2) to represent routersTextbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.

or NS2) to represent routers

7

Page 8: Simulation of ns2

A Study of Computer NetworksPros ConsPros Cons

Experiment Realistic Expensive/ E p r m nt a st c E p ns / Sometime not possible

M th ti I i ht N d t k Mathematic Model

Insight Need to make assumptions

Si l ti E (Ch ) N t h i i ht Simulation •Easy (Cheap)•Used for verification

Not much insight, sometimes need to make

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.

assumption

8

Page 9: Simulation of ns2

Simulation: Overview• Platform: Hardware Software or HybridPlatform: Hardware, Software, or Hybrid

• Developer: Commercial or In-house• Developer: Commercial or In-house

• Source code: Open or close• Source code: Open or close

P di m: Tim d p nd nt/n n tim• Paradigm: Time-dependent/non-time-dependent; Time-driven/Event-driven

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.9

Page 10: Simulation of ns2

Simulation: Overview• Dimension of simulation performanceDimension of simulation performance

– Execution speed– Scalability

Fid lit– Fidelity– Cost

• Physical Layer: y y– Simulate channel models, BER, PER, etc.– Matlab, LabView, ADS, SPD

• Network Layer• Network Layer– Free: NS2, GloMoSim– Commercial: Opnet, QualNet

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.10

Page 11: Simulation of ns2

Time-Dependent Simulation• Most commonly-usedMost commonly-used• Simulation proceeds chronologically.

T i • Two main types:1. Time-Driven Simulation2. Event-Driven Simulation

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.11

Page 12: Simulation of ns2

Time-Driven Simulation• Observe the system at a fixed interval.Observe the system at a fixed interval.• Event occurs within an interval is assumed to

occur at the end of the interval• Suppose an interval = seconds. Then the

simulation proceeds as follows:

– a,b,c,d are events– a is assume to occurred at t= 2– b,c are assume to occurred at t=( 5 )

• The simulation finishes at a pre specified timeTextbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.

• The simulation finishes at a pre-specified time.

12

Page 13: Simulation of ns2

Event-Driven Simulation• Observe every event.

• Each event provide a reference to the next event (e.g., using pointer)

Next_eventa

Next_eventb

Next_eventc

• Simulation finishes– At a pre-specified time

Wh th i t

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.

– When there is no more event

13

Page 14: Simulation of ns2

Outline• Computer NetworksComputer Networks• Network Simulation

E l• Example• Summaryy

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.14

Page 15: Simulation of ns2

Example: Queuing System

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.15

Page 16: Simulation of ns2

Example: Queuing System

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.16

Page 17: Simulation of ns2

Example: Queuing System

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.17

Page 18: Simulation of ns2

Example: Queuing System

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.18

Page 19: Simulation of ns2

Outline• Computer NetworksComputer Networks• Network Simulation

E l• Example• Summaryy

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.19

Page 20: Simulation of ns2

Summary• Computer Networks = Computer + Computer Networks = Computer +

Networking• A Study of Computer NetworksA Study of Computer Networks

– Experimental– Mathematical Model– Simulation

• Time-Dependent Simulation– Time-Driven Simulation– Event-Driven Simulation

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.

• Example: A queuing system20

Page 21: Simulation of ns2

Additional Reading• W T Kasch J R Ward and J W. T. Kasch, J. R. Ward, and J.

Andrusenko, “Wireless Network Modeling and Simulation Tools for Designers and gDevelopers,” IEEE Communication Magazine, vol. 47, no. 3, pp. 120-127, Mar. 2009 2009,

Textbook: T. Issariyakul and E. Hossain, Introduction to Network Simulator NS2, Springer 2008.21