22 #include "ns3/packet.h" 33 : m_preamble (txVector.GetPreambleType ()),
36 m_truncatedTx (false),
38 m_channelWidth (txVector.GetChannelWidth ()),
39 m_txPowerLevel (txVector.GetTxPowerLevel ())
65 uint8_t sigExtension = 0;
70 uint16_t length = ((ceil ((static_cast<double> (ppduDuration.
GetNanoSeconds () - (20 * 1000) - (sigExtension * 1000)) / 1000) / 4.0) * 3) - 3);
81 uint16_t length = ((ceil ((static_cast<double> (ppduDuration.
GetNanoSeconds () - (20 * 1000)) / 1000) / 4.0) * 3) - 3);
97 uint8_t sigExtension = 0;
111 uint16_t length = ((ceil ((static_cast<double> (ppduDuration.
GetNanoSeconds () - (20 * 1000) - (sigExtension * 1000)) / 1000) / 4.0) * 3) - 3 - m);
157 NS_ASSERT_MSG (
false,
"Invalid rate encoded in DSSS SIG header");
245 NS_ASSERT_MSG (
false,
"Invalid rate encoded in L-SIG header");
283 NS_ASSERT_MSG (
false,
"Invalid rate encoded in L-SIG header");
369 uint32_t nSymbols = floor (static_cast<double> ((calculatedDuration - preambleDuration).GetNanoSeconds ()) / tSymbol.
GetNanoSeconds ());
374 ppduDuration = preambleDuration + (nSymbols * tSymbol);
381 uint8_t sigExtension = 0;
397 uint32_t nSymbols = floor (static_cast<double> ((calculatedDuration - preambleDuration).GetNanoSeconds () - (sigExtension * 1000)) / tSymbol.
GetNanoSeconds ());
398 ppduDuration = preambleDuration + (nSymbols * tSymbol) +
MicroSeconds (sigExtension);
static WifiMode GetOfdmRate9MbpsBW5MHz()
Return a WifiMode for OFDM at 9Mbps with 5MHz channel spacing.
static WifiMode GetErpOfdmRate24Mbps()
Return a WifiMode for ERP-OFDM at 24Mbps.
static WifiMode GetDsssRate11Mbps()
Return a WifiMode for DSSS at 11Mbps.
bool IsAggregation(void) const
Checks whether the PSDU contains A-MPDU.
Simulation virtual time values and global simulation resolution.
static WifiMode GetErpOfdmRate36Mbps()
Return a WifiMode for ERP-OFDM at 36Mbps.
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 GetOfdmRate9Mbps()
Return a WifiMode for OFDM at 9Mbps.
static WifiMode GetOfdmRate18MbpsBW10MHz()
Return a WifiMode for OFDM at 18Mbps with 10MHz channel spacing.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
static WifiMode GetOfdmRate27MbpsBW10MHz()
Return a WifiMode for OFDM at 27Mbps with 10MHz channel spacing.
static WifiMode GetOfdmRate3MbpsBW5MHz()
Return a WifiMode for OFDM at 3Mbps with 5MHz channel spacing.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
static WifiMode GetDsssRate1Mbps()
Return a WifiMode for DSSS at 1Mbps.
Ptr< const WifiPsdu > GetPsdu(void) const
Get the payload of the PPDU.
void SetBssColor(uint8_t color)
Set the BSS color.
static WifiMode GetErpOfdmRate18Mbps()
Return a WifiMode for ERP-OFDM at 18Mbps.
void SetTruncatedTx(void)
Indicate that the PPDU's transmission was aborted due to transmitter switch off.
static WifiMode GetOfdmRate12Mbps()
Return a WifiMode for OFDM at 12Mbps.
WifiTxVector GetTxVector(void) const
Get the TXVECTOR used to send the PPDU.
HeSigHeader m_heSig
the HE-SIG PHY header
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static WifiMode GetOfdmRate1_5MbpsBW5MHz()
Return a WifiMode for OFDM at 1.5Mbps with 5MHz channel spacing.
static WifiMode GetOfdmRate4_5MbpsBW10MHz()
Return a WifiMode for OFDM at 4.5Mbps with 10MHz channel spacing.
static WifiMode GetOfdmRate54Mbps()
Return a WifiMode for OFDM at 54Mbps.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
uint16_t GetGuardInterval(void) const
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
static WifiMode GetOfdmRate36Mbps()
Return a WifiMode for OFDM at 36Mbps.
static WifiMode GetOfdmRate6MbpsBW5MHz()
Return a WifiMode for OFDM at 6Mbps with 5MHz channel spacing.
Modulation class unknown or unspecified.
static WifiMode GetErpOfdmRate54Mbps()
Return a WifiMode for ERP-OFDM at 54Mbps.
bool IsValid(void) const
The standard disallows certain combinations of WifiMode, number of spatial streams, and channel widths.
static Time CalculateTxDuration(uint32_t size, WifiTxVector txVector, WifiPhyBand band)
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
void SetGuardInterval(uint16_t guardInterval)
Sets the guard interval duration (in nanoseconds)
static WifiMode GetErpOfdmRate48Mbps()
Return a WifiMode for ERP-OFDM at 48Mbps.
void Print(std::ostream &os) const
Print the PPDU contents.
WifiPreamble m_preamble
the PHY preamble
HtSigHeader m_htSig
the HT-SIG PHY header
static WifiMode GetOfdmRate12MbpsBW10MHz()
Return a WifiMode for OFDM at 12Mbps with 10MHz channel spacing.
WifiMode GetMode(void) const
static WifiMode GetHeMcs(uint8_t mcs)
Get the WifiMode object corresponding to the given MCS of the HE modulation class.
static WifiMode GetOfdmRate18Mbps()
Return a WifiMode for OFDM at 18Mbps.
static WifiMode GetOfdmRate9MbpsBW10MHz()
Return a WifiMode for OFDM at 9Mbps with 10MHz channel spacing.
static WifiMode GetOfdmRate12MbpsBW5MHz()
Return a WifiMode for OFDM at 12Mbps with 5MHz channel spacing.
void SetNss(uint8_t nss)
Sets the number of Nss refer to IEEE 802.11n Table 20-28 for explanation and range.
static WifiMode GetOfdmRate48Mbps()
Return a WifiMode for OFDM at 48Mbps.
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
WifiPpdu stores a preamble, a modulation class, PHY headers and a PSDU.
int64_t GetMicroSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
WifiPhyBand m_band
the WifiPhyBand used to transmit that PPDU
bool IsTruncatedTx(void) const
Return true if the PPDU's transmission was aborted due to transmitter switch off. ...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
int64_t GetNanoSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
void SetAggregation(bool aggregation)
Sets if PSDU contains A-MPDU.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
static WifiMode GetOfdmRate24Mbps()
Return a WifiMode for OFDM at 24Mbps.
uint8_t m_txPowerLevel
the transmission power level (used only for TX and initializing the returned WifiTxVector) ...
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
static WifiMode GetDsssRate5_5Mbps()
Return a WifiMode for DSSS at 5.5Mbps.
static WifiMode GetOfdmRate2_25MbpsBW5MHz()
Return a WifiMode for OFDM at 2.25Mbps with 5MHz channel spacing.
static WifiMode GetErpOfdmRate9Mbps()
Return a WifiMode for ERP-OFDM at 9Mbps.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
bool m_truncatedTx
flag indicating whether the frame's transmission was aborted due to transmitter switch off ...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
WifiPhyBand
Identifies the PHY band.
Ptr< const WifiPsdu > m_psdu
the PSDU contained in this PPDU
static WifiMode GetErpOfdmRate6Mbps()
Return a WifiMode for ERP-OFDM at 6Mbps.
static WifiMode GetErpOfdmRate12Mbps()
Return a WifiMode for ERP-OFDM at 12Mbps.
DsssSigHeader m_dsssSig
the DSSS SIG PHY header
uint8_t GetBssColor(void) const
Get the BSS color.
LSigHeader m_lSig
the L-SIG PHY header
Time Seconds(double value)
Construct a Time in the indicated unit.
VhtSigHeader m_vhtSig
the VHT-SIG PHY header
WifiPpdu(Ptr< const WifiPsdu > psdu, WifiTxVector txVector, Time ppduDuration, WifiPhyBand band)
Create a single user PPDU storing a PSDU.
uint16_t m_channelWidth
the channel width used to transmit that PPDU in MHz
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
static WifiMode GetDsssRate2Mbps()
Return a WifiMode for DSSS at 2Mbps.
static WifiMode GetOfdmRate6MbpsBW10MHz()
Return a WifiMode for OFDM at 6Mbps with 10MHz channel spacing.
Time GetTxDuration() const
Get the total transmission duration of the PPDU.
static WifiMode GetOfdmRate24MbpsBW10MHz()
Return a WifiMode for OFDM at 24Mbps with 10MHz channel spacing.
static WifiMode GetOfdmRate13_5MbpsBW5MHz()
Return a WifiMode for OFDM at 13.5Mbps with 5MHz channel spacing.
uint8_t GetMcsValue(void) const
WifiModulationClass m_modulation
the modulation used for the transmission of this PPDU
static WifiMode GetOfdmRate6Mbps()
Return a WifiMode for OFDM at 6Mbps.
static WifiMode GetVhtMcs(uint8_t mcs)
Get the WifiMode object corresponding to the given MCS of the VHT modulation class.
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
static WifiMode GetOfdmRate4_5MbpsBW5MHz()
Return a WifiMode for OFDM at 4.5Mbps with 5MHz channel spacing.
uint8_t GetNss(void) const
static WifiMode GetHtMcs(uint8_t mcs)
Get the WifiMode object corresponding to the given MCS of the HT modulation class.
static WifiMode GetOfdmRate3MbpsBW10MHz()
Return a WifiMode for OFDM at 3Mbps with 10MHz channel spacing.
static Time CalculatePhyPreambleAndHeaderDuration(WifiTxVector txVector)