A Discrete-Event Network Simulator
API
NodeStatistics Class Reference

Class to collect node statistics. More...

+ Collaboration diagram for NodeStatistics:

Public Member Functions

 NodeStatistics (NetDeviceContainer aps, NetDeviceContainer stas)
 Constructor. More...
 
 NodeStatistics (NetDeviceContainer aps, NetDeviceContainer stas)
 Constructor. More...
 
 NodeStatistics (NetDeviceContainer aps, NetDeviceContainer stas)
 Constructor. More...
 
void AdvancePosition (Ptr< Node > node, int stepsSize, int stepsTime)
 Move a node. More...
 
void AdvancePosition (Ptr< Node > node, int stepsSize, int stepsTime)
 Advance node position. More...
 
void CheckStatistics (double time)
 Collects the statistics at a given time. More...
 
Gnuplot2dDataset GetBusyDatafile ()
 Get the BUSY state output data. More...
 
double GetBusyTime ()
 Get the Busy time. More...
 
Gnuplot2dDataset GetDatafile ()
 Get the Throughput output data. More...
 
Gnuplot2dDataset GetDatafile ()
 Get the Throughput output data. More...
 
Gnuplot2dDataset GetDatafile ()
 
Gnuplot2dDataset GetIdleDatafile ()
 Get the IDLE state output data. More...
 
Vector GetPosition (Ptr< Node > node)
 Get the Position of a node. More...
 
Vector GetPosition (Ptr< Node > node)
 Get node position. More...
 
Gnuplot2dDataset GetPowerDatafile ()
 Get the Power output data. More...
 
Gnuplot2dDataset GetPowerDatafile ()
 Get the Power output data. More...
 
Gnuplot2dDataset GetRxDatafile ()
 Get the RX state output data. More...
 
Gnuplot2dDataset GetTxDatafile ()
 Get the TX state output data. More...
 
void PhyCallback (std::string path, Ptr< const Packet > packet, double powerW)
 Callback called by WifiNetDevice/Phy/PhyTxBegin. More...
 
void PhyCallback (std::string path, Ptr< const Packet > packet, double powerW)
 Callback called by WifiNetDevice/Phy/PhyTxBegin. More...
 
void PowerCallback (std::string path, double oldPower, double newPower, Mac48Address dest)
 Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange. More...
 
void PowerCallback (std::string path, double oldPower, double newPower, Mac48Address dest)
 Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange. More...
 
void RateCallback (std::string path, DataRate oldRate, DataRate newRate, Mac48Address dest)
 Callback called by WifiNetDevice/RemoteStationManager/x/RateChange. More...
 
void RateCallback (std::string path, DataRate oldRate, DataRate newRate, Mac48Address dest)
 Callback called by WifiNetDevice/RemoteStationManager/x/RateChange. More...
 
void RxCallback (std::string path, Ptr< const Packet > packet, const Address &from)
 Callback called by PacketSink/Rx. More...
 
void RxCallback (std::string path, Ptr< const Packet > packet, const Address &from)
 Callback called by PacketSink/Rx. More...
 
void RxCallback (std::string path, Ptr< const Packet > packet, const Address &from)
 RX callback. More...
 
void SetPosition (Ptr< Node > node, Vector position)
 Set the Position of a node. More...
 
void SetPosition (Ptr< Node > node, Vector position)
 Set node position. More...
 
void StateCallback (std::string path, Time init, Time duration, WifiPhyState state)
 Callback called by YansWifiPhy/State/State. More...
 

Private Types

typedef std::vector< std::pair< Time, DataRate > > TxTime
 Time, DataRate pair vector. More...
 
typedef std::vector< std::pair< Time, DataRate > > TxTime
 Time, DataRate pair vector. More...
 

Private Member Functions

Time GetCalcTxTime (DataRate rate)
 Get the time at which a given datarate has been recorded. More...
 
Time GetCalcTxTime (DataRate rate)
 Get the time at which a given datarate has been recorded. More...
 
void SetupPhy (Ptr< WifiPhy > phy)
 Setup the WifiPhy object. More...
 
void SetupPhy (Ptr< WifiPhy > phy)
 Setup the WifiPhy object. More...
 

Private Attributes

double busyTime
 BUSY time. More...
 
double idleTime
 IDLE time. More...
 
uint32_t m_bytesTotal
 Number of received bytes on a given state. More...
 
std::map< Mac48Address, doublem_currentPower
 Current Tx power for each sender. More...
 
