1 / 16

network simulator 3

network simulator 3. Reporter: Chechieh Lin. Outline. Introduction NS3 vs. NS2 NS-3 Modules Key Abstractions A First ns-3 Script. Introduction. NS-3 is a new simulator, written from scratch Programming languages: C++, Python Manage: Mercurial Compile: Waf

kylene
Download Presentation

network simulator 3

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. network simulator 3 Reporter: Chechieh Lin

  2. Outline • Introduction • NS3 vs. NS2 • NS-3 Modules • Key Abstractions • A First ns-3 Script

  3. Introduction • NS-3 is a new simulator, written from scratch • Programming languages: C++, Python • Manage: Mercurial • Compile: Waf • Project started around mid 2006

  4. waf key concepts • For those familiar with autotools: • configure -> ./waf -d [optimized|debug] configure • make -> ./waf • make test -> ./waf check (run unit tests)‏ • Can run programs through a special wafshell • ./waf --run simple-point-to-point ns-3 tutorial March 2008

  5. NS3 vs. NS2(1)

  6. NS3 vs. NS2(2)

  7. NS-3 Modules

  8. Random Variables • Currently implemented distributions • Uniform: values uniformly distributed in an interval • Constant: value is always the same (not really random) • Exponential: exponential distribution (poisson process) • ... • Example • import pylab • import ns3 • rng = ns3.NormalVariable(10.0, 5.0) • x = [rng.GetValue() for t in range(100000)] • pylab.hist(x, 100) • pylab.show()

  9. Smart Pointers • Reduce bugs caused by the misuse of pointers while retaining efficiency • Memory Leak

  10. Callback •  Allow one piece of code to call a function without any specific inter-module dependency • Example • int (*pfi)(intarg) = 0 • intMyFunction (intarg) {} • pfi = MyFunction • int result = (*pfi) (1234) • int result = pfi (1234)

  11. Tracing • ns-3 provides a simple mechanism for logging and providing some control over output via Log Components • only get the information which from core system required without having to change and recompile the core system.

  12. Packet • Packet objects used vertically in NS-3 to represent: • Units of information sent and received by applications • Information chunks of what will become a real packet • Basic Usage • Create empty packet • Ptr<Packet> packet = Create<Packet> (); • Create packet with 10 ”dummy” bytes • Ptr<Packet> packet = Create<Packet> (10); • Create packet with user data • Ptr<Packet> packet = Create<Packet> (”hello”, 5); • Copy a packet • Ptr<Packet> packet2 = packet1->Copy ()

  13. Simulator • Time is not manipulated directly: the Time class • Time class supports high precision 128 bit time values(nanosecond precision) • Example • Time t1 = Seconds (10); Time t2 = t1 + MilliSeconds (100); std::cout << t2.GetSeconds () << std::endl; // t2 = 10.1 • Time now = Simulator::Now (); • void MyCallback (T1 param1, T2 param2) {...}[...] Simulator::Schedule (Seconds (3), MyCallback, param1, param2);

  14. Key Abstractions • Node • basic computing device abstraction • Application • acquires and uses the resources controlled • run on ns-3 Nodes to drive simulations • Channel • provides methods for managing communication subnetwork objects and connecting nodes • Net Device • provides methods for managing connections to Node and Channel objects • Topology Helpers • combine many distinct operations into an easy to use model for your convenience

  15. The basic model Application Application Application Application Sockets-like API Protocol stack Protocol stack Packet(s)‏ Node Node NetDevice NetDevice NetDevice Channel NetDevice Channel

  16. A First ns-3 Script

More Related