A Discrete-Event Network Simulator
API
WsnConstructor Class Reference

The class that constructs the WSN, setup applications on nodes and starts the simulation. More...

#include "wsnconstructor.h"

+ Inheritance diagram for WsnConstructor:
+ Collaboration diagram for WsnConstructor:

Public Member Functions

 WsnConstructor ()
 Default constructor. More...
 
void Configure ()
 Generate a description of attributes given from the config file and from CLI set the simulation seed and verbosity. More...
 
void Run ()
 Construct the WSN, install applications on nodes and start the simulation. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Register this type. More...
 

Private Member Functions

void AODVrouting ()
 Install AODV routing. More...
 
void BuildDiscTopology ()
 Deploy nodes at random positions on a disc shaped plane. More...
 
void BuildGridTopology ()
 Sensor nodes are deployed according to a grid structure; each sensor node is equidistant from the closest sensor nodes in cardinal directions. More...
 
void CaptureStatistics ()
 Instantiate objects for collecting data with the statistical framework. More...
 
void CreateDevices ()
 Create Network devices and setup the wireless communication based on the IEEE 802.11n Allow to select from 2.4GHz to 5GHz and setup different MCS using the attribute system. More...
 
void CreateNodes ()
 Create node objects. More...
 
void DSDVrouting ()
 Install DSDV routing. More...
 
void DSRrouting ()
 Install DSR routing. More...
 
void InstallApplications ()
 Install applications on nodes and setup starting time of the handshake and the onion start time. More...
 
void InstallInternetStack ()
 Installing the internet stack on nodes and setting up IP-addresses. More...
 
void OLSRrouting ()
 Install OLSR routing. More...
 
void ProcessPathString ()
 Split the string m_pathsLengths by the delimiter (,) and save each value into m_onionPathsLengths and the number of values into m_numOnionPaths. More...
 

Private Attributes

DataCollector data
 Collect data with the stats framework. More...
 
uint16_t m_cellSide
 Parameter for the setup of the grid topology. More...
 
enum IEEE_80211n m_mac
 Carrier frequency of the IEEE 802.11n. More...
 
uint16_t m_mss
 maximum segment size More...
 
uint16_t m_numNodes
 number of sensor nodes in the WSN More...
 
uint16_t m_numOnionPaths = 0
 Number of different onion paths. More...
 
uint16_t * m_onionPathsLengths
 Array containing one onion path length in each cell. More...
 
uint16_t m_onionRepeate
 Number of times to generate the onion for each value of path length. More...
 
Ptr< OnionValidatorm_onionValidator
 Checks if the onion messagess transiting in the network are valid. More...
 
Ptr< OutputManagerm_outputManager
 Manages the output of the simulation. More...
 
std::string m_pathsLengths
 String of values delimited by the symbol "," each value representing the number of hops the onion will travel to return back to the sink node issuer of the onion. More...
 
uint16_t m_radius
 Parameter for the setup of the random disc topology. More...
 
enum Routing m_routing
 routing algorithm for wireless multihop networks More...
 
std::string m_simulationDescription
 String holding a description of parameters used in the simulation. More...
 
std::string m_simulationName
 name of the simulation More...
 
uint32_t m_simulationSeed
 seed to use for the random generation of numbers during the simulation More...
 
NodeContainer m_sink
 Container of the sink node. More...
 
enum CommunicationStatistics m_stats
 setting of recording communication statistics More...
 
enum Topology m_topology
 network topology More...
 
enum Verbosity m_verbosity
 verbosity of the simulation More...
 
MobilityHelper mobility
 Topology helper. More...
 
ApplicationContainer sensornodeApps
 Container of sensor node applications. More...
 
NodeContainer sensornodes
 Container of sensor nodes. More...
 
ApplicationContainer sinkApps
 Container of sink node applications. More...
 
NetDeviceContainer wifiDevices
 Container of wireless devices. More...
 
Ipv4InterfaceContainer wifiInterfaces
 Container of netork interfaces. More...
 
NodeContainer wifiNodes
 Container of wireless nodes. More...
 

Detailed Description

The class that constructs the WSN, setup applications on nodes and starts the simulation.

Definition at line 69 of file wsnconstructor.h.

Constructor & Destructor Documentation

◆ WsnConstructor()

WsnConstructor::WsnConstructor ( )

Default constructor.

Definition at line 112 of file wsnconstructor.cc.

Member Function Documentation

