WiFi multirate experiment class. More...
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< Socket > | SetupPacketReceive (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. | |
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.
| anonymous_namespace{wifi-multirate.cc}::Experiment::Experiment | ( | ) |
Definition at line 263 of file wifi-multirate.cc.
| anonymous_namespace{wifi-multirate.cc}::Experiment::Experiment | ( | std::string | name | ) |
Construct a new Experiment object.
| name | The name of the experiment. |
Definition at line 267 of file wifi-multirate.cc.
References ns3::Gnuplot2dDataset::LINES, m_bytesTotal, m_enableFlowMon, m_enableMobility, m_enablePcap, m_enableRouting, m_enableTracing, m_expMean, m_gridSize, m_nodeDistance, m_output, m_outputFileName, m_packetSize, m_port, m_rateManager, m_rtsThreshold, m_samplingPeriod, m_scenario, and m_totalTime.
|
private |
Setup the application in the nodes.
| client | Client node. |
| server | Server node. |
| start | Start time. |
| stop | Stop 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().
|
private |
Take the grid map, divide it into 4 quadrants Assign all nodes from each quadrant to a specific container.
| c | The 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().
|
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().
| bool anonymous_namespace{wifi-multirate.cc}::Experiment::CommandSetup | ( | int | argc, |
| char ** | argv ) |
Setup the experiment from the command line arguments.
| argc | The argument count. |
| argv | The argument vector. |
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.
|
private |
Generate 1-hop and 2-hop neighbors of a node in grid topology.
| c | The node container. |
| senderId | The sender ID. |
Definition at line 364 of file wifi-multirate.cc.
References ns3::NodeContainer::Add(), and ns3::NodeContainer::Get().
Referenced by Run().
|
inline |
Get the Output File Name.
Definition at line 156 of file wifi-multirate.cc.
References m_outputFileName.
Referenced by Run().
|
inline |
Get the Rate Manager.
Definition at line 166 of file wifi-multirate.cc.
References m_rateManager.
|
inline |
Get the RTS Threshold.
Definition at line 146 of file wifi-multirate.cc.
References m_rtsThreshold.
|
inline |
Get the Scenario number.
Definition at line 136 of file wifi-multirate.cc.
References m_scenario.
|
inline |
Check if mobility is enabled.
Definition at line 126 of file wifi-multirate.cc.
References m_enableMobility.
|
inline |
Check if routing is enabled.
Definition at line 116 of file wifi-multirate.cc.
References m_enableRouting.
|
private |
Receive a packet.
| socket | The receiving socket. |
Definition at line 306 of file wifi-multirate.cc.
References m_bytesTotal.
Referenced by SetupPacketReceive().
| Gnuplot2dDataset anonymous_namespace{wifi-multirate.cc}::Experiment::Run | ( | const WifiHelper & | wifi, |
| const YansWifiPhyHelper & | wifiPhy, | ||
| const WifiMacHelper & | wifiMac, | ||
| const YansWifiChannelHelper & | wifiChannel, | ||
| const MobilityHelper & | mobility ) |
Run an experiment.
| wifi | The WifiHelper class. |
| wifiPhy | The YansWifiPhyHelper class. |
| wifiMac | The WifiMacHelper class. |
| wifiChannel | The YansWifiChannelHelper class. |
| mobility | The MobilityHelper class. |
Definition at line 494 of file wifi-multirate.cc.
References ApplicationSetup(), AssignNeighbors(), CheckThroughput(), ns3::NodeContainer::Create(), ns3::YansWifiChannelHelper::Create(), ns3::AsciiTraceHelper::CreateFileStream(), ns3::Simulator::Destroy(), ns3::WifiPhyHelper::DLT_IEEE802_11_RADIO, GenerateNeighbors(), ns3::NodeContainer::Get(), GetOutputFileName(), ns3::MobilityHelper::Install(), ns3::FlowMonitorHelper::InstallAll(), m_containerA, m_containerB, m_containerC, m_containerD, m_enableFlowMon, m_enableMobility, m_enablePcap, m_enableRouting, m_enableTracing, m_gridSize, m_nodeDistance, m_output, m_scenario, m_totalTime, NS_LOG_DEBUG, ns3::Simulator::Run(), ns3::Seconds(), SelectSrcDest(), SendMultiDestinations(), ns3::FlowMonitorHelper::SerializeToXmlFile(), ns3::MobilityHelper::SetMobilityModel(), ns3::MobilityHelper::SetPositionAllocator(), and ns3::Simulator::Stop().
|
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.
| c | The 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().
|
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.
| sender | The sender node. |
| c | The 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().
|
private |
Setup the receiving socket.
| node | The receiving node. |
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().
|
private |
Total number of received bytes.
Definition at line 236 of file wifi-multirate.cc.
Referenced by Experiment(), CheckThroughput(), and ReceivePacket().
|
private |
Node containers for each quadrant.
Definition at line 253 of file wifi-multirate.cc.
Referenced by AssignNeighbors(), and Run().
|
private |
Node containers for each quadrant.
Definition at line 254 of file wifi-multirate.cc.
Referenced by AssignNeighbors(), and Run().
|
private |
Node containers for each quadrant.
Definition at line 255 of file wifi-multirate.cc.
Referenced by AssignNeighbors(), and Run().
|
private |
Node containers for each quadrant.
Definition at line 256 of file wifi-multirate.cc.
Referenced by AssignNeighbors(), and Run().
|
private |
True if FlowMon is enabled.
Definition at line 245 of file wifi-multirate.cc.
Referenced by Experiment(), and Run().
|
private |
True if mobility is enabled.
Definition at line 247 of file wifi-multirate.cc.
Referenced by Experiment(), CommandSetup(), IsMobility(), and Run().
|
private |
True if PCAP output is enabled.
Definition at line 243 of file wifi-multirate.cc.
Referenced by Experiment(), and Run().
|
private |
True if routing is enabled.
Definition at line 246 of file wifi-multirate.cc.
Referenced by Experiment(), CommandSetup(), IsRouting(), and Run().
|
private |
True if tracing output is enabled.
Definition at line 244 of file wifi-multirate.cc.
Referenced by Experiment(), and Run().
|
private |
Exponential parameter for sending packets.
Definition at line 233 of file wifi-multirate.cc.
Referenced by Experiment(), and SendMultiDestinations().
|
private |
Grid size.
Definition at line 238 of file wifi-multirate.cc.
Referenced by Experiment(), AssignNeighbors(), and Run().
|
private |
Node distance.
Definition at line 239 of file wifi-multirate.cc.
Referenced by Experiment(), and Run().
|
private |
Output dataset.
Definition at line 230 of file wifi-multirate.cc.
Referenced by Experiment(), CheckThroughput(), and Run().
|
private |
Output file name.
Definition at line 260 of file wifi-multirate.cc.
Referenced by Experiment(), CommandSetup(), and GetOutputFileName().
|
private |
Packet size.
Definition at line 237 of file wifi-multirate.cc.
Referenced by Experiment(), ApplicationSetup(), and CommandSetup().
|
private |
Listening port.
Definition at line 240 of file wifi-multirate.cc.
Referenced by Experiment(), ApplicationSetup(), and SetupPacketReceive().
|
private |
Rate manager.
Definition at line 259 of file wifi-multirate.cc.
Referenced by Experiment(), CommandSetup(), and GetRateManager().
|
private |
Rts threshold.
Definition at line 258 of file wifi-multirate.cc.
Referenced by Experiment(), CommandSetup(), and GetRtsThreshold().
|
private |
Sampling period.
Definition at line 234 of file wifi-multirate.cc.
Referenced by Experiment(), CheckThroughput(), and CommandSetup().
|
private |
Scenario number.
Definition at line 241 of file wifi-multirate.cc.
Referenced by Experiment(), CommandSetup(), GetScenario(), and Run().
|
private |
Total experiment time.
Definition at line 232 of file wifi-multirate.cc.
Referenced by Experiment(), CommandSetup(), Run(), SelectSrcDest(), and SendMultiDestinations().