A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
anonymous_namespace{wifi-multirate.cc}::Experiment Class Reference

WiFi multirate experiment class. More...

Collaboration diagram for anonymous_namespace{wifi-multirate.cc}::Experiment:

Public Member Functions

 Experiment ()
 Experiment (std::string name)
 Construct a new Experiment object.
bool CommandSetup (int argc, char **argv)
 Setup the experiment from the command line arguments.
std::string GetOutputFileName () const
 Get the Output File Name.
std::string GetRateManager () const
 Get the Rate Manager.
std::string GetRtsThreshold () const
 Get the RTS Threshold.
uint32_t GetScenario () const
 Get the Scenario number.
bool IsMobility () const
 Check if mobility is enabled.
bool IsRouting () const
 Check if routing is enabled.
Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel, const MobilityHelper &mobility)
 Run an experiment.

Private Member Functions

void ApplicationSetup (Ptr< Node > client, Ptr< Node > server, double start, double stop)
 Setup the application in the nodes.
void AssignNeighbors (NodeContainer c)
 Take the grid map, divide it into 4 quadrants Assign all nodes from each quadrant to a specific container.
void CheckThroughput ()
 Calculate the throughput.
NodeContainer GenerateNeighbors (NodeContainer c, uint32_t senderId)
 Generate 1-hop and 2-hop neighbors of a node in grid topology.
void ReceivePacket (Ptr< Socket > socket)
 Receive a packet.
void SelectSrcDest (NodeContainer c)
 Sources and destinations are randomly selected such that a node may be the source for multiple destinations and a node maybe a destination for multiple sources.
void SendMultiDestinations (Ptr< Node > sender, NodeContainer c)
 A sender node will set up a flow to each of the its neighbors in its quadrant randomly.
Ptr< SocketSetupPacketReceive (Ptr< Node > node)
 Setup the receiving socket.

Private Attributes

uint32_t m_bytesTotal
 Total number of received bytes.
bool m_enableFlowMon
 True if FlowMon is enabled.
bool m_enableMobility
 True if mobility is enabled.
bool m_enablePcap
 True if PCAP output is enabled.
bool m_enableRouting
 True if routing is enabled.
bool m_enableTracing
 True if tracing output is enabled.
double m_expMean
 Exponential parameter for sending packets.
uint32_t m_gridSize
 Grid size.
uint32_t m_nodeDistance
 Node distance.
Gnuplot2dDataset m_output
 Output dataset.
std::string m_outputFileName
 Output file name.
uint32_t m_packetSize
 Packet size.
uint32_t m_port
 Listening port.
std::string m_rateManager
 Rate manager.
std::string m_rtsThreshold
 Rts threshold.
double m_samplingPeriod
 Sampling period.
uint32_t m_scenario
 Scenario number.
double m_totalTime
 Total experiment time.
NodeContainer m_containerA
 Node containers for each quadrant.
NodeContainer m_containerB
 Node containers for each quadrant.
NodeContainer m_containerC
 Node containers for each quadrant.
NodeContainer m_containerD
 Node containers for each quadrant.

Detailed Description

WiFi multirate experiment class.

It handles the creation and run of an experiment.

Scenarios: 100 nodes, multiple simultaneous flows, multi-hop ad hoc, routing, and mobility

QUICK INSTRUCTIONS:

To optimize build: ./ns3 configure -d optimized ./ns3

To compile: ./ns3 run wifi-multirate

To compile with command line(useful for varying parameters): ./ns3 run "wifi-multirate --totalTime=0.3s --rateManager=ns3::MinstrelWifiManager"

To turn on NS_LOG: export NS_LOG=multirate=level_all (can only view log if built with ./ns3 configure -d debug)

To debug: ./ns3 shell gdb ./build/debug/examples/wireless/wifi-multirate

To view pcap files: tcpdump -nn -tt -r filename.pcap

To monitor the files: tail -f filename.pcap

Definition at line 77 of file wifi-multirate.cc.

Constructor & Destructor Documentation

◆ Experiment() [1/2]

anonymous_namespace{wifi-multirate.cc}::Experiment::Experiment ( )

Definition at line 263 of file wifi-multirate.cc.

◆ Experiment() [2/2]

anonymous_namespace{wifi-multirate.cc}::Experiment::Experiment ( std::string name)

