|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
23 #include "ns3/wifi-phy.h"
24 #include "ns3/wifi-psdu.h"
25 #include "ns3/wifi-utils.h"
39 return (os <<
"PSD_NON_HE_TB");
41 return (os <<
"PSD_HE_TB_NON_OFDMA_PORTION");
43 return (os <<
"PSD_HE_TB_OFDMA_PORTION");
46 return (os <<
"INVALID");
54 NS_LOG_FUNCTION (
this << psdus << txVector << ppduDuration << band << uid << flag);
71 :
OfdmPpdu (psdu, txVector, band, uid, false)
73 NS_LOG_FUNCTION (
this << psdu << txVector << ppduDuration << band << uid);
87 uint8_t sigExtension = 0;
105 uint16_t length = ((ceil ((
static_cast<double> (ppduDuration.
GetNanoSeconds () - (20 * 1000) - (sigExtension * 1000)) / 1000) / 4.0) * 3) - 3 - m);
146 uint8_t sigExtension = 0;
151 uint8_t m =
IsDlMu () ? 1 : 2;
154 uint32_t nSymbols = floor (
static_cast<double> ((calculatedDuration - preambleDuration).GetNanoSeconds () - (sigExtension * 1000)) / tSymbol.
GetNanoSeconds ());
155 ppduDuration = preambleDuration + (nSymbols * tSymbol) +
MicroSeconds (sigExtension);
210 return m_psdus.begin ()->second;
217 auto it =
m_psdus.find (staId);
231 return m_psdus.begin ()->first;
284 std::ostringstream ss;
319 .SetGroupName (
"Wifi")
334 os <<
"MCS=" << +m_mcs
335 <<
" CHANNEL_WIDTH=" << GetChannelWidth ()
336 <<
" GI=" << GetGuardInterval ()
337 <<
" NSTS=" << +m_nsts
338 <<
" BSSColor=" << +m_bssColor
378 m_bssColor = bssColor;
390 if (channelWidth == 160)
394 else if (channelWidth == 80)
398 else if (channelWidth == 40)
411 if (m_bandwidth == 3)
415 else if (m_bandwidth == 2)
419 else if (m_bandwidth == 1)
432 if (gi == 800 && ltf == 1)
436 else if (gi == 800 && ltf == 2)
440 else if (gi == 1600 && ltf == 2)
453 if (m_gi_ltf_size == 3)
458 else if (m_gi_ltf_size == 2)
472 m_nsts = (nStreams - 1);
485 uint8_t
byte = m_format & 0x01;
486 byte |= ((m_ul_dl & 0x01) << 2);
487 byte |= ((m_mcs & 0x0f) << 3);
488 start.WriteU8 (
byte);
489 uint16_t bytes = (m_bssColor & 0x3f);
490 bytes |= (0x01 << 6);
491 bytes |= ((m_spatialReuse & 0x0f) << 7);
492 bytes |= ((m_bandwidth & 0x03) << 11);
493 bytes |= ((m_gi_ltf_size & 0x03) << 13);
494 bytes |= ((m_nsts & 0x01) << 15);
495 start.WriteU16 (bytes);
496 start.WriteU8 ((m_nsts >> 1) & 0x03);
500 sigA2 |= (0x01 << 14);
501 start.WriteU32 (sigA2);
516 uint8_t
byte = i.
ReadU8 ();
517 m_format = (
byte & 0x01);
518 m_ul_dl = ((
byte >> 2) & 0x01);
519 m_mcs = ((
byte >> 3) & 0x0f);
521 m_bssColor = (bytes & 0x3f);
522 m_spatialReuse = ((bytes >> 7) & 0x0f);
523 m_bandwidth = ((bytes >> 11) & 0x03);
524 m_gi_ltf_size = ((bytes >> 13) & 0x03);
525 m_nsts = ((bytes >> 15) & 0x01);
527 m_nsts |= (
byte & 0x03) << 1;
Time GetTxDuration(void) const override
Get the total transmission duration of the PPDU.
a unique identifier for an interface.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
HeSigHeader m_heSig
the HE-SIG PHY header
uint8_t GetBssColor(void) const
Get the BSS color.
HePpdu(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, Time ppduDuration, WifiPhyBand band, uint64_t uid)
Create an SU HE PPDU, storing a PSDU.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
TxPsdFlag
The transmit power spectral density flag, namely used to correctly build PSD for HE TB PPDU non-OFDMA...
HeRu::RuSpec GetRu(uint16_t staId) const
Get the RU specification for the STA-ID.
TxPsdFlag GetTxPsdFlag(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t GetDistanceFrom(Iterator const &o) const
WifiTxVector GetTxVector(void) const
Get the TXVECTOR used to send the PPDU.
virtual bool CanBeReceived(uint16_t txCenterFreq, uint16_t p20MinFreq, uint16_t p20MaxFreq) const
Check whether the given PPDU can be received on the specified primary channel.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
void SetNss(uint8_t nss)
Sets the number of Nss.
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
uint16_t m_channelWidth
the channel width used to transmit that PPDU in MHz
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Declaration of ns3::HePhy class and ns3::HeSigAParameters struct.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
bool IsUlMu(void) const
Return true if the PPDU is an UL MU PPDU.
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
@ PSD_NON_HE_TB
non-HE TB PPDU transmissions
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
LSigHeader m_lSig
the L-SIG PHY header
virtual ~HePpdu()
Destructor for HePpdu.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
uint16_t GetTransmissionChannelWidth(void) const override
Get the channel width over which the PPDU will effectively be transmitted.
bool CanBeReceived(uint16_t txCenterFreq, uint16_t p20MinFreq, uint16_t p20MaxFreq) const override
Check whether the given PPDU can be received on the specified primary channel.
Declaration of ns3::HePpdu class.
const HeMuUserInfoMap & GetHeMuUserInfoMap(void) const
Get a const reference to the map HE MU user-specific transmission information indexed by STA-ID.
WifiTxVector::HeMuUserInfoMap m_muUserInfos
the HE MU specific per-user information (to be removed once HE-SIG-B headers are implemented)
TxPsdFlag m_txPsdFlag
the transmit power spectral density flag
WifiPreamble GetPreambleType(void) const
Simulation virtual time values and global simulation resolution.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
@ PSD_HE_TB_NON_OFDMA_PORTION
preamble of HE TB PPDU, which should only be sent on minimum subset of 20 MHz channels containing RU
iterator in a Buffer instance
uint16_t GetGuardInterval(void) const
WifiPhyBand m_band
the WifiPhyBand used to transmit that PPDU
@ PSD_HE_TB_OFDMA_PORTION
OFDMA portion of HE TB PPDU, which should only be sent on RU.
Ptr< WifiPpdu > Copy(void) const override
Copy this instance.
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
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.
std::string PrintPayload(void) const override
Print the payload of the PPDU.
Time Seconds(double value)
Construct a Time in the indicated unit.
void SetHeMuUserInfo(uint16_t staId, HeMuUserInfo userInfo)
Set the HE MU user-specific transmission information for the given STA-ID.
void SetPhyHeaders(const WifiTxVector &txVector, Time ppduDuration)
Fill in the HE PHY headers.
WifiPpduType
The type of PPDU (SU, DL MU, or UL MU)
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
uint16_t GetStaId(void) const override
Get the ID of the STA that transmitted the PPDU for UL MU, SU_STA_ID otherwise.
WifiPpduType GetType(void) const override
Return the PPDU type (.
void SetTxPsdFlag(TxPsdFlag flag)
WifiPhyBand
Identifies the PHY band.
uint64_t m_uid
the unique ID of this PPDU
void SetBssColor(uint8_t color)
Set the BSS color.
virtual uint16_t GetTransmissionChannelWidth(void) const
Get the channel width over which the PPDU will effectively be transmitted.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Ptr< const WifiPsdu > GetPsdu(void) const
Get the payload of the PPDU.
WifiPreamble m_preamble
the PHY preamble
WifiConstPsduMap m_psdus
the PSDUs contained in this PPDU
bool IsDlMu(void) const
Return true if the PPDU is a DL MU PPDU.
WifiTxVector DoGetTxVector(void) const override
Get the TXVECTOR used to send the PPDU.
bool IsMu(void) const
Return true if the PPDU is a MU PPDU.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
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.
static WifiMode GetHeMcs(uint8_t index)
Return the HE MCS corresponding to the provided index.
uint8_t GetMcsValue(void) const