A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-bianchi.cc File Reference

Example comparing ns-3 to the Bianchi model. More...

#include "ns3/ampdu-subframe-header.h"
#include "ns3/application-container.h"
#include "ns3/boolean.h"
#include "ns3/command-line.h"
#include "ns3/config.h"
#include "ns3/double.h"
#include "ns3/gnuplot.h"
#include "ns3/integer.h"
#include "ns3/log.h"
#include "ns3/mobility-helper.h"
#include "ns3/node-list.h"
#include "ns3/packet-socket-client.h"
#include "ns3/packet-socket-helper.h"
#include "ns3/packet-socket-server.h"
#include "ns3/propagation-delay-model.h"
#include "ns3/propagation-loss-model.h"
#include "ns3/queue-size.h"
#include "ns3/rng-seed-manager.h"
#include "ns3/ssid.h"
#include "ns3/string.h"
#include "ns3/uinteger.h"
#include "ns3/wifi-mac-header.h"
#include "ns3/wifi-mac.h"
#include "ns3/wifi-net-device.h"
#include "ns3/wifi-phy-rx-trace-helper.h"
#include "ns3/wifi-tx-stats-helper.h"
#include "ns3/yans-wifi-helper.h"
#include <fstream>
#include <iomanip>
#include <vector>
Include dependency graph for wifi-bianchi.cc:

Go to the source code of this file.

Classes

class  anonymous_namespace{wifi-bianchi.cc}::Experiment
 Class to configure and run an experiment. More...

Namespaces

namespace  anonymous_namespace{wifi-bianchi.cc}
 Unnamed namespace, to disambiguate class Experiment.

Macros

#define PI   3.1415926535
 Avoid std::numbers::pi because it's C++20.

Functions

void anonymous_namespace{wifi-bianchi.cc}::AssociationLog (std::string context, Mac48Address address)
 Association log trace.
void anonymous_namespace{wifi-bianchi.cc}::BackoffTrace (std::string context, uint32_t newVal, uint8_t)
 Backoff trace.
Mac48Address anonymous_namespace{wifi-bianchi.cc}::ContextToMac (std::string context)
 Parse context strings of the form "/NodeList/x/DeviceList/x/..." and fetch the Mac address.
uint32_t anonymous_namespace{wifi-bianchi.cc}::ContextToNodeId (std::string context)
 Parse context strings of the form "/NodeList/x/DeviceList/x/..." to extract the NodeId integer.
void anonymous_namespace{wifi-bianchi.cc}::CwTrace (std::string context, uint32_t cw, uint8_t)
 Contention window trace.
void anonymous_namespace{wifi-bianchi.cc}::DisassociationLog (std::string context, Mac48Address address)
 Deassociation log trace.
uint64_t anonymous_namespace{wifi-bianchi.cc}::GetCount (const std::map< Mac48Address, uint64_t > &counter, Mac48Address addr)
 Get the Counter associated with a MAC address.
void anonymous_namespace{wifi-bianchi.cc}::IncrementCounter (std::map< Mac48Address, uint64_t > &counter, Mac48Address addr, uint64_t increment=1)
 Increment the counter for a given address.
void anonymous_namespace{wifi-bianchi.cc}::MacRxTrace (std::string context, Ptr< const Packet > p)
 MAC RX trace.
void anonymous_namespace{wifi-bianchi.cc}::MacTxTrace (std::string context, Ptr< const Packet > p)
 MAC TX trace.
void anonymous_namespace{wifi-bianchi.cc}::PhyRxDoneTrace (std::string context, Ptr< const Packet > p)
 PHY RX end trace.
void anonymous_namespace{wifi-bianchi.cc}::PhyRxDropTrace (std::string context, Ptr< const Packet > p, WifiPhyRxfailureReason reason)
 PHY Drop trace.
void anonymous_namespace{wifi-bianchi.cc}::PhyRxErrorTrace (std::string context, Ptr< const Packet > p, double snr)
 PHY RX error trace.
