25 #include "ns3/simulator.h"
26 #include "ns3/packet.h"
27 #include "ns3/assert.h"
29 #include "ns3/double.h"
30 #include "ns3/uinteger.h"
32 #include "ns3/trace-source-accessor.h"
58 .AddTraceSource (
"PhyTxBegin",
59 "Trace source indicating a packet has begun transmitting over the channel medium",
61 .AddTraceSource (
"PhyTxEnd",
62 "Trace source indicating a packet has been completely transmitted over the channel. NOTE: the only official WifiPhy implementation available to this date (YansWifiPhy) never fires this trace source.",
64 .AddTraceSource (
"PhyTxDrop",
65 "Trace source indicating a packet has been dropped by the device during transmission",
67 .AddTraceSource (
"PhyRxBegin",
68 "Trace source indicating a packet has begun being received from the channel medium by the device",
70 .AddTraceSource (
"PhyRxEnd",
71 "Trace source indicating a packet has been completely received from the channel medium by the device",
73 .AddTraceSource (
"PhyRxDrop",
74 "Trace source indicating a packet has been dropped by the device during reception",
76 .AddTraceSource (
"MonitorSnifferRx",
77 "Trace source simulating a wifi device in monitor mode sniffing all received frames",
79 .AddTraceSource (
"MonitorSnifferTx",
80 "Trace source simulating the capability of a wifi device in monitor mode to sniff all frames being transmitted",
118 return 4+ (4* txvector.
GetNss());
345 uint32_t symbolDurationUs;
351 symbolDurationUs = 4;
354 symbolDurationUs = 8;
357 symbolDurationUs = 16;
363 double numDataBitsPerSymbol = payloadMode.
GetDataRate () * symbolDurationUs / 1e6;
366 uint32_t numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
371 return numSymbols * symbolDurationUs + 6;
375 return numSymbols * symbolDurationUs;
380 double symbolDurationUs;
384 if (payloadMode.
GetUniqueName() ==
"OfdmRate135MbpsBW40MHzShGi" || payloadMode.
GetUniqueName() ==
"OfdmRate65MbpsBW20MHzShGi" )
386 symbolDurationUs=3.6;
406 symbolDurationUs=3.6;
416 double numDataBitsPerSymbol = payloadMode.
GetDataRate () *txvector.
GetNss() * symbolDurationUs / 1e6;
420 uint32_t numSymbols = lrint (m_Stbc*ceil ((16 + size * 8.0 + 6.0*Nes) / (m_Stbc* numDataBitsPerSymbol)));
422 return numSymbols * symbolDurationUs;
428 <<
" mode=" << payloadMode
430 return lrint (ceil ((size * 8.0) / (payloadMode.
GetDataRate () / 1.0e6)));
447 return MicroSeconds (duration);
1331 40000000, 108000000,
1343 40000000, 120000000,
1355 40000000, 121500000,
1367 40000000, 135000000,
1379 40000000, 135000000,
1392 40000000, 150000000,
1405 return (os <<
"IDLE");
1407 return (os <<
"CCA_BUSY");
1409 return (os <<
"TX");
1411 return (os <<
"RX");
1413 return (os <<
"SWITCHING");
1416 return (os <<
"INVALID");
static class anonymous_namespace{wifi-phy.cc}::Constructor g_constructor
static WifiMode GetOfdmRate9MbpsBW5MHz()
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
static WifiMode GetErpOfdmRate24Mbps()
static WifiMode GetDsssRate11Mbps()
static uint32_t GetPlcpHeaderDurationMicroSeconds(WifiMode payloadMode, WifiPreamble preamble)
keep track of time values and allow control of global simulation resolution
static WifiMode GetErpOfdmRate36Mbps()
#define NS_LOG_FUNCTION(parameters)
static WifiMode GetOfdmRate26MbpsBW20MHz()
static WifiMode GetOfdmRate9Mbps()
static WifiMode GetOfdmRate7_2MbpsBW20MHz()
static WifiMode GetOfdmRate18MbpsBW10MHz()
static WifiMode GetOfdmRate27MbpsBW10MHz()
static WifiMode GetOfdmRate3MbpsBW5MHz()
static WifiMode GetDsssRate1Mbps()
void NotifyMonitorSniffTx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, uint8_t txPower)
static WifiMode GetOfdmRate81MbpsBW40MHz()
static WifiMode GetErpOfdmRate18Mbps()
static WifiMode GetOfdmRate12Mbps()
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
enum WifiModulationClass GetModulationClass() const
static WifiMode GetOfdmRate43_3MbpsBW20MHz()
#define NS_LOG_COMPONENT_DEFINE(name)
static WifiMode GetOfdmRate60MbpsBW40MHz()
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
static WifiMode GetOfdmRate4_5MbpsBW10MHz()
static WifiMode GetMFPlcpHeaderMode(WifiMode payloadMode, WifiPreamble preamble)
static WifiMode GetOfdmRate54Mbps()
void NotifyTxDrop(Ptr< const Packet > packet)
static WifiMode GetOfdmRate108MbpsBW40MHz()
static WifiMode GetOfdmRate21_7MbpsBW20MHz()
void NotifyTxBegin(Ptr< const Packet > packet)
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
static WifiMode GetOfdmRate135MbpsBW40MHz()
static WifiMode GetOfdmRate36Mbps()
static WifiMode GetOfdmRate6MbpsBW5MHz()
#define NS_FATAL_ERROR(msg)
fatal error handling
static WifiMode GetErpOfdmRate54Mbps()
void NotifyRxDrop(Ptr< const Packet > packet)
static WifiMode GetOfdmRate6_5MbpsBW20MHz()
static double GetPayloadDurationMicroSeconds(uint32_t size, WifiTxVector txvector)
static WifiMode GetOfdmRate135MbpsBW40MHzShGi()
TracedCallback< Ptr< const Packet >, uint16_t, uint16_t, uint32_t, bool, uint8_t > m_phyMonitorSniffTxTrace
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
static WifiMode GetErpOfdmRate48Mbps()
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
static WifiMode GetPlcpHeaderMode(WifiMode payloadMode, WifiPreamble preamble)
uint8_t GetNess(void) const
static WifiMode GetOfdmRate12MbpsBW10MHz()
std::string GetUniqueName(void) const
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
virtual ~WifiPhyListener()
static WifiMode CreateWifiMode(std::string uniqueName, enum WifiModulationClass modClass, bool isMandatory, uint32_t bandwidth, uint32_t dataRate, enum WifiCodeRate codingRate, uint8_t constellationSize)
void NotifyRxBegin(Ptr< const Packet > packet)
static WifiMode GetOfdmRate19_5MbpsBW20MHz()
static WifiMode GetOfdmRate18Mbps()
static WifiMode GetOfdmRate9MbpsBW10MHz()
TracedCallback< Ptr< const Packet >, uint16_t, uint16_t, uint32_t, bool, double, double > m_phyMonitorSniffRxTrace
static WifiMode GetOfdmRate12MbpsBW5MHz()
static WifiMode GetOfdmRate52MbpsBW20MHz()
#define NS_LOG_LOGIC(msg)
static WifiMode GetOfdmRate40_5MbpsBW40MHz()
uint32_t GetBandwidth(void) const
TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
static WifiMode GetOfdmRate72_2MbpsBW20MHz()
static WifiMode GetOfdmRate65MbpsBW20MHzShGi()
static WifiMode GetOfdmRate48Mbps()
std::ostream & operator<<(std::ostream &os, const Angles &a)
void NotifyMonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, bool isShortPreamble, double signalDbm, double noiseDbm)
static TypeId GetTypeId(void)
static WifiMode GetOfdmRate57_8MbpsBW20MHz()
static WifiMode GetOfdmRate24Mbps()
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
static WifiMode GetOfdmRate13MbpsBW20MHz()
static WifiMode GetOfdmRate65MbpsBW20MHz()
static uint32_t GetPlcpHtTrainingSymbolDurationMicroSeconds(WifiMode payloadMode, WifiPreamble preamble, WifiTxVector txvector)
static WifiMode GetOfdmRate58_5MbpsBW20MHz()
static WifiMode GetDsssRate5_5Mbps()
static WifiMode GetOfdmRate2_25MbpsBW5MHz()
static WifiMode GetErpOfdmRate9Mbps()
void NotifyTxEnd(Ptr< const Packet > packet)
static WifiMode GetOfdmRate15MbpsBW40MHz()
static WifiMode GetOfdmRate121_5MbpsBW40MHz()
static WifiMode GetOfdmRate28_9MbpsBW20MHz()
static WifiMode GetErpOfdmRate6Mbps()
static Time CalculateTxDuration(uint32_t size, WifiTxVector txvector, enum WifiPreamble preamble)
uint8_t GetNss(void) const
static WifiMode GetErpOfdmRate12Mbps()
void NotifyRxEnd(Ptr< const Packet > packet)
static WifiMode GetOfdmRate13_5MbpsBW40MHz()
static WifiMode GetOfdmRate30MbpsBW40MHz()
static WifiMode GetOfdmRate54MbpsBW40MHz()
static WifiMode GetOfdmRate90MbpsBW40MHz()
static WifiMode GetOfdmRate45MbpsBW40MHz()
static WifiMode GetOfdmRate120MbpsBW40MHz()
static WifiMode GetOfdmRate39MbpsBW20MHz()
a base class which provides memory management and object aggregation
static WifiMode GetDsssRate2Mbps()
static WifiMode GetOfdmRate6MbpsBW10MHz()
WifiMode GetMode(void) const
static WifiMode GetOfdmRate24MbpsBW10MHz()
static WifiMode GetOfdmRate13_5MbpsBW5MHz()
a unique identifier for an interface.
static uint32_t GetPlcpPreambleDurationMicroSeconds(WifiMode payloadMode, WifiPreamble preamble)
uint64_t GetDataRate(void) const
TypeId SetParent(TypeId tid)
static WifiMode GetOfdmRate6Mbps()
static WifiMode GetOfdmRate27MbpsBW40MHz()
static WifiMode GetOfdmRate4_5MbpsBW5MHz()
static WifiMode GetOfdmRate14_4MbpsBW20MHz()
static uint32_t GetPlcpHtSigHeaderDurationMicroSeconds(WifiMode payloadMode, WifiPreamble preamble)
static WifiMode GetOfdmRate3MbpsBW10MHz()
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
static WifiMode GetOfdmRate150MbpsBW40MHz()