27 #include "ns3/wifi-phy.h"
28 #include "ns3/wifi-psdu.h"
37 uint16_t txCenterFreq,
48 NS_LOG_FUNCTION(
this << psdu << txVector << txCenterFreq << ppduDuration << band << uid);
57 #ifdef NS3_BUILD_PROFILE_DEBUG
76 ((ceil((
static_cast<double>(ppduDuration.
GetNanoSeconds() - (20 * 1000)) / 1000) / 4.0) *
85 Time ppduDuration)
const
109 #ifdef NS3_BUILD_PROFILE_DEBUG
113 if (phyHeaders->RemoveHeader(lSig) == 0)
119 if (phyHeaders->RemoveHeader(vhtSig) == 0)
152 bool sgiDisambiguation =
false;
153 #ifdef NS3_BUILD_PROFILE_DEBUG
157 phyHeaders->RemoveHeader(lSig);
159 phyHeaders->RemoveHeader(vhtSig);
165 length = m_lSig.GetLength();
166 sgi = m_vhtSig.GetShortGuardInterval();
167 sgiDisambiguation = m_vhtSig.GetShortGuardIntervalDisambiguation();
172 Time calculatedDuration =
MicroSeconds(((ceil(
static_cast<double>(length + 3) / 3)) * 4) + 20);
174 floor(
static_cast<double>((calculatedDuration - preambleDuration).GetNanoSeconds()) /
176 if (sgi && sgiDisambiguation)
180 ppduDuration = preambleDuration + (nSymbols * tSymbol);
200 m_sgi_disambiguation(0),
211 .SetGroupName(
"Wifi")
225 os <<
"SU_MCS=" << +m_suMcs <<
" CHANNEL_WIDTH=" << GetChannelWidth() <<
" SGI=" << +m_sgi
226 <<
" NSTS=" << +m_nsts <<
" MU=" << +m_mu;
251 if (channelWidth == 160)
255 else if (channelWidth == 80)
259 else if (channelWidth == 40)
294 m_nsts = (nStreams - 1);
318 m_sgi_disambiguation = disambiguation ? 1 : 0;
324 return m_sgi_disambiguation;
347 uint16_t bytes = (m_nsts & 0x07) << 2;
348 bytes |= (0x01 << (23 - 8));
349 start.WriteU16(bytes);
353 byte |= ((m_sgi_disambiguation & 0x01) << 1);
354 byte |= ((m_suMcs & 0x0f) << 4);
356 bytes = (0x01 << (9 - 8));
357 start.WriteU16(bytes);
372 uint8_t
byte = i.
ReadU8();
375 m_nsts = ((bytes >> 2) & 0x07);
380 m_sgi_disambiguation = ((
byte >> 1) & 0x01);
381 m_suMcs = ((
byte >> 4) & 0x0f);
iterator in a Buffer instance
uint32_t GetDistanceFrom(const Iterator &o) const
void AddHeader(const Header &header)
Add header to this packet.
Ptr< Packet > Copy() const
performs a COW copy of the packet.
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.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
virtual void SetPhyHeaders(const WifiTxVector &txVector, Time ppduDuration)
Fill in the PHY headers.
VhtPpdu(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, uint16_t txCenterFreq, Time ppduDuration, WifiPhyBand band, uint64_t uid)
Create a VHT PPDU.
WifiPpduType GetType() const override
Return the PPDU type (.
WifiTxVector DoGetTxVector() const override
Get the TXVECTOR used to send the PPDU.
void SetTxVectorFromPhyHeaders(WifiTxVector &txVector, const LSigHeader &lSig, const VhtSigHeader &vhtSig) const
Fill in the TXVECTOR from PHY headers.
void SetVhtSigHeader(VhtSigHeader &vhtSig, const WifiTxVector &txVector, Time ppduDuration) const
Fill in the VHT-SIG header.
Time GetTxDuration() const override
Get the total transmission duration of the PPDU.
Ptr< WifiPpdu > Copy() const override
Copy this instance.
virtual void SetLSigHeader(LSigHeader &lSig, Time ppduDuration) const
Fill in the L-SIG header.
uint8_t GetMcsValue() const
static Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector)
WifiPreamble m_preamble
the PHY preamble
Ptr< const WifiPsdu > GetPsdu() const
Get the payload of the PPDU.
const WifiTxVector & GetTxVector() const
Get the TXVECTOR used to send the PPDU.
Ptr< Packet > m_phyHeaders
the PHY headers contained in this PPDU
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint16_t GetGuardInterval() const
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
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.
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
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.
uint16_t GetChannelWidth() const
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetNss(uint8_t nss)
Sets the number of Nss.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiPhyBand
Identifies the PHY band.
WifiPpduType
The type of PPDU (SU, DL MU, or UL MU)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Declaration of ns3::VhtPhy class.
Declaration of ns3::VhtPpdu class.