A Discrete-Event Network Simulator
API
wifi-bianchi.cc File Reference
#include <fstream>
#include "ns3/log.h"
#include "ns3/config.h"
#include "ns3/gnuplot.h"
#include "ns3/boolean.h"
#include "ns3/string.h"
#include "ns3/double.h"
#include "ns3/integer.h"
#include "ns3/uinteger.h"
#include "ns3/command-line.h"
#include "ns3/node-list.h"
#include "ns3/yans-wifi-helper.h"
#include "ns3/ssid.h"
#include "ns3/wifi-mac-header.h"
#include "ns3/queue-size.h"
#include "ns3/propagation-loss-model.h"
#include "ns3/propagation-delay-model.h"
#include "ns3/rng-seed-manager.h"
#include "ns3/mobility-helper.h"
#include "ns3/wifi-net-device.h"
#include "ns3/packet-socket-helper.h"
#include "ns3/packet-socket-client.h"
#include "ns3/packet-socket-server.h"
#include "ns3/application-container.h"
#include "ns3/ampdu-subframe-header.h"
#include "ns3/wifi-mac.h"
+ Include dependency graph for wifi-bianchi.cc:

Go to the source code of this file.

Classes

class  Experiment
 Helper class for UAN CW MAC example. More...
 

Macros

#define PI   3.1415926535
 

Functions

void AssociationLog (std::string context, Mac48Address address)
 
void BackoffTrace (std::string context, uint32_t newVal)
 
Mac48Address ContextToMac (std::string context)
 
uint32_t ContextToNodeId (std::string context)
 
void CwTrace (std::string context, uint32_t oldVal, uint32_t newVal)
 
void DisassociationLog (std::string context, Mac48Address address)
 
uint64_t GetCount (const std::map< Mac48Address, uint64_t > &counter, Mac48Address addr)
 
void IncrementCounter (std::map< Mac48Address, uint64_t > &counter, Mac48Address addr, uint64_t increment=1)
 
void MacRxTrace (std::string context, Ptr< const Packet > p)
 
void MacTxTrace (std::string context, Ptr< const Packet > p)
 
void PhyRxDoneTrace (std::string context, Ptr< const Packet > p)
 
void PhyRxDropTrace (std::string context, Ptr< const Packet > p, WifiPhyRxfailureReason reason)
 
void PhyRxErrorTrace (std::string context, Ptr< const Packet > p, double snr)
 
void PhyRxOkTrace (std::string context, Ptr< const Packet > p, double snr, WifiMode mode, WifiPreamble preamble)
 
void PhyRxPayloadTrace (std::string context, WifiTxVector txVector, Time psduDuration)
 
void PhyRxTrace (std::string context, Ptr< const Packet > p, RxPowerWattPerChannelBand power)
 
void PhyTxDoneTrace (std::string context, Ptr< const Packet > p)
 
void PhyTxTrace (std::string context, Ptr< const Packet > p, double txPowerW)
 
void RestartCalc ()
 
void SocketSendTrace (std::string context, Ptr< const Packet > p, const Address &addr)
 
void TracePacketReception (std::string context, Ptr< const Packet > p, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId)
 

Variables

std::set< uint32_t > associated
 Contains the IDs of the STAs that successfully associated to the access point (in infrastructure mode only) More...
 
std::ofstream backoffTraceFile
 File that traces backoff over time. More...
 
std::map< std::string, std::map< unsigned int, double > > bianchiResultsDifs
 
std::map< std::string, std::map< unsigned int, double > > bianchiResultsEifs
 
std::map< Mac48Address, uint64_t > bytesReceived
 Map that stores the total bytes received per STA (and addressed to that STA) More...
 
std::ofstream cwTraceFile
 File that traces CW over time. More...
 
std::ofstream macRxTraceFile
 File that traces MAC receptions over time. More...
 
std::ofstream macTxTraceFile
 File that traces MAC transmissions over time. More...
 
uint8_t maxMpdus = 0
 The maximum number of MPDUs in A-MPDUs (0 to disable MPDU aggregation) More...
 
std::map< Mac48Address, uint64_t > packetsReceived
 Map that stores the total packets received per STA (and addressed to that STA) More...
 
std::map< Mac48Address, uint64_t > packetsTransmitted
 Map that stores the total packets transmitted per STA. More...
 
std::map< Mac48Address, uint64_t > phyHeaderFailed
 Map that stores the total number of unsuccessfully received PHY headers per STA. More...
 
std::ofstream phyTxTraceFile
 File that traces PHY transmissions over time. More...
 
