24 #include "ns3/wifi-psdu.h" 25 #include "ns3/wifi-phy.h" 26 #include "ns3/wifi-utils.h" 28 #include "ns3/assert.h" 55 { std::make_tuple ( 80, 7, 2), 3 },
56 { std::make_tuple ( 80, 7, 7), 6 },
57 { std::make_tuple ( 80, 7, 8), 6 },
58 { std::make_tuple ( 80, 8, 7), 6 },
59 { std::make_tuple (160, 4, 7), 6 },
60 { std::make_tuple (160, 5, 8), 8 },
61 { std::make_tuple (160, 6, 7), 8 },
62 { std::make_tuple (160, 7, 3), 4 },
63 { std::make_tuple (160, 7, 4), 6 },
64 { std::make_tuple (160, 7, 5), 7 },
65 { std::make_tuple (160, 7, 7), 9 },
66 { std::make_tuple (160, 7, 8), 12 },
67 { std::make_tuple (160, 7, 9), 12 }
172 uint8_t nDataLtf, uint8_t nExtensionLtf )
const 174 NS_ABORT_MSG_IF (nDataLtf > 8,
"Unsupported number of LTFs " << +nDataLtf <<
" for VHT");
175 NS_ABORT_MSG_IF (nExtensionLtf > 0,
"No extension LTFs expected for VHT");
203 double maxRatePerCoder = (txVector.
GetGuardInterval () == 800) ? 540e6 : 600e6;
204 uint8_t nes = ceil (payloadMode.
GetDataRate (txVector) / maxRatePerCoder);
221 return Create<VhtPpdu> (psdus.begin ()->second, txVector, ppduDuration,
m_wifiPhy->
GetPhyBand (),
259 NS_LOG_DEBUG (
"Drop packet because SIG-A reception failed");
293 NS_LOG_DEBUG (
"Drop reception because SIG-B reception failed");
321 for (uint8_t i = 0; i < 10; ++i)
332 return GetVhtMcs ## x (); \ 347 NS_ABORT_MSG (
"Inexistent index (" << +index <<
") requested for VHT");
353 #define GET_VHT_MCS(x) \ 355 VhtPhy::GetVhtMcs ## x (void) \ 357 static WifiMode mcs = CreateVhtMcs (x); \ 421 uint64_t dataRate =
GetDataRate (mcsValue, channelWidth, guardInterval, nss);
446 NS_ASSERT (guardInterval == 800 || guardInterval == 400);
448 NS_ASSERT_MSG (
IsModeAllowed (mcsValue, channelWidth, nss),
"VHT MCS " << +mcsValue <<
" forbidden at " << channelWidth <<
" MHz when NSS is " << +nss);
458 switch (channelWidth)
481 switch (constellationSize)
490 NS_FATAL_ERROR (
"Trying to get reference rate for a MCS with wrong combination of coding rate and modulation");
502 if (mcsValue == 9 && channelWidth == 20 && nss != 3)
506 if (mcsValue == 6 && channelWidth == 80 && nss == 3)
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Simulation virtual time values and global simulation resolution.
uint32_t GetMaxPsduSize(void) const override
Get the maximum PSDU size in bytes.
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 "...
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
virtual WifiMode GetSigAMode(void) const
static uint64_t CalculateDataRate(double symbolDuration, uint16_t guardInterval, uint16_t usableSubCarriers, uint16_t numberOfBitsPerSubcarrier, double codingRate, uint8_t nss)
Calculates data rate from the supplied parameters.
WifiMode GetHtSigMode(void) const override
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied VHT MCS index.
PhyRxFailureAction actionIfFailure
action to perform in case of failure
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
static uint64_t CalculatePhyRate(WifiCodeRate codeRate, uint64_t dataRate)
Return the PHY rate corresponding to the supplied code rate and data rate.
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
WifiPhyRxfailureReason reason
failure reason
static uint64_t GetNonHtReferenceRate(uint8_t mcsValue)
Calculate the rate in bps of the non-HT Reference Rate corresponding to the supplied VHT MCS index...
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
#define HT_PHY
This defines the BSS membership value for HT PHY.
uint16_t GetGuardInterval(void) const
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
const uint16_t WIFI_CODE_RATE_3_4
3/4 coding rate
static uint64_t CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize)
Return the rate (in bps) of the non-HT Reference Rate which corresponds to the supplied code rate and...
bool IsAllConfigSupported(WifiPpduField field, Ptr< const WifiPpdu > ppdu) const override
Checks if the signaled configuration (including bandwidth) is supported by the PHY.
virtual bool IsChannelWidthSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the PPDU's bandwidth is supported by the PHY.
WifiMode GetMode(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the selected payload transmission mode...
WifiPreamble GetPreambleType(void) const
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP, HT-GF-STF + HT-GF-LTF1 fields for HT-GF, L-STF + L-LTF fields otherwise.
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
virtual PhyFieldRxStatus ProcessSigA(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-A, perform amendment-specific actions, and provide an updated status of the reception...
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass, CodeRateCallback codeRateCallback, ConstellationSizeCallback constellationSizeCallback, PhyRateCallback phyRateCallback, PhyRateFromTxVectorCallback phyRateFromTxVectorCallback, DataRateCallback dataRateCallback, DataRateFromTxVectorCallback dataRateFromTxVectorCallback, NonHtReferenceRateCallback nonHtReferenceRateCallback, ModeAllowedCallback isModeAllowedCallback)
PHY entity for HT (11n)HT PHY is based on OFDM PHY.
SnrPer GetPhyHeaderSnrPer(WifiPpduField field, Ptr< Event > event) const
Obtain the SNR and PER of the PPDU field from the WifiPhy's InterferenceHelper class.
Status of the reception of the PPDU field.
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
#define VHT_PHY
This defines the BSS membership value for VHT PHY.
static bool IsModeAllowed(uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
Check whether the combination of <MCS, channel width, NSS> is allowed.
WifiPpduField
The type of PPDU field (grouped for convenience)
uint8_t m_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
static uint64_t GetPhyRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the PHY rate corresponding to the supplied VHT MCS index, channel width, guard interval...
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
bool isSuccess
outcome (true if success) of the reception
A struct for both SNR and PER.
static uint16_t GetUsableSubcarriers(uint16_t channelWidth)
static class anonymous_namespace{vht-phy.cc}::ConstructorVht g_constructor_vht
the constructor for VHT modes
Time GetDuration(WifiPpduField field, const WifiTxVector &txVector) const override
Get the duration of the PPDU field (or group of fields) used by this entity for the given transmissio...
const uint16_t WIFI_CODE_RATE_5_6
5/6 coding rate
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
static uint64_t CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize)
Return the rate (in bps) of the non-HT Reference Rate which corresponds to the supplied code rate and...
PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event) override
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
virtual Time GetSigADuration(WifiPreamble preamble) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Declaration of ns3::VhtPhy class.
void BuildModeList(void) override
Build mode list.
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied HT MCS index between 0 and 7...
static WifiMode GetVhtMcs0(void)
Return MCS 0 from VHT MCS values.
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Time GetLSigDuration(WifiPreamble preamble) const override
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation class...
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
PhyFieldRxStatus EndReceiveSigB(Ptr< Event > event)
End receiving the SIG-B, perform VHT-specific actions, and provide the status of the reception...
bool IsAllConfigSupported(WifiPpduField field, Ptr< const WifiPpdu > ppdu) const override
Checks if the signaled configuration (including bandwidth) is supported by the PHY.
drop PPDU and set CCA_BUSY
PhyFieldRxStatus EndReceiveSigA(Ptr< Event > event)
End receiving the SIG-A, perform VHT-specific actions, and provide the status of the reception...
double RatioToDb(double ratio)
Convert from ratio to dB.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied HT MCS index between 0 and 7, since HT MCS index > 8 is used for higher NSS.
virtual PhyFieldRxStatus ProcessSigB(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-B, perform amendment-specific actions, and provide an updated status of the reception...
static double GetCodeRatio(WifiCodeRate codeRate)
Convert WifiCodeRate to a ratio, e.g., code ratio of WIFI_CODE_RATE_1_2 is 0.5.
static WifiMode GetLSigMode(void)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event) override
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
Time GetHtSigDuration(void) const override
static void InitializeModes(void)
Initialize all VHT modes.
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
virtual ~VhtPhy()
Destructor for VHT PHY.
STF + LTF fields (excluding those in preamble for HT-GF)
double GetRandomValue(void) const
Obtain a random value from the WifiPhy's generator.
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
uint16_t GetChannelWidth(void) const
uint8_t m_bssMembershipSelector
the BSS membership selector
Constructor class for VHT modes.
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
PHY header field for DSSS or ERP, short PHY header field for HR/DSSS or ERP, field not present for HT...
std::map< std::tuple< uint16_t, uint8_t, uint8_t >, uint8_t > NesExceptionMap
Typedef for storing exceptions in the number of BCC encoders for VHT MCSs.
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
uint8_t GetMcsValue(void) const
Declaration of ns3::VhtPpdu class.
Time GetDuration(WifiPpduField field, const WifiTxVector &txVector) const override
Get the duration of the PPDU field (or group of fields) used by this entity for the given transmissio...
static uint16_t GetUsableSubcarriers(uint16_t channelWidth)
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
std::list< WifiMode > m_modeList
the list of supported modes
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
static uint64_t GetDataRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the data rate corresponding to the supplied VHT MCS index, channel width, guard interval...