Member Function Documentation

◆ ApplicationSetup()

void anonymous_namespace{wifi-multirate.cc}::Experiment::ApplicationSetup ( Ptr< Node > client,
Ptr< Node > server,
double start,
double stop )
private

Setup the application in the nodes.

Parameters
clientClient node.
serverServer node.
startStart time.
stopStop time.

Definition at line 470 of file wifi-multirate.cc.

References m_packetSize, m_port, NS_LOG_DEBUG, anonymous_namespace{wifi-multirate.cc}::PrintPosition(), ns3::Seconds(), SetupPacketReceive(), sink, ns3::ApplicationContainer::Start(), and ns3::ApplicationContainer::Stop().

Referenced by Run(), SelectSrcDest(), and SendMultiDestinations().

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

◆ AssignNeighbors()

void anonymous_namespace{wifi-multirate.cc}::Experiment::AssignNeighbors ( NodeContainer c)
private

Take the grid map, divide it into 4 quadrants Assign all nodes from each quadrant to a specific container.

Parameters
cThe node container.

Definition at line 327 of file wifi-multirate.cc.

References ns3::NodeContainer::Get(), ns3::NodeContainer::GetN(), m_containerA, m_containerB, m_containerC, m_containerD, and m_gridSize.

Referenced by Run().

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

◆ CheckThroughput()

void anonymous_namespace{wifi-multirate.cc}::Experiment::CheckThroughput ( )
private

Calculate the throughput.

Definition at line 316 of file wifi-multirate.cc.

References CheckThroughput(), m_bytesTotal, m_output, m_samplingPeriod, ns3::Simulator::Now(), ns3::Simulator::Schedule(), and ns3::Seconds().

Referenced by CheckThroughput(), and Run().

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

◆ CommandSetup()

bool anonymous_namespace{wifi-multirate.cc}::Experiment::CommandSetup ( int argc,
char ** argv )

Setup the experiment from the command line arguments.

Parameters
argcThe argument count.
argvThe argument vector.
Returns
true

Definition at line 665 of file wifi-multirate.cc.

References m_enableMobility, m_enableRouting, m_outputFileName, m_packetSize, m_rateManager, m_rtsThreshold, m_samplingPeriod, m_scenario, and m_totalTime.

◆ GenerateNeighbors()

NodeContainer anonymous_namespace{wifi-multirate.cc}::Experiment::GenerateNeighbors ( NodeContainer c,
uint32_t senderId )
private

Generate 1-hop and 2-hop neighbors of a node in grid topology.

Parameters
cThe node container.
senderIdThe sender ID.
Returns
the neighbor nodes.

Definition at line 364 of file wifi-multirate.cc.

References ns3::NodeContainer::Add(), and ns3::NodeContainer::Get().

Referenced by Run().

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

◆ GetOutputFileName()

std::string anonymous_namespace{wifi-multirate.cc}::Experiment::GetOutputFileName ( ) const
inline

Get the Output File Name.

Returns
the Output File Name.

Definition at line 156 of file wifi-multirate.cc.

References m_outputFileName.

Referenced by Run().

Here is the caller graph for this function:

◆ GetRateManager()

std::string anonymous_namespace{wifi-multirate.cc}::Experiment::GetRateManager ( ) const
inline

Get the Rate Manager.

Returns
the Rate Manager.

Definition at line 166 of file wifi-multirate.cc.

References m_rateManager.

◆ GetRtsThreshold()

std::string anonymous_namespace{wifi-multirate.cc}::Experiment::GetRtsThreshold ( ) const
inline

Get the RTS Threshold.

Returns
the RTS Threshold.

Definition at line 146 of file wifi-multirate.cc.

References m_rtsThreshold.

◆ GetScenario()

uint32_t anonymous_namespace{wifi-multirate.cc}::Experiment::GetScenario ( ) const
inline

Get the Scenario number.

Returns
the scenario number.

Definition at line 136 of file wifi-multirate.cc.

References m_scenario.

◆ IsMobility()

bool anonymous_namespace{wifi-multirate.cc}::Experiment::IsMobility ( ) const
inline

Check if mobility is enabled.

Returns
true if mobility is enabled.

Definition at line 126 of file wifi-multirate.cc.

References m_enableMobility.

◆ IsRouting()