uint32_t pktSize = 1500
 packet size used for the simulation (in bytes) More...
 
std::map< Mac48Address, uint64_t > psduFailed
 Map that stores the total number of unsuccessfully received PSDUS (for which the PHY header was successfully received) per STA (including PSDUs not addressed to that STA) More...
 
std::map< Mac48Address, uint64_t > psduSucceeded
 Map that stores the total number of successfully received PSDUs per STA (including PSDUs not addressed to that STA) More...
 
std::map< Mac48Address, uint64_t > rxEventAbortedByTx
 Map that stores the number of reception events aborted per STA because the PHY has started to transmit. More...
 
std::map< Mac48Address, uint64_t > rxEventWhileDecodingPreamble
 Map that stores the number of reception events per STA that occured while PHY was already decoding a preamble. More...
 
std::map< Mac48Address, uint64_t > rxEventWhileRxing
 Map that stores the number of reception events per STA that occured while PHY was already receiving a PPDU. More...
 
std::map< Mac48Address, uint64_t > rxEventWhileTxing
 Map that stores the number of reception events per STA that occured while PHY was already transmitting a PPDU. More...
 
std::ofstream socketSendTraceFile
 File that traces packets transmitted by the application over time. More...
 
std::map< Mac48Address, TimetimeFirstReceived
 Map that stores the time at which the first packet was received per STA (and the packet is addressed to that STA) More...
 
std::map< Mac48Address, TimetimeFirstTransmitted
 Map that stores the time at which the first packet was transmitted per STA. More...
 
std::map< Mac48Address, TimetimeLastReceived
 Map that stores the time at which the last packet was received per STA (and the packet is addressed to that STA) More...
 
std::map< Mac48Address, TimetimeLastTransmitted
 Map that stores the time at which the last packet was transmitted per STA. More...
 
bool tracing = false
 Flag to enable/disable generation of tracing files. More...
 

Macro Definition Documentation

◆ PI

#define PI   3.1415926535

Definition at line 54 of file wifi-bianchi.cc.

Referenced by Experiment::Run().

Function Documentation

◆ AssociationLog()

void AssociationLog ( std::string  context,
Mac48Address  address 
)

Definition at line 802 of file wifi-bianchi.cc.

References associated, ContextToNodeId(), ns3::Simulator::Now(), NS_FATAL_ERROR, and NS_LOG_DEBUG.

Referenced by Experiment::Run().

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

◆ BackoffTrace()

void BackoffTrace ( std::string  context,
uint32_t  newVal 
)

Definition at line 610 of file wifi-bianchi.cc.

References backoffTraceFile, ContextToNodeId(), ns3::Time::GetSeconds(), ns3::Simulator::Now(), NS_LOG_INFO, and tracing.

Referenced by Experiment::Run().

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

◆ ContextToMac()

Mac48Address ContextToMac ( std::string  context)

Definition at line 524 of file wifi-bianchi.cc.

References ns3::Mac48Address::ConvertFrom(), ns3::WifiNetDevice::GetAddress(), ns3::NodeList::GetNode(), and sample-rng-plot::n.

Referenced by PhyRxDropTrace(), PhyRxErrorTrace(), PhyRxOkTrace(), PhyTxTrace(), and TracePacketReception().

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

◆ ContextToNodeId()

uint32_t ContextToNodeId ( std::string  context)

◆ CwTrace()

void CwTrace ( std::string  context,
uint32_t  oldVal,
uint32_t  newVal 
)

Definition at line 600 of file wifi-bianchi.cc.

References ContextToNodeId(), cwTraceFile, ns3::Time::GetSeconds(), ns3::Simulator::Now(), NS_LOG_INFO, and tracing.

Referenced by Experiment::Run().

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

◆ DisassociationLog()

void DisassociationLog ( std::string  context,
Mac48Address  address 
)

Definition at line 818 of file wifi-bianchi.cc.

References ContextToNodeId(), ns3::Simulator::Now(), NS_FATAL_ERROR, and NS_LOG_DEBUG.

Referenced by Experiment::Run().

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

◆ GetCount()

uint64_t GetCount ( const std::map< Mac48Address, uint64_t > &  counter,
Mac48Address  addr 
)

Definition at line 1054 of file wifi-bianchi.cc.

◆ IncrementCounter()

void IncrementCounter ( std::map< Mac48Address, uint64_t > &  counter,
Mac48Address  addr,
uint64_t  increment = 1 
)

Definition at line 545 of file wifi-bianchi.cc.