◆ AODVrouting()

void WsnConstructor::AODVrouting ( )
private

Install AODV routing.

Definition at line 551 of file wsnconstructor.cc.

References m_simulationDescription, and wifiNodes.

Referenced by InstallInternetStack().

+ Here is the caller graph for this function:

◆ BuildDiscTopology()

void WsnConstructor::BuildDiscTopology ( )
private

Deploy nodes at random positions on a disc shaped plane.

The radius of the disc is selected based on r_disc2 * π = A. A being the sum of circular areas covered by m_numNodes at radius m_radius Therefore the average sensor node density is maintained fixed if the parameter m_numNodes changes. The sink node is deployed in the center of the disc.

Definition at line 414 of file wsnconstructor.cc.

References m_numNodes, m_radius, m_simulationDescription, m_sink, mobility, and sensornodes.

Referenced by Run().

+ Here is the caller graph for this function:

◆ BuildGridTopology()

void WsnConstructor::BuildGridTopology ( )
private

Sensor nodes are deployed according to a grid structure; each sensor node is equidistant from the closest sensor nodes in cardinal directions.

The distance between sensor nodes is defined by the parameter m_cellSide The sink node is deployed in the center of the grid repleacing a sensor node.

Definition at line 459 of file wsnconstructor.cc.

References m_cellSide, m_numNodes, m_simulationDescription, m_sink, mobility, and sensornodes.

Referenced by Run().

+ Here is the caller graph for this function:

◆ CaptureStatistics()

void WsnConstructor::CaptureStatistics ( )
private

Instantiate objects for collecting data with the statistical framework.

data sent and received at MAC layer, and data received at Application layer

Definition at line 286 of file wsnconstructor.cc.

References data, and m_simulationDescription.

Referenced by Run().

+ Here is the caller graph for this function:

◆ Configure()

void WsnConstructor::Configure ( )

Generate a description of attributes given from the config file and from CLI set the simulation seed and verbosity.

Definition at line 117 of file wsnconstructor.cc.

References ns3::AODV, ns3::Both, ns3::ConsoleLog, ns3::DISC, ns3::DSDV, ns3::DSR, ns3::GRID, m_mss, m_numNodes, m_onionValidator, m_outputManager, m_routing, m_simulationDescription, m_simulationName, m_simulationSeed, m_topology, m_verbosity, ns3::OLSR, and ns3::PrintDescription.

◆ CreateDevices()

void WsnConstructor::CreateDevices ( )
private

Create Network devices and setup the wireless communication based on the IEEE 802.11n Allow to select from 2.4GHz to 5GHz and setup different MCS using the attribute system.

Set up the network: configure the physical mode, the wi-fi parameters (seting an adhoc wifi), etc.

Definition at line 336 of file wsnconstructor.cc.

References ns3::F_24GHz, ns3::F_5GHz, m_mac, m_mss, m_simulationDescription, wifiDevices, and wifiNodes.

Referenced by Run().

+ Here is the caller graph for this function:

◆ CreateNodes()

void WsnConstructor::CreateNodes ( )
private

Create node objects.

Create nodes and split them between node containers, to split nodes by functionality in the application.

Definition at line 317 of file wsnconstructor.cc.

References m_numNodes, m_simulationDescription, m_sink, sensornodes, and wifiNodes.

Referenced by Run().

+ Here is the caller graph for this function:

◆ DSDVrouting()

void WsnConstructor::DSDVrouting ( )
private

Install DSDV routing.

Definition at line 589 of file wsnconstructor.cc.

References m_simulationDescription, and wifiNodes.

Referenced by InstallInternetStack().

+ Here is the caller graph for this function:

◆ DSRrouting()

void WsnConstructor::DSRrouting ( )
private

Install DSR routing.

Definition at line 537 of file wsnconstructor.cc.

References m_simulationDescription, and wifiNodes.

Referenced by InstallInternetStack().

+ Here is the caller graph for this function:

◆ GetTypeId()

TypeId WsnConstructor::GetTypeId ( void  )
static

◆ InstallApplications()

void WsnConstructor::InstallApplications ( )
private

Install applications on nodes and setup starting time of the handshake and the onion start time.

Install an aplication on network.

Definition at line 611 of file wsnconstructor.cc.