void anonymous_namespace{wifi-bianchi.cc}::PhyRxOkTrace (std::string context, Ptr< const Packet > p, double snr, WifiMode mode, WifiPreamble preamble)
 PHY successful RX trace.
void anonymous_namespace{wifi-bianchi.cc}::PhyRxPayloadTrace (std::string context, WifiTxVector txVector, Time psduDuration)
 PHY Rx trace.
void anonymous_namespace{wifi-bianchi.cc}::PhyRxTrace (std::string context, Ptr< const Packet > p, RxPowerWattPerChannelBand power)
 PHY Rx trace.
void anonymous_namespace{wifi-bianchi.cc}::PhyTxDoneTrace (std::string context, Ptr< const Packet > p)
 PHY TX end trace.
void anonymous_namespace{wifi-bianchi.cc}::PhyTxTrace (std::string context, Ptr< const Packet > p, double txPowerW)
 PHY TX trace.
void anonymous_namespace{wifi-bianchi.cc}::RestartCalc ()
 Reset the stats.
void anonymous_namespace{wifi-bianchi.cc}::SocketSendTrace (std::string context, Ptr< const Packet > p, const Address &addr)
 Socket send trace.
void anonymous_namespace{wifi-bianchi.cc}::TracePacketReception (std::string context, Ptr< const Packet > p, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId)
 Trace a packet reception.

Variables

std::set< uint32_tanonymous_namespace{wifi-bianchi.cc}::associated
 Contains the IDs of the STAs that successfully associated to the access point (in infrastructure mode only).
std::ofstream anonymous_namespace{wifi-bianchi.cc}::backoffTraceFile
 File that traces backoff over time.
std::map< std::string, std::map< unsigned int, double > > anonymous_namespace{wifi-bianchi.cc}::bianchiResultsDifs
 Table of the expected values for DIFS.
std::map< std::string, std::map< unsigned int, double > > anonymous_namespace{wifi-bianchi.cc}::bianchiResultsEifs
 Table of the expected values for EIFS.
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::bytesReceived
 Map that stores the total bytes received per STA (and addressed to that STA).
std::ofstream anonymous_namespace{wifi-bianchi.cc}::cwTraceFile
 File that traces CW over time.
std::ofstream anonymous_namespace{wifi-bianchi.cc}::macRxTraceFile
 File that traces MAC receptions over time.
std::ofstream anonymous_namespace{wifi-bianchi.cc}::macTxTraceFile
 File that traces MAC transmissions over time.
uint8_t anonymous_namespace{wifi-bianchi.cc}::maxMpdus = 0
 The maximum number of MPDUs in A-MPDUs (0 to disable MPDU aggregation).
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::packetsReceived
 Map that stores the total packets received per STA (and addressed to that STA).
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::packetsTransmitted
 Map that stores the total packets transmitted per STA.
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::phyHeaderFailed
 Map that stores the total number of unsuccessfully received PHY headers per STA.
std::ofstream anonymous_namespace{wifi-bianchi.cc}::phyTxTraceFile
 File that traces PHY transmissions over time.
uint32_t anonymous_namespace{wifi-bianchi.cc}::pktSize = 1500
 packet size used for the simulation (in bytes)
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::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).
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::psduSucceeded
 Map that stores the total number of successfully received PSDUs per STA (including PSDUs not addressed to that STA).
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::rxEventAbortedByTx
 Map that stores the number of reception events aborted per STA because the PHY has started to transmit.
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::rxEventWhileDecodingPreamble
 Map that stores the number of reception events per STA that occurred while PHY was already decoding a preamble.
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::rxEventWhileRxing
 Map that stores the number of reception events per STA that occurred while PHY was already receiving a PPDU.
std::map< Mac48Address, uint64_t > anonymous_namespace{wifi-bianchi.cc}::rxEventWhileTxing
 Map that stores the number of reception events per STA that occurred while PHY was already transmitting a PPDU.
