Beruflich Dokumente
Kultur Dokumente
Mihal Brumbulli
Agenda
ns-3
Overview
Features
Modules
Simulation Model
Alarming Protocol
Simulation Model
Implementation
Simulation Results
2
What is ns-3?
ns-3 is a discrete-event network simulator for
Internet systems
ns-3 allows researchers to study Internet protocols and
large-scale systems
ns-3 is a new simulator (not backwards-compatible with
ns-2)
ns-3 is a free, open source software project
organized around research community
development and maintenance
the target user community is networking researchers
and educators
3
Why ns-3?
4
ns-3 Project Goal
Develop a preferred, open simulation environment
for networking research
a tool aligned with the simulation needs of modern
networking research
an open-source project that encourages community
contribution, peer review, and validation of the software
5
ns-3 Timeline and Roadmap
ns-3.1: June 2008: ns-3.2: Sept. 2008: ns-3.3: Dec. 2008: ns-3.4: Apr 2009: ns-3.5: July 2009: ns-3.6: Oct 2009:
ns-3 first stable release - Python bindings - emulation - Tap Device - 802.11e MAC EDCA - Minstrel rate control
- simulator core - real-time scheduler - initial IPv6 support - Object names - 802.11n A-MSDU - WiFi Athstats and
- TCP/IPv4 - 802.1D learning - ICMP support - new Wifi models frame aggregation 5/10MHz channels
- point-to-point, CSMA, bridge - calendar queue - 802.11b PHY - IPv6 radvd, ICMP
WiFi device models - Network Simulation scheduler - Nakagami loss - 802.11s mesh
- mobility models Cradle (nsc) - allinone build - Gamma, Erlang, - Nix-vector routing
- statistics framework system Zipf random variables - Flow Monitor
6
Agenda
ns-3
Overview
Features
Modules
Simulation Model
Alarming Protocol
Simulation Model
Implementation
Simulation Results
7
Requirements
ns-3 responds to trends in how Internet research is
being conducted
extensible software core
attention to realism
software integration
support for virtualization and testbeds
flexible tracing and statistics
attribute system
new models
8
Extensible Software Core
Written in C++ with optional Python interface
extensively documented API (doxygen):
9
Attention to Realism
Problem: Research often involves a mix of
simulations and testbed or live experiments
If the simulator cannot be made to closely model a
real system:
hard to compare results or validate the model
hard to reuse software between the two domains
ns-3 solution:
model nodes more like a real computer
support key interfaces such as sockets API and
IP/device driver interface (in Linux)
reuse of kernel and application code
10
Attention to Realism (example)
An ns-3 Node is a husk of a computer to which
applications, stacks, and NICs are added
Application
Application
Application
11
Software Integration
Problem: why reimplement models and tools for
which open-source implementations abound?
ns-3 solution:
ns-3 conforms to standard input/output formats so
that other tools can be reused.
e.g., pcap trace output, ns-2 mobility scripts
ns-3 is adding support for running
implementation code
Network Simulation Cradle
ns-3 “process” API
12
Virtualization and Testbeds
Problem: need better support for the researcher
moving between simulation and testbeds or live
systems
ns-3 solution: Developing two modes of
integration with real systems:
virtual machines run on top of ns-3 devices and
channels
ns-3 stacks run in emulation mode and
emit/consume packets over real devices
13
Emulation
real machine
ns-3 ns-3
Testbed
Trace source
17
ns-3 Attribute System
Problem: Researchers want to know all of the values in
effect in their simulations
and configure them easily
ns-3 solution: Each ns-3 object has a set of attributes:
A name, help text
A type
An initial value
Control all simulation parameters for static objects
Dump and read them all in configuration files
Visualize them in a GUI
Makes it easy to verify the parameters of a simulation
18
ns-3 Models
19
Summary of ns-3 Features
Modular, documented core
C++ programs or (optionally) Python scripting
Alignment with real systems (sockets, device
driver interfaces)
Emphasis on software integration
Virtualization and testbed integration are a
priority (emulation modes)
Well-documented attribute system
Updated models
20
Agenda
ns-3
Overview
Features
Modules
Simulation Model
Alarming Protocol
Simulation Model
Implementation
Simulation Results
21
ns-3 Modules
22
Modules Documentation
23
Agenda
ns-3
Overview
Features
Modules
Simulation Model
Alarming Protocol
Simulation Model
Implementation
Simulation Results
24
ns-3 Basic Simulation Model
25
Example (first.cc)
NodeContainer nodes;
nodes.Create (2);
PointToPointHelper pointToPoint;
pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));
pointToPoint.SetChannelAttribute ("Delay", StringValue ("2ms"));
NetDeviceContainer devices;
devices = pointToPoint.Install (nodes);
InternetStackHelper stack;
stack.Install (nodes);
Ipv4AddressHelper address;
address.SetBase ("10.1.1.0", "255.255.255.0");
Ipv4InterfaceContainer interfaces = address.Assign (devices);
ApplicationContainer serverApps = echoServer.Install (nodes.Get (1));
serverApps.Start (Seconds (1.0));
serverApps.Stop (Seconds (10.0));
UdpEchoClientHelper echoClient (interfaces.GetAddress (1), 9);
echoClient.SetAttribute ("MaxPackets", UintegerValue (1));
echoClient.SetAttribute ("Interval", TimeValue (Seconds (1.)));
echoClient.SetAttribute ("PacketSize", UintegerValue (1024));
ApplicationContainer clientApps = echoClient.Install (nodes.Get (0));
clientApps.Start (Seconds (2.0));
clientApps.Stop (Seconds (10.0));
26
Agenda
ns-3
Overview
Features
Modules
Simulation Model
Alarming Protocol
Simulation Model
Implementation
Simulation Results
27
ns-3 Simulation Model for AP
TCP TCP
OLSR OLSR
802.11b 802.11b
28
Agenda
ns-3
Overview
Features
Modules
Simulation Model
Alarming Protocol
Simulation Model
Implementation
Simulation Results
29
The SOSEWIN Module
Helper
(SignalAnalyzingEntity, SensingEntity, LeadingEntity, GatewayEntity, TransportEntitySender,
TransportEntityReceiver, XmlWriter)
Node Mobility
Common Simulator
Core
(GeoVector)
30
ns3::SosewinLossModel
Base loss model:
ns3::FixedRssLossModel
ns3::FriisPropagationLossModel
ns3::JakesPropagationLossModel
ns3::LogDistancePropagationLossModel
ns3::NakagamiPropagationLossModel
ns3::RandomPropagationLossModel
ns3::ThreeLogDistancePropagationLossModel
31
ns3::SosewinHeader
32
ns3::SosewinAP
SAE SE LE GE
= ns3::Application
= ns3::UdpSocket
= ns3::TcpSocket
= Trace Source
= Trace Sink
33
Implementation Details
Each process (entity) modeled as a
ns3::Application
State Design Pattern used
Send/Receive functions
Timer specific functions:
TimerStart
TimerStop
TimerExpire
Trace sources for logging:
StateChange
TimerStart, TimerStop, TimerExpire
Tx, Rx
34 …
Implementation Details (cont.)
SDL-RT ns-3
void
le_groupIdle::On_t_Idle (Ptr<LeadingEntity> le) const
{
le->LECount = 0;
le->TimerStart (le->t_Idle);
while (le->LECount < le->LNs.size ())
{
le->Send (SosewinHeader::LN_LN_IDLE, le->LNs[le->LECount]);
le->LECount++;
}
}
35
Agenda
ns-3
Overview
Features
Modules
Simulation Model
Alarming Protocol
Simulation Model
Implementation
Simulation Results
36
General Structure
System initialization:
LNsInNetwork
GNsInNetwork
StartLN
System idle
37
Difference Reaction Diagram
Simulation VS Real World
Difference Reaction Time Diagram for 10 Experiments (ns-3 simulation) Difference Reaction Time Diagram for 10 Experiments
Experiment ID Experiment ID
2
3
9
15
15
15
15
15
15
14
14
14
14
14
14
14
14
14
14
14
14
14
14
4500 4500
4000 4000
3500 3500
3000 3000
2500 2500
2000 2000
1500 1500
1000 1000
500 500
0 0
5 10 15 20 5 10 15 20
Distance from epicentre (km) Distance from epicentre (km)
relatively last P-wave detection relatively first system alarm relatively last P-wave detection relatively first system alarm
relatively first group alarm relatively first S-wave detection relatively first group alarm relatively first S-wave detection
38
Distance Reaction Diagram
Simulation VS Real World
Distance Reaction Time Diagram for 10 Experiments (ns-3 simulation) Distance Reaction Time Diagram for 10 Experiments
Experiment ID Experiment ID
2
3
9
15
15
15
15
15
15
14
14
14
14
14
14
14
14
14
14
14
14
14
14
10000 10000
8000 8000
7000 7000
6000 6000
5000 5000
4000 4000
3000 3000
5 10 15 20 5 10 15 20
Distance from epicentre (km) Distance from epicentre (km)
first P-wave detection first group alarm first S-wave detection first P-wave detection first group alarm first S-wave detection
last P-wave detection first system alarm last P-wave detection first system alarm
39
Summary
Simulation VS Real World
Difference in System Alarm Time: Real World - ns3 Simulation
Experiment ID
2
3
15
15
15
14
14
14
14
14
14
14
1200
1000
Difference (ms)
800
600
400
200
0
5 10 15 20
Distance from epicentre (km)
|rw - ns3|
40
Useful Links (ns-3)
Web site:
http://www.nsnam.org
Documents (tutorial, manual, api doc, etc.)
http://www.nsnam.org/documents.html
ns-3 users:
http://groups.google.com/group/ns-3-users
Code server:
http://code.nsnam.org
Wiki:
http://www.nsnam.org/wiki/index.php/Main_Page
41