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

WiFi adhoc experiment class. More...

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

Public Member Functions

 Experiment ()
 Experiment (std::string name)
 Constructor.
Gnuplot2dDataset Run (const WifiHelper &wifi, const YansWifiPhyHelper &wifiPhy, const WifiMacHelper &wifiMac, const YansWifiChannelHelper &wifiChannel)
 Run an experiment.

Private Member Functions

void AdvancePosition (Ptr< Node > node)
 Move a node by 1m on the x axis, stops at 210m.
Vector GetPosition (Ptr< Node > node)
 Get the position of a node.
void ReceivePacket (Ptr< Socket > socket)
 Receive a packet.
void SetPosition (Ptr< Node > node, Vector position)
 Set the position of a node.
Ptr< SocketSetupPacketReceive (Ptr< Node > node)
 Setup the receiving socket.

Private Attributes

uint32_t m_bytesTotal
 The number of received bytes.
Gnuplot2dDataset m_output
 The output dataset.

Detailed Description

WiFi adhoc experiment class.

It handles the creation and run of an experiment.

Definition at line 43 of file wifi-adhoc.cc.

Constructor & Destructor Documentation

◆ Experiment() [1/2]

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

Definition at line 100 of file wifi-adhoc.cc.

◆ Experiment() [2/2]

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

Constructor.

Parameters
nameThe name of the experiment.

Definition at line 104 of file wifi-adhoc.cc.

References ns3::Gnuplot2dDataset::LINES, and m_output.

Member Function Documentation

◆ AdvancePosition()

void anonymous_namespace{wifi-adhoc.cc}::Experiment::AdvancePosition ( Ptr< Node > node)
private

Move a node by 1m on the x axis, stops at 210m.

Parameters
nodeThe node.

Definition at line 125 of file wifi-adhoc.cc.

References AdvancePosition(), GetPosition(), m_bytesTotal, m_output, ns3::Simulator::Schedule(), ns3::Seconds(), and SetPosition().

Referenced by AdvancePosition(), and Run().

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

◆ GetPosition()

Vector anonymous_namespace{wifi-adhoc.cc}::Experiment::GetPosition ( Ptr< Node > node)
private

Get the position of a node.

Parameters
nodeThe node.
Returns
the position of the node.

Definition at line 118 of file wifi-adhoc.cc.

Referenced by AdvancePosition().

Here is the caller graph for this function:

◆ ReceivePacket()

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

Receive a packet.

Parameters
socketThe receiving socket.

Definition at line 141 of file wifi-adhoc.cc.

References m_bytesTotal.

Referenced by SetupPacketReceive().

Here is the caller graph for this function:

◆ Run()

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

Run an experiment.

Parameters
wifi//!< The WifiHelper class.
wifiPhy//!< The YansWifiPhyHelper class.
wifiMac//!< The WifiMacHelper class.
wifiChannel//!< The YansWifiChannelHelper class.
Returns
a 2D dataset of the experiment data.

Definition at line 161 of file wifi-adhoc.cc.

References AdvancePosition(), ns3::NodeContainer::Create(), ns3::YansWifiChannelHelper::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), ns3::NodeContainer::Get(), ns3::PacketSocketHelper::Install(), m_bytesTotal, m_output, ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), ns3::PacketSocketAddress::SetPhysicalAddress(), ns3::PacketSocketAddress::SetProtocol(), ns3::PacketSocketAddress::SetSingleDevice(), SetupPacketReceive(), ns3::ApplicationContainer::Start(), and ns3::ApplicationContainer::Stop().

Here is the call graph for this function:

◆ SetPosition()

void anonymous_namespace{wifi-adhoc.cc}::Experiment::SetPosition ( Ptr< Node > node,
Vector position )
private

Set the position of a node.

Parameters
nodeThe node.
positionThe position of the node.

Definition at line 111 of file wifi-adhoc.cc.

Referenced by AdvancePosition().

Here is the caller graph for this function:

◆ SetupPacketReceive()

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

Setup the receiving socket.

Parameters
nodeThe receiving node.
Returns
the socket.

Definition at line 151 of file wifi-adhoc.cc.

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

Referenced by Run().

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-adhoc.cc}::Experiment::m_bytesTotal
private

The number of received bytes.

Definition at line 96 of file wifi-adhoc.cc.

Referenced by AdvancePosition(), ReceivePacket(), and Run().

◆ m_output

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

The output dataset.

Definition at line 97 of file wifi-adhoc.cc.

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


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