References ns3::DSDV, ns3::SensorNodeHelper::Install(), ns3::SinkHelper::Install(), m_numNodes, m_numOnionPaths, m_onionPathsLengths, m_onionRepeate, m_onionValidator, m_outputManager, m_routing, m_simulationDescription, m_sink, ns3::OLSR, sensornodeApps, sensornodes, sinkApps, and wifiInterfaces.

Referenced by Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InstallInternetStack()

void WsnConstructor::InstallInternetStack ( )
private

Installing the internet stack on nodes and setting up IP-addresses.

Set internet stack (ipv4) and its addresses.

Definition at line 504 of file wsnconstructor.cc.

References ns3::AODV, AODVrouting(), ns3::DSDV, DSDVrouting(), ns3::DSR, DSRrouting(), m_outputManager, m_routing, ns3::OLSR, OLSRrouting(), wifiDevices, and wifiInterfaces.

Referenced by Run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ OLSRrouting()

void WsnConstructor::OLSRrouting ( )
private

Install OLSR routing.

Definition at line 570 of file wsnconstructor.cc.

References m_simulationDescription, and wifiNodes.

Referenced by InstallInternetStack().

+ Here is the caller graph for this function:

◆ ProcessPathString()

void WsnConstructor::ProcessPathString ( )
private

Split the string m_pathsLengths by the delimiter (,) and save each value into m_onionPathsLengths and the number of values into m_numOnionPaths.

Convert the string given as parameter containing path lenghts in the array m_onionPathsLenghts containing a path length in each cell.

Definition at line 256 of file wsnconstructor.cc.

References m_numOnionPaths, m_onionPathsLengths, and m_pathsLengths.

Referenced by Run().

+ Here is the caller graph for this function:

◆ Run()

void WsnConstructor::Run ( )

Construct the WSN, install applications on nodes and start the simulation.

Run the simulation, showing the progress of it.

Definition at line 191 of file wsnconstructor.cc.

References BuildDiscTopology(), BuildGridTopology(), CaptureStatistics(), CreateDevices(), CreateNodes(), data, ns3::DISC, ns3::GRID, InstallApplications(), InstallInternetStack(), m_outputManager, m_simulationDescription, m_simulationName, m_stats, m_topology, ProcessPathString(), and ns3::Y.

+ Here is the call graph for this function:

Member Data Documentation

◆ data

DataCollector WsnConstructor::data
private

Collect data with the stats framework.

Definition at line 130 of file wsnconstructor.h.

Referenced by CaptureStatistics(), and Run().

◆ m_cellSide

uint16_t WsnConstructor::m_cellSide
private

Parameter for the setup of the grid topology.

Definition at line 113 of file wsnconstructor.h.

Referenced by BuildGridTopology(), and GetTypeId().

◆ m_mac

enum IEEE_80211n WsnConstructor::m_mac
private

Carrier frequency of the IEEE 802.11n.

Definition at line 108 of file wsnconstructor.h.

Referenced by CreateDevices(), and GetTypeId().

◆ m_mss

uint16_t WsnConstructor::m_mss
private

maximum segment size

Definition at line 111 of file wsnconstructor.h.

Referenced by Configure(), CreateDevices(), and GetTypeId().

◆ m_numNodes

uint16_t WsnConstructor::m_numNodes
private

number of sensor nodes in the WSN

Definition at line 105 of file wsnconstructor.h.

Referenced by BuildDiscTopology(), BuildGridTopology(), Configure(), CreateNodes(), GetTypeId(), and InstallApplications().

◆ m_numOnionPaths

uint16_t WsnConstructor::m_numOnionPaths = 0
private

Number of different onion paths.

Definition at line 124 of file wsnconstructor.h.

Referenced by InstallApplications(), and ProcessPathString().

◆ m_onionPathsLengths

uint16_t* WsnConstructor::m_onionPathsLengths
private

Array containing one onion path length in each cell.

Definition at line 125 of file wsnconstructor.h.

Referenced by InstallApplications(), and ProcessPathString().

◆ m_onionRepeate

uint16_t WsnConstructor::m_onionRepeate
private

Number of times to generate the onion for each value of path length.

Definition at line 126 of file wsnconstructor.h.

Referenced by GetTypeId(), and InstallApplications().

◆ m_onionValidator

Ptr<OnionValidator> WsnConstructor::m_onionValidator
private

Checks if the onion messagess transiting in the network are valid.

Definition at line 118 of file wsnconstructor.h.

Referenced by Configure(), and InstallApplications().

◆ m_outputManager

Ptr<OutputManager> WsnConstructor::m_outputManager
private