Referenced by PhyRxDropTrace(), PhyRxErrorTrace(), PhyRxOkTrace(), PhyTxTrace(), and TracePacketReception().

+ Here is the caller graph for this function:

◆ MacRxTrace()

void MacRxTrace ( std::string  context,
Ptr< const Packet p 
)

Definition at line 784 of file wifi-bianchi.cc.

References ContextToNodeId(), ns3::Time::GetSeconds(), ns3::Packet::GetSize(), macRxTraceFile, ns3::Simulator::Now(), and tracing.

Referenced by Experiment::Run().

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

◆ MacTxTrace()

void MacTxTrace ( std::string  context,
Ptr< const Packet p 
)

Definition at line 775 of file wifi-bianchi.cc.

References ContextToNodeId(), ns3::Time::GetSeconds(), ns3::Packet::GetSize(), macTxTraceFile, ns3::Simulator::Now(), and tracing.

Referenced by Experiment::Run().

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

◆ PhyRxDoneTrace()

void PhyRxDoneTrace ( std::string  context,
Ptr< const Packet p 
)

Definition at line 711 of file wifi-bianchi.cc.

References ContextToNodeId(), ns3::Packet::GetSize(), ns3::Simulator::Now(), and NS_LOG_INFO.

Referenced by Experiment::Run().

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

◆ PhyRxDropTrace()

◆ PhyRxErrorTrace()

void PhyRxErrorTrace ( std::string  context,
Ptr< const Packet p,
double  snr 
)

Definition at line 743 of file wifi-bianchi.cc.

References ContextToMac(), ContextToNodeId(), ns3::Packet::GetSize(), IncrementCounter(), ns3::Simulator::Now(), NS_LOG_INFO, pktSize, and psduFailed.

Referenced by Experiment::Run().

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

◆ PhyRxOkTrace()

void PhyRxOkTrace ( std::string  context,
Ptr< const Packet p,
double  snr,
WifiMode  mode,
WifiPreamble  preamble 
)

Definition at line 717 of file wifi-bianchi.cc.

References ContextToMac(), ContextToNodeId(), ns3::Packet::GetSize(), IncrementCounter(), maxMpdus, ns3::Simulator::Now(), NS_FATAL_ERROR, NS_LOG_INFO, NS_LOG_WARN, pktSize, psduSucceeded, and ns3::Time::S.

Referenced by Experiment::Run().

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

◆ PhyRxPayloadTrace()

void PhyRxPayloadTrace ( std::string  context,
WifiTxVector  txVector,
Time  psduDuration 
)

Definition at line 626 of file wifi-bianchi.cc.

References ContextToNodeId(), ns3::Simulator::Now(), and NS_LOG_INFO.

Referenced by Experiment::Run().

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

◆ PhyRxTrace()

void PhyRxTrace ( std::string  context,
Ptr< const Packet p,
RxPowerWattPerChannelBand  power 
)

Definition at line 620 of file wifi-bianchi.cc.

References ContextToNodeId(), ns3::Packet::GetSize(), ns3::Simulator::Now(), and NS_LOG_INFO.

Referenced by Experiment::Run().

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

◆ PhyTxDoneTrace()

void PhyTxDoneTrace ( std::string  context,
Ptr< const Packet p 
)

Definition at line 769 of file wifi-bianchi.cc.

References ContextToNodeId(), ns3::Packet::GetSize(), ns3::Simulator::Now(), and NS_LOG_INFO.

Referenced by Experiment::Run().

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

◆ PhyTxTrace()

void PhyTxTrace ( std::string  context,
Ptr< const Packet p,
double  txPowerW 
)

Definition at line 754 of file wifi-bianchi.cc.

References ContextToMac(), ContextToNodeId(), ns3::Time::GetSeconds(), ns3::Packet::GetSize(), IncrementCounter(), ns3::Simulator::Now(), NS_LOG_INFO, packetsTransmitted, phyTxTraceFile, pktSize, and tracing.

Referenced by Experiment::Run().

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

◆ RestartCalc()

◆ SocketSendTrace()

void SocketSendTrace ( std::string  context,
Ptr< const Packet p,
const Address addr 
)

Definition at line 793 of file wifi-bianchi.cc.

References ContextToNodeId(), ns3::Time::GetSeconds(), ns3::Packet::GetSize(), ns3::Simulator::Now(), socketSendTraceFile, and tracing.

Referenced by Experiment::Run().

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

◆ TracePacketReception()

void TracePacketReception ( std::string  context,
Ptr< const Packet p,
uint16_t  channelFreqMhz,
WifiTxVector  txVector,
MpduInfo  aMpdu,
SignalNoiseDbm  signalNoise,
uint16_t  staId 
)

