27 #include "ns3/simulator.h"
28 #include "ns3/assert.h"
30 #include "ns3/boolean.h"
31 #include "ns3/double.h"
32 #include "ns3/uinteger.h"
34 #include "ns3/pointer.h"
35 #include "ns3/trace-source-accessor.h"
36 #include "ns3/fatal-error.h"
164 .SetGroupName (
"Wifi")
165 .AddAttribute (
"Frequency",
166 "The operating center frequency (MHz)",
170 MakeUintegerChecker<uint32_t> ())
171 .AddAttribute (
"ChannelWidth",
172 "Whether 5MHz, 10MHz, 20MHz, 22MHz, 40MHz, 80 MHz or 160 MHz.",
176 MakeUintegerChecker<uint32_t> ())
177 .AddAttribute (
"ChannelNumber",
178 "If set to non-zero defined value, will control Frequency and ChannelWidth assignment",
182 MakeUintegerChecker<uint16_t> ())
183 .AddAttribute (
"EnergyDetectionThreshold",
184 "The energy of a received signal should be higher than "
185 "this threshold (dbm) to allow the PHY layer to detect the signal.",
189 MakeDoubleChecker<double> ())
190 .AddAttribute (
"CcaMode1Threshold",
191 "The energy of a received signal should be higher than "
192 "this threshold (dbm) to allow the PHY layer to declare CCA BUSY state.",
196 MakeDoubleChecker<double> ())
197 .AddAttribute (
"TxGain",
198 "Transmission gain (dB).",
202 MakeDoubleChecker<double> ())
203 .AddAttribute (
"RxGain",
204 "Reception gain (dB).",
208 MakeDoubleChecker<double> ())
209 .AddAttribute (
"TxPowerLevels",
210 "Number of transmission power levels available between "
211 "TxPowerStart and TxPowerEnd included.",
214 MakeUintegerChecker<uint32_t> ())
215 .AddAttribute (
"TxPowerEnd",
216 "Maximum available transmission level (dbm).",
220 MakeDoubleChecker<double> ())
221 .AddAttribute (
"TxPowerStart",
222 "Minimum available transmission level (dbm).",
226 MakeDoubleChecker<double> ())
227 .AddAttribute (
"RxNoiseFigure",
228 "Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
229 " According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
230 "\"the difference in decibels (dB) between"
231 " the noise output of the actual receiver to the noise output of an "
232 " ideal receiver with the same overall gain and bandwidth when the receivers "
233 " are connected to sources at the standard noise temperature T0 (usually 290 K)\".",
237 MakeDoubleChecker<double> ())
238 .AddAttribute (
"State",
239 "The state of the PHY layer.",
242 MakePointerChecker<WifiPhyStateHelper> ())
243 .AddAttribute (
"ChannelSwitchDelay",
244 "Delay between two short frames transmitted on different frequencies.",
248 .AddAttribute (
"TxAntennas",
249 "The number of supported Tx antennas.",
253 MakeUintegerChecker<uint32_t> ())
254 .AddAttribute (
"RxAntennas",
255 "The number of supported Rx antennas.",
259 MakeUintegerChecker<uint32_t> ())
260 .AddAttribute (
"ShortGuardEnabled",
261 "Whether or not short guard interval is enabled."
262 "This parameter is only valuable for 802.11n/ac STAs and APs.",
267 .AddAttribute (
"LdpcEnabled",
268 "Whether or not LDPC is enabled.",
273 .AddAttribute (
"STBCEnabled",
274 "Whether or not STBC is enabled.",
279 .AddAttribute (
"GreenfieldEnabled",
280 "Whether or not Greenfield is enabled."
281 "This parameter is only valuable for 802.11n STAs and APs.",
286 .AddAttribute (
"ShortPlcpPreambleSupported",
287 "Whether or not short PLCP preamble is supported."
288 "This parameter is only valuable for 802.11b STAs and APs."
289 "Note: 802.11g APs and STAs always support short PLCP preamble.",
294 .AddTraceSource (
"PhyTxBegin",
295 "Trace source indicating a packet "
296 "has begun transmitting over the channel medium",
298 "ns3::Packet::TracedCallback")
299 .AddTraceSource (
"PhyTxEnd",
300 "Trace source indicating a packet "
301 "has been completely transmitted over the channel. "
302 "NOTE: the only official WifiPhy implementation "
303 "available to this date never fires "
304 "this trace source.",
306 "ns3::Packet::TracedCallback")
307 .AddTraceSource (
"PhyTxDrop",
308 "Trace source indicating a packet "
309 "has been dropped by the device during transmission",
311 "ns3::Packet::TracedCallback")
312 .AddTraceSource (
"PhyRxBegin",
313 "Trace source indicating a packet "
314 "has begun being received from the channel medium "
317 "ns3::Packet::TracedCallback")
318 .AddTraceSource (
"PhyRxEnd",
319 "Trace source indicating a packet "
320 "has been completely received from the channel medium "
323 "ns3::Packet::TracedCallback")
324 .AddTraceSource (
"PhyRxDrop",
325 "Trace source indicating a packet "
326 "has been dropped by the device during reception",
328 "ns3::Packet::TracedCallback")
329 .AddTraceSource (
"MonitorSnifferRx",
330 "Trace source simulating a wifi device in monitor mode "
331 "sniffing all received frames",
333 "ns3::WifiPhy::MonitorSnifferRxTracedCallback")
334 .AddTraceSource (
"MonitorSnifferTx",
335 "Trace source simulating the capability of a wifi device "
336 "in monitor mode to sniff all frames being transmitted",
338 "ns3::WifiPhy::MonitorSnifferTxTracedCallback")
345 m_plcpSuccess (false),
346 m_txMpduReferenceNumber (0xffffffff),
347 m_rxMpduReferenceNumber (0xffffffff),
351 m_isConstructed (false),
352 m_channelCenterFrequency (0),
353 m_initialFrequency (0),
354 m_frequencyChannelNumberInitialized (false),
356 m_initialChannelNumber (0),
357 m_totalAmpduSize (0),
358 m_totalAmpduNumSymbols (0)
361 m_random = CreateObject<UniformRandomVariable> ();
362 m_state = CreateObject<WifiPhyStateHelper> ();
731 NS_LOG_WARN (
"Configuring unspecified standard; performing no action");
828 bool htFound =
false;
932 NS_LOG_FUNCTION (
this << channelNumber << standard << frequency << channelWidth);
934 ChannelToFrequencyWidthMap::const_iterator it;
938 NS_LOG_DEBUG (
"channel number/standard already defined; returning false");
965 return (it->first.first);
986 NS_LOG_DEBUG (
"Frequency set; checking whether a channel number corresponds");
988 if (channelNumberSearched)
990 NS_LOG_DEBUG (
"Channel number found; setting to " << channelNumberSearched);
995 NS_LOG_DEBUG (
"Channel number not found; setting to zero");
1009 NS_LOG_DEBUG (
"Falling back to check WIFI_PHY_STANDARD_UNSPECIFIED");
1018 NS_LOG_DEBUG (
"Setting frequency to " << f.first <<
"; width to " << f.second);
1091 NS_LOG_DEBUG (
"Saving frequency configuration for initialization");
1103 NS_LOG_DEBUG (
"Setting frequency and channel number to zero");
1114 NS_LOG_DEBUG (
"Setting frequency " << frequency <<
" corresponds to channel " << nch);
1117 NS_LOG_DEBUG (
"Channel frequency switched to " << frequency <<
"; channel number to " << nch);
1123 NS_LOG_DEBUG (
"Suppressing reassignment of frequency");
1128 NS_LOG_DEBUG (
"Channel number is unknown for frequency " << frequency);
1131 NS_LOG_DEBUG (
"Channel frequency switched to " << frequency <<
"; channel number to " << 0);
1137 NS_LOG_DEBUG (
"Suppressing reassignment of frequency");
1151 NS_ASSERT_MSG (channelwidth == 5 || channelwidth == 10 || channelwidth == 20 || channelwidth == 22 || channelwidth == 40 || channelwidth == 80 || channelwidth == 160,
"wrong channel width value");
1242 return supportedmodes;
1256 NS_LOG_FUNCTION (
"Adding " << width <<
" to supported channel width set");
1260 std::vector<uint32_t>
1280 NS_LOG_DEBUG (
"Saving channel number configuration for initialization");
1311 NS_LOG_DEBUG (
"Setting frequency to " << f.first <<
"; width to " << f.second);
1324 NS_FATAL_ERROR (
"Frequency not found for channel number " << nch);
1361 uint8_t Ndltf, Neltf;
1364 if (txVector.
GetNss () < 3)
1366 Ndltf = txVector.
GetNss ();
1368 else if (txVector.
GetNss () < 5)
1372 else if (txVector.
GetNss () < 7)
1641 Time symbolDuration;
1665 numSymbols = ((16 + size * 8.0 + 6) / numDataBitsPerSymbol);
1675 numSymbols = ((size * 8.0) / numDataBitsPerSymbol);
1686 numSymbols = lrint (ceil ((16 + totalAmpduSize * 8.0 + 6) / numDataBitsPerSymbol));
1698 numSymbols = lrint (ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
1702 NS_FATAL_ERROR (
"Wrong combination of preamble and packet type");
1718 Time symbolDuration;
1756 && txVector.
GetNss () == 3
1762 && txVector.
GetNss () == 2
1768 && txVector.
GetNss () == 3
1774 && txVector.
GetNss () == 3
1780 && txVector.
GetNss () == 4
1786 && txVector.
GetNss () == 4
1797 && txVector.
GetNss () == 2
1803 && txVector.
GetNss () == 2
1809 && txVector.
GetNss () == 3
1815 && txVector.
GetNss () == 3
1821 && txVector.
GetNss () == 3
1827 && txVector.
GetNss () == 4
1833 && txVector.
GetNss () == 4
1839 && txVector.
GetNss () == 4
1845 && txVector.
GetNss () == 4
1858 numSymbols = (m_Stbc * (16 + size * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol));
1868 numSymbols = (m_Stbc * size * 8.0) / (m_Stbc * numDataBitsPerSymbol);
1879 numSymbols = lrint (m_Stbc * ceil ((16 + totalAmpduSize * 8.0 + 6 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
1891 numSymbols = lrint (m_Stbc * ceil ((16 + size * 8.0 + 6.0 * Nes) / (m_Stbc * numDataBitsPerSymbol)));
1895 NS_FATAL_ERROR (
"Wrong combination of preamble and packet type");
1911 <<
" mode=" << payloadMode
1912 <<
" rate=" << payloadMode.
GetDataRate (22, 0, 1));
2791 uint8_t nss = txVector.
GetNss();
2796 if (nss != 3 && nss != 6)
2798 return (modeName !=
"VhtMcs9");
2801 else if (chWidth == 80)
2803 if (nss == 3 || nss == 7)
2805 return (modeName !=
"VhtMcs6");
2809 return (modeName !=
"VhtMcs9");
2812 else if (chWidth == 160)
2816 return (modeName !=
"VhtMcs9");
2826 for (uint32_t i = 0; i <
GetNModes (); i++)
2839 for (uint32_t i = 0; i <
GetNMcs (); i++)
2876 double ratio = std::pow (10.0, dB / 10.0);
2883 double mW = std::pow (10.0, dBm / 10.0);
2890 return 10.0 * std::log10 (w * 1000.0);
2896 return 10.0 * std::log10 (ratio);
2902 return m_state->IsStateCcaBusy ();
2908 return m_state->IsStateIdle ();
2914 return m_state->IsStateBusy ();
2932 return m_state->IsStateSwitching ();
2938 return m_state->IsStateSleep ();
2944 return m_state->GetStateDuration ();
2950 return m_state->GetDelayUntilIdle ();
2956 return m_state->GetLastRxStartTime ();
2972 return (os <<
"IDLE");
2974 return (os <<
"CCA_BUSY");
2976 return (os <<
"TX");
2978 return (os <<
"RX");
2980 return (os <<
"SWITCHING");
2982 return (os <<
"SLEEP");
2985 return (os <<
"INVALID");
static class anonymous_namespace{wifi-phy.cc}::Constructor g_constructor
ERP-OFDM PHY (Clause 19, Section 19.5)
static WifiMode GetVhtMcs6()
Return MCS 6 from VHT MCS values.
static WifiMode GetOfdmRate9MbpsBW5MHz()
Return a WifiMode for OFDM at 9Mbps with 5MHz channel spacing.
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium.
Ptr< NetDevice > m_device
Pointer to the device.
static WifiMode GetErpOfdmRate24Mbps()
Return a WifiMode for ERP-OFDM at 24Mbps.
static WifiMode GetDsssRate11Mbps()
Return a WifiMode for DSSS at 11Mbps.
virtual uint32_t GetNBssMembershipSelectors(void) const
The WifiPhy::NBssMembershipSelectors() method is used (e.g., by a WifiRemoteStationManager) to determ...
Simulation virtual time values and global simulation resolution.
virtual bool DoFrequencySwitch(uint32_t frequency)
The default implementation does nothing and returns true.
void SetDevice(Ptr< NetDevice > device)
Sets the device this PHY is associated with.
std::vector< uint32_t > m_supportedChannelWidthSet
Supported channel width.
static WifiMode GetErpOfdmRate36Mbps()
Return a WifiMode for ERP-OFDM at 36Mbps.
virtual void SetNumberOfTransmitAntennas(uint32_t tx)
void NotifyMonitorSniffTx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu)
Public method used to fire a MonitorSniffer trace for a wifi packet being transmitted.
virtual bool IsStateBusy(void)
Smart pointer class similar to boost::intrusive_ptr.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
OFDM PHY for the 5 GHz band (Clause 17 with 5 MHz channel bandwidth)
double RatioToDb(double ratio) const
Convert from ratio to dB.
void SetStream(int64_t stream)
Specifies the stream number for this RNG stream.
double m_rxGainDb
Reception gain (dB)
static WifiMode GetVhtMcs8()
Return MCS 8 from VHT MCS values.
double GetTxGain(void) const
Return the transmission gain (dB).
double GetRxNoiseFigure(void) const
Return the RX noise figure (dBm).
virtual void SetShortPlcpPreambleSupported(bool preamble)
Enable or disable short PLCP preamble.
AttributeValue implementation for Boolean.
virtual bool IsMcsSupported(WifiMode mcs) const
Check if the given WifiMode is supported by the PHY.
Ptr< ErrorRateModel > GetErrorRateModel(void) const
Return the error rate model.
uint16_t m_channelNumber
Operating channel number.
static WifiMode GetOfdmRate9Mbps()
Return a WifiMode for OFDM at 9Mbps.
HT OFDM PHY for the 5 GHz band (clause 20)
virtual bool GetGuardInterval(void) const
Return whether guard interval is being used.
static WifiMode GetOfdmRate18MbpsBW10MHz()
Return a WifiMode for OFDM at 18Mbps with 10MHz channel spacing.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static WifiMode GetOfdmRate27MbpsBW10MHz()
Return a WifiMode for OFDM at 27Mbps with 10MHz channel spacing.
double m_txGainDb
Transmission gain (dB)
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
static WifiMode GetOfdmRate3MbpsBW5MHz()
Return a WifiMode for OFDM at 3Mbps with 5MHz channel spacing.
static WifiMode GetVhtMcs0()
Return MCS 0 from VHT MCS values.
virtual void SetLdpc(bool ldpc)
Enable or disable LDPC.
static WifiMode GetDsssRate1Mbps()
Return a WifiMode for DSSS at 1Mbps.
bool m_ldpc
Flag if LDPC is used.
virtual bool GetGreenfield(void) const
Return whether Greenfield is supported.
static WifiMode GetErpOfdmRate18Mbps()
Return a WifiMode for ERP-OFDM at 18Mbps.
void SetTxGain(double gain)
Sets the transmission gain (dB).
The PHY layer has sense the medium busy through the CCA mechanism.
static WifiMode GetHtMcs7()
Return MCS 7 from HT MCS values.
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual void DoDispose(void)
Destructor implementation.
static WifiMode GetHtPlcpHeaderMode(WifiMode payloadMode)
virtual void SetStbc(bool stbc)
Enable or disable STBC.
static Time GetPlcpHtSigHeaderDuration(WifiPreamble preamble)
static WifiMode GetVhtMcs5()
Return MCS 5 from VHT MCS values.
static WifiMode GetHtMcs22()
Return MCS 22 from HT MCS values.
std::vector< uint32_t > m_bssMembershipSelectorSet
static WifiMode GetHtMcs14()
Return MCS 14 from HT MCS values.
static WifiMode GetOfdmRate12Mbps()
Return a WifiMode for OFDM at 12Mbps.
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
enum WifiModulationClass GetModulationClass() const
static WifiMode GetHtMcs31()
Return MCS 31 from HT MCS values.
static WifiMode GetHtMcs21()
Return MCS 21 from HT MCS values.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
uint32_t m_numberOfReceivers
Number of receivers.
static WifiMode GetHtMcs30()
Return MCS 30 from HT MCS values.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static WifiMode GetHtMcs10()
Return MCS 10 from HT MCS values.
Ptr< ErrorRateModel > GetErrorRateModel(void) const
Return the error rate model this PHY is using.
static WifiMode GetHtMcs26()
Return MCS 26 from HT MCS values.
bool IsShortGuardInterval(void) const
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
Return a WifiMode for OFDM at 1.5Mbps with 5MHz channel spacing.
virtual void SetNumberOfReceiveAntennas(uint32_t rx)
OFDM PHY for the 5 GHz band (Clause 17 with 10 MHz channel bandwidth)
The PHY layer is sleeping.
static WifiMode GetHtMcs17()
Return MCS 17 from HT MCS values.
static WifiMode GetHtMcs24()
Return MCS 24 from HT MCS values.
static WifiMode GetOfdmRate4_5MbpsBW10MHz()
Return a WifiMode for OFDM at 4.5Mbps with 10MHz channel spacing.
static WifiMode GetOfdmRate54Mbps()
Return a WifiMode for OFDM at 54Mbps.
void SetRxNoiseFigure(double noiseFigureDb)
Sets the RX loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
void ConfigureHolland(void)
virtual uint8_t GetNMcs(void) const
The WifiPhy::GetNMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of t...
void NotifyTxDrop(Ptr< const Packet > packet)
Public method used to fire a PhyTxDrop trace.
int64_t GetFemtoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
HT OFDM PHY for the 2.4 GHz band (clause 20)
virtual void SetGreenfield(bool greenfield)
Enable or disable Greenfield support.
void Configure80211_10Mhz(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard with 10...
static WifiMode GetHtMcs8()
Return MCS 8 from HT MCS values.
static WifiMode GetHtMcs18()
Return MCS 18 from HT MCS values.
virtual void SetGuardInterval(bool guardInterval)
Enable or disable short/long guard interval.
void NotifyTxBegin(Ptr< const Packet > packet)
Public method used to fire a PhyTxBegin trace.
static WifiMode GetVhtMcs4()
Return MCS 4 from VHT MCS values.
static WifiMode GetHtMcs27()
Return MCS 27 from HT MCS values.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
virtual bool IsModeSupported(WifiMode mode) const
Check if the given WifiMode is supported by the PHY.
static WifiMode GetOfdmRate36Mbps()
Return a WifiMode for OFDM at 36Mbps.
Time GetPayloadDuration(uint32_t size, WifiTxVector txVector, WifiPreamble preamble, double frequency)
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, enum WifiModulationClass modClass)
static WifiMode GetVhtMcs7()
Return MCS 7 from VHT MCS values.
static WifiMode GetOfdmRate6MbpsBW5MHz()
Return a WifiMode for OFDM at 6Mbps with 5MHz channel spacing.
virtual bool GetStbc(void) const
Return whether STBC is supported.
static WifiMode GetVhtMcs3()
Return MCS 3 from VHT MCS values.
void NotifyMonitorSniffRx(Ptr< const Packet > packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate, WifiPreamble preamble, WifiTxVector txVector, struct mpduInfo aMpdu, struct signalNoiseDbm signalNoise)
Public method used to fire a MonitorSniffer trace for a wifi packet being received.
virtual uint32_t GetBssMembershipSelector(uint32_t selector) const
The WifiPhy::BssMembershipSelector() method is used (e.g., by a WifiRemoteStationManager) to determin...
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
WifiModeList m_deviceMcsSet
static WifiMode GetVhtPlcpHeaderMode(WifiMode payloadMode)
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
static WifiMode GetHtMcs16()
Return MCS 16 from HT MCS values.
static WifiMode GetErpOfdmRate54Mbps()
Return a WifiMode for ERP-OFDM at 54Mbps.
virtual bool GetLdpc(void) const
Return if LDPC is supported.
static WifiMode GetHtMcs29()
Return MCS 29 from HT MCS values.
static WifiMode GetHtMcs11()
Return MCS 11 from HT MCS values.
void NotifyRxDrop(Ptr< const Packet > packet)
Public method used to fire a PhyRxDrop trace.
virtual uint32_t GetNumberOfReceiveAntennas(void) const
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Keep track of the current position and velocity of an object.
void SetNTxPower(uint32_t n)
Sets the number of transmission power levels available between the minimum level and the maximum leve...
void SetErrorRateModel(Ptr< ErrorRateModel > rate)
Set the error rate model for this interference helper.
static ChannelToFrequencyWidthMap m_channelToFrequencyWidth
This table maintains the mapping of valid ChannelNumber to Frequency/ChannelWidth pairs...
double GetPowerDbm(uint8_t power) const
Get the power of the given power level in dBm.
double GetEdThreshold(void) const
Return the energy detection threshold (dBm).
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
TracedCallback< Ptr< const Packet >, uint16_t, uint16_t, uint32_t, WifiPreamble, WifiTxVector, struct mpduInfo, struct signalNoiseDbm > m_phyMonitorSniffRxTrace
A trace source that emulates a wifi device in monitor mode sniffing a packet being received...
The MPDU is not part of an A-MPDU.
static WifiMode GetHtMcs2()
Return MCS 2 from HT MCS values.
virtual uint16_t GetChannelNumber(void) const
Return current channel number.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
Ptr< MobilityModel > m_mobility
Pointer to the mobility model.
AttributeValue implementation for Time.
Time CalculatePlcpPreambleAndHeaderDuration(WifiTxVector txVector, enum WifiPreamble preamble)
bool DefineChannelNumber(uint16_t channelNumber, enum WifiPhyStandard standard, uint32_t frequency, uint32_t channelWidth)
Add a channel definition to the WifiPhy.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the phy layer drops a packet as it tries to transmit it.
virtual void AddSupportedChannelWidth(uint32_t channelwidth)
bool m_shortPreamble
Flag if short PLCP preamble is supported.
virtual bool IsStateTx(void)
virtual void SetChannelWidth(uint32_t channelwidth)
Hold an unsigned integer type.
static WifiMode GetPlcpHeaderMode(WifiMode payloadMode, WifiPreamble preamble, WifiTxVector txVector)
std::pair< uint32_t, uint32_t > FrequencyWidthPair
A pair of a center Frequency and a ChannelWidth.
static WifiMode GetHtMcs12()
Return MCS 12 from HT MCS values.
static WifiMode GetErpOfdmRate48Mbps()
Return a WifiMode for ERP-OFDM at 48Mbps.
void SetTxPowerEnd(double end)
Sets the maximum available transmission power level (dBm).
uint8_t GetNess(void) const
static WifiMode GetOfdmRate12MbpsBW10MHz()
Return a WifiMode for OFDM at 12Mbps with 10MHz channel spacing.
uint32_t GetChannelWidth(void) const
virtual Time GetDelayUntilIdle(void)
uint8_t GetMcsValue(void) const
std::string GetUniqueName(void) const
Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, double frequency)
The PHY layer is receiving a packet.
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received.
double m_edThresholdW
Energy detection threshold in watts.
void Configure80211_5Mhz()
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard with 5M...
virtual ~WifiPhyListener()
virtual uint32_t GetFrequency(void) const
uint16_t FindChannelNumberForFrequencyWidth(uint32_t frequency, uint32_t width) const
Look for channel number matching the frequency and width.
void NotifyRxBegin(Ptr< const Packet > packet)
Public method used to fire a PhyRxBegin trace.
The PHY layer is sending a packet.
static WifiMode GetOfdmRate18Mbps()
Return a WifiMode for OFDM at 18Mbps.
virtual uint32_t GetNModes(void) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
static WifiMode GetOfdmRate9MbpsBW10MHz()
Return a WifiMode for OFDM at 9Mbps with 10MHz channel spacing.
bool IsStbc(void) const
Check if STBC is used or not.
static WifiMode GetOfdmRate12MbpsBW5MHz()
Return a WifiMode for OFDM at 12Mbps with 5MHz channel spacing.
virtual void SetChannelNumber(uint16_t id)
Set channel number.
virtual WifiModeList GetMembershipSelectorModes(uint32_t selector)
The WifiPhy::GetMembershipSelectorModes() method is used (e.g., by a WifiRemoteStationManager) to det...
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
std::pair< uint16_t, enum WifiPhyStandard > ChannelNumberStandardPair
A pair of a ChannelNumber and WifiPhyStandard.
The PHY layer is switching to other channel.
virtual bool DoChannelSwitch(uint16_t id)
The default implementation does nothing and returns true.
TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
The MPDU is part of an A-MPDU, but is not the last aggregate.
virtual uint32_t GetNTxPower(void) const
Return the number of available transmission power levels.
static WifiMode GetVhtMcs1()
Return MCS 1 from VHT MCS values.
virtual void ConfigureDefaultsForStandard(enum WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
This is intended to be the configuration used in this paper: Gavin Holland, Nitin Vaidya and Paramvir...
static WifiMode GetOfdmRate48Mbps()
Return a WifiMode for OFDM at 48Mbps.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
double f(double x, void *params)
static WifiMode GetHtMcs0()
Return MCS 0 from HT MCS values.
virtual WifiMode GetMcs(uint8_t mcs) const
The WifiPhy::GetMcs() method is used (e.g., by a WifiRemoteStationManager) to determine the set of tr...
virtual uint32_t GetChannelWidth(void) const
static TypeId GetTypeId(void)
OFDM PHY for the 5 GHz band (Clause 17)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr.
virtual double GetTxPowerEnd(void) const
Return the maximum available transmission power level (dBm).
virtual bool IsStateIdle(void)
static bool IsValidTxVector(WifiTxVector txVector)
The standard disallows certain combinations of WifiMode, number of spatial streams, and channel widths.
TracedCallback< Ptr< const Packet >, uint16_t, uint16_t, uint32_t, WifiPreamble, WifiTxVector, struct mpduInfo > m_phyMonitorSniffTxTrace
A trace source that emulates a wifi device in monitor mode sniffing a packet being transmitted...
static WifiMode GetOfdmRate24Mbps()
Return a WifiMode for OFDM at 24Mbps.
Ptr< const AttributeChecker > MakeBooleanChecker(void)
DSSS PHY (Clause 15) and HR/DSSS PHY (Clause 18)
static WifiMode GetHtMcs13()
Return MCS 13 from HT MCS values.
virtual double CalculateSnr(WifiTxVector txVector, double ber) const
static WifiMode GetHtMcs20()
Return MCS 20 from HT MCS values.
static WifiMode GetHtMcs5()
Return MCS 5 from HT MCS values.
void SetCcaMode1Threshold(double threshold)
Sets the CCA threshold (dBm).
virtual Time GetLastRxStartTime(void) const
Return the start time of the last received packet.
void SetMobility(Ptr< MobilityModel > mobility)
assign a mobility model to this device
uint64_t GetDataRate(uint32_t channelWidth, bool isShortGuardInterval, uint8_t nss) const
static WifiMode GetVhtMcs2()
Return MCS 2 from VHT MCS values.
virtual bool IsStateCcaBusy(void)
static WifiMode GetDsssRate5_5Mbps()
Return a WifiMode for DSSS at 5.5Mbps.
Ptr< MobilityModel > GetMobility(void)
Return the mobility model this PHY is associated with.
void Configure80211ac(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11ac standard...
virtual void DoInitialize(void)
Initialize() implementation.
static WifiMode GetOfdmRate2_25MbpsBW5MHz()
Return a WifiMode for OFDM at 2.25Mbps with 5MHz channel spacing.
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
std::vector< WifiMode > WifiModeList
In various parts of the code, folk are interested in maintaining a list of transmission modes...
static Time GetPlcpVhtSigA1Duration(WifiPreamble preamble)
static WifiMode GetErpOfdmRate9Mbps()
Return a WifiMode for ERP-OFDM at 9Mbps.
void NotifyTxEnd(Ptr< const Packet > packet)
Public method used to fire a PhyTxEnd trace.
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
virtual Time GetStateDuration(void)
void InitializeFrequencyChannelNumber(void)
post-construction setting of frequency and/or channel number
static WifiMode CreateWifiMode(std::string uniqueName, enum WifiModulationClass modClass, bool isMandatory, enum WifiCodeRate codingRate, uint16_t constellationSize)
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakeDoubleAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
virtual void ConfigureStandard(enum WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Ptr< NetDevice > GetDevice(void) const
Return the device this PHY is associated with.
void SetRxGain(double gain)
Sets the reception gain (dB).
void Configure80211b(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11b standard...
No explicit coding (e.g., DSSS rates)
virtual std::vector< uint32_t > GetSupportedChannelWidthSet(void) const
static WifiMode GetErpOfdmRate6Mbps()
Return a WifiMode for ERP-OFDM at 6Mbps.
uint8_t GetNss(void) const
static WifiMode GetErpOfdmRate12Mbps()
Return a WifiMode for ERP-OFDM at 12Mbps.
bool m_greenfield
Flag if GreenField format is supported.
virtual void ConfigureChannelForStandard(enum WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
virtual bool IsStateSleep(void)
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
void SetEdThreshold(double threshold)
Sets the energy detection threshold (dBm).
void NotifyRxEnd(Ptr< const Packet > packet)
Public method used to fire a PhyRxEnd trace.
void Configure80211n(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11n standard...
void SetTxPowerStart(double start)
Sets the minimum available transmission power level (dBm).
double m_txPowerBaseDbm
Minimum transmission power (dBm)
void SetNoiseFigure(double value)
Set the noise figure.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
virtual bool IsStateSwitching(void)
bool m_frequencyChannelNumberInitialized
Store initialization state.
static WifiMode GetHtMcs19()
Return MCS 19 from HT MCS values.
InterferenceHelper m_interference
Pointer to InterferenceHelper.
enum WifiPhyStandard m_standard
WifiPhyStandard.
virtual uint8_t GetSupportedTxSpatialStreams(void) const
static WifiMode GetHtMcs6()
Return MCS 6 from HT MCS values.
bool m_isConstructed
true when ready to set frequency
virtual uint32_t GetNumberOfTransmitAntennas(void) const
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
void ConfigureHtDeviceMcsSet(void)
Configure the device Mcs set with the appropriate HtMcs modes for the number of available transmit sp...
double m_totalAmpduNumSymbols
Number of symbols previously transmitted for the MPDUs in an A-MPDU, used for the computation of the ...
static WifiMode GetHtMcs28()
Return MCS 28 from HT MCS values.
FrequencyWidthPair GetFrequencyWidthForChannelNumberStandard(uint16_t channelNumber, enum WifiPhyStandard standard) const
Lookup frequency/width pair for channelNumber/standard pair.
static WifiMode GetHtMcs9()
Return MCS 9 from HT MCS values.
virtual void SetFrequency(uint32_t freq)
static Time GetPlcpHeaderDuration(WifiTxVector txVector, WifiPreamble preamble)
uint32_t m_channelCenterFrequency
Center frequency in MHz.
virtual Time GetChannelSwitchDelay(void) const
static WifiMode GetHtMcs4()
Return MCS 4 from HT MCS values.
static WifiMode GetHtMcs25()
Return MCS 25 from HT MCS values.
uint32_t m_initialFrequency
Store frequency until initialization.
void Configure80211g(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11g standard...
double WToDbm(double w) const
Convert from Watts to dBm.
uint32_t m_channelWidth
Channel width.
uint32_t m_totalAmpduSize
Total size of the previously transmitted MPDUs in an A-MPDU, used for the computation of the number o...
virtual uint8_t GetSupportedRxSpatialStreams(void) const
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiModeList m_deviceRateSet
This vector holds the set of transmission modes that this WifiPhy(-derived class) can support...
double DbmToW(double dbm) const
Convert from dBm to Watts.
static WifiMode GetHtMcs1()
Return MCS 1 from HT MCS values.
static WifiMode GetHtMcs23()
Return MCS 23 from HT MCS values.
A base class which provides memory management and object aggregation.
Time FemtoSeconds(uint64_t value)
Construct a Time in the indicated unit.
virtual enum WifiPhyStandard GetStandard(void) const
Get the configured Wi-Fi standard.
static WifiMode GetDsssRate2Mbps()
Return a WifiMode for DSSS at 2Mbps.
static WifiMode GetVhtMcs9()
Return MCS 9 from VHT MCS values.
static WifiMode GetOfdmRate6MbpsBW10MHz()
Return a WifiMode for OFDM at 6Mbps with 10MHz channel spacing.
double GetEdThresholdW(void) const
Return the energy detection threshold.
WifiMode GetMode(void) const
double m_txPowerEndDbm
Maximum transmission power (dBm)
virtual bool GetShortPlcpPreambleSupported(void) const
Return whether short PLCP preamble is supported.
State
The state of the PHY layer.
double GetNoiseFigure(void) const
Return the noise figure.
static Time GetPlcpHtTrainingSymbolDuration(WifiPreamble preamble, WifiTxVector txVector)
This class can be used to hold variables of floating point type such as 'double' or 'float'...
static WifiMode GetOfdmRate24MbpsBW10MHz()
Return a WifiMode for OFDM at 24Mbps with 10MHz channel spacing.
Time m_channelSwitchDelay
Time required to switch between channel.
static Time GetPlcpVhtSigBDuration(WifiPreamble preamble)
virtual bool IsStateRx(void)
uint32_t m_numberOfTransmitters
Number of transmitters.
static WifiMode GetOfdmRate13_5MbpsBW5MHz()
Return a WifiMode for OFDM at 13.5Mbps with 5MHz channel spacing.
double m_ccaMode1ThresholdW
Clear channel assessment (CCA) threshold in watts.
double GetCcaMode1Threshold(void) const
Return the CCA threshold (dBm).
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
static WifiMode GetHtMcs15()
Return MCS 15 from HT MCS values.
static Time GetPlcpPreambleDuration(WifiTxVector txVector, WifiPreamble preamble)
TypeId SetParent(TypeId tid)
Set the parent TypeId.
static WifiMode GetHtMcs3()
Return MCS 3 from HT MCS values.
uint16_t m_initialChannelNumber
Initial channel number.
double DbToRatio(double db) const
Convert from dB to ratio.
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6Mbps.
double GetRxGain(void) const
Return the reception gain (dB).
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
virtual double GetTxPowerStart(void) const
Return the minimum available transmission power level (dBm).
static Time GetPlcpVhtSigA2Duration(WifiPreamble preamble)
static WifiMode GetOfdmRate4_5MbpsBW5MHz()
Return a WifiMode for OFDM at 4.5Mbps with 5MHz channel spacing.
uint32_t m_nTxPower
Number of available transmission power levels.
bool m_stbc
Flag if STBC is used.
void Configure80211a(void)
Configure WifiPhy with appropriate channel frequency and supported rates for 802.11a standard...
mpduType
This enumeration defines the type of an MPDU.
void SetErrorRateModel(Ptr< ErrorRateModel > rate)
Sets the error rate model.
std::map< ChannelNumberStandardPair, FrequencyWidthPair > ChannelToFrequencyWidthMap
static WifiMode GetOfdmRate3MbpsBW10MHz()
Return a WifiMode for OFDM at 3Mbps with 10MHz channel spacing.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium. ...
bool m_guardInterval
Flag if short guard interval is used.
virtual WifiMode GetMode(uint32_t mode) const
The WifiPhy::GetNModes() and WifiPhy::GetMode() methods are used (e.g., by a WifiRemoteStationManager...
The MPDU is the last aggregate in an A-MPDU.