bool anonymous_namespace{wifi-multirate.cc}::Experiment::IsRouting ( ) const
inline

Check if routing is enabled.

Returns
true if routing is enabled.

Definition at line 116 of file wifi-multirate.cc.

References m_enableRouting.

◆ ReceivePacket()

void anonymous_namespace{wifi-multirate.cc}::Experiment::ReceivePacket ( Ptr< Socket > socket)
private

Receive a packet.

Parameters
socketThe receiving socket.

Definition at line 306 of file wifi-multirate.cc.

References m_bytesTotal.

Referenced by SetupPacketReceive().

Here is the caller graph for this function:

◆ Run()

Gnuplot2dDataset anonymous_namespace{wifi-multirate.cc}::Experiment::Run ( const WifiHelper & wifi,
const YansWifiPhyHelper & wifiPhy,
const WifiMacHelper & wifiMac,
const YansWifiChannelHelper & wifiChannel,
const MobilityHelper & mobility )

◆ SelectSrcDest()

void anonymous_namespace{wifi-multirate.cc}::Experiment::SelectSrcDest ( NodeContainer c)
private

Sources and destinations are randomly selected such that a node may be the source for multiple destinations and a node maybe a destination for multiple sources.

Parameters
cThe node container.

Definition at line 381 of file wifi-multirate.cc.

References ApplicationSetup(), ns3::CreateObject(), ns3::NodeContainer::Get(), ns3::NodeContainer::GetN(), and m_totalTime.

Referenced by Run().

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

◆ SendMultiDestinations()

void anonymous_namespace{wifi-multirate.cc}::Experiment::SendMultiDestinations ( Ptr< Node > sender,
NodeContainer c )
private

A sender node will set up a flow to each of the its neighbors in its quadrant randomly.

All the flows are exponentially distributed.

Parameters
senderThe sender node.
cThe node neighbors.

Definition at line 398 of file wifi-multirate.cc.

References ApplicationSetup(), ns3::CreateObject(), ns3::NodeContainer::Get(), ns3::NodeContainer::GetN(), m_expMean, m_totalTime, and NS_LOG_DEBUG.

Referenced by Run().

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

◆ SetupPacketReceive()

Ptr< Socket > anonymous_namespace{wifi-multirate.cc}::Experiment::SetupPacketReceive ( Ptr< Node > node)
private

Setup the receiving socket.

Parameters
nodeThe receiving node.
Returns
the Rx socket.

Definition at line 294 of file wifi-multirate.cc.

References ns3::Socket::CreateSocket(), ns3::Ipv4Address::GetAny(), ns3::TypeId::LookupByName(), m_port, ns3::MakeCallback(), ReceivePacket(), and sink.

Referenced by ApplicationSetup().

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

Member Data Documentation

◆ m_bytesTotal

uint32_t anonymous_namespace{wifi-multirate.cc}::Experiment::m_bytesTotal
private

Total number of received bytes.

Definition at line 236 of file wifi-multirate.cc.

Referenced by Experiment(), CheckThroughput(), and ReceivePacket().

◆ m_containerA

NodeContainer anonymous_namespace{wifi-multirate.cc}::Experiment::m_containerA
private

Node containers for each quadrant.

Definition at line 253 of file wifi-multirate.cc.

Referenced by AssignNeighbors(), and Run().

◆ m_containerB

NodeContainer anonymous_namespace{wifi-multirate.cc}::Experiment::m_containerB
private

Node containers for each quadrant.

Definition at line 254 of file wifi-multirate.cc.

Referenced by AssignNeighbors(), and Run().

◆ m_containerC

NodeContainer anonymous_namespace{wifi-multirate.cc}::Experiment::m_containerC
private

Node containers for each quadrant.

Definition at line 255 of file wifi-multirate.cc.

Referenced by AssignNeighbors(), and Run().

◆ m_containerD

NodeContainer anonymous_namespace{wifi-multirate.cc}::Experiment::m_containerD
private

Node containers for each quadrant.

Definition at line 256 of file wifi-multirate.cc.

Referenced by AssignNeighbors(), and Run().

◆ m_enableFlowMon

bool anonymous_namespace{wifi-multirate.cc}::Experiment::m_enableFlowMon
private

True if FlowMon is enabled.

Definition at line 245 of file wifi-multirate.cc.

Referenced by Experiment(), and Run().