std::map< Mac48Address, DataRatem_currentRate
 Current Tx rate for each sender. More...
 
Gnuplot2dDataset m_output
 Throughput output data. More...
 
Gnuplot2dDataset m_output_busy
 BUSY output data. More...
 
Gnuplot2dDataset m_output_idle
 IDLE output data. More...
 
Gnuplot2dDataset m_output_power
 Power output data. More...
 
Gnuplot2dDataset m_output_rx
 RX output data. More...
 
Gnuplot2dDataset m_output_tx
 TX output data. More...
 
TxTime m_timeTable
 Time, DataRate table. More...
 
double m_totalBusyTime
 Total time in BUSY state. More...
 
double m_totalEnergy
 Energy used on a given state. More...
 
double m_totalIdleTime
 Total time in IDLE state. More...
 
double m_totalRxTime
 Total time in RX state. More...
 
double m_totalTime
 Time spent on a given state. More...
 
double m_totalTxTime
 Total time in TX state. More...
 
double rxTime
 RX time. More...
 
double txTime
 TX time. More...
 

Detailed Description

Class to collect node statistics.

Node statistics.

Definition at line 117 of file wifi-power-adaptation-distance.cc.

Member Typedef Documentation

◆ TxTime [1/2]

typedef std::vector<std::pair<Time, DataRate> > NodeStatistics::TxTime
private

Time, DataRate pair vector.

Definition at line 200 of file wifi-power-adaptation-distance.cc.

◆ TxTime [2/2]

typedef std::vector<std::pair<Time, DataRate> > NodeStatistics::TxTime
private

Time, DataRate pair vector.

Definition at line 196 of file wifi-power-adaptation-interference.cc.

Constructor & Destructor Documentation

◆ NodeStatistics() [1/3]

NodeStatistics::NodeStatistics ( NetDeviceContainer  aps,
NetDeviceContainer  stas 
)

◆ NodeStatistics() [2/3]

NodeStatistics::NodeStatistics ( NetDeviceContainer  aps,
NetDeviceContainer  stas 
)

Constructor.

Parameters
apsAccess points
stasWiFi Stations.

◆ NodeStatistics() [3/3]

NodeStatistics::NodeStatistics ( NetDeviceContainer  aps,
NetDeviceContainer  stas 
)

Constructor.

Parameters
apsAP devices
stasSTA devices

Member Function Documentation

◆ AdvancePosition() [1/2]

void NodeStatistics::AdvancePosition ( Ptr< Node node,
int  stepsSize,
int  stepsTime 
)

Move a node.

Parameters
nodeThe node.
stepsSizeThe step size.
stepsTimeTime on each step.

Definition at line 326 of file wifi-power-adaptation-distance.cc.

References ns3::Gnuplot2dDataset::Add(), AdvancePosition(), GetPosition(), m_bytesTotal, m_output, m_output_power, m_totalEnergy, m_totalTime, ns3::Now(), NS_LOG_INFO, ns3::Seconds(), and SetPosition().

Referenced by AdvancePosition().

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

◆ AdvancePosition() [2/2]

void NodeStatistics::AdvancePosition ( Ptr< Node node,
int  stepsSize,
int  stepsTime 
)

Advance node position.

Parameters
nodethe node
stepsSizethe size of a step
stepsTimethe time interval between steps

◆ CheckStatistics()

void NodeStatistics::CheckStatistics ( double  time)

Collects the statistics at a given time.

Parameters
timeTime at which the statistics are collected.

Definition at line 356 of file wifi-power-adaptation-interference.cc.

References ns3::Gnuplot2dDataset::Add(), busyTime, CheckStatistics(), idleTime, m_bytesTotal, m_output, m_output_busy, m_output_idle, m_output_power, m_output_rx, m_output_tx, m_totalEnergy, m_totalTime, ns3::Now(), rxTime, ns3::Seconds(), and txTime.

Referenced by CheckStatistics().

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

◆ GetBusyDatafile()

Gnuplot2dDataset NodeStatistics::GetBusyDatafile ( )

Get the BUSY state output data.

Returns
the BUSY state output data.

Definition at line 397 of file wifi-power-adaptation-interference.cc.

References m_output_busy.

◆ GetBusyTime()

double NodeStatistics::GetBusyTime ( )

Get the Busy time.

Returns
the busy time.

Definition at line 415 of file wifi-power-adaptation-interference.cc.

References m_totalBusyTime, and m_totalRxTime.

◆ GetCalcTxTime() [1/2]

Time NodeStatistics::GetCalcTxTime ( DataRate  rate)
private

