|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
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)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
PhyFieldRxStatus EndReceiveSigA(Ptr< Event > event)
End receiving the SIG-A, perform VHT-specific actions, and provide the status of the reception.
PhyFieldRxStatus EndReceiveSigB(Ptr< Event > event)
End receiving the SIG-B, perform VHT-specific actions, and provide the status of the reception.
Constructor class for VHT modes.
bool IsAllConfigSupported(WifiPpduField field, Ptr< const WifiPpdu > ppdu) const override
Checks if the signaled configuration (including bandwidth) is supported by the PHY.
static class anonymous_namespace{vht-phy.cc}::ConstructorVht g_constructor_vht
the constructor for VHT modes
static bool IsModeAllowed(uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
Check whether the combination of <MCS, channel width, NSS> is allowed.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
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.
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
Declaration of ns3::VhtPhy class.
@ WIFI_PPDU_FIELD_SIG_A
SIG-A field.
std::list< WifiMode > m_modeList
the list of supported modes
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...
const uint16_t WIFI_CODE_RATE_5_6
5/6 coding rate
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double snr
SNR in linear scale.
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...
WifiMode GetHtSigMode(void) const override
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
PhyRxFailureAction actionIfFailure
action to perform in case of failure
#define VHT_PHY
This defines the BSS membership value for VHT PHY.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint32_t GetMaxPsduSize(void) const override
Get the maximum PSDU size in bytes.
@ WIFI_PPDU_FIELD_PREAMBLE
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP,...
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation 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 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,...
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Declaration of ns3::VhtPpdu class.
static WifiMode GetLSigMode(void)
uint8_t m_bssMembershipSelector
the BSS membership selector
uint8_t m_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
Smart pointer class similar to boost::intrusive_ptr.
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,...
static void InitializeModes(void)
Initialize all VHT modes.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Time GetHtSigDuration(void) const override
PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event) override
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
represent a single transmission mode
WifiPhyRxfailureReason reason
failure reason
bool IsAllConfigSupported(WifiPpduField field, Ptr< const WifiPpdu > ppdu) const override
Checks if the signaled configuration (including bandwidth) is supported by the PHY.
Status of the reception of the PPDU field.
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
virtual WifiMode GetSigAMode(void) const
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied HT MCS index between 0 and 7,...
#define HT_PHY
This defines the BSS membership value for HT PHY.
static WifiMode GetVhtMcs0(void)
Return MCS 0 from VHT MCS values.
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.
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
void BuildModeList(void) override
Build mode list.
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 uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
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)
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.
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
WifiPreamble GetPreambleType(void) const
Simulation virtual time values and global simulation resolution.
static uint16_t GetUsableSubcarriers(uint16_t channelWidth)
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
static uint16_t GetUsableSubcarriers(uint16_t channelWidth)
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
uint16_t GetChannelWidth(void) const
WifiPpduField
The type of PPDU field (grouped for convenience)
bool isSuccess
outcome (true if success) of the reception
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...
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
double RatioToDb(double ratio)
Convert from ratio to dB.
virtual bool IsChannelWidthSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the PPDU's bandwidth is supported by the PHY.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
virtual ~VhtPhy()
Destructor for VHT PHY.
double GetRandomValue(void) const
Obtain a random value from the WifiPhy's generator.
SnrPer GetPhyHeaderSnrPer(WifiPpduField field, Ptr< Event > event) const
Obtain the SNR and PER of the PPDU field from the WifiPhy's InterferenceHelper class.
virtual PhyFieldRxStatus ProcessSigA(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-A, perform amendment-specific actions, and provide an updated status of the reception.
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
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.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
static uint64_t CalculatePhyRate(WifiCodeRate codeRate, uint64_t dataRate)
Return the PHY rate corresponding to the supplied code rate and data rate.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
virtual PhyFieldRxStatus ProcessSigB(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-B, perform amendment-specific actions, and provide an updated status of the reception.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event) override
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
@ WIFI_PPDU_FIELD_DATA
data field
A struct for both SNR and PER.
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied HT MCS index between 0 and 7,...
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 double GetCodeRatio(WifiCodeRate codeRate)
Convert WifiCodeRate to a ratio, e.g., code ratio of WIFI_CODE_RATE_1_2 is 0.5.
@ WIFI_PPDU_FIELD_TRAINING
STF + LTF fields (excluding those in preamble for HT-GF)
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
const uint16_t WIFI_CODE_RATE_3_4
3/4 coding rate
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
@ WIFI_MOD_CLASS_VHT
VHT (Clause 22)
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
virtual Time GetSigADuration(WifiPreamble preamble) const
@ WIFI_PPDU_FIELD_SIG_B
SIG-B field.
@ WIFI_PPDU_FIELD_NON_HT_HEADER
PHY header field for DSSS or ERP, short PHY header field for HR/DSSS or ERP, field not present for HT...
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied VHT MCS index.
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.
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
@ DROP
drop PPDU and set CCA_BUSY
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
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
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.