13#include "ns3/interference-helper.h"
14#include "ns3/wifi-phy.h"
15#include "ns3/wifi-psdu.h"
16#include "ns3/wifi-utils.h"
18#undef NS_LOG_APPEND_CONTEXT
19#define NS_LOG_APPEND_CONTEXT WIFI_PHY_NS_LOG_APPEND_CONTEXT(m_wifiPhy)
225 for (uint8_t i = 0; i <= 13; ++i)
236 return GetEhtMcs##x();
255 NS_ABORT_MSG(
"Inexistent index (" << +index <<
") requested for EHT");
261#define GET_EHT_MCS(x) \
262 WifiMode EhtPhy::GetEhtMcs##x() \
264 static WifiMode mcs = CreateEhtMcs(x); \
332 const auto dataRate =
GetDataRate(mcsValue, channelWidth, guardInterval, nss);
368 NS_ASSERT((gi == 800) || (gi == 1600) || (gi == 3200));
389 switch (constellationSize)
398 NS_FATAL_ERROR(
"Trying to get reference rate for a MCS with wrong combination of "
399 "coding rate and modulation");
Constructor class for EHT modes.
static const PpduFormats m_ehtPpduFormats
EHT PPDU formats.
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 ProcessSig(Ptr< Event > event, PhyFieldRxStatus status, WifiPpduField field) override
Process SIG-A or SIG-B, perform amendment-specific actions, and provide an updated status of the rece...
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied EHT MCS index.
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied EHT MCS index.
WifiPhyRxfailureReason GetFailureReason(WifiPpduField field) const override
Get the failure reason corresponding to the unsuccessful processing of a given PPDU field.
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId=SU_STA_ID)
Return the PHY rate corresponding to the supplied TXVECTOR for the STA-ID.
static WifiMode GetEhtMcs(uint8_t index)
Return the EHT MCS corresponding to the provided index.
void BuildModeList() override
Build mode list.
static void InitializeModes()
Initialize all EHT modes.
static uint64_t GetDataRate(uint8_t mcsValue, MHz_u channelWidth, Time guardInterval, uint8_t nss)
Return the data rate corresponding to the supplied EHT MCS index, channel width, guard interval,...
static WifiMode CreateEhtMcs(uint8_t index)
Create and return the EHT MCS corresponding to the provided index.
const PpduFormats & GetPpduFormats() const override
Return the PPDU formats of the PHY.
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId=SU_STA_ID)
Return the data rate corresponding to the supplied TXVECTOR for the STA-ID.
~EhtPhy() override
Destructor for EHT PHY.
uint32_t GetSigBSize(const WifiTxVector &txVector) const override
static uint64_t GetPhyRate(uint8_t mcsValue, MHz_u channelWidth, Time guardInterval, uint8_t nss)
Return the PHY rate corresponding to the supplied EHT MCS index, channel width, guard interval,...
Time CalculateNonHeDurationForHeTb(const WifiTxVector &txVector) const override
EhtPhy(bool buildModeList=true)
Constructor for EHT PHY.
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
static uint64_t GetNonHtReferenceRate(uint8_t mcsValue)
Calculate the rate in bps of the non-HT Reference Rate corresponding to the supplied HE MCS index.
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...
Time CalculateNonHeDurationForHeMu(const WifiTxVector &txVector) const override
WifiMode GetSigBMode(const WifiTxVector &txVector) 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...
static uint32_t GetEhtSigFieldSize(MHz_u channelWidth, const std::vector< uint8_t > &ruAllocation, uint8_t ehtPpduType, bool compression, std::size_t numMuMimoUsers)
Get variable length EHT-SIG field size.
virtual PhyFieldRxStatus ProcessSigB(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-B, perform amendment-specific actions, and provide an updated status of the reception.
Time GetSigBDuration(const WifiTxVector &txVector) const override
virtual uint32_t GetSigBSize(const WifiTxVector &txVector) const
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...
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied HE MCS index.
PhyFieldRxStatus ProcessSig(Ptr< Event > event, PhyFieldRxStatus status, WifiPpduField field) override
Process SIG-A or SIG-B, perform amendment-specific actions, and provide an updated status of the rece...
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
uint64_t ObtainNextUid(const WifiTxVector &txVector) override
Obtain the next UID for the PPDU to transmit.
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
static Time GetSymbolDuration(Time guardInterval)
WifiMode GetSigBMode(const WifiTxVector &txVector) const override
virtual PhyFieldRxStatus ProcessSigA(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-A, perform amendment-specific actions, and provide an updated status of the reception.
WifiMode GetSigAMode() const override
Time GetSigADuration(WifiPreamble preamble) const override
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied HE MCS index.
@ PSD_NON_HE_PORTION
Non-HE portion of an HE PPDU.
RuType GetRuType() const
Get the RU type.
static MHz_u GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
static uint64_t CalculatePhyRate(WifiCodeRate codeRate, uint64_t dataRate)
Return the PHY rate corresponding to the supplied code rate and data rate.
uint8_t m_bssMembershipSelector
the BSS membership selector
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_maxMcsIndexPerSs
the maximum MCS index per spatial stream as defined by the standard
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 CalculateDataRate(Time symbolDuration, uint16_t usableSubCarriers, uint16_t numberOfBitsPerSubcarrier, double codingRate, uint8_t nss)
Calculates data rate from the supplied parameters.
static double GetCodeRatio(WifiCodeRate codeRate)
Convert WifiCodeRate to a ratio, e.g., code ratio of WIFI_CODE_RATE_1_2 is 0.5.
uint8_t m_maxSupportedMcsIndexPerSs
the maximum supported MCS index per spatial stream
static uint16_t GetUsableSubcarriers()
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
std::list< WifiMode > m_modeList
the list of supported modes
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
int64_t GetNanoSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
PhyFieldRxStatus EndReceiveSig(Ptr< Event > event, WifiPpduField field)
End receiving the SIG-A or SIG-B, perform VHT-specific actions, and provide the status of the recepti...
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
virtual WifiPhyRxfailureReason GetFailureReason(WifiPpduField field) const
Get the failure reason corresponding to the unsuccessful processing of a given PPDU field.
static WifiMode CreateWifiMcs(std::string uniqueName, uint8_t mcsValue, WifiModulationClass modClass, bool isMandatory, CodeRateCallback codeRateCallback, ConstellationSizeCallback constellationSizeCallback, PhyRateCallback phyRateCallback, DataRateCallback dataRateCallback, NonHtReferenceRateCallback nonHtReferenceRateCallback, AllowedCallback isAllowedCallback)
represent a single transmission mode
uint8_t GetMcsValue() const
static void AddStaticPhyEntity(WifiModulationClass modulation, Ptr< PhyEntity > phyEntity)
Add the PHY entity to the map of implemented PHY entities for the given modulation class.
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
uint8_t GetPrimaryChannelIndex(MHz_u primaryChannelWidth) const
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of th...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
bool IsSigBCompression() const
Indicate whether the Common field is present in the HE-SIG-B field.
const RuAllocation & GetRuAllocation(uint8_t p20Index) const
Get RU_ALLOCATION field.
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() const
HeRu::RuSpec GetRu(uint16_t staId) const
Get the RU specification for the STA-ID.
const HeMuUserInfoMap & GetHeMuUserInfoMap() const
Get a const reference to the map HE MU user-specific transmission information indexed by STA-ID.
uint8_t GetEhtPpduType() const
Get the EHT_PPDU_TYPE parameter.
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.
MHz_u GetChannelWidth() const
Time GetGuardInterval() const
Declaration of ns3::EhtPhy class.
#define EHT_PHY
This defines the BSS membership value for EHT PHY.
Declaration of ns3::EhtPpdu class.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPpduField
The type of PPDU field (grouped for convenience)
@ WIFI_MOD_CLASS_EHT
EHT (Clause 36)
@ WIFI_PPDU_FIELD_SIG_B
SIG-B field.
@ WIFI_PPDU_FIELD_TRAINING
STF + LTF fields (excluding those in preamble for HT-GF)
@ 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...
@ WIFI_PPDU_FIELD_EHT_SIG
EHT-SIG field.
@ WIFI_PPDU_FIELD_PREAMBLE
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP,...
@ WIFI_PPDU_FIELD_U_SIG
U-SIG field.
@ WIFI_PPDU_FIELD_DATA
data field
@ WIFI_PPDU_FIELD_SIG_A
SIG-A field.
class anonymous_namespace{eht-phy.cc}::ConstructorEht g_constructor_eht
the constructor for EHT modes
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
bool IsEht(WifiPreamble preamble)
Return true if a preamble corresponds to an EHT transmission.
bool IsDlMu(WifiPreamble preamble)
Return true if a preamble corresponds to a downlink multi-user transmission.
WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
@ WIFI_CODE_RATE_3_4
3/4 coding rate
@ WIFI_CODE_RATE_5_6
5/6 coding rate
Status of the reception of the PPDU field.