std::ofstream anonymous_namespace{wifi-bianchi.cc}::socketSendTraceFile
 File that traces packets transmitted by the application over time.
std::map< Mac48Address, Timeanonymous_namespace{wifi-bianchi.cc}::timeFirstReceived
 Map that stores the time at which the first packet was received per STA (and the packet is addressed to that STA).
std::map< Mac48Address, Timeanonymous_namespace{wifi-bianchi.cc}::timeFirstTransmitted
 Map that stores the time at which the first packet was transmitted per STA.
std::map< Mac48Address, Timeanonymous_namespace{wifi-bianchi.cc}::timeLastReceived
 Map that stores the time at which the last packet was received per STA (and the packet is addressed to that STA).
std::map< Mac48Address, Timeanonymous_namespace{wifi-bianchi.cc}::timeLastTransmitted
 Map that stores the time at which the last packet was transmitted per STA.
bool anonymous_namespace{wifi-bianchi.cc}::tracing = false
 Flag to enable/disable generation of tracing files.
bool anonymous_namespace{wifi-bianchi.cc}::useRxHelper = false
 Flag to get PPDU statistics with WifiPhyRxTraceHelper.
bool anonymous_namespace{wifi-bianchi.cc}::useTxHelper = false
 Flag to get MPDU statistics with WifiTxStatsHelper.

Detailed Description

Example comparing ns-3 to the Bianchi model.

See the Wi-Fi Module documentation in the Models chapter.

Usage

$ ./ns3 run "wifi-bianchi [Program Options]"

Program Options

--verbose
Logging level (0: no log - 1: simulation script logs - 2: all logs) [0]
--tracing
Generate trace files [false]
--useTxHelper
Enable WifiTxStatsHelper on all devices [false]
--useRxHelper
Enable WifiPhyRxTraceHelper on all devices [false]
--pktSize
The packet size in bytes [1500]
--trials
The maximal number of runs per network size [1]
--duration
Time duration for each trial in seconds [100]
--pcap
Enable/disable PCAP tracing [false]
--infra
True to use infrastructure mode, false to use ring adhoc mode [false]
--workDir
The working directory used to store generated files [./]
--phyMode
Set the constant PHY mode string used to transmit frames [OfdmRate54Mbps]
--standard
Set the standard (11a, 11b, 11g, 11n, 11ac, 11ax) [11a]
--nMinStas
Minimum number of stations to start with [5]
--nMaxStas
Maximum number of stations to start with [50]
--nStepSize
Number of stations to add at each step [5]
--plotBianchiModel
First bit corresponds to the DIFS model, second bit to the EIFS model [1]
--validate
Enable/disable validation of the ns-3 simulations against the Bianchi model [false]
--maxRelativeError
The maximum relative error tolerated between ns-3 results and the Bianchi model (used for regression, i.e. when the validate flag is set) [0.015]
--frequency
Set the operating frequency band in GHz: 2.4, 5 or 6 [5]
--channelWidth
Set the constant channel width in MHz (only for 11n/ac/ax) [20]
--guardIntervalNs
Set the the guard interval in nanoseconds (800 or 400 for 11n/ac, 800 or 1600 or 3200 for 11 ax) [800]
--maxMpdus
Set the maximum number of MPDUs in A-MPDUs (0 to disable MPDU aggregation) [ ]
--distance
Set the distance in meters between the AP and the STAs [0.001]
--apTxPower
Set the transmit power of the AP in dBm (if infrastructure only) [16]
--staTxPower
Set the transmit power of each STA in dBm (or all STAs if adhoc) [16]
--pktInterval
Set the socket packet interval in microseconds [1000]

Definition in file wifi-bianchi.cc.

Macro Definition Documentation

◆ PI

#define PI   3.1415926535

Avoid std::numbers::pi because it's C++20.

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

Referenced by anonymous_namespace{wifi-bianchi.cc}::Experiment::Run().