Variable Documentation

◆ associated

std::set<uint32_t> associated

Contains the IDs of the STAs that successfully associated to the access point (in infrastructure mode only)

Definition at line 83 of file wifi-bianchi.cc.

Referenced by AssociationLog().

◆ backoffTraceFile

std::ofstream backoffTraceFile

File that traces backoff over time.

Definition at line 61 of file wifi-bianchi.cc.

Referenced by BackoffTrace(), and Experiment::Run().

◆ bianchiResultsDifs

std::map<std::string , std::map<unsigned int , double > > bianchiResultsDifs

Definition at line 301 of file wifi-bianchi.cc.

◆ bianchiResultsEifs

std::map<std::string , std::map<unsigned int , double > > bianchiResultsEifs

Definition at line 89 of file wifi-bianchi.cc.

◆ bytesReceived

std::map<Mac48Address, uint64_t> bytesReceived

Map that stores the total bytes received per STA (and addressed to that STA)

Definition at line 68 of file wifi-bianchi.cc.

Referenced by RestartCalc(), and TracePacketReception().

◆ cwTraceFile

std::ofstream cwTraceFile

File that traces CW over time.

Definition at line 60 of file wifi-bianchi.cc.

Referenced by CwTrace(), and Experiment::Run().

◆ macRxTraceFile

std::ofstream macRxTraceFile

File that traces MAC receptions over time.

Definition at line 64 of file wifi-bianchi.cc.

Referenced by MacRxTrace(), and Experiment::Run().

◆ macTxTraceFile

std::ofstream macTxTraceFile

File that traces MAC transmissions over time.

Definition at line 63 of file wifi-bianchi.cc.

Referenced by MacTxTrace(), and Experiment::Run().

◆ maxMpdus

uint8_t maxMpdus = 0

The maximum number of MPDUs in A-MPDUs (0 to disable MPDU aggregation)

Definition at line 87 of file wifi-bianchi.cc.

Referenced by PhyRxOkTrace(), and Experiment::Run().

◆ packetsReceived

std::map<Mac48Address, uint64_t> packetsReceived

Map that stores the total packets received per STA (and addressed to that STA)

Definition at line 67 of file wifi-bianchi.cc.

Referenced by VanetRoutingExperiment::CheckThroughput(), RestartCalc(), and TracePacketReception().

◆ packetsTransmitted

std::map<Mac48Address, uint64_t> packetsTransmitted

Map that stores the total packets transmitted per STA.

Definition at line 69 of file wifi-bianchi.cc.

Referenced by PhyTxTrace(), and RestartCalc().

◆ phyHeaderFailed

std::map<Mac48Address, uint64_t> phyHeaderFailed

Map that stores the total number of unsuccessfully received PHY headers per STA.

Definition at line 72 of file wifi-bianchi.cc.

Referenced by PhyRxDropTrace(), and RestartCalc().

◆ phyTxTraceFile

std::ofstream phyTxTraceFile

File that traces PHY transmissions over time.

Definition at line 62 of file wifi-bianchi.cc.

Referenced by PhyTxTrace(), and Experiment::Run().

◆ pktSize

uint32_t pktSize = 1500

packet size used for the simulation (in bytes)

Definition at line 86 of file wifi-bianchi.cc.

Referenced by ns3::TcpRxBuffer::Add(), CreateBulkFlow(), ns3::TcpTxBuffer::DiscardUpTo(), ns3::TbfQueueDisc::DoDequeue(), ns3::SubscriberStationNetDevice::DoReceive(), SpectrumIdealPhyTestCase::DoRun(), CobaltQueueDiscBasicEnqueueDequeue::DoRun(), CoDelQueueDiscBasicEnqueueDequeue::DoRun(), CoDelQueueDiscBasicOverflow::DoRun(), CobaltQueueDiscMarkTest::DoRun(), CoDelQueueDiscBasicDrop::DoRun(), CoDelQueueDiscBasicMark::DoRun(), CobaltQueueDiscCeThresholdTest::DoRun(), CobaltQueueDiscEnhancedBlueTest::DoRun(), FifoQueueDiscTestCase::DoRunFifoTest(), ns3::SixLowPanNetDevice::DoSend(), ns3::TcpRxBuffer::Extract(), ns3::TapBridge::Filter(), Experiment::GenerateTraffic(), GenerateTraffic(), ns3::BsmApplication::GenerateWaveTraffic(), TestInterBssConstantObssPdAlgo::NotifyPhyRxDrop(), TestInterBssConstantObssPdAlgo::NotifyPhyRxEnd(), TestInterBssConstantObssPdAlgo::NotifyPhyTxBegin(), PhyRxDropTrace(), PhyRxErrorTrace(), PhyRxOkTrace(), WifiPhyStats::PhyTxTrace(), PhyTxTrace(), Experiment::Run(), AredQueueDiscTestCase::RunAredDiscTest(), CobaltQueueDiscDropTest::RunDropTest(), FifoQueueDiscTestCase::RunFifoTest(), PieQueueDiscTestCase::RunPieTest(), RedQueueDiscTestCase::RunRedTest(), TbfQueueDiscTestCase::RunTbfTest(), SendPacket(), ns3::TcpGeneralTest::SendPacket(), ns3::Ipv4RawSocketImpl::SendTo(), ns3::Ipv6RawSocketImpl::SendTo(), ns3::PacketSocket::SendTo(), ns3::TcpGeneralTest::SetAppPktSize(), TracePacketReception(), and ns3::TcpTxBuffer::Update().