Manages the output of the simulation.

Definition at line 116 of file wsnconstructor.h.

Referenced by Configure(), InstallApplications(), InstallInternetStack(), and Run().

◆ m_pathsLengths

std::string WsnConstructor::m_pathsLengths
private

String of values delimited by the symbol "," each value representing the number of hops the onion will travel to return back to the sink node issuer of the onion.

Definition at line 128 of file wsnconstructor.h.

Referenced by GetTypeId(), and ProcessPathString().

◆ m_radius

uint16_t WsnConstructor::m_radius
private

Parameter for the setup of the random disc topology.

Definition at line 112 of file wsnconstructor.h.

Referenced by BuildDiscTopology(), and GetTypeId().

◆ m_routing

enum Routing WsnConstructor::m_routing
private

routing algorithm for wireless multihop networks

Definition at line 106 of file wsnconstructor.h.

Referenced by Configure(), GetTypeId(), InstallApplications(), and InstallInternetStack().

◆ m_simulationDescription

std::string WsnConstructor::m_simulationDescription
private

String holding a description of parameters used in the simulation.

Definition at line 120 of file wsnconstructor.h.

Referenced by AODVrouting(), BuildDiscTopology(), BuildGridTopology(), CaptureStatistics(), Configure(), CreateDevices(), CreateNodes(), DSDVrouting(), DSRrouting(), InstallApplications(), OLSRrouting(), and Run().

◆ m_simulationName

std::string WsnConstructor::m_simulationName
private

name of the simulation

Definition at line 121 of file wsnconstructor.h.

Referenced by Configure(), GetTypeId(), and Run().

◆ m_simulationSeed

uint32_t WsnConstructor::m_simulationSeed
private

seed to use for the random generation of numbers during the simulation

Definition at line 104 of file wsnconstructor.h.

Referenced by Configure(), and GetTypeId().

◆ m_sink

NodeContainer WsnConstructor::m_sink
private

Container of the sink node.

Definition at line 224 of file wsnconstructor.h.

Referenced by BuildDiscTopology(), BuildGridTopology(), CreateNodes(), and InstallApplications().

◆ m_stats

enum CommunicationStatistics WsnConstructor::m_stats
private

setting of recording communication statistics

Definition at line 110 of file wsnconstructor.h.

Referenced by GetTypeId(), and Run().

◆ m_topology

enum Topology WsnConstructor::m_topology
private

network topology

Definition at line 107 of file wsnconstructor.h.

Referenced by Configure(), GetTypeId(), and Run().

◆ m_verbosity

enum Verbosity WsnConstructor::m_verbosity
private

verbosity of the simulation

Definition at line 109 of file wsnconstructor.h.

Referenced by Configure(), and GetTypeId().

◆ mobility

MobilityHelper WsnConstructor::mobility
private

Topology helper.

Definition at line 222 of file wsnconstructor.h.

Referenced by BuildDiscTopology(), and BuildGridTopology().

◆ sensornodeApps

ApplicationContainer WsnConstructor::sensornodeApps
private

Container of sensor node applications.

Definition at line 229 of file wsnconstructor.h.

Referenced by InstallApplications().

◆ sensornodes

NodeContainer WsnConstructor::sensornodes
private

Container of sensor nodes.

Definition at line 225 of file wsnconstructor.h.

Referenced by BuildDiscTopology(), BuildGridTopology(), CreateNodes(), and InstallApplications().

◆ sinkApps

ApplicationContainer WsnConstructor::sinkApps
private

Container of sink node applications.

Definition at line 228 of file wsnconstructor.h.

Referenced by InstallApplications().

◆ wifiDevices

NetDeviceContainer WsnConstructor::wifiDevices
private

Container of wireless devices.

Definition at line 226 of file wsnconstructor.h.

Referenced by CreateDevices(), and InstallInternetStack().

◆ wifiInterfaces

Ipv4InterfaceContainer WsnConstructor::wifiInterfaces
private

Container of netork interfaces.

Definition at line 227 of file wsnconstructor.h.

Referenced by InstallApplications(), and InstallInternetStack().

◆ wifiNodes

NodeContainer WsnConstructor::wifiNodes
private

Container of wireless nodes.

Definition at line 223 of file wsnconstructor.h.

Referenced by AODVrouting(), CreateDevices(), CreateNodes(), DSDVrouting(), DSRrouting(), and OLSRrouting().


The documentation for this class was generated from the following files: