Introduction to NS-3 - University of...

33
Introduction to NS-3 Konstantinos Katsaros k.katsaros @ surrey.ac.uk Centre for Communications System Research University of Surrey System Level Simulations - Technical Club

Transcript of Introduction to NS-3 - University of...

Page 1: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction to NS-3

Konstantinos Katsaroskkatsaros surreyacuk

Centre for Communications System ResearchUniversity of Surrey

System Level Simulations - Technical Club

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

Outline

1 Introduction

2 NS-3 Modules

3 LTE Module

4 WiFi Example

K Katsaros Introduction to NS-3 040713 2 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Introduction

ns-3 is written in C++ with bindings available for Pythonsimulation programs are C++ executables or Python programssim300000 lines of mostly C++ (estimate based on cloc source codeanalysis)

ns-3 is a GNU GPLv2-licensed projectns-3 is mainly supported for Linux OS X and FreeBSDns-3 is not backwards-compatible with ns-2

K Katsaros Introduction to NS-3 040713 3 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Where to get it

Where do I get ns-3- httpwwwnsnamorgWhere do I get todayrsquos code

Download the latest release- wgethttpwwwnsnamorgreleasesns-allinone-317tarbz2- tar xjf ns-allinone-317tarbz2Clone the latest development code1- hg clone httpcodensnamorgns-3-allinone

1Mercurial is used as source code control toolK Katsaros Introduction to NS-3 040713 4 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Current Modules in main NS-3 tree

Network Node Sockets Queues Packet etcCore Smart Pointers Callbacks Event Scheduler Logging Tracing etc

K Katsaros Introduction to NS-3 040713 5 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Module Organization

model larr contains source code for main part of modulehelper larr contains code for helper classesexamplestestsbindings larr files related to pythondocwscript larr the ldquoMakefile equivalent

K Katsaros Introduction to NS-3 040713 6 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Helper API

The ns-3 ldquohelper API provides a set of classes and methods thatmake common operations easier than using the low-level APIConsists of- container objects- helper classesThe helper API is implemented using the low-level APIUsers are encouraged to contribute or propose improvements to thens-3 helper API

K Katsaros Introduction to NS-3 040713 7 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Building NS-3

Waf is a Python-based framework for configuring compiling andinstalling applications

It is a replacement for other tools such as Autotools CMake or Anthttpcodegooglecompwaf

For those familiar with autotoolsconfigure rarr waf configuremake rarrwaf build

K Katsaros Introduction to NS-3 040713 8 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Discrete-event simulations

Simulation time moves in discrete jumps from event to eventC++ functions schedule events to occur at specific simulation timesA simulation scheduler orders the event executionSimulatorRun() gets it all startedSimulation stops at specific time or when events end

K Katsaros Introduction to NS-3 040713 9 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 2: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

Outline

1 Introduction

2 NS-3 Modules

3 LTE Module

4 WiFi Example

K Katsaros Introduction to NS-3 040713 2 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Introduction

ns-3 is written in C++ with bindings available for Pythonsimulation programs are C++ executables or Python programssim300000 lines of mostly C++ (estimate based on cloc source codeanalysis)

ns-3 is a GNU GPLv2-licensed projectns-3 is mainly supported for Linux OS X and FreeBSDns-3 is not backwards-compatible with ns-2

K Katsaros Introduction to NS-3 040713 3 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Where to get it

Where do I get ns-3- httpwwwnsnamorgWhere do I get todayrsquos code

Download the latest release- wgethttpwwwnsnamorgreleasesns-allinone-317tarbz2- tar xjf ns-allinone-317tarbz2Clone the latest development code1- hg clone httpcodensnamorgns-3-allinone

1Mercurial is used as source code control toolK Katsaros Introduction to NS-3 040713 4 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Current Modules in main NS-3 tree

Network Node Sockets Queues Packet etcCore Smart Pointers Callbacks Event Scheduler Logging Tracing etc

