diff --git a/examples/wireless/wifi-80211n-mimo.cc b/examples/wireless/wifi-80211n-mimo.cc index 549f696e7..629077b88 100644 --- a/examples/wireless/wifi-80211n-mimo.cc +++ b/examples/wireless/wifi-80211n-mimo.cc @@ -216,7 +216,7 @@ main(int argc, char* argv[]) /* Setting applications */ const auto maxLoad = HtPhy::GetDataRate(i, channelBonding ? 40 : 20, - shortGuardInterval ? 400 : 800, + NanoSeconds(shortGuardInterval ? 400 : 800), nStreams); ApplicationContainer serverApp; if (udp) diff --git a/examples/wireless/wifi-eht-network.cc b/examples/wireless/wifi-eht-network.cc index 2ee3f5c4e..d20fc7964 100644 --- a/examples/wireless/wifi-eht-network.cc +++ b/examples/wireless/wifi-eht-network.cc @@ -498,7 +498,7 @@ main(int argc, char* argv[]) } const auto maxLoad = - nLinks * EhtPhy::GetDataRate(mcs, channelWidth, gi, 1) / nStations; + nLinks * EhtPhy::GetDataRate(mcs, channelWidth, NanoSeconds(gi), 1) / nStations; if (udp) { // UDP flow diff --git a/examples/wireless/wifi-he-network.cc b/examples/wireless/wifi-he-network.cc index af4cda941..8067f92f1 100644 --- a/examples/wireless/wifi-he-network.cc +++ b/examples/wireless/wifi-he-network.cc @@ -367,7 +367,8 @@ main(int argc, char* argv[]) clientNodes.Add(downlink ? wifiApNode.Get(0) : wifiStaNodes.Get(i)); } - const auto maxLoad = HePhy::GetDataRate(mcs, channelWidth, gi, 1) / nStations; + const auto maxLoad = + HePhy::GetDataRate(mcs, channelWidth, NanoSeconds(gi), 1) / nStations; if (udp) { // UDP flow diff --git a/examples/wireless/wifi-ht-network.cc b/examples/wireless/wifi-ht-network.cc index aaf27ae23..e529428ba 100644 --- a/examples/wireless/wifi-ht-network.cc +++ b/examples/wireless/wifi-ht-network.cc @@ -232,7 +232,8 @@ main(int argc, char* argv[]) apNodeInterface = address.Assign(apDevice); /* Setting applications */ - const auto maxLoad = HtPhy::GetDataRate(mcs, channelWidth, sgi ? 400 : 800, 1); + const auto maxLoad = + HtPhy::GetDataRate(mcs, channelWidth, NanoSeconds(sgi ? 400 : 800), 1); ApplicationContainer serverApp; if (udp) { diff --git a/examples/wireless/wifi-vht-network.cc b/examples/wireless/wifi-vht-network.cc index e82c74d2b..125efd0a9 100644 --- a/examples/wireless/wifi-vht-network.cc +++ b/examples/wireless/wifi-vht-network.cc @@ -265,7 +265,8 @@ main(int argc, char* argv[]) apNodeInterface = address.Assign(apDevice); /* Setting applications */ - const auto maxLoad = VhtPhy::GetDataRate(mcs, channelWidth, sgi ? 400 : 800, 1); + const auto maxLoad = + VhtPhy::GetDataRate(mcs, channelWidth, NanoSeconds(sgi ? 400 : 800), 1); ApplicationContainer serverApp; if (udp) { diff --git a/src/mesh/model/mesh-wifi-interface-mac.cc b/src/mesh/model/mesh-wifi-interface-mac.cc index 7a88a30d5..38f090e1b 100644 --- a/src/mesh/model/mesh-wifi-interface-mac.cc +++ b/src/mesh/model/mesh-wifi-interface-mac.cc @@ -298,14 +298,14 @@ MeshWifiInterfaceMac::GetSupportedRates() const AllSupportedRates rates; for (const auto& mode : GetWifiPhy()->GetModeList()) { - uint16_t gi = ConvertGuardIntervalToNanoSeconds(mode, GetWifiPhy()->GetDevice()); + const auto gi = GetGuardIntervalForMode(mode, GetWifiPhy()->GetDevice()); rates.AddSupportedRate(mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1)); } // set the basic rates for (uint32_t j = 0; j < GetWifiRemoteStationManager()->GetNBasicModes(); j++) { - WifiMode mode = GetWifiRemoteStationManager()->GetBasicMode(j); - uint16_t gi = ConvertGuardIntervalToNanoSeconds(mode, GetWifiPhy()->GetDevice()); + const auto mode = GetWifiRemoteStationManager()->GetBasicMode(j); + const auto gi = GetGuardIntervalForMode(mode, GetWifiPhy()->GetDevice()); rates.SetBasicRate(mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1)); } return rates; @@ -316,8 +316,8 @@ MeshWifiInterfaceMac::CheckSupportedRates(AllSupportedRates rates) const { for (uint32_t i = 0; i < GetWifiRemoteStationManager()->GetNBasicModes(); i++) { - WifiMode mode = GetWifiRemoteStationManager()->GetBasicMode(i); - uint16_t gi = ConvertGuardIntervalToNanoSeconds(mode, GetWifiPhy()->GetDevice()); + const auto mode = GetWifiRemoteStationManager()->GetBasicMode(i); + const auto gi = GetGuardIntervalForMode(mode, GetWifiPhy()->GetDevice()); if (!rates.IsSupportedRate(mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1))) { return false; @@ -441,8 +441,8 @@ MeshWifiInterfaceMac::Receive(Ptr mpdu, uint8_t linkId) for (const auto& mode : GetWifiPhy()->GetModeList()) { - uint16_t gi = ConvertGuardIntervalToNanoSeconds(mode, GetWifiPhy()->GetDevice()); - uint64_t rate = mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1); + const auto gi = GetGuardIntervalForMode(mode, GetWifiPhy()->GetDevice()); + const auto rate = mode.GetDataRate(GetWifiPhy()->GetChannelWidth(), gi, 1); if (rates.IsSupportedRate(rate)) { GetWifiRemoteStationManager()->AddSupportedMode(hdr->GetAddr2(), mode); diff --git a/src/wifi/helper/wifi-helper.cc b/src/wifi/helper/wifi-helper.cc index 433211f80..c051f4b2a 100644 --- a/src/wifi/helper/wifi-helper.cc +++ b/src/wifi/helper/wifi-helper.cc @@ -281,7 +281,7 @@ WifiPhyHelper::GetRadiotapHeader(RadiotapHeader& header, frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_PREAMBLE; } - if (txVector.GetGuardInterval() == 400) + if (txVector.GetGuardInterval().GetNanoSeconds() == 400) { frameFlags |= RadiotapHeader::FRAME_FLAG_SHORT_GUARD; } @@ -339,7 +339,7 @@ WifiPhyHelper::GetRadiotapHeader(RadiotapHeader& header, } mcsKnown |= RadiotapHeader::MCS_KNOWN_GUARD_INTERVAL; - if (txVector.GetGuardInterval() == 400) + if (txVector.GetGuardInterval().GetNanoSeconds() == 400) { mcsFlags |= RadiotapHeader::MCS_FLAGS_GUARD_INTERVAL; } @@ -401,7 +401,7 @@ WifiPhyHelper::GetRadiotapHeader(RadiotapHeader& header, } vhtKnown |= RadiotapHeader::VHT_KNOWN_GUARD_INTERVAL; - if (txVector.GetGuardInterval() == 400) + if (txVector.GetGuardInterval().GetNanoSeconds() == 400) { vhtFlags |= RadiotapHeader::VHT_FLAGS_GUARD_INTERVAL; } @@ -517,11 +517,11 @@ WifiPhyHelper::GetRadiotapHeader(RadiotapHeader& header, { data5 |= RadiotapHeader::HE_DATA5_DATA_BW_RU_ALLOC_160MHZ; } - if (txVector.GetGuardInterval() == 1600) + if (txVector.GetGuardInterval().GetNanoSeconds() == 1600) { data5 |= RadiotapHeader::HE_DATA5_GI_1_6; } - else if (txVector.GetGuardInterval() == 3200) + else if (txVector.GetGuardInterval().GetNanoSeconds() == 3200) { data5 |= RadiotapHeader::HE_DATA5_GI_3_2; } diff --git a/src/wifi/model/ap-wifi-mac.cc b/src/wifi/model/ap-wifi-mac.cc index 8dfb569a9..b61ee4705 100644 --- a/src/wifi/model/ap-wifi-mac.cc +++ b/src/wifi/model/ap-wifi-mac.cc @@ -861,10 +861,10 @@ ApWifiMac::GetHtOperation(uint8_t linkId) const { uint8_t nss = (mcs.GetMcsValue() / 8) + 1; NS_ASSERT(nss > 0 && nss < 5); - uint64_t dataRate = - mcs.GetDataRate(phy->GetChannelWidth(), - GetHtConfiguration()->GetShortGuardIntervalSupported() ? 400 : 800, - nss); + uint64_t dataRate = mcs.GetDataRate( + phy->GetChannelWidth(), + NanoSeconds(GetHtConfiguration()->GetShortGuardIntervalSupported() ? 400 : 800), + nss); if (dataRate > maxSupportedRate) { maxSupportedRate = dataRate; @@ -890,7 +890,9 @@ ApWifiMac::GetHtOperation(uint8_t linkId) const NS_ASSERT(nss > 0 && nss < 5); uint64_t dataRate = mcs.GetDataRate( remoteStationManager->GetChannelWidthSupported(sta.second), - remoteStationManager->GetShortGuardIntervalSupported(sta.second) ? 400 : 800, + NanoSeconds(remoteStationManager->GetShortGuardIntervalSupported(sta.second) + ? 400 + : 800), nss); if (dataRate > maxSupportedRateByHtSta) { diff --git a/src/wifi/model/ctrl-headers.cc b/src/wifi/model/ctrl-headers.cc index 47c33aab7..7a45e6817 100644 --- a/src/wifi/model/ctrl-headers.cc +++ b/src/wifi/model/ctrl-headers.cc @@ -1696,8 +1696,8 @@ CtrlTriggerHeader::CtrlTriggerHeader(TriggerFrameType type, const WifiTxVector& m_triggerType = type; SetUlBandwidth(txVector.GetChannelWidth()); SetUlLength(txVector.GetLength()); - uint16_t gi = txVector.GetGuardInterval(); - if (gi == 800 || gi == 1600) + const auto gi = txVector.GetGuardInterval().GetNanoSeconds(); + if ((gi == 800) || (gi == 1600)) { m_giAndLtfType = 1; } @@ -2067,17 +2067,18 @@ CtrlTriggerHeader::GetUlBandwidth() const } void -CtrlTriggerHeader::SetGiAndLtfType(uint16_t guardInterval, uint8_t ltfType) +CtrlTriggerHeader::SetGiAndLtfType(Time guardInterval, uint8_t ltfType) { - if (ltfType == 1 && guardInterval == 1600) + const auto gi = guardInterval.GetNanoSeconds(); + if ((ltfType == 1) && (gi == 1600)) { m_giAndLtfType = 0; } - else if (ltfType == 2 && guardInterval == 1600) + else if ((ltfType == 2) && (gi == 1600)) { m_giAndLtfType = 1; } - else if (ltfType == 4 && guardInterval == 3200) + else if ((ltfType == 4) && (gi == 3200)) { m_giAndLtfType = 2; } @@ -2087,16 +2088,16 @@ CtrlTriggerHeader::SetGiAndLtfType(uint16_t guardInterval, uint8_t ltfType) } } -uint16_t +Time CtrlTriggerHeader::GetGuardInterval() const { if (m_giAndLtfType == 0 || m_giAndLtfType == 1) { - return 1600; + return NanoSeconds(1600); } else if (m_giAndLtfType == 2) { - return 3200; + return NanoSeconds(3200); } else { diff --git a/src/wifi/model/ctrl-headers.h b/src/wifi/model/ctrl-headers.h index edee0e8c1..fe94f41bb 100644 --- a/src/wifi/model/ctrl-headers.h +++ b/src/wifi/model/ctrl-headers.h @@ -1142,16 +1142,16 @@ class CtrlTriggerHeader : public Header * - 2x LTF + 1.6us GI * - 4x LTF + 3.2us GI * - * \param guardInterval the guard interval duration (in nanoseconds) + * \param guardInterval the guard interval duration * \param ltfType the HE-LTF type (1, 2 or 4) */ - void SetGiAndLtfType(uint16_t guardInterval, uint8_t ltfType); + void SetGiAndLtfType(Time guardInterval, uint8_t ltfType); /** - * Get the guard interval duration (in nanoseconds) of the solicited HE TB PPDU. + * Get the guard interval duration of the solicited HE TB PPDU. * - * \return the guard interval duration (in nanoseconds) of the solicited HE TB PPDU + * \return the guard interval duration of the solicited HE TB PPDU */ - uint16_t GetGuardInterval() const; + Time GetGuardInterval() const; /** * Get the LTF type of the solicited HE TB PPDU. * diff --git a/src/wifi/model/eht/eht-phy.cc b/src/wifi/model/eht/eht-phy.cc index 4b11dae99..a60d1c3eb 100644 --- a/src/wifi/model/eht/eht-phy.cc +++ b/src/wifi/model/eht/eht-phy.cc @@ -337,13 +337,10 @@ EhtPhy::GetConstellationSize(uint8_t mcsValue) } uint64_t -EhtPhy::GetPhyRate(uint8_t mcsValue, - ChannelWidthMhz channelWidth, - uint16_t guardInterval, - uint8_t nss) +EhtPhy::GetPhyRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) { - WifiCodeRate codeRate = GetCodeRate(mcsValue); - uint64_t dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss); + const auto codeRate = GetCodeRate(mcsValue); + const auto dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss); return HtPhy::CalculatePhyRate(codeRate, dataRate); } @@ -376,14 +373,12 @@ EhtPhy::GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t staId /* } uint64_t -EhtPhy::GetDataRate(uint8_t mcsValue, - ChannelWidthMhz channelWidth, - uint16_t guardInterval, - uint8_t nss) +EhtPhy::GetDataRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) { - NS_ASSERT(guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200); + [[maybe_unused]] const auto gi = guardInterval.GetNanoSeconds(); + NS_ASSERT((gi == 800) || (gi == 1600) || (gi == 3200)); NS_ASSERT(nss <= 8); - return HtPhy::CalculateDataRate(GetSymbolDuration(NanoSeconds(guardInterval)), + return HtPhy::CalculateDataRate(GetSymbolDuration(guardInterval), GetUsableSubcarriers(channelWidth), static_cast(log2(GetConstellationSize(mcsValue))), HtPhy::GetCodeRatio(GetCodeRate(mcsValue)), diff --git a/src/wifi/model/eht/eht-phy.h b/src/wifi/model/eht/eht-phy.h index f7324dc73..3f8b1eeab 100644 --- a/src/wifi/model/eht/eht-phy.h +++ b/src/wifi/model/eht/eht-phy.h @@ -193,14 +193,14 @@ class EhtPhy : public HePhy * * \param mcsValue the EHT MCS index * \param channelWidth the considered channel width in MHz - * \param guardInterval the considered guard interval duration in nanoseconds + * \param guardInterval the considered guard interval duration * \param nss the considered number of stream * * \return the physical bit rate of this signal in bps. */ static uint64_t GetPhyRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, uint8_t nss); /** @@ -233,13 +233,13 @@ class EhtPhy : public HePhy * * \param mcsValue the EHT MCS index * \param channelWidth the channel width in MHz - * \param guardInterval the guard interval duration in nanoseconds + * \param guardInterval the guard interval duration * \param nss the number of spatial streams * \return the data bit rate in bps. */ static uint64_t GetDataRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, uint8_t nss); /** diff --git a/src/wifi/model/error-rate-model.cc b/src/wifi/model/error-rate-model.cc index 8917c79be..8953508ad 100644 --- a/src/wifi/model/error-rate-model.cc +++ b/src/wifi/model/error-rate-model.cc @@ -73,7 +73,7 @@ ErrorRateModel::GetChunkSuccessRate(WifiMode mode, if (mode.GetModulationClass() == WIFI_MOD_CLASS_DSSS || mode.GetModulationClass() == WIFI_MOD_CLASS_HR_DSSS) { - switch (mode.GetDataRate(22, 0, 1)) + switch (mode.GetDataRate(22)) { case 1000000: return DsssErrorRateModel::GetDsssDbpskSuccessRate(snr, nbits); diff --git a/src/wifi/model/he/he-configuration.cc b/src/wifi/model/he/he-configuration.cc index f14310e6b..f7f13e22c 100644 --- a/src/wifi/model/he/he-configuration.cc +++ b/src/wifi/model/he/he-configuration.cc @@ -188,8 +188,8 @@ void HeConfiguration::SetGuardInterval(Time guardInterval) { NS_LOG_FUNCTION(this << guardInterval); - NS_ASSERT(guardInterval == NanoSeconds(800) || guardInterval == NanoSeconds(1600) || - guardInterval == NanoSeconds(3200)); + [[maybe_unused]] const auto gi = guardInterval.GetNanoSeconds(); + NS_ASSERT((gi == 800) || (gi == 1600) || (gi == 3200)); m_guardInterval = guardInterval; } diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index eedd12f90..dcc1e05b9 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -238,13 +238,13 @@ HePhy::GetSigBSize(const WifiTxVector& txVector) const Time HePhy::GetSigBDuration(const WifiTxVector& txVector) const { - if (auto sigBSize = GetSigBSize(txVector); sigBSize > 0) + if (const auto sigBSize = GetSigBSize(txVector); sigBSize > 0) { - auto symbolDuration = MicroSeconds(4); + const auto symbolDuration = MicroSeconds(4); // Number of data bits per symbol - auto ndbps = - GetSigBMode(txVector).GetDataRate(20, 800, 1) * symbolDuration.GetNanoSeconds() / 1e9; - auto numSymbols = ceil((sigBSize) / ndbps); + const auto ndbps = + GetSigBMode(txVector).GetDataRate(20) * symbolDuration.GetNanoSeconds() / 1e9; + const auto numSymbols = ceil((sigBSize) / ndbps); return FemtoSeconds(static_cast(numSymbols * symbolDuration.GetFemtoSeconds())); } @@ -258,8 +258,8 @@ HePhy::GetSigBDuration(const WifiTxVector& txVector) const Time HePhy::GetValidPpduDuration(Time ppduDuration, const WifiTxVector& txVector, WifiPhyBand band) { - Time tSymbol = NanoSeconds(12800 + txVector.GetGuardInterval()); - Time preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector); + const auto tSymbol = GetSymbolDuration(txVector.GetGuardInterval()); + const auto preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector); uint8_t sigExtension = (band == WIFI_PHY_BAND_2_4GHZ ? 6 : 0); uint32_t nSymbols = floor(static_cast((ppduDuration - preambleDuration).GetNanoSeconds() - @@ -329,16 +329,17 @@ HePhy::GetNumberBccEncoders(const WifiTxVector& /* txVector */) const Time HePhy::GetSymbolDuration(const WifiTxVector& txVector) const { - uint16_t gi = txVector.GetGuardInterval(); + const auto guardInterval = txVector.GetGuardInterval(); + [[maybe_unused]] const auto gi = guardInterval.GetNanoSeconds(); NS_ASSERT(gi == 800 || gi == 1600 || gi == 3200); - return GetSymbolDuration(NanoSeconds(gi)); + return GetSymbolDuration(guardInterval); } void HePhy::SetTrigVector(const WifiTxVector& trigVector, Time validity) { NS_LOG_FUNCTION(this << trigVector << validity); - NS_ASSERT_MSG(trigVector.GetGuardInterval() > 800, + NS_ASSERT_MSG(trigVector.GetGuardInterval().GetNanoSeconds() > 800, "Invalid guard interval " << trigVector.GetGuardInterval()); if (auto mac = m_wifiPhy->GetDevice()->GetMac(); mac && mac->GetTypeOfStation() != AP) { @@ -1672,13 +1673,10 @@ HePhy::GetConstellationSize(uint8_t mcsValue) } uint64_t -HePhy::GetPhyRate(uint8_t mcsValue, - ChannelWidthMhz channelWidth, - uint16_t guardInterval, - uint8_t nss) +HePhy::GetPhyRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) { - WifiCodeRate codeRate = GetCodeRate(mcsValue); - uint64_t dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss); + const auto codeRate = GetCodeRate(mcsValue); + const auto dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss); return HtPhy::CalculatePhyRate(codeRate, dataRate); } @@ -1711,14 +1709,12 @@ HePhy::GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t staId /* = } uint64_t -HePhy::GetDataRate(uint8_t mcsValue, - ChannelWidthMhz channelWidth, - uint16_t guardInterval, - uint8_t nss) +HePhy::GetDataRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) { - NS_ASSERT(guardInterval == 800 || guardInterval == 1600 || guardInterval == 3200); + [[maybe_unused]] const auto gi = guardInterval.GetNanoSeconds(); + NS_ASSERT((gi == 800) || (gi == 1600) || (gi == 3200)); NS_ASSERT(nss <= 8); - return HtPhy::CalculateDataRate(GetSymbolDuration(NanoSeconds(guardInterval)), + return HtPhy::CalculateDataRate(GetSymbolDuration(guardInterval), GetUsableSubcarriers(channelWidth), static_cast(log2(GetConstellationSize(mcsValue))), HtPhy::GetCodeRatio(GetCodeRate(mcsValue)), diff --git a/src/wifi/model/he/he-phy.h b/src/wifi/model/he/he-phy.h index 5b4c1ea68..f04dd1fd4 100644 --- a/src/wifi/model/he/he-phy.h +++ b/src/wifi/model/he/he-phy.h @@ -368,14 +368,14 @@ class HePhy : public VhtPhy * * \param mcsValue the HE MCS index * \param channelWidth the considered channel width in MHz - * \param guardInterval the considered guard interval duration in nanoseconds + * \param guardInterval the considered guard interval duration * \param nss the considered number of stream * * \return the physical bit rate of this signal in bps. */ static uint64_t GetPhyRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, uint8_t nss); /** * Return the PHY rate corresponding to @@ -405,13 +405,13 @@ class HePhy : public VhtPhy * * \param mcsValue the MCS index * \param channelWidth the channel width in MHz - * \param guardInterval the guard interval duration in nanoseconds + * \param guardInterval the guard interval duration * \param nss the number of spatial streams * \return the data bit rate in bps. */ static uint64_t GetDataRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, uint8_t nss); /** * Calculate the rate in bps of the non-HT Reference Rate corresponding @@ -441,6 +441,12 @@ class HePhy : public VhtPhy */ static WifiMode CreateHeMcs(uint8_t index); + /** + * \param guardInterval the guard interval duration + * \return the symbol duration + */ + static Time GetSymbolDuration(Time guardInterval); + /** * \param bandWidth the width (MHz) of the band used for the OFDMA transmission. Must be * a multiple of 20 MHz @@ -555,12 +561,6 @@ class HePhy : public VhtPhy */ static uint16_t GetUsableSubcarriers(ChannelWidthMhz channelWidth); - /** - * \param guardInterval the guard interval duration - * \return the symbol duration - */ - static Time GetSymbolDuration(Time guardInterval); - uint64_t m_previouslyTxPpduUid; //!< UID of the previously sent PPDU, used by AP to recognize //!< response HE TB PPDUs uint64_t m_currentMuPpduUid; //!< UID of the HE MU or HE TB PPDU being received diff --git a/src/wifi/model/he/he-ppdu.cc b/src/wifi/model/he/he-ppdu.cc index e55ad0d89..da8ad7d85 100644 --- a/src/wifi/model/he/he-ppdu.cc +++ b/src/wifi/model/he/he-ppdu.cc @@ -316,7 +316,7 @@ HePpdu::GetTxDuration() const Time ppduDuration = Seconds(0); const auto& txVector = GetTxVector(); const auto length = m_lSig.GetLength(); - const auto tSymbol = NanoSeconds(12800 + txVector.GetGuardInterval()); + const auto tSymbol = HePhy::GetSymbolDuration(txVector.GetGuardInterval()); const auto preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector); NS_ASSERT(m_operatingChannel.IsSet()); uint8_t sigExtension = (m_operatingChannel.GetPhyBand() == WIFI_PHY_BAND_2_4GHZ) ? 6 : 0; @@ -735,17 +735,18 @@ HePpdu::GetChannelWidthMhzFromEncoding(uint8_t bandwidth) } uint8_t -HePpdu::GetGuardIntervalAndNltfEncoding(uint16_t gi, uint8_t nltf) +HePpdu::GetGuardIntervalAndNltfEncoding(Time guardInterval, uint8_t nltf) { - if (gi == 800 && nltf == 1) + const auto gi = guardInterval.GetNanoSeconds(); + if ((gi == 800) && (nltf == 1)) { return 0; } - else if (gi == 800 && nltf == 2) + else if ((gi == 800) && (nltf == 2)) { return 1; } - else if (gi == 1600 && nltf == 2) + else if ((gi == 1600) && (nltf == 2)) { return 2; } @@ -755,21 +756,21 @@ HePpdu::GetGuardIntervalAndNltfEncoding(uint16_t gi, uint8_t nltf) } } -uint16_t +Time HePpdu::GetGuardIntervalFromEncoding(uint8_t giAndNltfSize) { if (giAndNltfSize == 3) { // we currently do not consider DCM nor STBC fields - return 3200; + return NanoSeconds(3200); } else if (giAndNltfSize == 2) { - return 1600; + return NanoSeconds(1600); } else { - return 800; + return NanoSeconds(800); } } diff --git a/src/wifi/model/he/he-ppdu.h b/src/wifi/model/he/he-ppdu.h index e5c050bbc..40e9ecfa2 100644 --- a/src/wifi/model/he/he-ppdu.h +++ b/src/wifi/model/he/he-ppdu.h @@ -269,13 +269,13 @@ class HePpdu : public OfdmPpdu static uint8_t GetNstsEncodingFromNss(uint8_t nss); /** - * Convert guard interval (in ns) and NLTF to its encoding in HE-SIG-A. + * Convert guard interval and NLTF to its encoding in HE-SIG-A. * - * \param gi the guard interval in nanoseconds + * \param guardInterval the guard interval * \param nltf the the number of long training symbols * \return the value used to encode the NSTS field in HE-SIG-A */ - static uint8_t GetGuardIntervalAndNltfEncoding(uint16_t gi, uint8_t nltf); + static uint8_t GetGuardIntervalAndNltfEncoding(Time guardInterval, uint8_t nltf); /** * Convert number of spatial streams from NSTS field encoding in HE-SIG-A. @@ -294,12 +294,12 @@ class HePpdu : public OfdmPpdu static ChannelWidthMhz GetChannelWidthMhzFromEncoding(uint8_t bandwidth); /** - * Convert guard interval (in ns) from its encoding in HE-SIG-A. + * Convert guard interval from its encoding in HE-SIG-A. * * \param giAndNltfSize the value used to encode the guard interval and NLTF field in HE-SIG-A - * \return the guard interval in nanoseconds + * \return the guard interval */ - static uint16_t GetGuardIntervalFromEncoding(uint8_t giAndNltfSize); + static Time GetGuardIntervalFromEncoding(uint8_t giAndNltfSize); /** * Convert number of MU-MIMO users to its encoding in HE-SIG-A. diff --git a/src/wifi/model/he/rr-multi-user-scheduler.cc b/src/wifi/model/he/rr-multi-user-scheduler.cc index 9a3a681f2..e0b738f83 100644 --- a/src/wifi/model/he/rr-multi-user-scheduler.cc +++ b/src/wifi/model/he/rr-multi-user-scheduler.cc @@ -201,7 +201,7 @@ RrMultiUserScheduler::GetTxVectorForUlMu(Func canBeSolicited) WifiTxVector txVector; txVector.SetPreambleType(WIFI_PREAMBLE_HE_TB); txVector.SetChannelWidth(m_allowedWidth); - txVector.SetGuardInterval(heConfiguration->GetGuardInterval().GetNanoSeconds()); + txVector.SetGuardInterval(heConfiguration->GetGuardInterval()); txVector.SetBssColor(heConfiguration->GetBssColor()); // iterate over the associated stations until an enough number of stations is identified @@ -651,7 +651,7 @@ RrMultiUserScheduler::TrySendingDlMuPpdu() m_txParams.Clear(); m_txParams.m_txVector.SetPreambleType(WIFI_PREAMBLE_HE_MU); m_txParams.m_txVector.SetChannelWidth(m_allowedWidth); - m_txParams.m_txVector.SetGuardInterval(heConfiguration->GetGuardInterval().GetNanoSeconds()); + m_txParams.m_txVector.SetGuardInterval(heConfiguration->GetGuardInterval()); m_txParams.m_txVector.SetBssColor(heConfiguration->GetBssColor()); // The TXOP limit can be exceeded by the TXOP holder if it does not transmit more diff --git a/src/wifi/model/ht/ht-phy.cc b/src/wifi/model/ht/ht-phy.cc index f1741178d..25774a612 100644 --- a/src/wifi/model/ht/ht-phy.cc +++ b/src/wifi/model/ht/ht-phy.cc @@ -366,16 +366,17 @@ HtPhy::GetNumberBccEncoders(const WifiTxVector& txVector) const * were obtained by observing the rates for which Nes was incremented in tables * 19-27 to 19-41 of IEEE 802.11-2016. */ - double maxRatePerCoder = (txVector.GetGuardInterval() == 800) ? 320e6 : 350e6; + double maxRatePerCoder = (txVector.GetGuardInterval().GetNanoSeconds() == 800) ? 320e6 : 350e6; return ceil(txVector.GetMode().GetDataRate(txVector) / maxRatePerCoder); } Time HtPhy::GetSymbolDuration(const WifiTxVector& txVector) const { - uint16_t gi = txVector.GetGuardInterval(); + const auto guardInterval = txVector.GetGuardInterval(); + [[maybe_unused]] const auto gi = guardInterval.GetNanoSeconds(); NS_ASSERT(gi == 400 || gi == 800); - return NanoSeconds(3200 + gi); + return GetSymbolDuration(guardInterval); } Ptr @@ -650,13 +651,10 @@ HtPhy::GetConstellationSize(uint8_t mcsValue) } uint64_t -HtPhy::GetPhyRate(uint8_t mcsValue, - ChannelWidthMhz channelWidth, - uint16_t guardInterval, - uint8_t nss) +HtPhy::GetPhyRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) { - WifiCodeRate codeRate = GetHtCodeRate(mcsValue); - uint64_t dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss); + const auto codeRate = GetHtCodeRate(mcsValue); + const auto dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss); return CalculatePhyRate(codeRate, dataRate); } @@ -697,14 +695,12 @@ HtPhy::GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId * } uint64_t -HtPhy::GetDataRate(uint8_t mcsValue, - ChannelWidthMhz channelWidth, - uint16_t guardInterval, - uint8_t nss) +HtPhy::GetDataRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) { - NS_ASSERT(guardInterval == 800 || guardInterval == 400); + [[maybe_unused]] const auto gi = guardInterval.GetNanoSeconds(); + NS_ASSERT((gi == 800) || (gi == 400)); NS_ASSERT(nss <= 4); - return CalculateDataRate(GetSymbolDuration(NanoSeconds(guardInterval)), + return CalculateDataRate(GetSymbolDuration(guardInterval), GetUsableSubcarriers(channelWidth), static_cast(log2(GetHtConstellationSize(mcsValue))), GetCodeRatio(GetHtCodeRate(mcsValue)), diff --git a/src/wifi/model/ht/ht-phy.h b/src/wifi/model/ht/ht-phy.h index bb6c10329..72331aa91 100644 --- a/src/wifi/model/ht/ht-phy.h +++ b/src/wifi/model/ht/ht-phy.h @@ -397,14 +397,14 @@ class HtPhy : public OfdmPhy * * \param mcsValue the HT MCS index * \param channelWidth the considered channel width in MHz - * \param guardInterval the considered guard interval duration in nanoseconds + * \param guardInterval the considered guard interval duration * \param nss the considered number of stream * * \return the physical bit rate of this signal in bps. */ static uint64_t GetPhyRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, uint8_t nss); /** * Return the PHY rate corresponding to @@ -442,7 +442,7 @@ class HtPhy : public OfdmPhy */ static uint64_t GetDataRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, uint8_t nss); /** * Calculate the rate in bps of the non-HT Reference Rate corresponding diff --git a/src/wifi/model/ht/ht-ppdu.cc b/src/wifi/model/ht/ht-ppdu.cc index ca62bc7b8..8e002585d 100644 --- a/src/wifi/model/ht/ht-ppdu.cc +++ b/src/wifi/model/ht/ht-ppdu.cc @@ -82,7 +82,7 @@ HtPpdu::SetHtSigHeader(HtSigHeader& htSig, const WifiTxVector& txVector, std::si htSig.SetChannelWidth(txVector.GetChannelWidth()); htSig.SetHtLength(psduSize); htSig.SetAggregation(txVector.IsAggregation()); - htSig.SetShortGuardInterval(txVector.GetGuardInterval() == 400); + htSig.SetShortGuardInterval(txVector.GetGuardInterval().GetNanoSeconds() == 400); } WifiTxVector @@ -102,7 +102,7 @@ HtPpdu::SetTxVectorFromPhyHeaders(WifiTxVector& txVector, txVector.SetMode(HtPhy::GetHtMcs(htSig.GetMcs())); txVector.SetChannelWidth(htSig.GetChannelWidth()); txVector.SetNss(1 + (htSig.GetMcs() / 8)); - txVector.SetGuardInterval(htSig.GetShortGuardInterval() ? 400 : 800); + txVector.SetGuardInterval(NanoSeconds(htSig.GetShortGuardInterval() ? 400 : 800)); txVector.SetAggregation(htSig.GetAggregation()); } diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index 1c8268cc5..393ceea0e 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -653,8 +653,7 @@ PhyEntity::ScheduleEndOfMpdus(Ptr event) remainingAmpduDuration -= mpduDuration; if (i == (nMpdus - 1) && !remainingAmpduDuration.IsZero()) // no more MPDUs coming { - if (remainingAmpduDuration < - NanoSeconds(txVector.GetGuardInterval())) // enables to ignore padding + if (remainingAmpduDuration < txVector.GetGuardInterval()) // enables to ignore padding { mpduDuration += remainingAmpduDuration; // apply a correction just in case rounding // had induced slight shift diff --git a/src/wifi/model/rate-control/aarf-wifi-manager.cc b/src/wifi/model/rate-control/aarf-wifi-manager.cc index ff5149127..ea9d0d615 100644 --- a/src/wifi/model/rate-control/aarf-wifi-manager.cc +++ b/src/wifi/model/rate-control/aarf-wifi-manager.cc @@ -276,7 +276,7 @@ AarfWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allowe mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -309,7 +309,7 @@ AarfWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/aarfcd-wifi-manager.cc b/src/wifi/model/rate-control/aarfcd-wifi-manager.cc index 16eb13c03..a74de39e5 100644 --- a/src/wifi/model/rate-control/aarfcd-wifi-manager.cc +++ b/src/wifi/model/rate-control/aarfcd-wifi-manager.cc @@ -345,7 +345,7 @@ AarfcdWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allo mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -378,7 +378,7 @@ AarfcdWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/amrr-wifi-manager.cc b/src/wifi/model/rate-control/amrr-wifi-manager.cc index b1a575181..cd1f9d41a 100644 --- a/src/wifi/model/rate-control/amrr-wifi-manager.cc +++ b/src/wifi/model/rate-control/amrr-wifi-manager.cc @@ -391,7 +391,7 @@ AmrrWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allowe mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -423,7 +423,7 @@ AmrrWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/aparf-wifi-manager.cc b/src/wifi/model/rate-control/aparf-wifi-manager.cc index 099848e1c..ee949feab 100644 --- a/src/wifi/model/rate-control/aparf-wifi-manager.cc +++ b/src/wifi/model/rate-control/aparf-wifi-manager.cc @@ -377,7 +377,7 @@ AparfWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allow mode, station->m_powerLevel, GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -410,7 +410,7 @@ AparfWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/arf-wifi-manager.cc b/src/wifi/model/rate-control/arf-wifi-manager.cc index c5291e5ec..1ef41272e 100644 --- a/src/wifi/model/rate-control/arf-wifi-manager.cc +++ b/src/wifi/model/rate-control/arf-wifi-manager.cc @@ -253,7 +253,7 @@ ArfWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allowed mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -286,7 +286,7 @@ ArfWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/cara-wifi-manager.cc b/src/wifi/model/rate-control/cara-wifi-manager.cc index 7313c7fa9..ad2e2361b 100644 --- a/src/wifi/model/rate-control/cara-wifi-manager.cc +++ b/src/wifi/model/rate-control/cara-wifi-manager.cc @@ -224,7 +224,7 @@ CaraWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allowe mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -257,7 +257,7 @@ CaraWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/constant-rate-wifi-manager.cc b/src/wifi/model/rate-control/constant-rate-wifi-manager.cc index 4733e848b..df1c33619 100644 --- a/src/wifi/model/rate-control/constant-rate-wifi-manager.cc +++ b/src/wifi/model/rate-control/constant-rate-wifi-manager.cc @@ -136,9 +136,9 @@ ConstantRateWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMh m_dataMode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(m_dataMode.GetModulationClass(), GetShortPreambleEnabled()), - ConvertGuardIntervalToNanoSeconds(m_dataMode, - GetShortGuardIntervalSupported(st), - NanoSeconds(GetGuardInterval(st))), + GetGuardIntervalForMode(m_dataMode, + GetShortGuardIntervalSupported(st), + GetGuardInterval(st)), GetNumberOfAntennas(), nss, 0, @@ -154,9 +154,9 @@ ConstantRateWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) m_ctlMode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(m_ctlMode.GetModulationClass(), GetShortPreambleEnabled()), - ConvertGuardIntervalToNanoSeconds(m_ctlMode, - GetShortGuardIntervalSupported(st), - NanoSeconds(GetGuardInterval(st))), + GetGuardIntervalForMode(m_ctlMode, + GetShortGuardIntervalSupported(st), + GetGuardInterval(st)), 1, 1, 0, diff --git a/src/wifi/model/rate-control/ideal-wifi-manager.cc b/src/wifi/model/rate-control/ideal-wifi-manager.cc index d63a5f914..5484d0093 100644 --- a/src/wifi/model/rate-control/ideal-wifi-manager.cc +++ b/src/wifi/model/rate-control/ideal-wifi-manager.cc @@ -141,7 +141,8 @@ IdealWifiManager::BuildSnrThresholds() txVector.SetChannelWidth(j); if (mode.GetModulationClass() == WIFI_MOD_CLASS_HT) { - uint16_t guardInterval = GetShortGuardIntervalSupported() ? 400 : 800; + const auto guardInterval = + NanoSeconds(GetShortGuardIntervalSupported() ? 400 : 800); txVector.SetGuardInterval(guardInterval); // derive NSS from the MCS index nss = (mode.GetMcsValue() / 8) + 1; @@ -153,10 +154,10 @@ IdealWifiManager::BuildSnrThresholds() } else { - uint16_t guardInterval; + Time guardInterval{}; if (mode.GetModulationClass() == WIFI_MOD_CLASS_VHT) { - guardInterval = GetShortGuardIntervalSupported() ? 400 : 800; + guardInterval = NanoSeconds(GetShortGuardIntervalSupported() ? 400 : 800); } else { @@ -344,7 +345,7 @@ IdealWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allow WifiTxVector txVector; uint64_t bestRate = 0; uint8_t selectedNss = 1; - uint16_t guardInterval; + Time guardInterval{}; const auto channelWidth = std::min(GetChannelWidth(station), allowedWidth); txVector.SetChannelWidth(channelWidth); if ((station->m_lastSnrCached != CACHE_INITIAL_VALUE) && @@ -373,16 +374,16 @@ IdealWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allow continue; } txVector.SetMode(mode); - uint16_t guardInterval; + Time guardInterval{}; if (mode.GetModulationClass() >= WIFI_MOD_CLASS_HE) { guardInterval = std::max(GetGuardInterval(station), GetGuardInterval()); } else { - guardInterval = static_cast( - std::max(GetShortGuardIntervalSupported(station) ? 400 : 800, - GetShortGuardIntervalSupported() ? 400 : 800)); + guardInterval = + std::max(NanoSeconds(GetShortGuardIntervalSupported(station) ? 400 : 800), + NanoSeconds(GetShortGuardIntervalSupported() ? 400 : 800)); } txVector.SetGuardInterval(guardInterval); if (mode.GetModulationClass() == WIFI_MOD_CLASS_HT) @@ -500,13 +501,12 @@ IdealWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allow } else if ((maxMode.GetModulationClass() >= WIFI_MOD_CLASS_HT)) { - guardInterval = - static_cast(std::max(GetShortGuardIntervalSupported(station) ? 400 : 800, - GetShortGuardIntervalSupported() ? 400 : 800)); + guardInterval = std::max(NanoSeconds(GetShortGuardIntervalSupported(station) ? 400 : 800), + NanoSeconds(GetShortGuardIntervalSupported() ? 400 : 800)); } else { - guardInterval = 800; + guardInterval = NanoSeconds(800); } WifiTxVector bestTxVector{ maxMode, @@ -558,7 +558,7 @@ IdealWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) maxMode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(maxMode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), GetNumberOfAntennas(), nss, 0, diff --git a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc index ae558e771..70fbe43a9 100644 --- a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc +++ b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.cc @@ -232,12 +232,13 @@ MinstrelHtWifiManager::DoInitialize() { for (int gi = 800; gi >= 400;) { + const auto guardInterval = NanoSeconds(gi); for (uint8_t streams = 1; streams <= MAX_HT_SUPPORTED_STREAMS; streams++) { - uint8_t groupId = GetHtGroupId(streams, gi, chWidth); + uint8_t groupId = GetHtGroupId(streams, guardInterval, chWidth); m_minstrelGroups[groupId].streams = streams; - m_minstrelGroups[groupId].gi = gi; + m_minstrelGroups[groupId].gi = guardInterval; m_minstrelGroups[groupId].chWidth = chWidth; m_minstrelGroups[groupId].type = WIFI_MINSTREL_GROUP_HT; m_minstrelGroups[groupId].isSupported = false; @@ -262,7 +263,7 @@ MinstrelHtWifiManager::DoInitialize() mode, CalculateMpduTxDuration(GetPhy(), streams, - gi, + guardInterval, chWidth, mode, FIRST_MPDU_IN_AGGREGATE)); @@ -270,13 +271,14 @@ MinstrelHtWifiManager::DoInitialize() mode, CalculateMpduTxDuration(GetPhy(), streams, - gi, + guardInterval, chWidth, mode, MIDDLE_MPDU_IN_AGGREGATE)); } NS_LOG_DEBUG("Initialized group " << +groupId << ": (" << +streams << "," - << gi << "," << chWidth << ")"); + << guardInterval << "," << chWidth + << ")"); } } gi /= 2; @@ -291,12 +293,13 @@ MinstrelHtWifiManager::DoInitialize() { for (int gi = 800; gi >= 400;) { + const auto guardInterval = NanoSeconds(gi); for (uint8_t streams = 1; streams <= MAX_VHT_SUPPORTED_STREAMS; streams++) { - uint8_t groupId = GetVhtGroupId(streams, gi, chWidth); + uint8_t groupId = GetVhtGroupId(streams, guardInterval, chWidth); m_minstrelGroups[groupId].streams = streams; - m_minstrelGroups[groupId].gi = gi; + m_minstrelGroups[groupId].gi = guardInterval; m_minstrelGroups[groupId].chWidth = chWidth; m_minstrelGroups[groupId].type = WIFI_MINSTREL_GROUP_VHT; m_minstrelGroups[groupId].isSupported = false; @@ -324,7 +327,7 @@ MinstrelHtWifiManager::DoInitialize() mode, CalculateMpduTxDuration(GetPhy(), streams, - gi, + guardInterval, chWidth, mode, FIRST_MPDU_IN_AGGREGATE)); @@ -332,7 +335,7 @@ MinstrelHtWifiManager::DoInitialize() mode, CalculateMpduTxDuration(GetPhy(), streams, - gi, + guardInterval, chWidth, mode, MIDDLE_MPDU_IN_AGGREGATE)); @@ -354,18 +357,20 @@ MinstrelHtWifiManager::DoInitialize() { for (int gi = 3200; gi >= 800;) { + const auto guardInterval = NanoSeconds(gi); for (uint8_t streams = 1; streams <= MAX_HE_SUPPORTED_STREAMS; streams++) { - uint8_t groupId = GetHeGroupId(streams, gi, chWidth); + uint8_t groupId = GetHeGroupId(streams, guardInterval, chWidth); m_minstrelGroups[groupId].streams = streams; - m_minstrelGroups[groupId].gi = gi; + m_minstrelGroups[groupId].gi = guardInterval; m_minstrelGroups[groupId].chWidth = chWidth; m_minstrelGroups[groupId].type = WIFI_MINSTREL_GROUP_HE; m_minstrelGroups[groupId].isSupported = false; // Check capabilities of the device - if ((GetGuardInterval() <= gi) /// Is GI supported by the transmitter? + if ((GetGuardInterval() <= + guardInterval) /// Is GI supported by the transmitter? && (GetPhy()->GetChannelWidth() >= chWidth) /// Is channel width supported by the transmitter? && (GetPhy()->GetMaxSupportedTxSpatialStreams() >= @@ -386,7 +391,7 @@ MinstrelHtWifiManager::DoInitialize() mode, CalculateMpduTxDuration(GetPhy(), streams, - gi, + guardInterval, chWidth, mode, FIRST_MPDU_IN_AGGREGATE)); @@ -394,7 +399,7 @@ MinstrelHtWifiManager::DoInitialize() mode, CalculateMpduTxDuration(GetPhy(), streams, - gi, + guardInterval, chWidth, mode, MIDDLE_MPDU_IN_AGGREGATE)); @@ -427,7 +432,7 @@ MinstrelHtWifiManager::IsValidMcs(Ptr phy, Time MinstrelHtWifiManager::CalculateMpduTxDuration(Ptr phy, uint8_t streams, - uint16_t gi, + Time gi, ChannelWidthMhz chWidth, WifiMode mode, MpduType mpduType) @@ -1058,7 +1063,7 @@ MinstrelHtWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz // Check consistency of rate selected. if (((group.type == WIFI_MINSTREL_GROUP_HE) && (group.gi < GetGuardInterval(station))) || (((group.type == WIFI_MINSTREL_GROUP_HT) || (group.type == WIFI_MINSTREL_GROUP_VHT)) && - (group.gi == 400) && !GetShortGuardIntervalSupported(station)) || + (group.gi.GetNanoSeconds() == 400) && !GetShortGuardIntervalSupported(station)) || (group.chWidth > GetChannelWidth(station)) || (group.streams > GetNumberOfSupportedStreams(station))) { @@ -1067,7 +1072,7 @@ MinstrelHtWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz << " Station capabilities: (" << GetNumberOfSupportedStreams(station) << "," << ((group.type == WIFI_MINSTREL_GROUP_HE) ? GetGuardInterval(station) - : (GetShortGuardIntervalSupported(station) ? 400 : 800)) + : NanoSeconds(GetShortGuardIntervalSupported(station) ? 400 : 800)) << "," << GetChannelWidth(station) << ")"); } WifiMode mode = GetMcsSupported(station, mcsIndex); @@ -1164,7 +1169,7 @@ MinstrelHtWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) rtsRate, GetDefaultTxPowerLevel(), GetPreambleForTransmission(rtsRate.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -1742,7 +1747,8 @@ MinstrelHtWifiManager::RateInit(MinstrelHtWifiRemoteStation* station) } if (((m_minstrelGroups[groupId].type == WIFI_MINSTREL_GROUP_HT) || (m_minstrelGroups[groupId].type == WIFI_MINSTREL_GROUP_VHT)) && - (m_minstrelGroups[groupId].gi == 400) && !GetShortGuardIntervalSupported(station)) + (m_minstrelGroups[groupId].gi.GetNanoSeconds() == 400) && + !GetShortGuardIntervalSupported(station)) { // It is a SGI group but the receiver does not support SGI: skip continue; @@ -2108,20 +2114,20 @@ MinstrelHtWifiManager::GetGroupId(uint16_t index) } uint8_t -MinstrelHtWifiManager::GetHtGroupId(uint8_t txstreams, uint16_t gi, ChannelWidthMhz chWidth) +MinstrelHtWifiManager::GetHtGroupId(uint8_t txstreams, Time guardInterval, ChannelWidthMhz chWidth) { - NS_LOG_FUNCTION(this << +txstreams << gi << chWidth); - uint8_t giIndex = (gi == 400) ? 1 : 0; + NS_LOG_FUNCTION(this << +txstreams << guardInterval << chWidth); + uint8_t giIndex = (guardInterval.GetNanoSeconds() == 400) ? 1 : 0; uint8_t widthIndex = (chWidth == 40) ? 1 : 0; return (MAX_HT_SUPPORTED_STREAMS * 2 * widthIndex) + (MAX_HT_SUPPORTED_STREAMS * giIndex) + txstreams - 1; } uint8_t -MinstrelHtWifiManager::GetVhtGroupId(uint8_t txstreams, uint16_t gi, ChannelWidthMhz chWidth) +MinstrelHtWifiManager::GetVhtGroupId(uint8_t txstreams, Time guardInterval, ChannelWidthMhz chWidth) { - NS_LOG_FUNCTION(this << +txstreams << gi << chWidth); - uint8_t giIndex = (gi == 400) ? 1 : 0; + NS_LOG_FUNCTION(this << +txstreams << guardInterval << chWidth); + uint8_t giIndex = (guardInterval.GetNanoSeconds() == 400) ? 1 : 0; uint8_t widthIndex; if (chWidth == 160) { @@ -2146,11 +2152,11 @@ MinstrelHtWifiManager::GetVhtGroupId(uint8_t txstreams, uint16_t gi, ChannelWidt } uint8_t -MinstrelHtWifiManager::GetHeGroupId(uint8_t txstreams, uint16_t gi, ChannelWidthMhz chWidth) +MinstrelHtWifiManager::GetHeGroupId(uint8_t txstreams, Time guardInterval, ChannelWidthMhz chWidth) { - NS_LOG_FUNCTION(this << +txstreams << gi << chWidth); + NS_LOG_FUNCTION(this << +txstreams << guardInterval << chWidth); uint8_t giIndex; - if (gi == 800) + if (const auto gi = guardInterval.GetNanoSeconds(); gi == 800) { giIndex = 2; } diff --git a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.h b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.h index 7d00d3596..5fd3118af 100644 --- a/src/wifi/model/rate-control/minstrel-ht-wifi-manager.h +++ b/src/wifi/model/rate-control/minstrel-ht-wifi-manager.h @@ -81,7 +81,7 @@ operator<<(std::ostream& os, McsGroupType type) struct McsGroup { uint8_t streams; ///< number of spatial streams - uint16_t gi; ///< guard interval duration (nanoseconds) + Time gi; ///< guard interval duration ChannelWidthMhz chWidth; ///< channel width (MHz) McsGroupType type; ///< identifies the group, \see McsGroupType bool isSupported; ///< flag whether group is supported @@ -305,7 +305,7 @@ class MinstrelHtWifiManager : public WifiRemoteStationManager * * \param phy pointer to the wifi PHY * \param streams the number of streams - * \param gi guard interval duration (nanoseconds) + * \param gi guard interval duration * \param chWidth the channel width (MHz) * \param mode the wifi mode * \param mpduType the type of the MPDU @@ -313,7 +313,7 @@ class MinstrelHtWifiManager : public WifiRemoteStationManager */ Time CalculateMpduTxDuration(Ptr phy, uint8_t streams, - uint16_t gi, + Time gi, ChannelWidthMhz chWidth, WifiMode mode, MpduType mpduType); @@ -578,31 +578,31 @@ class MinstrelHtWifiManager : public WifiRemoteStationManager * Returns the groupId of an HT MCS with the given number of streams, GI and channel width used. * * \param txstreams the number of streams - * \param gi guard interval duration (nanoseconds) - * \param chWidth the channel width (MHz) + * \param guardInterval guard interval duration + * \param chWidth the channel width * \returns the HT group ID */ - uint8_t GetHtGroupId(uint8_t txstreams, uint16_t gi, ChannelWidthMhz chWidth); + uint8_t GetHtGroupId(uint8_t txstreams, Time guardInterval, ChannelWidthMhz chWidth); /** * Returns the groupId of a VHT MCS with the given number of streams, GI and channel width used. * * \param txstreams the number of streams - * \param gi guard interval duration (nanoseconds) - * \param chWidth the channel width (MHz) + * \param guardInterval guard interval duration + * \param chWidth the channel width * \returns the VHT group ID */ - uint8_t GetVhtGroupId(uint8_t txstreams, uint16_t gi, ChannelWidthMhz chWidth); + uint8_t GetVhtGroupId(uint8_t txstreams, Time guardInterval, ChannelWidthMhz chWidth); /** * Returns the groupId of an HE MCS with the given number of streams, GI and channel width used. * * \param txstreams the number of streams - * \param gi guard interval duration (nanoseconds) - * \param chWidth the channel width (MHz) + * \param guardInterval guard interval duration + * \param chWidth the channel width * \returns the HE group ID */ - uint8_t GetHeGroupId(uint8_t txstreams, uint16_t gi, ChannelWidthMhz chWidth); + uint8_t GetHeGroupId(uint8_t txstreams, Time guardInterval, ChannelWidthMhz chWidth); /** * Returns the lowest global index of the rates supported by the station. diff --git a/src/wifi/model/rate-control/minstrel-wifi-manager.cc b/src/wifi/model/rate-control/minstrel-wifi-manager.cc index a1528f891..1ae37bf88 100644 --- a/src/wifi/model/rate-control/minstrel-wifi-manager.cc +++ b/src/wifi/model/rate-control/minstrel-wifi-manager.cc @@ -405,7 +405,7 @@ MinstrelWifiManager::GetDataTxVector(MinstrelWifiRemoteStation* station) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -436,7 +436,7 @@ MinstrelWifiManager::GetRtsTxVector(MinstrelWifiRemoteStation* station) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/onoe-wifi-manager.cc b/src/wifi/model/rate-control/onoe-wifi-manager.cc index 8a1c88c60..85ff19843 100644 --- a/src/wifi/model/rate-control/onoe-wifi-manager.cc +++ b/src/wifi/model/rate-control/onoe-wifi-manager.cc @@ -350,7 +350,7 @@ OnoeWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allowe mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -382,7 +382,7 @@ OnoeWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/parf-wifi-manager.cc b/src/wifi/model/rate-control/parf-wifi-manager.cc index 5832782ea..6ee97139e 100644 --- a/src/wifi/model/rate-control/parf-wifi-manager.cc +++ b/src/wifi/model/rate-control/parf-wifi-manager.cc @@ -349,7 +349,7 @@ ParfWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allowe mode, station->m_powerLevel, GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -382,7 +382,7 @@ ParfWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/rraa-wifi-manager.cc b/src/wifi/model/rate-control/rraa-wifi-manager.cc index 3aadeb7c4..c190e4507 100644 --- a/src/wifi/model/rate-control/rraa-wifi-manager.cc +++ b/src/wifi/model/rate-control/rraa-wifi-manager.cc @@ -374,7 +374,7 @@ RraaWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allowe mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -405,7 +405,7 @@ RraaWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/rrpaa-wifi-manager.cc b/src/wifi/model/rate-control/rrpaa-wifi-manager.cc index 18935c4d3..d384c7710 100644 --- a/src/wifi/model/rate-control/rrpaa-wifi-manager.cc +++ b/src/wifi/model/rate-control/rrpaa-wifi-manager.cc @@ -426,7 +426,7 @@ RrpaaWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWidthMhz allow mode, station->m_powerLevel, GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, @@ -457,7 +457,7 @@ RrpaaWifiManager::DoGetRtsTxVector(WifiRemoteStation* st) mode, GetDefaultTxPowerLevel(), GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled()), - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/model/rate-control/thompson-sampling-wifi-manager.cc b/src/wifi/model/rate-control/thompson-sampling-wifi-manager.cc index 09c8c742c..1c3e8cb6f 100644 --- a/src/wifi/model/rate-control/thompson-sampling-wifi-manager.cc +++ b/src/wifi/model/rate-control/thompson-sampling-wifi-manager.cc @@ -227,12 +227,12 @@ ThompsonSamplingWifiManager::UpdateNextMode(WifiRemoteStation* st) const for (uint32_t i = 0; i < station->m_mcsStats.size(); i++) { Decay(st, i); - const WifiMode mode{station->m_mcsStats.at(i).mode}; + const auto mode{station->m_mcsStats.at(i).mode}; - uint16_t guardInterval = GetModeGuardInterval(st, mode); - double rate = mode.GetDataRate(station->m_mcsStats.at(i).channelWidth, - guardInterval, - station->m_mcsStats.at(i).nss); + const auto guardInterval = GetModeGuardInterval(st, mode); + const auto rate = mode.GetDataRate(station->m_mcsStats.at(i).channelWidth, + guardInterval, + station->m_mcsStats.at(i).nss); // Thompson sampling frameSuccessRate = SampleBetaVariable(1.0 + station->m_mcsStats.at(i).success, @@ -297,7 +297,7 @@ ThompsonSamplingWifiManager::DoReportFinalDataFailed(WifiRemoteStation* station) NS_LOG_FUNCTION(this << station); } -uint16_t +Time ThompsonSamplingWifiManager::GetModeGuardInterval(WifiRemoteStation* st, WifiMode mode) const { if (mode.GetModulationClass() == WIFI_MOD_CLASS_HE) @@ -307,12 +307,12 @@ ThompsonSamplingWifiManager::GetModeGuardInterval(WifiRemoteStation* st, WifiMod else if ((mode.GetModulationClass() == WIFI_MOD_CLASS_HT) || (mode.GetModulationClass() == WIFI_MOD_CLASS_VHT)) { - return std::max(GetShortGuardIntervalSupported(st) ? 400 : 800, - GetShortGuardIntervalSupported() ? 400 : 800); + auto useSgi = GetShortGuardIntervalSupported(st) && GetShortGuardIntervalSupported(); + return NanoSeconds(useSgi ? 400 : 800); } else { - return 800; + return NanoSeconds(800); } } @@ -324,10 +324,10 @@ ThompsonSamplingWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWid auto station = static_cast(st); auto& stats = station->m_mcsStats.at(station->m_nextMode); - WifiMode mode = stats.mode; + const auto mode = stats.mode; const auto channelWidth = std::min(stats.channelWidth, allowedWidth); - uint8_t nss = stats.nss; - uint16_t guardInterval = GetModeGuardInterval(st, mode); + const auto nss = stats.nss; + const auto guardInterval = GetModeGuardInterval(st, mode); station->m_lastMode = station->m_nextMode; @@ -335,7 +335,7 @@ ThompsonSamplingWifiManager::DoGetDataTxVector(WifiRemoteStation* st, ChannelWid << " mode=" << mode << " channelWidth=" << channelWidth << " nss=" << +nss << " guardInterval=" << guardInterval); - uint64_t rate = mode.GetDataRate(channelWidth, guardInterval, nss); + const auto rate = mode.GetDataRate(channelWidth, guardInterval, nss); if (m_currentRate != rate) { NS_LOG_DEBUG("New datarate: " << rate); diff --git a/src/wifi/model/rate-control/thompson-sampling-wifi-manager.h b/src/wifi/model/rate-control/thompson-sampling-wifi-manager.h index 72f26cb34..2e87197f0 100644 --- a/src/wifi/model/rate-control/thompson-sampling-wifi-manager.h +++ b/src/wifi/model/rate-control/thompson-sampling-wifi-manager.h @@ -107,13 +107,13 @@ class ThompsonSamplingWifiManager : public WifiRemoteStationManager void Decay(WifiRemoteStation* st, size_t i) const; /** - * Returns guard interval in nanoseconds for the given mode. + * Returns guard interval for the given mode. * - * \param st Remote STA. - * \param mode The WifiMode. - * \return the guard interval in nanoseconds + * \param st Remote STA + * \param mode The WifiMode + * \return the guard interval */ - uint16_t GetModeGuardInterval(WifiRemoteStation* st, WifiMode mode) const; + Time GetModeGuardInterval(WifiRemoteStation* st, WifiMode mode) const; /** * Sample beta random variable with given parameters diff --git a/src/wifi/model/vht/vht-phy.cc b/src/wifi/model/vht/vht-phy.cc index 8101d3350..867fadd14 100644 --- a/src/wifi/model/vht/vht-phy.cc +++ b/src/wifi/model/vht/vht-phy.cc @@ -234,7 +234,7 @@ VhtPhy::GetNumberBccEncoders(const WifiTxVector& txVector) const * 21-30 to 21-61 of IEEE 802.11-2016. * These values are the last values before changing encoders. */ - double maxRatePerCoder = (txVector.GetGuardInterval() == 800) ? 540e6 : 600e6; + double maxRatePerCoder = (txVector.GetGuardInterval().GetNanoSeconds() == 800) ? 540e6 : 600e6; uint8_t nes = ceil(payloadMode.GetDataRate(txVector) / maxRatePerCoder); // Handle exceptions to the rule @@ -430,10 +430,7 @@ VhtPhy::GetConstellationSize(uint8_t mcsValue) } uint64_t -VhtPhy::GetPhyRate(uint8_t mcsValue, - ChannelWidthMhz channelWidth, - uint16_t guardInterval, - uint8_t nss) +VhtPhy::GetPhyRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) { WifiCodeRate codeRate = GetCodeRate(mcsValue); uint64_t dataRate = GetDataRate(mcsValue, channelWidth, guardInterval, nss); @@ -459,17 +456,15 @@ VhtPhy::GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t /* staId } uint64_t -VhtPhy::GetDataRate(uint8_t mcsValue, - ChannelWidthMhz channelWidth, - uint16_t guardInterval, - uint8_t nss) +VhtPhy::GetDataRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) { - NS_ASSERT(guardInterval == 800 || guardInterval == 400); + [[maybe_unused]] const auto gi = guardInterval.GetNanoSeconds(); + NS_ASSERT((gi == 800) || (gi == 400)); NS_ASSERT(nss <= 8); NS_ASSERT_MSG(IsCombinationAllowed(mcsValue, channelWidth, nss), "VHT MCS " << +mcsValue << " forbidden at " << channelWidth << " MHz when NSS is " << +nss); - return HtPhy::CalculateDataRate(GetSymbolDuration(NanoSeconds(guardInterval)), + return HtPhy::CalculateDataRate(GetSymbolDuration(guardInterval), GetUsableSubcarriers(channelWidth), static_cast(log2(GetConstellationSize(mcsValue))), HtPhy::GetCodeRatio(GetCodeRate(mcsValue)), diff --git a/src/wifi/model/vht/vht-phy.h b/src/wifi/model/vht/vht-phy.h index 0d22233bb..789a75add 100644 --- a/src/wifi/model/vht/vht-phy.h +++ b/src/wifi/model/vht/vht-phy.h @@ -196,14 +196,14 @@ class VhtPhy : public HtPhy * * \param mcsValue the VHT MCS index * \param channelWidth the considered channel width in MHz - * \param guardInterval the considered guard interval duration in nanoseconds + * \param guardInterval the considered guard interval duration * \param nss the considered number of stream * * \return the physical bit rate of this signal in bps. */ static uint64_t GetPhyRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, uint8_t nss); /** * Return the PHY rate corresponding to @@ -235,13 +235,13 @@ class VhtPhy : public HtPhy * * \param mcsValue the MCS index * \param channelWidth the channel width in MHz - * \param guardInterval the guard interval duration in nanoseconds + * \param guardInterval the guard interval duration * \param nss the number of spatial streams * \return the data bit rate in bps. */ static uint64_t GetDataRate(uint8_t mcsValue, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, uint8_t nss); /** * Calculate the rate in bps of the non-HT Reference Rate corresponding diff --git a/src/wifi/model/vht/vht-ppdu.cc b/src/wifi/model/vht/vht-ppdu.cc index 2ea52f17a..c8db476ea 100644 --- a/src/wifi/model/vht/vht-ppdu.cc +++ b/src/wifi/model/vht/vht-ppdu.cc @@ -73,13 +73,14 @@ VhtPpdu::SetVhtSigHeader(VhtSigHeader& vhtSig, { vhtSig.SetMuFlag(m_preamble == WIFI_PREAMBLE_VHT_MU); vhtSig.SetChannelWidth(txVector.GetChannelWidth()); - vhtSig.SetShortGuardInterval(txVector.GetGuardInterval() == 400); + const auto sgi = txVector.GetGuardInterval().GetNanoSeconds() == 400; + vhtSig.SetShortGuardInterval(sgi); uint32_t nSymbols = (static_cast( (ppduDuration - WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector)) .GetNanoSeconds()) / - (3200 + txVector.GetGuardInterval())); - if (txVector.GetGuardInterval() == 400) + (3200 + txVector.GetGuardInterval().GetNanoSeconds())); + if (sgi) { vhtSig.SetShortGuardIntervalDisambiguation((nSymbols % 10) == 9); } @@ -104,7 +105,7 @@ VhtPpdu::SetTxVectorFromPhyHeaders(WifiTxVector& txVector, txVector.SetMode(VhtPhy::GetVhtMcs(vhtSig.GetSuMcs())); txVector.SetChannelWidth(vhtSig.GetChannelWidth()); txVector.SetNss(vhtSig.GetNStreams()); - txVector.SetGuardInterval(vhtSig.GetShortGuardInterval() ? 400 : 800); + txVector.SetGuardInterval(NanoSeconds(vhtSig.GetShortGuardInterval() ? 400 : 800)); txVector.SetAggregation(GetPsdu()->IsAggregate()); } @@ -115,7 +116,7 @@ VhtPpdu::GetTxDuration() const const auto length = m_lSig.GetLength(); const auto sgi = m_vhtSig.GetShortGuardInterval(); const auto sgiDisambiguation = m_vhtSig.GetShortGuardIntervalDisambiguation(); - const auto tSymbol = NanoSeconds(3200 + txVector.GetGuardInterval()); + const auto tSymbol = NanoSeconds(3200) + txVector.GetGuardInterval(); const auto preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration(txVector); const auto calculatedDuration = MicroSeconds(((ceil(static_cast(length + 3) / 3)) * 4) + 20); diff --git a/src/wifi/model/wifi-default-ack-manager.cc b/src/wifi/model/wifi-default-ack-manager.cc index d73a94846..510f2c76a 100644 --- a/src/wifi/model/wifi-default-ack-manager.cc +++ b/src/wifi/model/wifi-default-ack-manager.cc @@ -547,7 +547,7 @@ WifiDefaultAckManager::GetAckInfoIfTfMuBar(Ptr mpdu, blockAckTxVector.SetChannelWidth(txParams.m_txVector.GetChannelWidth()); // 800ns GI is not allowed for HE TB blockAckTxVector.SetGuardInterval( - std::max(txParams.m_txVector.GetGuardInterval(), 1600)); + std::max(txParams.m_txVector.GetGuardInterval(), NanoSeconds(1600))); const auto& userInfo = txParams.m_txVector.GetHeMuUserInfo(staId); blockAckTxVector.SetHeMuUserInfo( staId, @@ -635,7 +635,7 @@ WifiDefaultAckManager::GetAckInfoIfAggregatedMuBar(Ptr mpdu, blockAckTxVector.SetChannelWidth(txParams.m_txVector.GetChannelWidth()); // 800ns GI is not allowed for HE TB blockAckTxVector.SetGuardInterval( - std::max(txParams.m_txVector.GetGuardInterval(), 1600)); + std::max(txParams.m_txVector.GetGuardInterval(), NanoSeconds(1600))); const auto& userInfo = txParams.m_txVector.GetHeMuUserInfo(staId); blockAckTxVector.SetHeMuUserInfo( staId, diff --git a/src/wifi/model/wifi-mac.cc b/src/wifi/model/wifi-mac.cc index 356c4395d..d3e4d275b 100644 --- a/src/wifi/model/wifi-mac.cc +++ b/src/wifi/model/wifi-mac.cc @@ -2117,7 +2117,7 @@ WifiMac::GetHtCapabilities(uint8_t linkId) const uint8_t nss = (mcs.GetMcsValue() / 8) + 1; NS_ASSERT(nss > 0 && nss < 5); uint64_t dataRate = mcs.GetDataRate(htConfiguration->Get40MHzOperationSupported() ? 40 : 20, - sgiSupported ? 400 : 800, + NanoSeconds(sgiSupported ? 400 : 800), nss); if (dataRate > maxSupportedRate) { @@ -2247,7 +2247,7 @@ WifiMac::GetHeCapabilities(uint8_t linkId) const } capabilities.SetChannelWidthSet(channelWidthSet); capabilities.SetLdpcCodingInPayload(htConfiguration->GetLdpcSupported()); - if (heConfiguration->GetGuardInterval() == NanoSeconds(800)) + if (heConfiguration->GetGuardInterval().GetNanoSeconds() == 800) { // todo: We assume for now that if we support 800ns GI then 1600ns GI is supported as well // todo: Assuming reception support for both 1x HE LTF and 4x HE LTF 800 ns diff --git a/src/wifi/model/wifi-mode.cc b/src/wifi/model/wifi-mode.cc index efd60d455..5df633af8 100644 --- a/src/wifi/model/wifi-mode.cc +++ b/src/wifi/model/wifi-mode.cc @@ -84,11 +84,11 @@ WifiMode::IsAllowed(const WifiTxVector& txVector) const uint64_t WifiMode::GetPhyRate(ChannelWidthMhz channelWidth) const { - return GetPhyRate(channelWidth, 800, 1); + return GetPhyRate(channelWidth, NanoSeconds(800), 1); } uint64_t -WifiMode::GetPhyRate(ChannelWidthMhz channelWidth, uint16_t guardInterval, uint8_t nss) const +WifiMode::GetPhyRate(ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) const { WifiTxVector txVector; txVector.SetMode(WifiMode(m_uid)); @@ -108,7 +108,7 @@ WifiMode::GetPhyRate(const WifiTxVector& txVector, uint16_t staId) const uint64_t WifiMode::GetDataRate(ChannelWidthMhz channelWidth) const { - return GetDataRate(channelWidth, 800, 1); + return GetDataRate(channelWidth, NanoSeconds(800), 1); } uint64_t @@ -119,7 +119,7 @@ WifiMode::GetDataRate(const WifiTxVector& txVector, uint16_t staId) const } uint64_t -WifiMode::GetDataRate(ChannelWidthMhz channelWidth, uint16_t guardInterval, uint8_t nss) const +WifiMode::GetDataRate(ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) const { NS_ASSERT(nss <= 8); WifiTxVector txVector; diff --git a/src/wifi/model/wifi-mode.h b/src/wifi/model/wifi-mode.h index 06c5a0af7..88176de6f 100644 --- a/src/wifi/model/wifi-mode.h +++ b/src/wifi/model/wifi-mode.h @@ -66,7 +66,7 @@ class WifiMode /** * * \param channelWidth the considered channel width in MHz - * \param guardInterval the considered guard interval duration in nanoseconds + * \param guardInterval the considered guard interval duration * \param nss the considered number of streams * * \returns the physical bit rate of this signal in bps. @@ -74,7 +74,7 @@ class WifiMode * If a transmission mode uses 1/2 FEC, and if its * data rate is 3.25Mbps, the PHY rate is 6.5Mbps */ - uint64_t GetPhyRate(ChannelWidthMhz channelWidth, uint16_t guardInterval, uint8_t nss) const; + uint64_t GetPhyRate(ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) const; /** * \param txVector the const WifiTxVector& of the signal * \param staId the station ID for MU (unused if SU) @@ -94,12 +94,12 @@ class WifiMode /** * * \param channelWidth the considered channel width in MHz - * \param guardInterval the considered guard interval duration in nanoseconds + * \param guardInterval the considered guard interval duration * \param nss the considered number of streams * * \returns the data bit rate of this signal in bps. */ - uint64_t GetDataRate(ChannelWidthMhz channelWidth, uint16_t guardInterval, uint8_t nss) const; + uint64_t GetDataRate(ChannelWidthMhz channelWidth, Time guardInterval, uint8_t nss) const; /** * \param txVector the const WifiTxVector& of the signal * \param staId the station ID for MU (unused if SU) diff --git a/src/wifi/model/wifi-phy-common.cc b/src/wifi/model/wifi-phy-common.cc index 23437b91a..87d4431ed 100644 --- a/src/wifi/model/wifi-phy-common.cc +++ b/src/wifi/model/wifi-phy-common.cc @@ -28,16 +28,16 @@ namespace ns3 { -uint16_t -ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr device) +Time +GetGuardIntervalForMode(WifiMode mode, const Ptr device) { - uint16_t gi = 800; + auto gi = NanoSeconds(800); if (mode.GetModulationClass() >= WIFI_MOD_CLASS_HE) { Ptr heConfiguration = device->GetHeConfiguration(); NS_ASSERT(heConfiguration); // If HE/EHT modulation is used, we should have a HE // configuration attached - gi = static_cast(heConfiguration->GetGuardInterval().GetNanoSeconds()); + gi = heConfiguration->GetGuardInterval(); } else if (mode.GetModulationClass() == WIFI_MOD_CLASS_HT || mode.GetModulationClass() == WIFI_MOD_CLASS_VHT) @@ -45,27 +45,23 @@ ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr device Ptr htConfiguration = device->GetHtConfiguration(); NS_ASSERT(htConfiguration); // If HT/VHT modulation is used, we should have a HT // configuration attached - gi = htConfiguration->GetShortGuardIntervalSupported() ? 400 : 800; + gi = NanoSeconds(htConfiguration->GetShortGuardIntervalSupported() ? 400 : 800); } return gi; } -uint16_t -ConvertGuardIntervalToNanoSeconds(WifiMode mode, bool htShortGuardInterval, Time heGuardInterval) +Time +GetGuardIntervalForMode(WifiMode mode, bool htShortGuardInterval, Time heGuardInterval) { - uint16_t gi; + auto gi = NanoSeconds(800); if (mode.GetModulationClass() >= WIFI_MOD_CLASS_HE) { - gi = static_cast(heGuardInterval.GetNanoSeconds()); + gi = heGuardInterval; } else if (mode.GetModulationClass() == WIFI_MOD_CLASS_HT || mode.GetModulationClass() == WIFI_MOD_CLASS_VHT) { - gi = htShortGuardInterval ? 400 : 800; - } - else - { - gi = 800; + gi = NanoSeconds(htShortGuardInterval ? 400 : 800); } return gi; } diff --git a/src/wifi/model/wifi-phy-common.h b/src/wifi/model/wifi-phy-common.h index 8238b5665..77eec66e1 100644 --- a/src/wifi/model/wifi-phy-common.h +++ b/src/wifi/model/wifi-phy-common.h @@ -592,27 +592,25 @@ operator<<(std::ostream& os, WifiChannelWidthType width) } /** - * Convert the guard interval to nanoseconds based on the WifiMode. + * Get the guard interval for a given WifiMode. * * \param mode the WifiMode * \param device pointer to the WifiNetDevice object * - * \return the guard interval duration in nanoseconds + * \return the guard interval duration to use for the mode */ -uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, const Ptr device); +Time GetGuardIntervalForMode(WifiMode mode, const Ptr device); /** - * Convert the guard interval to nanoseconds based on the WifiMode. + * Get the guard interval for a given WifiMode. * * \param mode the WifiMode * \param htShortGuardInterval whether HT/VHT short guard interval is enabled * \param heGuardInterval the HE guard interval duration * - * \return the guard interval duration in nanoseconds + * \return the guard interval duration to use for the mode */ -uint16_t ConvertGuardIntervalToNanoSeconds(WifiMode mode, - bool htShortGuardInterval, - Time heGuardInterval); +Time GetGuardIntervalForMode(WifiMode mode, bool htShortGuardInterval, Time heGuardInterval); /** * Return the preamble to be used for the transmission. diff --git a/src/wifi/model/wifi-remote-station-manager.cc b/src/wifi/model/wifi-remote-station-manager.cc index da97c5f10..9c482cf4c 100644 --- a/src/wifi/model/wifi-remote-station-manager.cc +++ b/src/wifi/model/wifi-remote-station-manager.cc @@ -297,16 +297,16 @@ WifiRemoteStationManager::GetShortGuardIntervalSupported() const return false; } -uint16_t +Time WifiRemoteStationManager::GetGuardInterval() const { - uint16_t gi = 0; + Time gi{}; if (GetHeSupported()) { Ptr heConfiguration = m_wifiPhy->GetDevice()->GetHeConfiguration(); NS_ASSERT(heConfiguration); // If HE is supported, we should have a HE configuration // attached - gi = static_cast(heConfiguration->GetGuardInterval().GetNanoSeconds()); + gi = heConfiguration->GetGuardInterval(); } return gi; } @@ -601,7 +601,7 @@ WifiRemoteStationManager::GetDataTxVector(const WifiMacHeader& header, ChannelWi GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(m_defaultTxPowerLevel); v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(mode, allowedWidth)); - v.SetGuardInterval(ConvertGuardIntervalToNanoSeconds(mode, m_wifiPhy->GetDevice())); + v.SetGuardInterval(GetGuardIntervalForMode(mode, m_wifiPhy->GetDevice())); v.SetNTx(GetNumberOfAntennas()); v.SetNss(1); v.SetNess(0); @@ -635,8 +635,7 @@ WifiRemoteStationManager::GetDataTxVector(const WifiMacHeader& header, ChannelWi } txVector.SetChannelWidth(m_wifiPhy->GetTxBandwidth(mgtMode, channelWidth)); - txVector.SetGuardInterval( - ConvertGuardIntervalToNanoSeconds(mgtMode, m_wifiPhy->GetDevice())); + txVector.SetGuardInterval(GetGuardIntervalForMode(mgtMode, m_wifiPhy->GetDevice())); } else { @@ -690,7 +689,7 @@ WifiRemoteStationManager::GetCtsToSelfTxVector() return WifiTxVector(defaultMode, GetDefaultTxPowerLevel(), defaultPreamble, - ConvertGuardIntervalToNanoSeconds(defaultMode, m_wifiPhy->GetDevice()), + GetGuardIntervalForMode(defaultMode, m_wifiPhy->GetDevice()), GetNumberOfAntennas(), 1, 0, @@ -711,7 +710,7 @@ WifiRemoteStationManager::GetRtsTxVector(Mac48Address address, uint16_t allowedW GetPreambleForTransmission(mode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(m_defaultTxPowerLevel); v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(mode)); - v.SetGuardInterval(ConvertGuardIntervalToNanoSeconds(mode, m_wifiPhy->GetDevice())); + v.SetGuardInterval(GetGuardIntervalForMode(mode, m_wifiPhy->GetDevice())); v.SetNTx(GetNumberOfAntennas()); v.SetNss(1); v.SetNess(0); @@ -753,9 +752,7 @@ WifiRemoteStationManager::GetCtsTxVector(Mac48Address to, WifiMode rtsTxMode) co GetPreambleForTransmission(ctsMode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(GetDefaultTxPowerLevel()); v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(ctsMode)); - uint16_t ctsTxGuardInterval = - ConvertGuardIntervalToNanoSeconds(ctsMode, m_wifiPhy->GetDevice()); - v.SetGuardInterval(ctsTxGuardInterval); + v.SetGuardInterval(GetGuardIntervalForMode(ctsMode, m_wifiPhy->GetDevice())); v.SetNss(1); return v; } @@ -804,9 +801,7 @@ WifiRemoteStationManager::GetAckTxVector(Mac48Address to, const WifiTxVector& da GetPreambleForTransmission(ackMode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(GetDefaultTxPowerLevel()); v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(ackMode)); - uint16_t ackTxGuardInterval = - ConvertGuardIntervalToNanoSeconds(ackMode, m_wifiPhy->GetDevice()); - v.SetGuardInterval(ackTxGuardInterval); + v.SetGuardInterval(GetGuardIntervalForMode(ackMode, m_wifiPhy->GetDevice())); v.SetNss(1); return v; } @@ -823,9 +818,7 @@ WifiRemoteStationManager::GetBlockAckTxVector(Mac48Address to, GetPreambleForTransmission(blockAckMode.GetModulationClass(), GetShortPreambleEnabled())); v.SetTxPowerLevel(GetDefaultTxPowerLevel()); v.SetChannelWidth(m_wifiPhy->GetTxBandwidth(blockAckMode)); - uint16_t blockAckTxGuardInterval = - ConvertGuardIntervalToNanoSeconds(blockAckMode, m_wifiPhy->GetDevice()); - v.SetGuardInterval(blockAckTxGuardInterval); + v.SetGuardInterval(GetGuardIntervalForMode(blockAckMode, m_wifiPhy->GetDevice())); v.SetNss(1); return v; } @@ -1576,12 +1569,12 @@ WifiRemoteStationManager::AddStationHeCapabilities(Mac48Address from, HeCapabili } if (heCapabilities.GetHeSuPpdu1xHeLtf800nsGi()) { - state->m_guardInterval = 800; + state->m_guardInterval = NanoSeconds(800); } else { // todo: Using 3200ns, default value for HeConfiguration::GuardInterval - state->m_guardInterval = 3200; + state->m_guardInterval = NanoSeconds(3200); } for (const auto& mcs : m_wifiPhy->GetMcsList(WIFI_MOD_CLASS_HE)) { @@ -1992,7 +1985,7 @@ WifiRemoteStationManager::GetShortGuardIntervalSupported(const WifiRemoteStation return htCapabilities->GetShortGuardInterval20(); } -uint16_t +Time WifiRemoteStationManager::GetGuardInterval(const WifiRemoteStation* station) const { return station->m_state->m_guardInterval; diff --git a/src/wifi/model/wifi-remote-station-manager.h b/src/wifi/model/wifi-remote-station-manager.h index 0af04204b..b5842bdea 100644 --- a/src/wifi/model/wifi-remote-station-manager.h +++ b/src/wifi/model/wifi-remote-station-manager.h @@ -121,14 +121,13 @@ struct WifiRemoteStationState bool m_emlsrEnabled; //!< whether EMLSR mode is enabled on this link ChannelWidthMhz m_channelWidth; //!< Channel width (in MHz) supported by the remote station - uint16_t m_guardInterval; //!< HE Guard interval duration (in nanoseconds) supported by the - //!< remote station - uint8_t m_ness; //!< Number of extended spatial streams of the remote station - bool m_aggregation; //!< Flag if MPDU aggregation is used by the remote station - bool m_shortPreamble; //!< Flag if short PHY preamble is supported by the remote station - bool m_shortSlotTime; //!< Flag if short ERP slot time is supported by the remote station - bool m_qosSupported; //!< Flag if QoS is supported by the station - bool m_isInPsMode; //!< Flag if the STA is currently in PS mode + Time m_guardInterval; //!< HE Guard interval durationsupported by the remote station + uint8_t m_ness; //!< Number of extended spatial streams of the remote station + bool m_aggregation; //!< Flag if MPDU aggregation is used by the remote station + bool m_shortPreamble; //!< Flag if short PHY preamble is supported by the remote station + bool m_shortSlotTime; //!< Flag if short ERP slot time is supported by the remote station + bool m_qosSupported; //!< Flag if QoS is supported by the station + bool m_isInPsMode; //!< Flag if the STA is currently in PS mode }; /** @@ -376,11 +375,11 @@ class WifiRemoteStationManager : public Object */ bool GetShortGuardIntervalSupported() const; /** - * Return the supported HE guard interval duration (in nanoseconds). + * Return the supported HE guard interval duration. * - * \return the supported HE guard interval duration (in nanoseconds) + * \return the supported HE guard interval duration */ - uint16_t GetGuardInterval() const; + Time GetGuardInterval() const; /** * Enable or disable protection for non-ERP stations. * @@ -1249,9 +1248,9 @@ class WifiRemoteStationManager : public Object * * \param station the station being queried * - * \return the HE guard interval duration (in nanoseconds) supported by the station + * \return the HE guard interval duration supported by the station */ - uint16_t GetGuardInterval(const WifiRemoteStation* station) const; + Time GetGuardInterval(const WifiRemoteStation* station) const; /** * Return whether the given station supports A-MPDU. * diff --git a/src/wifi/model/wifi-tx-vector.cc b/src/wifi/model/wifi-tx-vector.cc index 667f2cdb3..7e50bc859 100644 --- a/src/wifi/model/wifi-tx-vector.cc +++ b/src/wifi/model/wifi-tx-vector.cc @@ -37,7 +37,7 @@ WifiTxVector::WifiTxVector() : m_txPowerLevel(1), m_preamble(WIFI_PREAMBLE_LONG), m_channelWidth(20), - m_guardInterval(800), + m_guardInterval(NanoSeconds(800)), m_nTx(1), m_nss(1), m_ness(0), @@ -58,7 +58,7 @@ WifiTxVector::WifiTxVector() WifiTxVector::WifiTxVector(WifiMode mode, uint8_t powerLevel, WifiPreamble preamble, - uint16_t guardInterval, + Time guardInterval, uint8_t nTx, uint8_t nss, uint8_t ness, @@ -187,7 +187,7 @@ WifiTxVector::GetChannelWidth() const return m_channelWidth; } -uint16_t +Time WifiTxVector::GetGuardInterval() const { return m_guardInterval; @@ -315,7 +315,7 @@ WifiTxVector::SetChannelWidth(ChannelWidthMhz channelWidth) } void -WifiTxVector::SetGuardInterval(uint16_t guardInterval) +WifiTxVector::SetGuardInterval(Time guardInterval) { m_guardInterval = guardInterval; } diff --git a/src/wifi/model/wifi-tx-vector.h b/src/wifi/model/wifi-tx-vector.h index 96287f297..cdbdb4a46 100644 --- a/src/wifi/model/wifi-tx-vector.h +++ b/src/wifi/model/wifi-tx-vector.h @@ -26,6 +26,7 @@ #include "wifi-phy-common.h" #include "ns3/he-ru.h" +#include "ns3/nstime.h" #include #include @@ -136,7 +137,7 @@ class WifiTxVector WifiTxVector(WifiMode mode, uint8_t powerLevel, WifiPreamble preamble, - uint16_t guardInterval, + Time guardInterval, uint8_t nTx, uint8_t nss, uint8_t ness, @@ -221,13 +222,13 @@ class WifiTxVector /** * \returns the guard interval duration (in nanoseconds) */ - uint16_t GetGuardInterval() const; + Time GetGuardInterval() const; /** * Sets the guard interval duration (in nanoseconds) * * \param guardInterval the guard interval duration (in nanoseconds) */ - void SetGuardInterval(uint16_t guardInterval); + void SetGuardInterval(Time guardInterval); /** * \returns the number of TX antennas */ @@ -566,7 +567,7 @@ class WifiTxVector to PMD_TXPWRLVL.request */ WifiPreamble m_preamble; /**< preamble */ ChannelWidthMhz m_channelWidth; /**< channel width */ - uint16_t m_guardInterval; /**< guard interval duration in nanoseconds */ + Time m_guardInterval; /**< guard interval duration */ uint8_t m_nTx; /**< number of TX antennas */ uint8_t m_nss; /**< number of spatial streams */ uint8_t m_ness; /**< number of spatial streams in beamforming */ diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc index c661b7967..2eda3e219 100644 --- a/src/wifi/test/spectrum-wifi-phy-test.cc +++ b/src/wifi/test/spectrum-wifi-phy-test.cc @@ -194,7 +194,7 @@ SpectrumWifiPhyBasicTest::MakeSignal(double txPowerWatts, const WifiPhyOperating WifiTxVector txVector = WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, - 800, + NanoSeconds(800), 1, 1, 0, @@ -527,7 +527,7 @@ SpectrumWifiPhyFilterTest::SendPpdu() WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -1357,7 +1357,7 @@ SpectrumWifiPhy80Plus80Test::Send160MhzPpdu() WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_SU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -1825,8 +1825,16 @@ SpectrumWifiPhyMultipleInterfacesTest::SendPpdu(Ptr phy, NS_LOG_FUNCTION(this << phy << txPowerDbm << payloadSize << phy->GetCurrentFrequencyRange() << phy->GetChannelWidth() << phy->GetChannelNumber()); - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs11(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, false, false); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs11(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + false, + false); Ptr pkt = Create(payloadSize); WifiMacHeader hdr; hdr.SetType(WIFI_MAC_QOSDATA); diff --git a/src/wifi/test/tx-duration-test.cc b/src/wifi/test/tx-duration-test.cc index c8783ca83..4718f1293 100644 --- a/src/wifi/test/tx-duration-test.cc +++ b/src/wifi/test/tx-duration-test.cc @@ -57,8 +57,8 @@ class TxDurationTest : public TestCase * * @param size size of payload in octets (includes everything after the PHY header) * @param payloadMode the WifiMode used for the transmission - * @param channelWidth the channel width used for the transmission (in MHz) - * @param guardInterval the guard interval duration used for the transmission (in nanoseconds) + * @param channelWidth the channel width used for the transmission + * @param guardInterval the guard interval duration used for the transmission * @param preamble the WifiPreamble used for the transmission * @param knownDuration the known duration value of the transmission * @@ -67,7 +67,7 @@ class TxDurationTest : public TestCase bool CheckPayloadDuration(uint32_t size, WifiMode payloadMode, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, WifiPreamble preamble, Time knownDuration); @@ -77,8 +77,8 @@ class TxDurationTest : public TestCase * * @param size size of payload in octets (includes everything after the PHY header) * @param payloadMode the WifiMode used for the transmission - * @param channelWidth the channel width used for the transmission (in MHz) - * @param guardInterval the guard interval duration used for the transmission (in nanoseconds) + * @param channelWidth the channel width used for the transmission + * @param guardInterval the guard interval duration used for the transmission * @param preamble the WifiPreamble used for the transmission * @param knownDuration the known duration value of the transmission * @@ -87,7 +87,7 @@ class TxDurationTest : public TestCase bool CheckTxDuration(uint32_t size, WifiMode payloadMode, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, WifiPreamble preamble, Time knownDuration); @@ -97,8 +97,8 @@ class TxDurationTest : public TestCase * * @param sizes the list of PSDU sizes for each station in octets * @param userInfos the list of HE MU specific user transmission parameters - * @param channelWidth the channel width used for the transmission (in MHz) - * @param guardInterval the guard interval duration used for the transmission (in nanoseconds) + * @param channelWidth the channel width used for the transmission + * @param guardInterval the guard interval duration used for the transmission * @param preamble the WifiPreamble used for the transmission * @param knownDuration the known duration value of the transmission * @@ -107,7 +107,7 @@ class TxDurationTest : public TestCase static bool CheckMuTxDuration(std::list sizes, std::list userInfos, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, WifiPreamble preamble, Time knownDuration); @@ -144,7 +144,7 @@ bool TxDurationTest::CheckPayloadDuration(uint32_t size, WifiMode payloadMode, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, WifiPreamble preamble, Time knownDuration) { @@ -196,7 +196,7 @@ bool TxDurationTest::CheckTxDuration(uint32_t size, WifiMode payloadMode, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, WifiPreamble preamble, Time knownDuration) { @@ -255,7 +255,7 @@ bool TxDurationTest::CheckMuTxDuration(std::list sizes, std::list userInfos, ChannelWidthMhz channelWidth, - uint16_t guardInterval, + Time guardInterval, WifiPreamble preamble, Time knownDuration) { @@ -369,25 +369,25 @@ TxDurationTest::DoRun() CheckPayloadDuration(1023, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(744)) && CheckPayloadDuration(1024, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(745)) && CheckPayloadDuration(1025, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(746)) && CheckPayloadDuration(1026, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(747)); @@ -401,193 +401,193 @@ TxDurationTest::DoRun() CheckTxDuration(1023, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(744 + 96)) && CheckTxDuration(1024, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(745 + 96)) && CheckTxDuration(1025, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(746 + 96)) && CheckTxDuration(1026, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(747 + 96)) && CheckTxDuration(1023, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(744 + 192)) && CheckTxDuration(1024, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(745 + 192)) && CheckTxDuration(1025, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(746 + 192)) && CheckTxDuration(1026, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(747 + 192)) && CheckTxDuration(1023, DsssPhy::GetDsssRate5_5Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(1488 + 96)) && CheckTxDuration(1024, DsssPhy::GetDsssRate5_5Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(1490 + 96)) && CheckTxDuration(1025, DsssPhy::GetDsssRate5_5Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(1491 + 96)) && CheckTxDuration(1026, DsssPhy::GetDsssRate5_5Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(1493 + 96)) && CheckTxDuration(1023, DsssPhy::GetDsssRate5_5Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(1488 + 192)) && CheckTxDuration(1024, DsssPhy::GetDsssRate5_5Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(1490 + 192)) && CheckTxDuration(1025, DsssPhy::GetDsssRate5_5Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(1491 + 192)) && CheckTxDuration(1026, DsssPhy::GetDsssRate5_5Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(1493 + 192)) && CheckTxDuration(1023, DsssPhy::GetDsssRate2Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(4092 + 96)) && CheckTxDuration(1024, DsssPhy::GetDsssRate2Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(4096 + 96)) && CheckTxDuration(1025, DsssPhy::GetDsssRate2Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(4100 + 96)) && CheckTxDuration(1026, DsssPhy::GetDsssRate2Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(4104 + 96)) && CheckTxDuration(1023, DsssPhy::GetDsssRate2Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(4092 + 192)) && CheckTxDuration(1024, DsssPhy::GetDsssRate2Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(4096 + 192)) && CheckTxDuration(1025, DsssPhy::GetDsssRate2Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(4100 + 192)) && CheckTxDuration(1026, DsssPhy::GetDsssRate2Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(4104 + 192)) && CheckTxDuration(1023, DsssPhy::GetDsssRate1Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(8184 + 192)) && CheckTxDuration(1024, DsssPhy::GetDsssRate1Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(8192 + 192)) && CheckTxDuration(1025, DsssPhy::GetDsssRate1Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(8200 + 192)) && CheckTxDuration(1026, DsssPhy::GetDsssRate1Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_SHORT, MicroSeconds(8208 + 192)) && CheckTxDuration(1023, DsssPhy::GetDsssRate1Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(8184 + 192)) && CheckTxDuration(1024, DsssPhy::GetDsssRate1Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(8192 + 192)) && CheckTxDuration(1025, DsssPhy::GetDsssRate1Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(8200 + 192)) && CheckTxDuration(1026, DsssPhy::GetDsssRate1Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(8208 + 192)); @@ -596,7 +596,7 @@ TxDurationTest::DoRun() retval = retval && CheckTxDuration(14, DsssPhy::GetDsssRate1Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(304)); @@ -605,19 +605,19 @@ TxDurationTest::DoRun() CheckTxDuration(1536, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(1310)) && CheckTxDuration(76, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(248)) && CheckTxDuration(14, DsssPhy::GetDsssRate11Mbps(), 22, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(203)); @@ -629,19 +629,19 @@ TxDurationTest::DoRun() CheckTxDuration(1536, OfdmPhy::GetOfdmRate54Mbps(), 20, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(248)) && CheckTxDuration(76, OfdmPhy::GetOfdmRate54Mbps(), 20, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(32)) && CheckTxDuration(14, OfdmPhy::GetOfdmRate54Mbps(), 20, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(24)); @@ -652,67 +652,116 @@ TxDurationTest::DoRun() CheckTxDuration(1536, ErpOfdmPhy::GetErpOfdmRate54Mbps(), 20, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(254)) && CheckTxDuration(76, ErpOfdmPhy::GetErpOfdmRate54Mbps(), 20, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(38)) && CheckTxDuration(14, ErpOfdmPhy::GetErpOfdmRate54Mbps(), 20, - 800, + NanoSeconds(800), WIFI_PREAMBLE_LONG, MicroSeconds(30)); NS_TEST_EXPECT_MSG_EQ(retval, true, "an 802.11g duration failed"); // 802.11n durations - retval = - retval && - CheckTxDuration(1536, - HtPhy::GetHtMcs7(), - 20, - 800, - WIFI_PREAMBLE_HT_MF, - MicroSeconds(228)) && - CheckTxDuration(76, HtPhy::GetHtMcs7(), 20, 800, WIFI_PREAMBLE_HT_MF, MicroSeconds(48)) && - CheckTxDuration(14, HtPhy::GetHtMcs7(), 20, 800, WIFI_PREAMBLE_HT_MF, MicroSeconds(40)) && - CheckTxDuration(1536, - HtPhy::GetHtMcs0(), - 20, - 400, - WIFI_PREAMBLE_HT_MF, - NanoSeconds(1742400)) && - CheckTxDuration(76, HtPhy::GetHtMcs0(), 20, 400, WIFI_PREAMBLE_HT_MF, MicroSeconds(126)) && - CheckTxDuration(14, HtPhy::GetHtMcs0(), 20, 400, WIFI_PREAMBLE_HT_MF, NanoSeconds(57600)) && - CheckTxDuration(1536, - HtPhy::GetHtMcs6(), - 20, - 400, - WIFI_PREAMBLE_HT_MF, - NanoSeconds(226800)) && - CheckTxDuration(76, HtPhy::GetHtMcs6(), 20, 400, WIFI_PREAMBLE_HT_MF, NanoSeconds(46800)) && - CheckTxDuration(14, HtPhy::GetHtMcs6(), 20, 400, WIFI_PREAMBLE_HT_MF, NanoSeconds(39600)) && - CheckTxDuration(1536, - HtPhy::GetHtMcs7(), - 40, - 800, - WIFI_PREAMBLE_HT_MF, - MicroSeconds(128)) && - CheckTxDuration(76, HtPhy::GetHtMcs7(), 40, 800, WIFI_PREAMBLE_HT_MF, MicroSeconds(44)) && - CheckTxDuration(14, HtPhy::GetHtMcs7(), 40, 800, WIFI_PREAMBLE_HT_MF, MicroSeconds(40)) && - CheckTxDuration(1536, - HtPhy::GetHtMcs7(), - 40, - 400, - WIFI_PREAMBLE_HT_MF, - NanoSeconds(118800)) && - CheckTxDuration(76, HtPhy::GetHtMcs7(), 40, 400, WIFI_PREAMBLE_HT_MF, NanoSeconds(43200)) && - CheckTxDuration(14, HtPhy::GetHtMcs7(), 40, 400, WIFI_PREAMBLE_HT_MF, NanoSeconds(39600)); + retval = retval && + CheckTxDuration(1536, + HtPhy::GetHtMcs7(), + 20, + NanoSeconds(800), + WIFI_PREAMBLE_HT_MF, + MicroSeconds(228)) && + CheckTxDuration(76, + HtPhy::GetHtMcs7(), + 20, + NanoSeconds(800), + WIFI_PREAMBLE_HT_MF, + MicroSeconds(48)) && + CheckTxDuration(14, + HtPhy::GetHtMcs7(), + 20, + NanoSeconds(800), + WIFI_PREAMBLE_HT_MF, + MicroSeconds(40)) && + CheckTxDuration(1536, + HtPhy::GetHtMcs0(), + 20, + NanoSeconds(400), + WIFI_PREAMBLE_HT_MF, + NanoSeconds(1742400)) && + CheckTxDuration(76, + HtPhy::GetHtMcs0(), + 20, + NanoSeconds(400), + WIFI_PREAMBLE_HT_MF, + MicroSeconds(126)) && + CheckTxDuration(14, + HtPhy::GetHtMcs0(), + 20, + NanoSeconds(400), + WIFI_PREAMBLE_HT_MF, + NanoSeconds(57600)) && + CheckTxDuration(1536, + HtPhy::GetHtMcs6(), + 20, + NanoSeconds(400), + WIFI_PREAMBLE_HT_MF, + NanoSeconds(226800)) && + CheckTxDuration(76, + HtPhy::GetHtMcs6(), + 20, + NanoSeconds(400), + WIFI_PREAMBLE_HT_MF, + NanoSeconds(46800)) && + CheckTxDuration(14, + HtPhy::GetHtMcs6(), + 20, + NanoSeconds(400), + WIFI_PREAMBLE_HT_MF, + NanoSeconds(39600)) && + CheckTxDuration(1536, + HtPhy::GetHtMcs7(), + 40, + NanoSeconds(800), + WIFI_PREAMBLE_HT_MF, + MicroSeconds(128)) && + CheckTxDuration(76, + HtPhy::GetHtMcs7(), + 40, + NanoSeconds(800), + WIFI_PREAMBLE_HT_MF, + MicroSeconds(44)) && + CheckTxDuration(14, + HtPhy::GetHtMcs7(), + 40, + NanoSeconds(800), + WIFI_PREAMBLE_HT_MF, + MicroSeconds(40)) && + CheckTxDuration(1536, + HtPhy::GetHtMcs7(), + 40, + NanoSeconds(400), + WIFI_PREAMBLE_HT_MF, + NanoSeconds(118800)) && + CheckTxDuration(76, + HtPhy::GetHtMcs7(), + 40, + NanoSeconds(400), + WIFI_PREAMBLE_HT_MF, + NanoSeconds(43200)) && + CheckTxDuration(14, + HtPhy::GetHtMcs7(), + 40, + NanoSeconds(400), + WIFI_PREAMBLE_HT_MF, + NanoSeconds(39600)); NS_TEST_EXPECT_MSG_EQ(retval, true, "an 802.11n duration failed"); @@ -721,521 +770,620 @@ TxDurationTest::DoRun() CheckTxDuration(1536, VhtPhy::GetVhtMcs8(), 20, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(196)) && CheckTxDuration(76, VhtPhy::GetVhtMcs8(), 20, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(48)) && CheckTxDuration(14, VhtPhy::GetVhtMcs8(), 20, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(40)) && CheckTxDuration(1536, VhtPhy::GetVhtMcs8(), 20, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, MicroSeconds(180)) && CheckTxDuration(76, VhtPhy::GetVhtMcs8(), 20, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(46800)) && CheckTxDuration(14, VhtPhy::GetVhtMcs8(), 20, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(39600)) && CheckTxDuration(1536, VhtPhy::GetVhtMcs9(), 40, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(108)) && CheckTxDuration(76, VhtPhy::GetVhtMcs9(), 40, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(40)) && CheckTxDuration(14, VhtPhy::GetVhtMcs9(), 40, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(40)) && CheckTxDuration(1536, VhtPhy::GetVhtMcs9(), 40, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(100800)) && CheckTxDuration(76, VhtPhy::GetVhtMcs9(), 40, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(39600)) && CheckTxDuration(14, VhtPhy::GetVhtMcs9(), 40, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(39600)) && CheckTxDuration(1536, VhtPhy::GetVhtMcs0(), 80, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(460)) && CheckTxDuration(76, VhtPhy::GetVhtMcs0(), 80, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(60)) && CheckTxDuration(14, VhtPhy::GetVhtMcs0(), 80, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(44)) && CheckTxDuration(1536, VhtPhy::GetVhtMcs0(), 80, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(417600)) && CheckTxDuration(76, VhtPhy::GetVhtMcs0(), 80, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(57600)) && CheckTxDuration(14, VhtPhy::GetVhtMcs0(), 80, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(43200)) && CheckTxDuration(1536, VhtPhy::GetVhtMcs9(), 80, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(68)) && CheckTxDuration(76, VhtPhy::GetVhtMcs9(), 80, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(40)) && CheckTxDuration(14, VhtPhy::GetVhtMcs9(), 80, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(40)) && CheckTxDuration(1536, VhtPhy::GetVhtMcs9(), 80, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(64800)) && CheckTxDuration(76, VhtPhy::GetVhtMcs9(), 80, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(39600)) && CheckTxDuration(14, VhtPhy::GetVhtMcs9(), 80, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(39600)) && CheckTxDuration(1536, VhtPhy::GetVhtMcs8(), 160, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(56)) && CheckTxDuration(76, VhtPhy::GetVhtMcs8(), 160, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(40)) && CheckTxDuration(14, VhtPhy::GetVhtMcs8(), 160, - 800, + NanoSeconds(800), WIFI_PREAMBLE_VHT_SU, MicroSeconds(40)) && CheckTxDuration(1536, VhtPhy::GetVhtMcs8(), 160, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, MicroSeconds(54)) && CheckTxDuration(76, VhtPhy::GetVhtMcs8(), 160, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(39600)) && CheckTxDuration(14, VhtPhy::GetVhtMcs8(), 160, - 400, + NanoSeconds(400), WIFI_PREAMBLE_VHT_SU, NanoSeconds(39600)); NS_TEST_EXPECT_MSG_EQ(retval, true, "an 802.11ac duration failed"); // 802.11ax SU durations - retval = - retval && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 20, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(1485600)) && - CheckTxDuration(76, - HePhy::GetHeMcs0(), - 20, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(125600)) && - CheckTxDuration(14, HePhy::GetHeMcs0(), 20, 800, WIFI_PREAMBLE_HE_SU, NanoSeconds(71200)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 40, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(764800)) && - CheckTxDuration(76, HePhy::GetHeMcs0(), 40, 800, WIFI_PREAMBLE_HE_SU, NanoSeconds(84800)) && - CheckTxDuration(14, HePhy::GetHeMcs0(), 40, 800, WIFI_PREAMBLE_HE_SU, NanoSeconds(57600)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 80, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(397600)) && - CheckTxDuration(76, HePhy::GetHeMcs0(), 80, 800, WIFI_PREAMBLE_HE_SU, NanoSeconds(71200)) && - CheckTxDuration(14, HePhy::GetHeMcs0(), 80, 800, WIFI_PREAMBLE_HE_SU, NanoSeconds(57600)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 160, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(220800)) && - CheckTxDuration(76, - HePhy::GetHeMcs0(), - 160, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(14, - HePhy::GetHeMcs0(), - 160, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 20, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(1570400)) && - CheckTxDuration(76, - HePhy::GetHeMcs0(), - 20, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(130400)) && - CheckTxDuration(14, - HePhy::GetHeMcs0(), - 20, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(72800)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 40, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(807200)) && - CheckTxDuration(76, - HePhy::GetHeMcs0(), - 40, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(87200)) && - CheckTxDuration(14, - HePhy::GetHeMcs0(), - 40, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 80, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(418400)) && - CheckTxDuration(76, - HePhy::GetHeMcs0(), - 80, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(72800)) && - CheckTxDuration(14, - HePhy::GetHeMcs0(), - 80, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 160, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(231200)) && - CheckTxDuration(76, - HePhy::GetHeMcs0(), - 160, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(14, - HePhy::GetHeMcs0(), - 160, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 20, - 3200, - WIFI_PREAMBLE_HE_SU, - MicroSeconds(1740)) && - CheckTxDuration(76, HePhy::GetHeMcs0(), 20, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(140)) && - CheckTxDuration(14, HePhy::GetHeMcs0(), 20, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(76)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 40, - 3200, - WIFI_PREAMBLE_HE_SU, - MicroSeconds(892)) && - CheckTxDuration(76, HePhy::GetHeMcs0(), 40, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(92)) && - CheckTxDuration(14, HePhy::GetHeMcs0(), 40, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 80, - 3200, - WIFI_PREAMBLE_HE_SU, - MicroSeconds(460)) && - CheckTxDuration(76, HePhy::GetHeMcs0(), 80, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(76)) && - CheckTxDuration(14, HePhy::GetHeMcs0(), 80, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(1536, - HePhy::GetHeMcs0(), - 160, - 3200, - WIFI_PREAMBLE_HE_SU, - MicroSeconds(252)) && - CheckTxDuration(76, HePhy::GetHeMcs0(), 160, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(14, HePhy::GetHeMcs0(), 160, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 20, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(139200)) && - CheckTxDuration(76, - HePhy::GetHeMcs11(), - 20, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(14, - HePhy::GetHeMcs11(), - 20, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 40, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(98400)) && - CheckTxDuration(76, - HePhy::GetHeMcs11(), - 40, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(14, - HePhy::GetHeMcs11(), - 40, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 80, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(71200)) && - CheckTxDuration(76, - HePhy::GetHeMcs11(), - 80, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(14, - HePhy::GetHeMcs11(), - 80, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 160, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(76, - HePhy::GetHeMcs11(), - 160, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(14, - HePhy::GetHeMcs11(), - 160, - 800, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(57600)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 20, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(144800)) && - CheckTxDuration(76, - HePhy::GetHeMcs11(), - 20, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(14, - HePhy::GetHeMcs11(), - 20, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 40, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(101600)) && - CheckTxDuration(76, - HePhy::GetHeMcs11(), - 40, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(14, - HePhy::GetHeMcs11(), - 40, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 80, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(72800)) && - CheckTxDuration(76, - HePhy::GetHeMcs11(), - 80, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(14, - HePhy::GetHeMcs11(), - 80, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 160, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(76, - HePhy::GetHeMcs11(), - 160, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(14, - HePhy::GetHeMcs11(), - 160, - 1600, - WIFI_PREAMBLE_HE_SU, - NanoSeconds(58400)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 20, - 3200, - WIFI_PREAMBLE_HE_SU, - MicroSeconds(156)) && - CheckTxDuration(76, HePhy::GetHeMcs11(), 20, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(14, HePhy::GetHeMcs11(), 20, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 40, - 3200, - WIFI_PREAMBLE_HE_SU, - MicroSeconds(108)) && - CheckTxDuration(76, HePhy::GetHeMcs11(), 40, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(14, HePhy::GetHeMcs11(), 40, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 80, - 3200, - WIFI_PREAMBLE_HE_SU, - MicroSeconds(76)) && - CheckTxDuration(76, HePhy::GetHeMcs11(), 80, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(14, HePhy::GetHeMcs11(), 80, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)) && - CheckTxDuration(1536, - HePhy::GetHeMcs11(), - 160, - 3200, - WIFI_PREAMBLE_HE_SU, - MicroSeconds(60)) && - CheckTxDuration(76, - HePhy::GetHeMcs11(), - 160, - 3200, - WIFI_PREAMBLE_HE_SU, - MicroSeconds(60)) && - CheckTxDuration(14, HePhy::GetHeMcs11(), 160, 3200, WIFI_PREAMBLE_HE_SU, MicroSeconds(60)); + retval = retval && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 20, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(1485600)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 20, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(125600)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 20, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(71200)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 40, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(764800)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 40, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(84800)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 40, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 80, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(397600)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 80, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(71200)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 80, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 160, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(220800)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 160, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 160, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 20, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(1570400)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 20, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(130400)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 20, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(72800)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 40, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(807200)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 40, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(87200)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 40, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 80, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(418400)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 80, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(72800)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 80, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 160, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(231200)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 160, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 160, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 20, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(1740)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 20, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(140)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 20, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(76)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 40, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(892)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 40, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(92)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 40, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 80, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(460)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 80, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(76)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 80, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(1536, + HePhy::GetHeMcs0(), + 160, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(252)) && + CheckTxDuration(76, + HePhy::GetHeMcs0(), + 160, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(14, + HePhy::GetHeMcs0(), + 160, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 20, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(139200)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 20, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 20, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 40, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(98400)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 40, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 40, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 80, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(71200)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 80, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 80, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 160, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 160, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 160, + NanoSeconds(800), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(57600)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 20, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(144800)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 20, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 20, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 40, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(101600)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 40, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 40, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 80, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(72800)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 80, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 80, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 160, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 160, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 160, + NanoSeconds(1600), + WIFI_PREAMBLE_HE_SU, + NanoSeconds(58400)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 20, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(156)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 20, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 20, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 40, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(108)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 40, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 40, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 80, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(76)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 80, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 80, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(1536, + HePhy::GetHeMcs11(), + 160, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(76, + HePhy::GetHeMcs11(), + 160, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)) && + CheckTxDuration(14, + HePhy::GetHeMcs11(), + 160, + NanoSeconds(3200), + WIFI_PREAMBLE_HE_SU, + MicroSeconds(60)); NS_TEST_EXPECT_MSG_EQ(retval, true, "an 802.11ax SU duration failed"); @@ -1246,7 +1394,7 @@ TxDurationTest::DoRun() std::list{{{HeRu::RU_242_TONE, 1, true}, 0, 1}, {{HeRu::RU_242_TONE, 2, true}, 0, 1}}, 40, - 800, + NanoSeconds(800), WIFI_PREAMBLE_HE_MU, NanoSeconds( 1493600)) // equivalent to HE_SU for 20 MHz with 2 extra HE-SIG-B (i.e. 8 us) @@ -1254,14 +1402,14 @@ TxDurationTest::DoRun() std::list{{{HeRu::RU_242_TONE, 1, true}, 1, 1}, {{HeRu::RU_242_TONE, 2, true}, 0, 1}}, 40, - 800, + NanoSeconds(800), WIFI_PREAMBLE_HE_MU, NanoSeconds(1493600)) // shouldn't change if first PSDU is shorter && CheckMuTxDuration(std::list{1536, 76}, std::list{{{HeRu::RU_242_TONE, 1, true}, 0, 1}, {{HeRu::RU_242_TONE, 2, true}, 0, 1}}, 40, - 800, + NanoSeconds(800), WIFI_PREAMBLE_HE_MU, NanoSeconds(1493600)); @@ -1273,21 +1421,21 @@ TxDurationTest::DoRun() std::list{{{HeRu::RU_242_TONE, 1, true}, 0, 1}, {{HeRu::RU_242_TONE, 2, true}, 0, 1}}, 40, - 800, + NanoSeconds(800), WIFI_PREAMBLE_EHT_MU, NanoSeconds(1493600)) // equivalent to 802.11ax MU && CheckMuTxDuration(std::list{1536, 1536}, std::list{{{HeRu::RU_242_TONE, 1, true}, 1, 1}, {{HeRu::RU_242_TONE, 2, true}, 0, 1}}, 40, - 800, + NanoSeconds(800), WIFI_PREAMBLE_EHT_MU, NanoSeconds(1493600)) // shouldn't change if first PSDU is shorter && CheckMuTxDuration(std::list{1536, 76}, std::list{{{HeRu::RU_242_TONE, 1, true}, 0, 1}, {{HeRu::RU_242_TONE, 2, true}, 0, 1}}, 40, - 800, + NanoSeconds(800), WIFI_PREAMBLE_EHT_MU, NanoSeconds(1493600)); @@ -1378,7 +1526,7 @@ HeSigBDurationTest::BuildTxVector() const WifiTxVector txVector; txVector.SetPreambleType(WIFI_PREAMBLE_HE_MU); txVector.SetChannelWidth(m_channelWidth); - txVector.SetGuardInterval(3200); + txVector.SetGuardInterval(NanoSeconds(3200)); txVector.SetStbc(false); txVector.SetNess(0); std::list staIds; diff --git a/src/wifi/test/wifi-mac-ofdma-test.cc b/src/wifi/test/wifi-mac-ofdma-test.cc index 418243187..5f9fab547 100644 --- a/src/wifi/test/wifi-mac-ofdma-test.cc +++ b/src/wifi/test/wifi-mac-ofdma-test.cc @@ -301,7 +301,7 @@ TestMultiUserScheduler::ComputeWifiTxVector() m_txVector.SetEhtPpduType(0); } m_txVector.SetChannelWidth(bw); - m_txVector.SetGuardInterval(m_apMac->GetHeConfiguration()->GetGuardInterval().GetNanoSeconds()); + m_txVector.SetGuardInterval(m_apMac->GetHeConfiguration()->GetGuardInterval()); m_txVector.SetTxPowerLevel( GetWifiRemoteStationManager(SINGLE_LINK_OP_ID)->GetDefaultTxPowerLevel()); diff --git a/src/wifi/test/wifi-non-ht-dup-test.cc b/src/wifi/test/wifi-non-ht-dup-test.cc index 0d11cb90d..c1d1cbb7d 100644 --- a/src/wifi/test/wifi-non-ht-dup-test.cc +++ b/src/wifi/test/wifi-non-ht-dup-test.cc @@ -339,7 +339,7 @@ TestNonHtDuplicatePhyReception::SendNonHtDuplicatePpdu(ChannelWidthMhz channelWi WifiTxVector txVector = WifiTxVector(OfdmPhy::GetOfdmRate24Mbps(), 0, WIFI_PREAMBLE_LONG, - 800, + NanoSeconds(800), 1, 1, 0, @@ -759,7 +759,7 @@ TestMultipleCtsResponsesFromMuRts::TxNonHtDuplicateCts(std::size_t phyIndex) WifiTxVector(OfdmPhy::GetOfdmRate54Mbps(), // use less robust modulation for test purpose 0, WIFI_PREAMBLE_LONG, - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/test/wifi-operating-channel-test.cc b/src/wifi/test/wifi-operating-channel-test.cc index 85a63f91e..3cfea2df7 100644 --- a/src/wifi/test/wifi-operating-channel-test.cc +++ b/src/wifi/test/wifi-operating-channel-test.cc @@ -515,8 +515,15 @@ Ptr WifiPhyChannel80Plus80Test::CreateDummyHePpdu(ChannelWidthMhz bandwidth, const WifiPhyOperatingChannel& channel) { - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, bandwidth, false); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + bandwidth, + false); Ptr psdu = CreateDummyPsdu(); return Create(psdu, txVector, channel, MicroSeconds(100), 0); } diff --git a/src/wifi/test/wifi-phy-cca-test.cc b/src/wifi/test/wifi-phy-cca-test.cc index f8cefb13d..15018aed0 100644 --- a/src/wifi/test/wifi-phy-cca-test.cc +++ b/src/wifi/test/wifi-phy-cca-test.cc @@ -176,8 +176,15 @@ WifiPhyCcaThresholdsTest::CreateDummyPsdu() Ptr WifiPhyCcaThresholdsTest::CreateDummyNonHtPpdu(const WifiPhyOperatingChannel& channel) { - WifiTxVector txVector = - WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, 800, 1, 1, 0, 20, false); + WifiTxVector txVector = WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), + 0, + WIFI_PREAMBLE_LONG, + NanoSeconds(800), + 1, + 1, + 0, + 20, + false); Ptr psdu = CreateDummyPsdu(); return Create(psdu, txVector, channel, 0); } @@ -186,8 +193,15 @@ Ptr WifiPhyCcaThresholdsTest::CreateDummyHtPpdu(ChannelWidthMhz bandwidth, const WifiPhyOperatingChannel& channel) { - WifiTxVector txVector = - WifiTxVector(HtPhy::GetHtMcs0(), 0, WIFI_PREAMBLE_HT_MF, 800, 1, 1, 0, bandwidth, false); + WifiTxVector txVector = WifiTxVector(HtPhy::GetHtMcs0(), + 0, + WIFI_PREAMBLE_HT_MF, + NanoSeconds(800), + 1, + 1, + 0, + bandwidth, + false); Ptr psdu = CreateDummyPsdu(); return Create(psdu, txVector, channel, MicroSeconds(100), 0); } @@ -196,8 +210,15 @@ Ptr WifiPhyCcaThresholdsTest::CreateDummyVhtPpdu(ChannelWidthMhz bandwidth, const WifiPhyOperatingChannel& channel) { - WifiTxVector txVector = - WifiTxVector(VhtPhy::GetVhtMcs0(), 0, WIFI_PREAMBLE_VHT_SU, 800, 1, 1, 0, bandwidth, false); + WifiTxVector txVector = WifiTxVector(VhtPhy::GetVhtMcs0(), + 0, + WIFI_PREAMBLE_VHT_SU, + NanoSeconds(800), + 1, + 1, + 0, + bandwidth, + false); Ptr psdu = CreateDummyPsdu(); return Create(psdu, txVector, channel, MicroSeconds(100), 0); } @@ -206,8 +227,15 @@ Ptr WifiPhyCcaThresholdsTest::CreateDummyHePpdu(ChannelWidthMhz bandwidth, const WifiPhyOperatingChannel& channel) { - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, bandwidth, false); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + bandwidth, + false); Ptr psdu = CreateDummyPsdu(); return Create(psdu, txVector, channel, MicroSeconds(100), 0); } @@ -880,8 +908,15 @@ WifiPhyCcaIndicationTest::SendHeSuPpdu(double txPowerDbm, m_txPhy->SetOperatingChannel( WifiPhy::ChannelTuple{channelNum, bandwidth, WIFI_PHY_BAND_5GHZ, 0}); - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, bandwidth, false); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + bandwidth, + false); Ptr pkt = Create(1000); WifiMacHeader hdr; diff --git a/src/wifi/test/wifi-phy-mu-mimo-test.cc b/src/wifi/test/wifi-phy-mu-mimo-test.cc index f481024fb..20a661e51 100644 --- a/src/wifi/test/wifi-phy-mu-mimo-test.cc +++ b/src/wifi/test/wifi-phy-mu-mimo-test.cc @@ -541,7 +541,7 @@ TestDlMuMimoPhyTransmission::SendMuPpdu(const std::vector& staInfos) WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_MU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -1295,7 +1295,7 @@ TestUlMuMimoPhyTransmission::SendHeSuPpdu(uint16_t txStaId, WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_SU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -1330,7 +1330,7 @@ TestUlMuMimoPhyTransmission::GetTxVectorForHeTbPpdu(uint16_t txStaId, WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_TB, - 1600, + NanoSeconds(1600), 1, nss, 0, @@ -1354,7 +1354,7 @@ TestUlMuMimoPhyTransmission::SetTrigVector(const std::vector& staIds, WifiTxVector txVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_TB, - 1600, + NanoSeconds(1600), 1, 1, 0, diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index 906594f5d..e613cb059 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -486,7 +486,7 @@ TestDlOfdmaPhyTransmission::SendMuPpdu(uint16_t rxStaId1, uint16_t rxStaId2) WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_MU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -1361,7 +1361,7 @@ TestDlOfdmaPhyPuncturing::SendMuPpdu(uint16_t rxStaId1, WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_MU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -2054,7 +2054,7 @@ TestUlOfdmaPpduUid::SendMuPpdu() WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_MU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -2106,7 +2106,7 @@ TestUlOfdmaPpduUid::SendTbPpdu() WifiTxVector txVector1 = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_TB, - 1600, + NanoSeconds(1600), 1, 1, 0, @@ -2183,7 +2183,7 @@ TestUlOfdmaPpduUid::SendSuPpdu(uint16_t txStaId) WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_SU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -2336,7 +2336,7 @@ TestMultipleHeTbPreambles::TestMultipleHeTbPreambles() m_trigVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_TB, - 1600, + NanoSeconds(1600), 1, 1, 0, @@ -2401,7 +2401,7 @@ TestMultipleHeTbPreambles::RxHeTbPpdu(uint64_t uid, WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_TB, - 1600, + NanoSeconds(1600), 1, 1, 0, @@ -3231,7 +3231,7 @@ TestUlOfdmaPhyTransmission::SendHeSuPpdu(uint16_t txStaId, WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_SU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -3282,7 +3282,7 @@ TestUlOfdmaPhyTransmission::GetTxVectorForHeTbPpdu(uint16_t txStaId, WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_TB, - 1600, + NanoSeconds(1600), 1, 1, 0, @@ -3339,7 +3339,7 @@ TestUlOfdmaPhyTransmission::SetTrigVector(uint8_t bssColor, TrigVectorInfo error WifiTxVector txVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_TB, - 1600, + NanoSeconds(1600), 1, 1, 0, @@ -4892,7 +4892,7 @@ TestPhyPaddingExclusion::SendHeTbPpdu(uint16_t txStaId, WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_TB, - 1600, + NanoSeconds(1600), 1, 1, 0, @@ -5191,7 +5191,7 @@ TestPhyPaddingExclusion::SetTrigVector(Time ppduDuration) WifiTxVector trigVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_TB, - 1600, + NanoSeconds(1600), 1, 1, 0, @@ -5458,7 +5458,7 @@ TestUlOfdmaPowerControl::SendMuBar(std::vector staIds) muBar.SetMoreTF(true); muBar.SetCsRequired(true); muBar.SetUlBandwidth(DEFAULT_CHANNEL_WIDTH); - muBar.SetGiAndLtfType(1600, 2); + muBar.SetGiAndLtfType(NanoSeconds(1600), 2); muBar.SetApTxPower(static_cast(m_txPowerAp)); muBar.SetUlSpatialReuse(60500); @@ -5507,7 +5507,7 @@ TestUlOfdmaPowerControl::SendMuBar(std::vector staIds) WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_SU, - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/test/wifi-phy-reception-test.cc b/src/wifi/test/wifi-phy-reception-test.cc index 17d29ab31..106968f97 100644 --- a/src/wifi/test/wifi-phy-reception-test.cc +++ b/src/wifi/test/wifi-phy-reception-test.cc @@ -119,8 +119,15 @@ WifiPhyReceptionTest::WifiPhyReceptionTest(std::string test_name) void WifiPhyReceptionTest::SendPacket(double rxPowerDbm, uint32_t packetSize, uint8_t mcs) { - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs(mcs), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, false); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs(mcs), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + false); Ptr pkt = Create(packetSize); WifiMacHeader hdr; @@ -2773,8 +2780,15 @@ TestAmpduReception::CheckPhyState(WifiPhyState expectedState) void TestAmpduReception::SendAmpduWithThreeMpdus(double rxPowerDbm, uint32_t referencePacketSize) { - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, true); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + true); WifiMacHeader hdr; hdr.SetType(WIFI_MAC_QOSDATA); @@ -4300,8 +4314,15 @@ TestUnsupportedBandwidthReception::TestUnsupportedBandwidthReception() void TestUnsupportedBandwidthReception::SendPpdu(double centerFreqMhz, ChannelWidthMhz bandwidthMhz) { - auto txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, bandwidthMhz, false); + auto txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + bandwidthMhz, + false); auto pkt = Create(1000); WifiMacHeader hdr; @@ -4553,7 +4574,7 @@ TestPrimary20CoveredByPpdu::CreatePpdu(double ppduCenterFreqMhz) auto txVector = WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_SU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -4756,8 +4777,15 @@ TestSpectrumChannelWithBandwidthFilter::TestSpectrumChannelWithBandwidthFilter( void TestSpectrumChannelWithBandwidthFilter::Send() const { - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs7(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, false); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs7(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + false); Ptr pkt = Create(1000); WifiMacHeader hdr; @@ -4927,8 +4955,15 @@ TestPhyDropDueToTx::TestPhyDropDueToTx(Time delay, WifiPhyRxfailureReason expect void TestPhyDropDueToTx::Send(Ptr phy) const { - const auto txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, false); + const auto txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + false); auto pkt = Create(1000); WifiMacHeader hdr; diff --git a/src/wifi/test/wifi-phy-rx-trace-helper-test.cc b/src/wifi/test/wifi-phy-rx-trace-helper-test.cc index 740b37204..e6d33fda4 100644 --- a/src/wifi/test/wifi-phy-rx-trace-helper-test.cc +++ b/src/wifi/test/wifi-phy-rx-trace-helper-test.cc @@ -269,8 +269,15 @@ TestWifiPhyRxTraceHelper::SendPpduWithTwoMpdus(double rxPowerDbm, tx_phy->SetTxPowerStart(txPower); tx_phy->SetTxPowerEnd(txPower); - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, true); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + true); std::vector> mpduList; @@ -302,8 +309,15 @@ TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu(double rxPowerDbm, tx_phy->SetTxPowerStart(txPower); tx_phy->SetTxPowerEnd(txPower); - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, true); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + true); std::vector> mpduList; @@ -1129,8 +1143,15 @@ TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus(double rxPowerDbm, tx_phy->SetTxPowerStart(txPower); tx_phy->SetTxPowerEnd(txPower); - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, true); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + true); std::vector> mpduList; @@ -1166,7 +1187,7 @@ TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu(double rxPowerDbm, WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -1883,8 +1904,15 @@ TestWifiPhyRxTraceHelperYans::SendPpduWithTwoMpdus(double rxPowerDbm, { propLoss->SetRss(rxPowerDbm); - WifiTxVector txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, true); + WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + true); std::vector> mpduList; @@ -1922,8 +1950,15 @@ TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu(double rxPowerDbm, { propLoss->SetRss(rxPowerDbm); - auto txVector = - WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, 20, true); + auto txVector = WifiTxVector(HePhy::GetHeMcs0(), + 0, + WIFI_PREAMBLE_HE_SU, + NanoSeconds(800), + 1, + 1, + 0, + 20, + true); std::vector> mpduList; diff --git a/src/wifi/test/wifi-phy-thresholds-test.cc b/src/wifi/test/wifi-phy-thresholds-test.cc index 15f440c6e..1bbb4d432 100644 --- a/src/wifi/test/wifi-phy-thresholds-test.cc +++ b/src/wifi/test/wifi-phy-thresholds-test.cc @@ -150,7 +150,7 @@ WifiPhyThresholdsTest::MakeWifiSignal(double txPowerWatts, const WifiPhyOperatin WifiTxVector txVector = WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, - 800, + NanoSeconds(800), 1, 1, 0, diff --git a/src/wifi/test/wifi-primary-channels-test.cc b/src/wifi/test/wifi-primary-channels-test.cc index e81bce85d..74ce2e20d 100644 --- a/src/wifi/test/wifi-primary-channels-test.cc +++ b/src/wifi/test/wifi-primary-channels-test.cc @@ -480,7 +480,7 @@ WifiPrimaryChannelsTest::DoSetup() m_triggerTxVector = WifiTxVector(OfdmPhy::GetOfdmRate6Mbps(), 0, WIFI_PREAMBLE_LONG, - 800, + NanoSeconds(800), 1, 1, 0, @@ -784,7 +784,7 @@ WifiPrimaryChannelsTest::SendDlSuPpdu(uint8_t bss, ChannelWidthMhz txChannelWidt WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs8(), 0, WIFI_PREAMBLE_HE_SU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -820,7 +820,7 @@ WifiPrimaryChannelsTest::SendDlMuPpdu(uint8_t bss, WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs8(), 0, WIFI_PREAMBLE_HE_MU, - 800, + NanoSeconds(800), 1, 1, 0, @@ -906,7 +906,7 @@ WifiPrimaryChannelsTest::DoSendHeTbPpdu(uint8_t bss, WifiTxVector trigVector(HePhy::GetHeMcs8(), 0, WIFI_PREAMBLE_HE_TB, - 3200, + NanoSeconds(3200), 1, 1, 0, @@ -931,7 +931,7 @@ WifiPrimaryChannelsTest::DoSendHeTbPpdu(uint8_t bss, WifiTxVector txVector(HePhy::GetHeMcs8(), 0, WIFI_PREAMBLE_HE_TB, - 3200, + NanoSeconds(3200), 1, 1, 0, diff --git a/src/wifi/test/wifi-test.cc b/src/wifi/test/wifi-test.cc index 7dcf08857..6b38b41d9 100644 --- a/src/wifi/test/wifi-test.cc +++ b/src/wifi/test/wifi-test.cc @@ -3589,7 +3589,7 @@ class HeRuMcsDataRateTestCase : public TestCase bool CheckDataRate(HeRu::RuType ruType, std::string mcs, uint8_t nss, - uint16_t guardInterval, + Time guardInterval, uint16_t expectedDataRate); void DoRun() override; }; @@ -3603,7 +3603,7 @@ bool HeRuMcsDataRateTestCase::CheckDataRate(HeRu::RuType ruType, std::string mcs, uint8_t nss, - uint16_t guardInterval, + Time guardInterval, uint16_t expectedDataRate) { uint8_t staId = 1; @@ -3641,18 +3641,18 @@ HeRuMcsDataRateTestCase::DoRun() bool retval = true; // 26-tone RU, browse over all MCSs, GIs and Nss's (up to 4, current max) - retval = retval && CheckDataRate(HeRu::RU_26_TONE, "HeMcs0", 1, 800, 9) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs1", 1, 1600, 17) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs2", 1, 3200, 23) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs3", 1, 3200, 30) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs4", 2, 1600, 100) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs5", 3, 1600, 200) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs6", 4, 1600, 300) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs7", 4, 3200, 300) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs8", 4, 1600, 400) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs9", 4, 3200, 400) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs10", 4, 1600, 500) && - CheckDataRate(HeRu::RU_26_TONE, "HeMcs11", 4, 3200, 500); + retval = retval && CheckDataRate(HeRu::RU_26_TONE, "HeMcs0", 1, NanoSeconds(800), 9) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs1", 1, NanoSeconds(1600), 17) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs2", 1, NanoSeconds(3200), 23) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs3", 1, NanoSeconds(3200), 30) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs4", 2, NanoSeconds(1600), 100) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs5", 3, NanoSeconds(1600), 200) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs6", 4, NanoSeconds(1600), 300) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs7", 4, NanoSeconds(3200), 300) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs8", 4, NanoSeconds(1600), 400) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs9", 4, NanoSeconds(3200), 400) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs10", 4, NanoSeconds(1600), 500) && + CheckDataRate(HeRu::RU_26_TONE, "HeMcs11", 4, NanoSeconds(3200), 500); NS_TEST_EXPECT_MSG_EQ( retval, @@ -3660,12 +3660,12 @@ HeRuMcsDataRateTestCase::DoRun() "26-tone RU data rate verification for different MCSs, GIs, and Nss's failed"); // Check other RU sizes - retval = retval && CheckDataRate(HeRu::RU_52_TONE, "HeMcs2", 1, 1600, 50) && - CheckDataRate(HeRu::RU_106_TONE, "HeMcs9", 1, 800, 500) && - CheckDataRate(HeRu::RU_242_TONE, "HeMcs5", 1, 1600, 650) && - CheckDataRate(HeRu::RU_484_TONE, "HeMcs3", 1, 1600, 650) && - CheckDataRate(HeRu::RU_996_TONE, "HeMcs5", 1, 3200, 2450) && - CheckDataRate(HeRu::RU_2x996_TONE, "HeMcs3", 1, 3200, 2450); + retval = retval && CheckDataRate(HeRu::RU_52_TONE, "HeMcs2", 1, NanoSeconds(1600), 50) && + CheckDataRate(HeRu::RU_106_TONE, "HeMcs9", 1, NanoSeconds(800), 500) && + CheckDataRate(HeRu::RU_242_TONE, "HeMcs5", 1, NanoSeconds(1600), 650) && + CheckDataRate(HeRu::RU_484_TONE, "HeMcs3", 1, NanoSeconds(1600), 650) && + CheckDataRate(HeRu::RU_996_TONE, "HeMcs5", 1, NanoSeconds(3200), 2450) && + CheckDataRate(HeRu::RU_2x996_TONE, "HeMcs3", 1, NanoSeconds(3200), 2450); NS_TEST_EXPECT_MSG_EQ(retval, true,