◆ m_enableMobility

bool anonymous_namespace{wifi-multirate.cc}::Experiment::m_enableMobility
private

True if mobility is enabled.

Definition at line 247 of file wifi-multirate.cc.

Referenced by Experiment(), CommandSetup(), IsMobility(), and Run().

◆ m_enablePcap

bool anonymous_namespace{wifi-multirate.cc}::Experiment::m_enablePcap
private

True if PCAP output is enabled.

Definition at line 243 of file wifi-multirate.cc.

Referenced by Experiment(), and Run().

◆ m_enableRouting

bool anonymous_namespace{wifi-multirate.cc}::Experiment::m_enableRouting
private

True if routing is enabled.

Definition at line 246 of file wifi-multirate.cc.

Referenced by Experiment(), CommandSetup(), IsRouting(), and Run().

◆ m_enableTracing

bool anonymous_namespace{wifi-multirate.cc}::Experiment::m_enableTracing
private

True if tracing output is enabled.

Definition at line 244 of file wifi-multirate.cc.

Referenced by Experiment(), and Run().

◆ m_expMean

double anonymous_namespace{wifi-multirate.cc}::Experiment::m_expMean
private

Exponential parameter for sending packets.

Definition at line 233 of file wifi-multirate.cc.

Referenced by Experiment(), and SendMultiDestinations().

◆ m_gridSize

uint32_t anonymous_namespace{wifi-multirate.cc}::Experiment::m_gridSize
private

Grid size.

Definition at line 238 of file wifi-multirate.cc.

Referenced by Experiment(), AssignNeighbors(), and Run().

◆ m_nodeDistance

uint32_t anonymous_namespace{wifi-multirate.cc}::Experiment::m_nodeDistance
private

Node distance.

Definition at line 239 of file wifi-multirate.cc.

Referenced by Experiment(), and Run().

◆ m_output

Gnuplot2dDataset anonymous_namespace{wifi-multirate.cc}::Experiment::m_output
private

Output dataset.

Definition at line 230 of file wifi-multirate.cc.

Referenced by Experiment(), CheckThroughput(), and Run().

◆ m_outputFileName

std::string anonymous_namespace{wifi-multirate.cc}::Experiment::m_outputFileName
private

Output file name.

Definition at line 260 of file wifi-multirate.cc.

Referenced by Experiment(), CommandSetup(), and GetOutputFileName().

◆ m_packetSize

uint32_t anonymous_namespace{wifi-multirate.cc}::Experiment::m_packetSize
private

Packet size.

Definition at line 237 of file wifi-multirate.cc.

Referenced by Experiment(), ApplicationSetup(), and CommandSetup().

◆ m_port

uint32_t anonymous_namespace{wifi-multirate.cc}::Experiment::m_port
private

Listening port.

Definition at line 240 of file wifi-multirate.cc.

Referenced by Experiment(), ApplicationSetup(), and SetupPacketReceive().

◆ m_rateManager

std::string anonymous_namespace{wifi-multirate.cc}::Experiment::m_rateManager
private

Rate manager.

Definition at line 259 of file wifi-multirate.cc.

Referenced by Experiment(), CommandSetup(), and GetRateManager().

◆ m_rtsThreshold

std::string anonymous_namespace{wifi-multirate.cc}::Experiment::m_rtsThreshold
private

Rts threshold.

Definition at line 258 of file wifi-multirate.cc.

Referenced by Experiment(), CommandSetup(), and GetRtsThreshold().

◆ m_samplingPeriod

double anonymous_namespace{wifi-multirate.cc}::Experiment::m_samplingPeriod
private

Sampling period.

Definition at line 234 of file wifi-multirate.cc.

Referenced by Experiment(), CheckThroughput(), and CommandSetup().

◆ m_scenario

uint32_t anonymous_namespace{wifi-multirate.cc}::Experiment::m_scenario
private

Scenario number.

Definition at line 241 of file wifi-multirate.cc.

Referenced by Experiment(), CommandSetup(), GetScenario(), and Run().

◆ m_totalTime

double anonymous_namespace{wifi-multirate.cc}::Experiment::m_totalTime
private

Total experiment time.

Definition at line 232 of file wifi-multirate.cc.

Referenced by Experiment(), CommandSetup(), Run(), SelectSrcDest(), and SendMultiDestinations().


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