K Katsaros Introduction to NS-3 040713 5 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Module Organization

model larr contains source code for main part of modulehelper larr contains code for helper classesexamplestestsbindings larr files related to pythondocwscript larr the ldquoMakefile equivalent

K Katsaros Introduction to NS-3 040713 6 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Helper API

The ns-3 ldquohelper API provides a set of classes and methods thatmake common operations easier than using the low-level APIConsists of- container objects- helper classesThe helper API is implemented using the low-level APIUsers are encouraged to contribute or propose improvements to thens-3 helper API

K Katsaros Introduction to NS-3 040713 7 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Building NS-3

Waf is a Python-based framework for configuring compiling andinstalling applications

It is a replacement for other tools such as Autotools CMake or Anthttpcodegooglecompwaf

For those familiar with autotoolsconfigure rarr waf configuremake rarrwaf build

K Katsaros Introduction to NS-3 040713 8 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Discrete-event simulations

Simulation time moves in discrete jumps from event to eventC++ functions schedule events to occur at specific simulation timesA simulation scheduler orders the event executionSimulatorRun() gets it all startedSimulation stops at specific time or when events end

K Katsaros Introduction to NS-3 040713 9 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 3: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Introduction

ns-3 is written in C++ with bindings available for Pythonsimulation programs are C++ executables or Python programssim300000 lines of mostly C++ (estimate based on cloc source codeanalysis)

ns-3 is a GNU GPLv2-licensed projectns-3 is mainly supported for Linux OS X and FreeBSDns-3 is not backwards-compatible with ns-2

K Katsaros Introduction to NS-3 040713 3 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Where to get it

Where do I get ns-3- httpwwwnsnamorgWhere do I get todayrsquos code

Download the latest release- wgethttpwwwnsnamorgreleasesns-allinone-317tarbz2- tar xjf ns-allinone-317tarbz2Clone the latest development code1- hg clone httpcodensnamorgns-3-allinone

1Mercurial is used as source code control toolK Katsaros Introduction to NS-3 040713 4 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Current Modules in main NS-3 tree

Network Node Sockets Queues Packet etcCore Smart Pointers Callbacks Event Scheduler Logging Tracing etc

K Katsaros Introduction to NS-3 040713 5 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Module Organization

model larr contains source code for main part of modulehelper larr contains code for helper classesexamplestestsbindings larr files related to pythondocwscript larr the ldquoMakefile equivalent

K Katsaros Introduction to NS-3 040713 6 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Helper API

The ns-3 ldquohelper API provides a set of classes and methods thatmake common operations easier than using the low-level APIConsists of- container objects- helper classesThe helper API is implemented using the low-level APIUsers are encouraged to contribute or propose improvements to thens-3 helper API

K Katsaros Introduction to NS-3 040713 7 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Building NS-3

Waf is a Python-based framework for configuring compiling andinstalling applications

It is a replacement for other tools such as Autotools CMake or Anthttpcodegooglecompwaf

For those familiar with autotoolsconfigure rarr waf configuremake rarrwaf build

K Katsaros Introduction to NS-3 040713 8 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Discrete-event simulations

Simulation time moves in discrete jumps from event to eventC++ functions schedule events to occur at specific simulation timesA simulation scheduler orders the event executionSimulatorRun() gets it all startedSimulation stops at specific time or when events end

K Katsaros Introduction to NS-3 040713 9 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 4: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Where to get it

Where do I get ns-3- httpwwwnsnamorgWhere do I get todayrsquos code

Download the latest release- wgethttpwwwnsnamorgreleasesns-allinone-317tarbz2- tar xjf ns-allinone-317tarbz2Clone the latest development code1- hg clone httpcodensnamorgns-3-allinone

1Mercurial is used as source code control toolK Katsaros Introduction to NS-3 040713 4 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Current Modules in main NS-3 tree

Network Node Sockets Queues Packet etcCore Smart Pointers Callbacks Event Scheduler Logging Tracing etc

K Katsaros Introduction to NS-3 040713 5 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Module Organization

model larr contains source code for main part of modulehelper larr contains code for helper classesexamplestestsbindings larr files related to pythondocwscript larr the ldquoMakefile equivalent

K Katsaros Introduction to NS-3 040713 6 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Helper API

The ns-3 ldquohelper API provides a set of classes and methods thatmake common operations easier than using the low-level APIConsists of- container objects- helper classesThe helper API is implemented using the low-level APIUsers are encouraged to contribute or propose improvements to thens-3 helper API

K Katsaros Introduction to NS-3 040713 7 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Building NS-3

Waf is a Python-based framework for configuring compiling andinstalling applications

It is a replacement for other tools such as Autotools CMake or Anthttpcodegooglecompwaf

For those familiar with autotoolsconfigure rarr waf configuremake rarrwaf build

K Katsaros Introduction to NS-3 040713 8 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Discrete-event simulations

Simulation time moves in discrete jumps from event to eventC++ functions schedule events to occur at specific simulation timesA simulation scheduler orders the event executionSimulatorRun() gets it all startedSimulation stops at specific time or when events end

K Katsaros Introduction to NS-3 040713 9 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 5: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Current Modules in main NS-3 tree

Network Node Sockets Queues Packet etcCore Smart Pointers Callbacks Event Scheduler Logging Tracing etc

K Katsaros Introduction to NS-3 040713 5 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Module Organization

model larr contains source code for main part of modulehelper larr contains code for helper classesexamplestestsbindings larr files related to pythondocwscript larr the ldquoMakefile equivalent

K Katsaros Introduction to NS-3 040713 6 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Helper API

The ns-3 ldquohelper API provides a set of classes and methods thatmake common operations easier than using the low-level APIConsists of- container objects- helper classesThe helper API is implemented using the low-level APIUsers are encouraged to contribute or propose improvements to thens-3 helper API

K Katsaros Introduction to NS-3 040713 7 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Building NS-3

Waf is a Python-based framework for configuring compiling andinstalling applications

It is a replacement for other tools such as Autotools CMake or Anthttpcodegooglecompwaf

For those familiar with autotoolsconfigure rarr waf configuremake rarrwaf build

K Katsaros Introduction to NS-3 040713 8 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Discrete-event simulations

Simulation time moves in discrete jumps from event to eventC++ functions schedule events to occur at specific simulation timesA simulation scheduler orders the event executionSimulatorRun() gets it all startedSimulation stops at specific time or when events end

K Katsaros Introduction to NS-3 040713 9 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 6: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Module Organization

model larr contains source code for main part of modulehelper larr contains code for helper classesexamplestestsbindings larr files related to pythondocwscript larr the ldquoMakefile equivalent

K Katsaros Introduction to NS-3 040713 6 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Helper API

The ns-3 ldquohelper API provides a set of classes and methods thatmake common operations easier than using the low-level APIConsists of- container objects- helper classesThe helper API is implemented using the low-level APIUsers are encouraged to contribute or propose improvements to thens-3 helper API

K Katsaros Introduction to NS-3 040713 7 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Building NS-3

Waf is a Python-based framework for configuring compiling andinstalling applications

It is a replacement for other tools such as Autotools CMake or Anthttpcodegooglecompwaf

For those familiar with autotoolsconfigure rarr waf configuremake rarrwaf build

K Katsaros Introduction to NS-3 040713 8 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Discrete-event simulations

Simulation time moves in discrete jumps from event to eventC++ functions schedule events to occur at specific simulation timesA simulation scheduler orders the event executionSimulatorRun() gets it all startedSimulation stops at specific time or when events end

K Katsaros Introduction to NS-3 040713 9 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 7: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Helper API

The ns-3 ldquohelper API provides a set of classes and methods thatmake common operations easier than using the low-level APIConsists of- container objects- helper classesThe helper API is implemented using the low-level APIUsers are encouraged to contribute or propose improvements to thens-3 helper API

K Katsaros Introduction to NS-3 040713 7 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Building NS-3

Waf is a Python-based framework for configuring compiling andinstalling applications

It is a replacement for other tools such as Autotools CMake or Anthttpcodegooglecompwaf

For those familiar with autotoolsconfigure rarr waf configuremake rarrwaf build

K Katsaros Introduction to NS-3 040713 8 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Discrete-event simulations

Simulation time moves in discrete jumps from event to eventC++ functions schedule events to occur at specific simulation timesA simulation scheduler orders the event executionSimulatorRun() gets it all startedSimulation stops at specific time or when events end

K Katsaros Introduction to NS-3 040713 9 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 8: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Building NS-3

Waf is a Python-based framework for configuring compiling andinstalling applications

It is a replacement for other tools such as Autotools CMake or Anthttpcodegooglecompwaf

For those familiar with autotoolsconfigure rarr waf configuremake rarrwaf build

K Katsaros Introduction to NS-3 040713 8 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Discrete-event simulations

Simulation time moves in discrete jumps from event to eventC++ functions schedule events to occur at specific simulation timesA simulation scheduler orders the event executionSimulatorRun() gets it all startedSimulation stops at specific time or when events end

K Katsaros Introduction to NS-3 040713 9 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 9: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Discrete-event simulations

Simulation time moves in discrete jumps from event to eventC++ functions schedule events to occur at specific simulation timesA simulation scheduler orders the event executionSimulatorRun() gets it all startedSimulation stops at specific time or when events end

K Katsaros Introduction to NS-3 040713 9 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 10: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Time in NS-3

Time is stored as a large integer in ns-3- Avoid floating point discrepancies across platformsSpecial Time classes are provided to manipulate time (such asstandard operators)Default time resolution is nanoseconds but can be set to otherresolutionsTime objects can be set by floating-point values and can exportfloating-pointdouble timeDouble = tGetSeconds()

K Katsaros Introduction to NS-3 040713 10 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 11: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 API

Most of the ns-3 API is documented with Doxygen(httpwwwdoxygenorg)

K Katsaros Introduction to NS-3 040713 11 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 12: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Scalability

Distributed simulation in ns-3 allows a user to run a singlesimulation in parallel on multiple processorsBy assigning a different rank to nodes and connecting these nodeswith point-to-point links simulator boundaries are createdSimulator boundaries divide Logical Processes (LPs) and each LPcan be executed by a different processorDistributed simulation in ns-3 offers solid performance gains in timeof execution for large topologies

Simulation on a HPC cluster at the US Mobile Network ModelingInstitute (2011)2- 176 cores 3 TB of memory- 360448000 simulated nodes- 41370452 packet receive events per second [wall-clock]

2K Renard et al ldquoA Performance and Scalability Evaluation of the NS-3Distributed Scheduler Proceedings of WNS3 2012

K Katsaros Introduction to NS-3 040713 12 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 13: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Attribute System

Problem Researchers want to identify all of the values affecting theresults of their simulations and configure them easilyns-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 objectsDump and read them all in configuration filesVisualize them in a GUIMakes it easy to verify the parameters of a simulation

List of all attributes in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___attribute_listhtml

K Katsaros Introduction to NS-3 040713 13 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 14: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Tracing System

Simulator provides a set of pre-configured trace sources- Users may edit the core to add their ownUsers provide trace sinks and attach to the trace source-Simulator core provides a few examples for common casesMultiple trace sources can connect to a trace sinkList of all trace sources in the APIhttpwwwnsnamorgdocsrelease317doxygengroup___trace_source_listhtml

K Katsaros Introduction to NS-3 040713 14 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 15: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1FlowMonitor

Network monitoring framework found insrcflow-monitor

Goals- detect all flows passing through network- stores metrics for analysis such as throughput duration delays packetsizes packet loss ratiosCurrently works ONLY on IPv4 packets

K Katsaros Introduction to NS-3 040713 15 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 16: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NetAnim

Animate packets over wired-links and wireless- links- limited support for LTE tracesPacket timeline with regex filter on packet meta-dataNode position statistics with node trajectory plotting (path of amobile node)Print brief packet meta-data on packets

K Katsaros Introduction to NS-3 040713 16 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 17: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1LTE module - Design

FemtoForum LTE MAC Scheduler APIRadio signal model granularity Resource Block- Symbol-level model not affordable- Simplified Channel PHY modelRealistic Data Plane Protocol stack model- Realistic RLC PDCP S1-U X2-U- Allow proper interaction with IP networking- Allow end-to-end QoE evaluationsHybrid Control Plane model- Realistic RRC model- Simplified S1-C X2-C and S11 modelsSimplified EPC- One MME and one SGW- SGW and PGW in the same node (no S5S8 interface)Focus on connected mode- RRC connected EMM Registered ECM connected

K Katsaros Introduction to NS-3 040713 17 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 18: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Model Overview

K Katsaros Introduction to NS-3 040713 18 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 19: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Propagation Models

Buildings model- Add buildings to network topologyPath loss model- Okumura Hata (outdoor)- ITU-R P1411 LOS amp NLOS (outdoor)- ITU-R P1238 (indoor)- External amp internal wall losses- Log-normal shadowing- Pathloss logic chooses correct model depending on node positionFast fading model- Trace-based- Freq and time dependentAntenna models- Isotropic- Sectorial (cosine amp parabolic shape)

K Katsaros Introduction to NS-3 040713 19 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 20: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1PHY model

Only FDD is modelledFreq domain granularity RBTime domain granularity 1 TTI further divided into- DL ctrl data - UL ctrl+data SRSGaussian Interference modelCQI feedbackSignal processing not modelled accuratelyrarr use error modelSISO propagation modelMIMO modeled as SINR gain over SISO- different gains for different TX modesSupports different freqs and bandwidths per eNB- leveraging on the ns-3 Spectrum module

K Katsaros Introduction to NS-3 040713 20 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 21: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler model

Resource allocation model- allocation type 0- RBs grouped into RBGs- localized mapping approachAdaptive Modulation and Coding- two algorithms working on reported CQI feedback- ldquoPiro model based on analytical BER (very conservative)- ldquoVienna model aim at max 10 BLER based on error modelcurves- Dynamic TX mode selection supportedbut no adaptive algorithm currently implementedTransport Block model- Mimics 3GPP structuremux RLC PDU onto MAC PDU- Virtual MAC Headers and CEs (no real bits)MAC overhead not modeledConsistent with requirements (scheduler neglects MAC OH)

K Katsaros Introduction to NS-3 040713 21 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 22: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1MAC Scheduler

Round Robin (RR)Proportional Fair (PF)Maximum Throughput (MT)Throughput to Average (TTA)Blind Average Throughput (BET)Token Bank Fair Queue (TBFQ)Priority Set Scheduler (PSS)

All implementations based on the FemtoForum APIThe above algorithms are for downlink onlyFor uplink all current implementations use the same Round Robinalgorithm

K Katsaros Introduction to NS-3 040713 22 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 23: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Output

Lots of KPIs available at different levelsChannel- SINR maps- pathloss matricesPHY- TB tx rx traces- RSRPRSRQ tracesMAC- ULDL scheduling tracesRLC and PDCP- Time-averaged PDU tx rx statsIP and application stats- Can be obtained with usual ns-3 means- FlowMonitor PCAP traces get stats directly from app etc

K Katsaros Introduction to NS-3 040713 23 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 24: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Features Highlighted

K Katsaros Introduction to NS-3 040713 24 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 25: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Simulation Time

5s sim time 1 UE per eNB full traffic

K Katsaros Introduction to NS-3 040713 25 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 26: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Walkthrough of WiFi Internet example

K Katsaros Introduction to NS-3 040713 26 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 27: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1NS-3 Implementation of WiFi Example

K Katsaros Introduction to NS-3 040713 27 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 28: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Structure of NS-3 program

int main (int argc char argv[]) Set default attribute values Parse command-line arguments Configure the topology nodes channels devicesmobility Add (Internet) stack to nodes Configure IP addressing and routing Add and configure applications Configure tracing Run simulation

K Katsaros Introduction to NS-3 040713 28 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 29: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Source Code for P2P example

Starting your script with this line ensures that emacs editor will be ableto indent your code correctly The following lines ensure that your code islicensed under the GPLv2 -- ModeC++ c-file-stylegnu indent-tabs-modenil-- GPLv2 LicenceInclude the proper header files For simulation scripts you can aggregatethem with modules but when developing your module you have toinclude the specific header file (not the aggregated)include ldquons3core-modulehinclude ldquons3network-modulehinclude ldquons3internet-modulehinclude ldquons3point-to-point-modulehinclude ldquons3applications-modulehUse the ns3 project namespaceusing namespace ns3

K Katsaros Introduction to NS-3 040713 29 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 30: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Enable and disable console message logging by reference to the nameNS_LOG_COMPONENT_DEFINE (ldquoFirstScriptExample)int main (int argc char argv[])LogComponentEnable (ldquoUdpEchoClientApplication LOG_LEVEL_INFO)LogComponentEnable (ldquoUdpEchoServerApplication LOG_LEVEL_INFO)Topology ConfigurationNodeContainer nodesnodesCreate (2)PointToPointHelper pointToPointpointToPointSetDeviceAttribute (DataRate StringValue(5Mbps))pointToPointSetChannelAttribute (Delay StringValue (2ms))NetDeviceContainer devicesdevices = pointToPointInstall (nodes)

K Katsaros Introduction to NS-3 040713 30 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 31: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1example cont

Set up Internet StackInternetStackHelper stackstackInstall (nodes)Ipv4AddressHelper addressaddressSetBase (10110 2552552550)Ipv4InterfaceContainer interfaces = addressAssign (devices)Set up applicationsUdpEchoServerHelper echoServer (9)ApplicationContainer serverApps = echoServerInstall (nodesGet (1))serverAppsStart (Seconds (10))serverAppsStop (Seconds (100))UdpEchoClientHelper echoClient (interfacesGetAddress (1) 9)echoClientSetAttribute (MaxPackets UintegerValue (1))echoClientSetAttribute (Interval TimeValue (Seconds (10)))echoClientSetAttribute (PacketSize UintegerValue (1024))ApplicationContainer clientApps = echoClientInstall (nodesGet (0))clientAppsStart (Seconds (20))clientAppsStop (Seconds (100))Run your scenarioSimulatorRun ()SimulatorDestroy ()

K Katsaros Introduction to NS-3 040713 31 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 32: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Resources

Web sitehttpwwwnsnamorgMailing listhttpsgroupsgooglecomforumfromgroupsforumns-3-usersIRCns-3 at freenodenetTutorialhttpwwwnsnamorgdocstutorialtutorialhtmlCode serverhttpcodensnamorgWikihttpwwwnsnamorgwikiindexphpMain_PageFor LENA projecthttpiptechwikicttcesLTE-EPC_Network_Simulator_(LENA)

K Katsaros Introduction to NS-3 040713 32 33

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part
Page 33: Introduction to NS-3 - University of Surreyinfo.ee.surrey.ac.uk/CCSR/Internal/SLS/04_NS3_tutorial.pdf · Current Modules inFakeTitle1 main NS-3 tree Network: Node, Sockets, Queues,

Introduction NS-3 Modules LTE Module WiFi Example Acknoledgement

FakeTitle1Acknowledgments

Special Thanks toTom HendersonMathieu LacageNicola Baldo

for borrowing material from their presenations

K Katsaros Introduction to NS-3 040713 33 33

  • Main Part