◆ psduFailed

std::map<Mac48Address, uint64_t> psduFailed

Map that stores the total number of unsuccessfully received PSDUS (for which the PHY header was successfully received) per STA (including PSDUs not addressed to that STA)

Definition at line 70 of file wifi-bianchi.cc.

Referenced by PhyRxErrorTrace(), and RestartCalc().

◆ psduSucceeded

std::map<Mac48Address, uint64_t> psduSucceeded

Map that stores the total number of successfully received PSDUs per STA (including PSDUs not addressed to that STA)

Definition at line 71 of file wifi-bianchi.cc.

Referenced by PhyRxOkTrace(), and RestartCalc().

◆ rxEventAbortedByTx

std::map<Mac48Address, uint64_t> rxEventAbortedByTx

Map that stores the number of reception events aborted per STA because the PHY has started to transmit.

Definition at line 76 of file wifi-bianchi.cc.

Referenced by PhyRxDropTrace(), and RestartCalc().

◆ rxEventWhileDecodingPreamble

std::map<Mac48Address, uint64_t> rxEventWhileDecodingPreamble

Map that stores the number of reception events per STA that occured while PHY was already decoding a preamble.

Definition at line 75 of file wifi-bianchi.cc.

Referenced by PhyRxDropTrace(), and RestartCalc().

◆ rxEventWhileRxing

std::map<Mac48Address, uint64_t> rxEventWhileRxing

Map that stores the number of reception events per STA that occured while PHY was already receiving a PPDU.

Definition at line 74 of file wifi-bianchi.cc.

Referenced by PhyRxDropTrace(), and RestartCalc().

◆ rxEventWhileTxing

std::map<Mac48Address, uint64_t> rxEventWhileTxing

Map that stores the number of reception events per STA that occured while PHY was already transmitting a PPDU.

Definition at line 73 of file wifi-bianchi.cc.

Referenced by PhyRxDropTrace(), and RestartCalc().

◆ socketSendTraceFile

std::ofstream socketSendTraceFile

File that traces packets transmitted by the application over time.

Definition at line 65 of file wifi-bianchi.cc.

Referenced by Experiment::Run(), and SocketSendTrace().

◆ timeFirstReceived

std::map<Mac48Address, Time> timeFirstReceived

Map that stores the time at which the first packet was received per STA (and the packet is addressed to that STA)

Definition at line 78 of file wifi-bianchi.cc.

Referenced by RestartCalc(), and TracePacketReception().

◆ timeFirstTransmitted

std::map<Mac48Address, Time> timeFirstTransmitted

Map that stores the time at which the first packet was transmitted per STA.

Definition at line 80 of file wifi-bianchi.cc.

◆ timeLastReceived

std::map<Mac48Address, Time> timeLastReceived

Map that stores the time at which the last packet was received per STA (and the packet is addressed to that STA)

Definition at line 79 of file wifi-bianchi.cc.

Referenced by RestartCalc(), and TracePacketReception().

◆ timeLastTransmitted

std::map<Mac48Address, Time> timeLastTransmitted

Map that stores the time at which the last packet was transmitted per STA.

Definition at line 81 of file wifi-bianchi.cc.

◆ tracing

bool tracing = false

Flag to enable/disable generation of tracing files.

Definition at line 85 of file wifi-bianchi.cc.

Referenced by BackoffTrace(), CwTrace(), MacRxTrace(), MacTxTrace(), PhyTxTrace(), Experiment::Run(), and SocketSendTrace().