Get the time at which a given datarate has been recorded.

Parameters
rateThe datarate to search.
Returns
the time.

Definition at line 266 of file wifi-power-adaptation-distance.cc.

References m_timeTable, NS_ASSERT, and ns3::Seconds().

Referenced by PhyCallback().

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

◆ GetCalcTxTime() [2/2]

Time NodeStatistics::GetCalcTxTime ( DataRate  rate)
private

Get the time at which a given datarate has been recorded.

Parameters
rateThe datarate to search.
Returns
the time.

◆ GetDatafile() [1/3]

Gnuplot2dDataset NodeStatistics::GetDatafile ( )

Get the Throughput output data.

Returns
the Throughput output data.

Definition at line 343 of file wifi-power-adaptation-distance.cc.

References m_output.

◆ GetDatafile() [2/3]

Gnuplot2dDataset NodeStatistics::GetDatafile ( )

Get the Throughput output data.

Returns
the Throughput output data.

◆ GetDatafile() [3/3]

Gnuplot2dDataset NodeStatistics::GetDatafile ( )
Returns
the gnuplot 2d dataset

◆ GetIdleDatafile()

Gnuplot2dDataset NodeStatistics::GetIdleDatafile ( )

Get the IDLE state output data.

Returns
the IDLE state output data.

Definition at line 391 of file wifi-power-adaptation-interference.cc.

References m_output_idle.

◆ GetPosition() [1/2]

Vector NodeStatistics::GetPosition ( Ptr< Node node)

Get the Position of a node.

Parameters
nodeThe node.
Returns
the position of the node.

Definition at line 319 of file wifi-power-adaptation-distance.cc.

References ns3::Object::GetObject(), and third::mobility.

Referenced by AdvancePosition().

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

◆ GetPosition() [2/2]

Vector NodeStatistics::GetPosition ( Ptr< Node node)

Get node position.

Parameters
nodethe node
Returns
the position

◆ GetPowerDatafile() [1/2]

Gnuplot2dDataset NodeStatistics::GetPowerDatafile ( )

Get the Power output data.

Returns
the Power output data.

Definition at line 349 of file wifi-power-adaptation-distance.cc.

References m_output_power.

◆ GetPowerDatafile() [2/2]

Gnuplot2dDataset NodeStatistics::GetPowerDatafile ( )

Get the Power output data.

Returns
the Power output data.

◆ GetRxDatafile()

Gnuplot2dDataset NodeStatistics::GetRxDatafile ( )

Get the RX state output data.

Returns
the RX state output data.

Definition at line 403 of file wifi-power-adaptation-interference.cc.

References m_output_rx.

◆ GetTxDatafile()

Gnuplot2dDataset NodeStatistics::GetTxDatafile ( )

Get the TX state output data.

Returns
the TX state output data.

Definition at line 409 of file wifi-power-adaptation-interference.cc.

References m_output_tx.

◆ PhyCallback() [1/2]

void NodeStatistics::PhyCallback ( std::string  path,
Ptr< const Packet packet,
double  powerW 
)

Callback called by WifiNetDevice/Phy/PhyTxBegin.

Parameters
pathThe trace path.
packetThe sent packet.
powerWThe Tx power.

Definition at line 280 of file wifi-power-adaptation-distance.cc.

References ns3::WifiMacHeader::GetAddr1(), GetCalcTxTime(), ns3::Time::GetSeconds(), ns3::WifiMacHeader::GetType(), m_currentPower, m_currentRate, m_totalEnergy, m_totalTime, ns3::Packet::PeekHeader(), and ns3::WIFI_MAC_DATA.

+ Here is the call graph for this function:

◆ PhyCallback() [2/2]

void NodeStatistics::PhyCallback ( std::string  path,
Ptr< const Packet packet,
double  powerW 
)

Callback called by WifiNetDevice/Phy/PhyTxBegin.

Parameters
pathThe trace path.
packetThe sent packet.
powerWThe Tx power.

◆ PowerCallback() [1/2]

void NodeStatistics::PowerCallback ( std::string  path,
double  oldPower,
double  newPower,
Mac48Address  dest 
)

Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange.

Parameters
pathThe trace path.
oldPowerOld Tx power.
newPowerActual Tx power.
destDestination of the transmission.

Definition at line 294 of file wifi-power-adaptation-distance.cc.

References m_currentPower.

◆ PowerCallback() [2/2]

void NodeStatistics::PowerCallback ( std::string  path,
double  oldPower,
double  newPower,
Mac48Address  dest 
)

Callback called by WifiNetDevice/RemoteStationManager/x/PowerChange.

Parameters
pathThe trace path.
oldPowerOld Tx power.
newPowerActual Tx power.
destDestination of the transmission.

◆ RateCallback() [1/2]

void NodeStatistics::RateCallback ( std::string  path,
DataRate  oldRate,
DataRate  newRate,
Mac48Address  dest 
)

Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.

Parameters
pathThe trace path.
oldRateOld rate.
newRateActual rate.
destDestination of the transmission.

Definition at line 300 of file wifi-power-adaptation-distance.cc.

References m_currentRate.

◆ RateCallback() [2/2]

void NodeStatistics::RateCallback ( std::string  path,
DataRate  oldRate,
DataRate  newRate,
Mac48Address  dest 
)

Callback called by WifiNetDevice/RemoteStationManager/x/RateChange.

Parameters
pathThe trace path.
oldRateOld rate.
newRateActual rate.
destDestination of the transmission.

◆ RxCallback() [1/3]

void NodeStatistics::RxCallback ( std::string  path,
Ptr< const Packet packet,
const Address from 
)

Callback called by PacketSink/Rx.

Parameters
pathThe trace path.
packetThe received packet.
fromThe sender address.

Definition at line 306 of file wifi-power-adaptation-distance.cc.

References ns3::Packet::GetSize(), and m_bytesTotal.

+ Here is the call graph for this function:

◆ RxCallback() [2/3]

void NodeStatistics::RxCallback ( std::string  path,
Ptr< const Packet packet,
const Address from 
)

Callback called by PacketSink/Rx.

Parameters
pathThe trace path.
packetThe received packet.
fromThe sender address.

◆ RxCallback() [3/3]

void NodeStatistics::RxCallback ( std::string  path,
Ptr< const Packet packet,
const Address from 
)

RX callback.

Parameters
pathpath
packetreceived packet
fromsender

◆ SetPosition() [1/2]

void NodeStatistics::SetPosition ( Ptr< Node node,
Vector  position 
)

Set the Position of a node.

Parameters
nodeThe node.
positionThe position.

Definition at line 312 of file wifi-power-adaptation-distance.cc.

References ns3::Object::GetObject(), and third::mobility.

Referenced by AdvancePosition().

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

◆ SetPosition() [2/2]

void NodeStatistics::SetPosition ( Ptr< Node node,
Vector  position 
)

Set node position.

Parameters
nodethe node
positionthe position

◆ SetupPhy() [1/2]

void NodeStatistics::SetupPhy ( Ptr< WifiPhy phy)
private

Setup the WifiPhy object.

Parameters
phyThe WifiPhy to setup.

Definition at line 250 of file wifi-power-adaptation-distance.cc.

References ns3::Time::GetSeconds(), m_timeTable, NS_LOG_DEBUG, packetSize, third::phy, ns3::WifiTxVector::SetChannelWidth(), ns3::WifiTxVector::SetMode(), ns3::WifiTxVector::SetPreambleType(), and ns3::WIFI_PREAMBLE_LONG.

Referenced by NodeStatistics().

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

◆ SetupPhy() [2/2]

void NodeStatistics::SetupPhy ( Ptr< WifiPhy phy)
private

Setup the WifiPhy object.

Parameters
phyThe WifiPhy to setup.

◆ StateCallback()

void NodeStatistics::StateCallback ( std::string  path,
Time  init,
Time  duration,
WifiPhyState  state 
)

Callback called by YansWifiPhy/State/State.

Parameters
pathThe trace path.
initTime when the state started.
durationAmount of time we've been in (or will be in) the state.
stateThe state.

Definition at line 325 of file wifi-power-adaptation-interference.cc.

References busyTime, CCA_BUSY, ns3::Time::GetSeconds(), IDLE, idleTime, m_totalBusyTime, m_totalIdleTime, m_totalRxTime, m_totalTxTime, RX, rxTime, TX, and txTime.

+ Here is the call graph for this function:

Member Data Documentation

◆ busyTime

double NodeStatistics::busyTime
private

BUSY time.

Definition at line 216 of file wifi-power-adaptation-interference.cc.

Referenced by CheckStatistics(), and StateCallback().

◆ idleTime

double NodeStatistics::idleTime
private

IDLE time.

Definition at line 217 of file wifi-power-adaptation-interference.cc.

Referenced by CheckStatistics(), and StateCallback().

◆ m_bytesTotal

uint32_t NodeStatistics::m_bytesTotal
private

Number of received bytes on a given state.

total bytes

Number of received bytes.

Definition at line 217 of file wifi-power-adaptation-distance.cc.

Referenced by NodeStatistics(), AdvancePosition(), CheckStatistics(), and RxCallback().

◆ m_currentPower

std::map< Mac48Address, double > NodeStatistics::m_currentPower
private

Current Tx power for each sender.

Definition at line 215 of file wifi-power-adaptation-distance.cc.

Referenced by NodeStatistics(), PhyCallback(), and PowerCallback().

◆ m_currentRate

std::map< Mac48Address, DataRate > NodeStatistics::m_currentRate
private

Current Tx rate for each sender.

Definition at line 216 of file wifi-power-adaptation-distance.cc.

Referenced by NodeStatistics(), PhyCallback(), and RateCallback().

◆ m_output

Gnuplot2dDataset NodeStatistics::m_output
private

Throughput output data.

gnuplot 2d dataset

Definition at line 221 of file wifi-power-adaptation-distance.cc.

Referenced by NodeStatistics(), AdvancePosition(), CheckStatistics(), and GetDatafile().

◆ m_output_busy

Gnuplot2dDataset NodeStatistics::m_output_busy
private

BUSY output data.

Definition at line 228 of file wifi-power-adaptation-interference.cc.

Referenced by CheckStatistics(), and GetBusyDatafile().

◆ m_output_idle

Gnuplot2dDataset NodeStatistics::m_output_idle
private

IDLE output data.

Definition at line 227 of file wifi-power-adaptation-interference.cc.

Referenced by CheckStatistics(), and GetIdleDatafile().

◆ m_output_power

Gnuplot2dDataset NodeStatistics::m_output_power
private

Power output data.

Definition at line 222 of file wifi-power-adaptation-distance.cc.

Referenced by NodeStatistics(), AdvancePosition(), CheckStatistics(), and GetPowerDatafile().

◆ m_output_rx

Gnuplot2dDataset NodeStatistics::m_output_rx
private

RX output data.

Definition at line 229 of file wifi-power-adaptation-interference.cc.

Referenced by CheckStatistics(), and GetRxDatafile().

◆ m_output_tx

Gnuplot2dDataset NodeStatistics::m_output_tx
private

TX output data.

Definition at line 230 of file wifi-power-adaptation-interference.cc.

Referenced by CheckStatistics(), and GetTxDatafile().

◆ m_timeTable

TxTime NodeStatistics::m_timeTable
private

Time, DataRate table.

Definition at line 220 of file wifi-power-adaptation-distance.cc.

Referenced by GetCalcTxTime(), and SetupPhy().

◆ m_totalBusyTime

double NodeStatistics::m_totalBusyTime
private

Total time in BUSY state.

Definition at line 220 of file wifi-power-adaptation-interference.cc.

Referenced by GetBusyTime(), and StateCallback().

◆ m_totalEnergy

double NodeStatistics::m_totalEnergy
private

Energy used on a given state.

Energy used.

Definition at line 218 of file wifi-power-adaptation-distance.cc.

Referenced by NodeStatistics(), AdvancePosition(), CheckStatistics(), and PhyCallback().

◆ m_totalIdleTime

double NodeStatistics::m_totalIdleTime
private

Total time in IDLE state.

Definition at line 221 of file wifi-power-adaptation-interference.cc.

Referenced by StateCallback().

◆ m_totalRxTime

double NodeStatistics::m_totalRxTime
private

Total time in RX state.

Definition at line 223 of file wifi-power-adaptation-interference.cc.

Referenced by GetBusyTime(), and StateCallback().

◆ m_totalTime

double NodeStatistics::m_totalTime
private

Time spent on a given state.

Time spent.

Definition at line 219 of file wifi-power-adaptation-distance.cc.

Referenced by NodeStatistics(), AdvancePosition(), CheckStatistics(), and PhyCallback().

◆ m_totalTxTime

double NodeStatistics::m_totalTxTime
private

Total time in TX state.

Definition at line 222 of file wifi-power-adaptation-interference.cc.

Referenced by StateCallback().

◆ rxTime

double NodeStatistics::rxTime
private

RX time.

Definition at line 219 of file wifi-power-adaptation-interference.cc.

Referenced by CheckStatistics(), and StateCallback().

◆ txTime

double NodeStatistics::txTime
private

TX time.

Definition at line 218 of file wifi-power-adaptation-interference.cc.

Referenced by CheckStatistics(), and StateCallback().


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