diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index 19d0de930..eedd12f90 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -1230,9 +1230,9 @@ HePhy::GetPer20MHzDurations(const Ptr ppdu) if (ppdu) { - const uint16_t subchannelMinFreq = + const double subchannelMinFreq = m_wifiPhy->GetFrequency() - (m_wifiPhy->GetChannelWidth() / 2) + (index * 20); - const uint16_t subchannelMaxFreq = subchannelMinFreq + 20; + const double subchannelMaxFreq = subchannelMinFreq + 20; const auto ppduBw = ppdu->GetTxVector().GetChannelWidth(); if (ppduBw <= m_wifiPhy->GetChannelWidth() && @@ -1351,7 +1351,7 @@ HePhy::GetTxPowerSpectralDensity(double txPowerW, const auto& txVector = ppdu->GetTxVector(); const auto& centerFrequencies = ppdu->GetTxCenterFreqs(); auto channelWidth = txVector.GetChannelWidth(); - auto printFrequencies = [](const std::vector& v) { + auto printFrequencies = [](const std::vector& v) { std::stringstream ss; for (const auto& centerFrequency : v) { @@ -1443,7 +1443,7 @@ HePhy::GetTxPowerSpectralDensity(double txPowerW, } } -std::vector +std::vector HePhy::GetCenterFrequenciesForNonHePart(Ptr ppdu, uint16_t staId) const { NS_LOG_FUNCTION(this << ppdu << staId); @@ -1460,7 +1460,7 @@ HePhy::GetCenterFrequenciesForNonHePart(Ptr ppdu, uint16_t staId HeRu::RuSpec nonOfdmaRu = HeRu::FindOverlappingRu(currentWidth, ru, HeRu::GetRuType(nonOfdmaWidth)); - uint16_t startingFrequency = centerFrequencies.front() - (currentWidth / 2); + double startingFrequency = centerFrequencies.front() - (currentWidth / 2); centerFrequencies.front() = startingFrequency + nonOfdmaWidth * (nonOfdmaRu.GetPhyIndex( @@ -1859,9 +1859,9 @@ HePhy::GetRxPpduFromTxPpdu(Ptr ppdu) std::vector HePhy::ConvertHeRuSubcarriers(ChannelWidthMhz bandWidth, ChannelWidthMhz guardBandwidth, - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz totalWidth, - uint32_t subcarrierSpacing, + double subcarrierSpacing, HeRu::SubcarrierRange subcarrierRange, uint8_t bandIndex) { diff --git a/src/wifi/model/he/he-phy.h b/src/wifi/model/he/he-phy.h index 23b1915e3..5b4c1ea68 100644 --- a/src/wifi/model/he/he-phy.h +++ b/src/wifi/model/he/he-phy.h @@ -223,8 +223,8 @@ class HePhy : public VhtPhy * \param staId the STA-ID of the station taking part of the UL MU * \return the center frequency in MHz corresponding to the non-HE portion of the HE TB PPDU */ - std::vector GetCenterFrequenciesForNonHePart(const Ptr ppdu, - uint16_t staId) const; + std::vector GetCenterFrequenciesForNonHePart(const Ptr ppdu, + uint16_t staId) const; /** * Sets the OBSS-PD algorithm. @@ -459,9 +459,9 @@ class HePhy : public VhtPhy static std::vector ConvertHeRuSubcarriers( ChannelWidthMhz bandWidth, ChannelWidthMhz guardBandwidth, - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz totalWidth, - uint32_t subcarrierSpacing, + double subcarrierSpacing, HeRu::SubcarrierRange subcarrierRange, uint8_t bandIndex = 0); diff --git a/src/wifi/model/ht/ht-phy.cc b/src/wifi/model/ht/ht-phy.cc index 5396fe810..f1741178d 100644 --- a/src/wifi/model/ht/ht-phy.cc +++ b/src/wifi/model/ht/ht-phy.cc @@ -846,10 +846,10 @@ HtPhy::GetCcaIndication(const Ptr ppdu) if (ppdu) { const ChannelWidthMhz primaryWidth = 20; - uint16_t p20MinFreq = + double p20MinFreq = m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(primaryWidth) - (primaryWidth / 2); - uint16_t p20MaxFreq = + double p20MaxFreq = m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(primaryWidth) + (primaryWidth / 2); if (ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq)) @@ -863,10 +863,10 @@ HtPhy::GetCcaIndication(const Ptr ppdu) } const ChannelWidthMhz secondaryWidth = 20; - uint16_t s20MinFreq = + double s20MinFreq = m_wifiPhy->GetOperatingChannel().GetSecondaryChannelCenterFrequency(secondaryWidth) - (secondaryWidth / 2); - uint16_t s20MaxFreq = + double s20MaxFreq = m_wifiPhy->GetOperatingChannel().GetSecondaryChannelCenterFrequency(secondaryWidth) + (secondaryWidth / 2); if (!ppdu || ppdu->DoesOverlapChannel(s20MinFreq, s20MaxFreq)) diff --git a/src/wifi/model/reduced-neighbor-report.cc b/src/wifi/model/reduced-neighbor-report.cc index bac6c2aa0..80ce32ad4 100644 --- a/src/wifi/model/reduced-neighbor-report.cc +++ b/src/wifi/model/reduced-neighbor-report.cc @@ -168,7 +168,7 @@ ReducedNeighborReport::SetOperatingChannel(std::size_t nbrApInfoId, << "band " << channel.GetPhyBand()); // find the primary channel number - uint16_t startingFreq = 0; + double startingFreq = 0; switch (channel.GetPhyBand()) { @@ -256,7 +256,7 @@ ReducedNeighborReport::GetOperatingChannel(std::size_t nbrApInfoId) const NS_ABORT_IF(band == WIFI_PHY_BAND_UNSPECIFIED || width == 0); - uint16_t startingFreq = 0; + double startingFreq = 0; switch (band) { @@ -276,10 +276,10 @@ ReducedNeighborReport::GetOperatingChannel(std::size_t nbrApInfoId) const } uint8_t primaryChannelNumber = m_nbrApInfoFields.at(nbrApInfoId).channelNumber; - uint16_t primaryChannelCenterFrequency = startingFreq + primaryChannelNumber * 5; + double primaryChannelCenterFrequency = startingFreq + primaryChannelNumber * 5; uint8_t channelNumber = 0; - uint16_t frequency = 0; + double frequency = 0; for (const auto& channel : WifiPhyOperatingChannel::m_frequencyChannels) { @@ -335,8 +335,8 @@ ReducedNeighborReport::GetOperatingChannel(std::size_t nbrApInfoId) const WifiPhyOperatingChannel channel; channel.Set({{channelNumber, frequency, width, band}}, WIFI_STANDARD_UNSPECIFIED); - uint16_t channelLowestFreq = frequency - width / 2; - uint16_t primaryChannelLowestFreq = primaryChannelCenterFrequency - 10; + double channelLowestFreq = frequency - width / 2; + double primaryChannelLowestFreq = primaryChannelCenterFrequency - 10; channel.SetPrimary20Index((primaryChannelLowestFreq - channelLowestFreq) / 20); return channel; diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index 328640e5a..0260c877a 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -275,7 +275,7 @@ SpectrumWifiPhy::AddChannel(const Ptr channel, const FrequencyR void SpectrumWifiPhy::ResetSpectrumModel(Ptr spectrumPhyInterface, - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth) { std::stringstream ss; @@ -310,7 +310,7 @@ SpectrumWifiPhy::DoChannelSwitch() NS_LOG_FUNCTION(this); m_frequenciesBeforeSwitch = GetOperatingChannel().IsSet() ? GetOperatingChannel().GetFrequencies() - : std::vector{}; + : std::vector{}; m_widthsBeforeSwitch = GetOperatingChannel().IsSet() ? GetOperatingChannel().GetWidths() : std::vector{}; WifiPhy::DoChannelSwitch(); @@ -414,7 +414,7 @@ SpectrumWifiPhy::NotifyChannelSwitched() } void -SpectrumWifiPhy::ConfigureInterface(const std::vector& frequencies, ChannelWidthMhz width) +SpectrumWifiPhy::ConfigureInterface(const std::vector& frequencies, ChannelWidthMhz width) { std::stringstream ss; for (const auto& centerFrequency : frequencies) @@ -693,7 +693,7 @@ SpectrumWifiPhy::GetGuardBandwidth(ChannelWidthMhz currentChannelWidth) const } uint32_t -SpectrumWifiPhy::GetNumBandsBetweenSegments(const std::vector& centerFrequencies, +SpectrumWifiPhy::GetNumBandsBetweenSegments(const std::vector& centerFrequencies, ChannelWidthMhz totalWidth, uint32_t subcarrierSpacing) { @@ -800,9 +800,7 @@ SpectrumWifiPhy::ConvertIndicesToFrequenciesForInterface( auto startGuardBand = rxSpectrumModel->Begin(); auto startChannel = std::next(startGuardBand, indices.first); auto endChannel = std::next(startGuardBand, indices.second + 1); - auto lowFreq = static_cast(startChannel->fc); - auto highFreq = static_cast(endChannel->fc); - return {lowFreq, highFreq}; + return {startChannel->fc, endChannel->fc}; } std::tuple @@ -827,7 +825,7 @@ SpectrumWifiPhy::GetSpectrumPhyInterfaces() const } Ptr -SpectrumWifiPhy::GetInterfaceCoveringChannelBand(uint16_t frequency, ChannelWidthMhz width) const +SpectrumWifiPhy::GetInterfaceCoveringChannelBand(double frequency, ChannelWidthMhz width) const { const auto lowFreq = frequency - (width / 2); const auto highFreq = frequency + (width / 2); diff --git a/src/wifi/model/spectrum-wifi-phy.h b/src/wifi/model/spectrum-wifi-phy.h index c897fda2b..2c0da2356 100644 --- a/src/wifi/model/spectrum-wifi-phy.h +++ b/src/wifi/model/spectrum-wifi-phy.h @@ -144,7 +144,7 @@ class SpectrumWifiPhy : public WifiPhy * \param frequencies the center frequency of each segment in MHz the PHY interface should use * \param width the total channel width in MHz the PHY interface should use */ - void ConfigureInterface(const std::vector& frequencies, ChannelWidthMhz width); + void ConfigureInterface(const std::vector& frequencies, ChannelWidthMhz width); /** * This function is sending the signal to the Spectrum channel @@ -186,7 +186,7 @@ class SpectrumWifiPhy : public WifiPhy * \return the number of bands between the two segments if the operating channel is made of * non-contiguous segments, zero otherwise */ - static uint32_t GetNumBandsBetweenSegments(const std::vector& centerFrequencies, + static uint32_t GetNumBandsBetweenSegments(const std::vector& centerFrequencies, ChannelWidthMhz totalWidth, uint32_t subcarrierSpacing); @@ -222,7 +222,7 @@ class SpectrumWifiPhy : public WifiPhy * \param channelWidth the total channel width in MHz the PHY interface should use */ void ResetSpectrumModel(Ptr spectrumPhyInterface, - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth); /** @@ -290,7 +290,7 @@ class SpectrumWifiPhy : public WifiPhy * \param width the width in MHz of the RF channel band * \return the spectrum PHY interface that covers the indicated band of the RF channel */ - Ptr GetInterfaceCoveringChannelBand(uint16_t frequency, + Ptr GetInterfaceCoveringChannelBand(double frequency, ChannelWidthMhz width) const; /** @@ -303,7 +303,7 @@ class SpectrumWifiPhy : public WifiPhy bool m_disableWifiReception; //!< forces this PHY to fail to sync on any signal bool m_trackSignalsInactiveInterfaces; //!< flag whether signals coming from inactive spectrum //!< PHY interfaces are tracked - std::vector m_frequenciesBeforeSwitch; //!< center frequency before channel switch + std::vector m_frequenciesBeforeSwitch; //!< center frequency before channel switch std::vector m_widthsBeforeSwitch; //!< channel width before channel switch TracedCallback, uint32_t, double, Time> diff --git a/src/wifi/model/vht/vht-phy.cc b/src/wifi/model/vht/vht-phy.cc index 2773144b3..8101d3350 100644 --- a/src/wifi/model/vht/vht-phy.cc +++ b/src/wifi/model/vht/vht-phy.cc @@ -609,10 +609,10 @@ VhtPhy::GetCcaIndication(const Ptr ppdu) if (ppdu) { const ChannelWidthMhz primaryWidth = 20; - uint16_t p20MinFreq = + double p20MinFreq = m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(primaryWidth) - (primaryWidth / 2); - uint16_t p20MaxFreq = + double p20MaxFreq = m_wifiPhy->GetOperatingChannel().GetPrimaryChannelCenterFrequency(primaryWidth) + (primaryWidth / 2); if (ppdu->DoesOverlapChannel(p20MinFreq, p20MaxFreq)) @@ -631,11 +631,11 @@ VhtPhy::GetCcaIndication(const Ptr ppdu) for (const auto& secondaryChannel : secondaryChannels) { const auto secondaryWidth = secondaryChannel.first; - uint16_t secondaryMinFreq = + const auto secondaryMinFreq = m_wifiPhy->GetOperatingChannel().GetSecondaryChannelCenterFrequency( secondaryWidth) - (secondaryWidth / 2); - uint16_t secondaryMaxFreq = + const auto secondaryMaxFreq = m_wifiPhy->GetOperatingChannel().GetSecondaryChannelCenterFrequency( secondaryWidth) + (secondaryWidth / 2); diff --git a/src/wifi/model/wifi-phy-common.h b/src/wifi/model/wifi-phy-common.h index 2872d6c41..8238b5665 100644 --- a/src/wifi/model/wifi-phy-common.h +++ b/src/wifi/model/wifi-phy-common.h @@ -56,7 +56,7 @@ static constexpr uint8_t MAX_PROPAGATION_DELAY_USEC = 1; /** * typedef for a pair of start and stop frequencies in Hz to represent a band */ -using WifiSpectrumBandFrequencies = std::pair; +using WifiSpectrumBandFrequencies = std::pair; /// WifiSpectrumBandInfo structure containing info about a spectrum band struct WifiSpectrumBandInfo diff --git a/src/wifi/model/wifi-phy-operating-channel.cc b/src/wifi/model/wifi-phy-operating-channel.cc index d11d21024..9682c9f82 100644 --- a/src/wifi/model/wifi-phy-operating-channel.cc +++ b/src/wifi/model/wifi-phy-operating-channel.cc @@ -444,7 +444,7 @@ WifiPhyOperatingChannel::GetDefaultChannelNumber( WifiPhyOperatingChannel::ConstIterator WifiPhyOperatingChannel::FindFirst(uint8_t number, - uint16_t frequency, + double frequency, ChannelWidthMhz width, WifiStandard standard, WifiPhyBand band, @@ -498,7 +498,7 @@ WifiPhyOperatingChannel::GetNumber(std::size_t segment /* = 0 */) const return (*std::next(m_channelIts.begin(), segment))->number; } -uint16_t +double WifiPhyOperatingChannel::GetFrequency(std::size_t segment /* = 0 */) const { NS_ASSERT(IsSet()); @@ -554,11 +554,11 @@ WifiPhyOperatingChannel::GetNumbers() const return channelNumbers; } -std::vector +std::vector WifiPhyOperatingChannel::GetFrequencies() const { NS_ASSERT(IsSet()); - std::vector centerFrequencies{}; + std::vector centerFrequencies{}; std::transform(m_channelIts.cbegin(), m_channelIts.cend(), std::back_inserter(centerFrequencies), @@ -688,7 +688,7 @@ WifiPhyOperatingChannel::GetSecondarySegmentIndex(ChannelWidthMhz primaryChannel return (secondaryIndex >= (numIndices / 2)) ? 1 : 0; } -uint16_t +double WifiPhyOperatingChannel::GetPrimaryChannelCenterFrequency(ChannelWidthMhz primaryChannelWidth) const { const auto segmentIndex = GetPrimarySegmentIndex(primaryChannelWidth); @@ -701,7 +701,7 @@ WifiPhyOperatingChannel::GetPrimaryChannelCenterFrequency(ChannelWidthMhz primar primaryChannelWidth; } -uint16_t +double WifiPhyOperatingChannel::GetSecondaryChannelCenterFrequency( ChannelWidthMhz secondaryChannelWidth) const { diff --git a/src/wifi/model/wifi-phy-operating-channel.h b/src/wifi/model/wifi-phy-operating-channel.h index baab31f2c..cfd3cd2f2 100644 --- a/src/wifi/model/wifi-phy-operating-channel.h +++ b/src/wifi/model/wifi-phy-operating-channel.h @@ -49,7 +49,7 @@ struct FrequencyChannelInfo */ auto operator<=>(const FrequencyChannelInfo& info) const = default; uint8_t number{0}; ///< the channel number - uint16_t frequency{0}; ///< the center frequency + double frequency{0}; ///< the center frequency ChannelWidthMhz width{0}; ///< the channel width in MHz WifiPhyBand band{WifiPhyBand::WIFI_PHY_BAND_UNSPECIFIED}; ///< the PHY band FrequencyChannelType type{FrequencyChannelType::OFDM}; ///< the frequency channel type @@ -204,7 +204,7 @@ class WifiPhyOperatingChannel * \param segment the index of the frequency segment (if operating channel is non-contiguous) * \return the center frequency for a given frequency segment (in MHz) */ - uint16_t GetFrequency(std::size_t segment = 0) const; + double GetFrequency(std::size_t segment = 0) const; /** * Return the channel width for a given frequency segment (in MHz). * Segments are ordered by increasing frequencies, hence by default @@ -234,7 +234,7 @@ class WifiPhyOperatingChannel * * \return the center frequency per segment (in MHz) */ - std::vector GetFrequencies() const; + std::vector GetFrequencies() const; /** * Return the channel width per segment (in MHz). * Segments are ordered by increasing frequencies. @@ -307,7 +307,7 @@ class WifiPhyOperatingChannel * \param primaryChannelWidth the width of the primary channel in MHz * \return the center frequency of the primary channel of the given width */ - uint16_t GetPrimaryChannelCenterFrequency(ChannelWidthMhz primaryChannelWidth) const; + double GetPrimaryChannelCenterFrequency(ChannelWidthMhz primaryChannelWidth) const; /** * Get the center frequency of the secondary channel of the given width. @@ -315,7 +315,7 @@ class WifiPhyOperatingChannel * \param secondaryChannelWidth the width of the secondary channel in MHz * \return the center frequency of the secondary channel of the given width */ - uint16_t GetSecondaryChannelCenterFrequency(ChannelWidthMhz secondaryChannelWidth) const; + double GetSecondaryChannelCenterFrequency(ChannelWidthMhz secondaryChannelWidth) const; /** * Get the channel indices of all the 20 MHz channels included in the primary @@ -367,7 +367,7 @@ class WifiPhyOperatingChannel * of the set of available channels */ static ConstIterator FindFirst(uint8_t number, - uint16_t frequency, + double frequency, ChannelWidthMhz width, WifiStandard standard, WifiPhyBand band, diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 940234067..2cf13a0fe 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -124,7 +124,7 @@ WifiPhy::GetTypeId() TypeId::ATTR_GET, UintegerValue(0), MakeUintegerAccessor(&WifiPhy::GetFrequency), - MakeUintegerChecker()) + MakeUintegerChecker()) .AddAttribute("ChannelNumber", "The channel number of the current operating channel.", TypeId::ATTR_GET, @@ -1083,7 +1083,7 @@ WifiPhy::GetOperatingChannel() const return m_operatingChannel; } -uint16_t +double WifiPhy::GetFrequency() const { return m_operatingChannel.GetFrequency(); @@ -1700,7 +1700,7 @@ WifiPhy::NotifyRxPpduDrop(Ptr ppdu, WifiPhyRxfailureReason reaso void WifiPhy::NotifyMonitorSniffRx(Ptr psdu, - uint16_t channelFreqMhz, + double channelFreqMhz, WifiTxVector txVector, SignalNoiseDbm signalNoise, std::vector statusPerMpdu, @@ -1723,7 +1723,7 @@ WifiPhy::NotifyMonitorSniffRx(Ptr psdu, if (statusPerMpdu.at(i)) // packet received without error, hand over to sniffer { m_phyMonitorSniffRxTrace(psdu->GetAmpduSubframe(i), - channelFreqMhz, + static_cast(channelFreqMhz), txVector, aMpdu, signalNoise, @@ -1743,7 +1743,7 @@ WifiPhy::NotifyMonitorSniffRx(Ptr psdu, { aMpdu.type = NORMAL_MPDU; m_phyMonitorSniffRxTrace(psdu->GetPacket(), - channelFreqMhz, + static_cast(channelFreqMhz), txVector, aMpdu, signalNoise, @@ -1754,7 +1754,7 @@ WifiPhy::NotifyMonitorSniffRx(Ptr psdu, void WifiPhy::NotifyMonitorSniffTx(Ptr psdu, - uint16_t channelFreqMhz, + double channelFreqMhz, WifiTxVector txVector, uint16_t staId) { @@ -2361,10 +2361,10 @@ WifiPhy::GetPrimaryChannelNumber(ChannelWidthMhz primaryChannelWidth) const return m_operatingChannel.GetPrimaryChannelNumber(primaryChannelWidth, m_standard); } -uint32_t +double WifiPhy::GetSubcarrierSpacing() const { - uint32_t subcarrierSpacing = 0; + double subcarrierSpacing = 0; switch (GetStandard()) { case WIFI_STANDARD_80211a: diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 42bed8e43..f37c71703 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -650,7 +650,7 @@ class WifiPhy : public Object * \param staId the STA-ID */ void NotifyMonitorSniffRx(Ptr psdu, - uint16_t channelFreqMhz, + double channelFreqMhz, WifiTxVector txVector, SignalNoiseDbm signalNoise, std::vector statusPerMpdu, @@ -698,7 +698,7 @@ class WifiPhy : public Object * \param staId the STA-ID */ void NotifyMonitorSniffTx(Ptr psdu, - uint16_t channelFreqMhz, + double channelFreqMhz, WifiTxVector txVector, uint16_t staId = SU_STA_ID); @@ -985,7 +985,7 @@ class WifiPhy : public Object /** * \return the operating center frequency (MHz) */ - uint16_t GetFrequency() const; + double GetFrequency() const; /** * \return the index of the primary 20 MHz channel */ @@ -1272,7 +1272,7 @@ class WifiPhy : public Object /** * \return the subcarrier spacing corresponding to the configure standard (Hz) */ - uint32_t GetSubcarrierSpacing() const; + double GetSubcarrierSpacing() const; /** * Callback invoked when the PHY model starts to transmit a signal diff --git a/src/wifi/model/wifi-ppdu.cc b/src/wifi/model/wifi-ppdu.cc index 14193ebce..8e4d8e1cd 100644 --- a/src/wifi/model/wifi-ppdu.cc +++ b/src/wifi/model/wifi-ppdu.cc @@ -37,7 +37,7 @@ namespace * \param channelWidth the channel width in MHz * \return the center frequency (in MHz) of each segment covered by the given width */ -std::vector +std::vector GetChannelCenterFrequenciesPerSegment(const ns3::WifiPhyOperatingChannel& channel, ns3::ChannelWidthMhz channelWidth) { @@ -45,7 +45,7 @@ GetChannelCenterFrequenciesPerSegment(const ns3::WifiPhyOperatingChannel& channe { return {}; } - std::vector freqs{}; + std::vector freqs{}; const auto width = std::min(channelWidth, channel.GetWidth(0)); const auto primarySegmentIndex = channel.GetPrimarySegmentIndex(width); const auto secondarySegmentIndex = channel.GetSecondarySegmentIndex(width); @@ -188,14 +188,14 @@ WifiPpdu::GetTxChannelWidth() const return m_txChannelWidth; } -std::vector +std::vector WifiPpdu::GetTxCenterFreqs() const { return m_txCenterFreqs; } bool -WifiPpdu::DoesOverlapChannel(uint16_t minFreq, uint16_t maxFreq) const +WifiPpdu::DoesOverlapChannel(double minFreq, double maxFreq) const { NS_LOG_FUNCTION(this << minFreq << maxFreq); // all segments have the same width diff --git a/src/wifi/model/wifi-ppdu.h b/src/wifi/model/wifi-ppdu.h index 93c4f9968..2b650e767 100644 --- a/src/wifi/model/wifi-ppdu.h +++ b/src/wifi/model/wifi-ppdu.h @@ -140,7 +140,7 @@ class WifiPpdu : public SimpleRefCount /** * \return the center frequency per segment (MHz) used for the transmission of this PPDU */ - std::vector GetTxCenterFreqs() const; + std::vector GetTxCenterFreqs() const; /** * Check whether the given PPDU overlaps a given channel. @@ -149,7 +149,7 @@ class WifiPpdu : public SimpleRefCount * \param maxFreq the maximum frequency (MHz) of the channel * \return true if this PPDU overlaps the channel, false otherwise */ - bool DoesOverlapChannel(uint16_t minFreq, uint16_t maxFreq) const; + bool DoesOverlapChannel(double minFreq, double maxFreq) const; /** * Get the modulation used for the PPDU. @@ -200,12 +200,12 @@ class WifiPpdu : public SimpleRefCount */ virtual std::string PrintPayload() const; - WifiPreamble m_preamble; //!< the PHY preamble - WifiModulationClass m_modulation; //!< the modulation used for the transmission of this PPDU - WifiConstPsduMap m_psdus; //!< the PSDUs contained in this PPDU - std::vector m_txCenterFreqs; //!< the center frequency (MHz) per segment used for the - //!< transmission of this PPDU - uint64_t m_uid; //!< the unique ID of this PPDU + WifiPreamble m_preamble; //!< the PHY preamble + WifiModulationClass m_modulation; //!< the modulation used for the transmission of this PPDU + WifiConstPsduMap m_psdus; //!< the PSDUs contained in this PPDU + std::vector m_txCenterFreqs; //!< the center frequency (MHz) per segment used for the + //!< transmission of this PPDU + uint64_t m_uid; //!< the unique ID of this PPDU mutable std::optional m_txVector; //!< the TXVECTOR at TX PHY or the reconstructed TXVECTOR at RX PHY (or //!< std::nullopt if TXVECTOR has not been reconstructed yet) diff --git a/src/wifi/model/wifi-spectrum-phy-interface.cc b/src/wifi/model/wifi-spectrum-phy-interface.cc index 1e7db0071..4557541f4 100644 --- a/src/wifi/model/wifi-spectrum-phy-interface.cc +++ b/src/wifi/model/wifi-spectrum-phy-interface.cc @@ -109,7 +109,7 @@ WifiSpectrumPhyInterface::SetChannel(const Ptr c) } void -WifiSpectrumPhyInterface::SetRxSpectrumModel(const std::vector& centerFrequencies, +WifiSpectrumPhyInterface::SetRxSpectrumModel(const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, uint32_t bandBandwidth, ChannelWidthMhz guardBandwidth) @@ -152,7 +152,7 @@ WifiSpectrumPhyInterface::GetFrequencyRange() const return m_frequencyRange; } -const std::vector& +const std::vector& WifiSpectrumPhyInterface::GetCenterFrequencies() const { return m_centerFrequencies; diff --git a/src/wifi/model/wifi-spectrum-phy-interface.h b/src/wifi/model/wifi-spectrum-phy-interface.h index 958478375..8b8630a90 100644 --- a/src/wifi/model/wifi-spectrum-phy-interface.h +++ b/src/wifi/model/wifi-spectrum-phy-interface.h @@ -99,7 +99,7 @@ class WifiSpectrumPhyInterface : public SpectrumPhy * \return the center frequency in MHz for each segment of the the spectrum channel this * interface is attached to to */ - const std::vector& GetCenterFrequencies() const; + const std::vector& GetCenterFrequencies() const; /** * Get the channel width in MHz covered by the spectrum channel this interface is attached to @@ -124,7 +124,7 @@ class WifiSpectrumPhyInterface : public SpectrumPhy * \param bandBandwidth the width of each band in Hz * \param guardBandwidth the total width of the guard band in MHz */ - void SetRxSpectrumModel(const std::vector& centerFrequencies, + void SetRxSpectrumModel(const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, uint32_t bandBandwidth, ChannelWidthMhz guardBandwidth); @@ -162,7 +162,7 @@ class WifiSpectrumPhyInterface : public SpectrumPhy Ptr m_spectrumWifiPhy; ///< spectrum PHY Ptr m_netDevice; ///< the device Ptr m_channel; ///< spectrum channel - std::vector m_centerFrequencies; ///< center frequency per segment in MHz + std::vector m_centerFrequencies; ///< center frequency per segment in MHz ChannelWidthMhz m_channelWidth; ///< channel width in MHz Ptr m_rxSpectrumModel; ///< receive spectrum model diff --git a/src/wifi/model/wifi-spectrum-value-helper.cc b/src/wifi/model/wifi-spectrum-value-helper.cc index ca6ecd3ec..95ae6d695 100644 --- a/src/wifi/model/wifi-spectrum-value-helper.cc +++ b/src/wifi/model/wifi-spectrum-value-helper.cc @@ -43,7 +43,7 @@ namespace /** * Lambda to print a vector of frequencies. */ -auto printFrequencies = [](const std::vector& v) { +auto printFrequencies = [](const std::vector& v) { std::stringstream ss; for (const auto& centerFrequency : v) { @@ -61,10 +61,10 @@ NS_LOG_COMPONENT_DEFINE("WifiSpectrumValueHelper"); ///< Wifi Spectrum Model structure struct WifiSpectrumModelId { - std::vector centerFrequencies; ///< center frequency per segment (in MHz) - ChannelWidthMhz channelWidth; ///< channel width - uint32_t carrierSpacing; ///< carrier spacing (in Hz) - ChannelWidthMhz guardBandwidth; ///< guard band width + std::vector centerFrequencies; ///< center frequency per segment (in MHz) + ChannelWidthMhz channelWidth; ///< channel width + double carrierSpacing; ///< carrier spacing (in Hz) + ChannelWidthMhz guardBandwidth; ///< guard band width }; /** @@ -91,9 +91,9 @@ static std::map> g_wifiSpectrumModelMap; ///< static initializer for the class Ptr -WifiSpectrumValueHelper::GetSpectrumModel(const std::vector& centerFrequencies, +WifiSpectrumValueHelper::GetSpectrumModel(const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, - uint32_t carrierSpacing, + double carrierSpacing, ChannelWidthMhz guardBandwidth) { NS_LOG_FUNCTION(printFrequencies(centerFrequencies) @@ -168,13 +168,13 @@ WifiSpectrumValueHelper::GetSpectrumModel(const std::vector& centerFre // Power allocated to 71 center subbands out of 135 total subbands in the band Ptr -WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity(uint16_t centerFrequency, +WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity(double centerFrequency, double txPowerW, ChannelWidthMhz guardBandwidth) { NS_LOG_FUNCTION(centerFrequency << txPowerW << +guardBandwidth); ChannelWidthMhz channelWidth = 22; // DSSS channels are 22 MHz wide - uint32_t carrierSpacing = 312500; + double carrierSpacing = 312500; // Hz Ptr c = Create( GetSpectrumModel({centerFrequency}, channelWidth, carrierSpacing, guardBandwidth)); auto vit = c->ValuesBegin(); @@ -195,7 +195,7 @@ WifiSpectrumValueHelper::CreateDsssTxPowerSpectralDensity(uint16_t centerFrequen } Ptr -WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(uint16_t centerFrequency, +WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(double centerFrequency, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -205,21 +205,21 @@ WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(uint16_t centerFrequen { NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr << minOuterBandDbr << lowestPointDbr); - uint32_t carrierSpacing = 0; + double carrierSpacing = 0; uint32_t innerSlopeWidth = 0; switch (static_cast(channelWidth)) { case 20: - carrierSpacing = 312500; + carrierSpacing = 312500; // Hz innerSlopeWidth = static_cast((2e6 / carrierSpacing) + 0.5); // [-11;-9] & [9;11] break; case 10: - carrierSpacing = 156250; + carrierSpacing = 156250; // Hz innerSlopeWidth = static_cast((1e6 / carrierSpacing) + 0.5); // [-5.5;-4.5] & [4.5;5.5] break; case 5: - carrierSpacing = 78125; + carrierSpacing = 78125; // Hz innerSlopeWidth = static_cast((5e5 / carrierSpacing) + 0.5); // [-2.75;-2.5] & [2.5;2.75] break; @@ -267,7 +267,7 @@ WifiSpectrumValueHelper::CreateOfdmTxPowerSpectralDensity(uint16_t centerFrequen Ptr WifiSpectrumValueHelper::CreateDuplicated20MhzTxPowerSpectralDensity( - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -283,7 +283,7 @@ WifiSpectrumValueHelper::CreateDuplicated20MhzTxPowerSpectralDensity( NS_LOG_FUNCTION(printFrequencies(centerFrequencies) << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr << minOuterBandDbr << lowestPointDbr); - uint32_t carrierSpacing = 312500; + double carrierSpacing = 312500; // Hz Ptr c = Create( GetSpectrumModel(centerFrequencies, channelWidth, carrierSpacing, guardBandwidth)); // assume all frequency segments have the same width, hence split the guard bandwidth @@ -372,7 +372,7 @@ WifiSpectrumValueHelper::CreateDuplicated20MhzTxPowerSpectralDensity( Ptr WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity( - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -387,7 +387,7 @@ WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity( NS_LOG_FUNCTION(printFrequencies(centerFrequencies) << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr << minOuterBandDbr << lowestPointDbr); - uint32_t carrierSpacing = 312500; + double carrierSpacing = 312500; // Hz Ptr c = Create( GetSpectrumModel(centerFrequencies, channelWidth, carrierSpacing, guardBandwidth)); // assume all frequency segments have the same width, hence split the guard bandwidth @@ -461,7 +461,7 @@ WifiSpectrumValueHelper::CreateHtOfdmTxPowerSpectralDensity( Ptr WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity( - uint16_t centerFrequency, + double centerFrequency, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -470,7 +470,7 @@ WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity( double lowestPointDbr, const std::vector& puncturedSubchannels) { - return CreateHeOfdmTxPowerSpectralDensity(std::vector{centerFrequency}, + return CreateHeOfdmTxPowerSpectralDensity(std::vector{centerFrequency}, channelWidth, txPowerW, guardBandwidth, @@ -482,7 +482,7 @@ WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity( Ptr WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity( - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -497,7 +497,7 @@ WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity( NS_LOG_FUNCTION(printFrequencies(centerFrequencies) << channelWidth << txPowerW << guardBandwidth << minInnerBandDbr << minOuterBandDbr << lowestPointDbr); - uint32_t carrierSpacing = 78125; + double carrierSpacing = 78125; // Hz Ptr c = Create( GetSpectrumModel(centerFrequencies, channelWidth, carrierSpacing, guardBandwidth)); // assume all frequency segments have the same width, hence split the guard bandwidth @@ -651,7 +651,7 @@ WifiSpectrumValueHelper::CreateHeOfdmTxPowerSpectralDensity( Ptr WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity( - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -667,7 +667,7 @@ WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity( }; NS_LOG_FUNCTION(printFrequencies(centerFrequencies) << channelWidth << txPowerW << guardBandwidth << printRuIndices(ru)); - uint32_t carrierSpacing = 78125; + double carrierSpacing = 78125; // Hz Ptr c = Create( GetSpectrumModel(centerFrequencies, channelWidth, carrierSpacing, guardBandwidth)); diff --git a/src/wifi/model/wifi-spectrum-value-helper.h b/src/wifi/model/wifi-spectrum-value-helper.h index 18653bdb8..c49cc0ef1 100644 --- a/src/wifi/model/wifi-spectrum-value-helper.h +++ b/src/wifi/model/wifi-spectrum-value-helper.h @@ -64,9 +64,9 @@ class WifiSpectrumValueHelper * \return the static SpectrumModel instance corresponding to the * given carrier frequency and channel width configuration. */ - static Ptr GetSpectrumModel(const std::vector& centerFrequencies, + static Ptr GetSpectrumModel(const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, - uint32_t carrierSpacing, + double carrierSpacing, ChannelWidthMhz guardBandwidth); /** @@ -83,7 +83,7 @@ class WifiSpectrumValueHelper * \returns a pointer to a newly allocated SpectrumValue representing the DSSS Transmit Power * Spectral Density in W/Hz */ - static Ptr CreateDsssTxPowerSpectralDensity(uint16_t centerFrequency, + static Ptr CreateDsssTxPowerSpectralDensity(double centerFrequency, double txPowerW, ChannelWidthMhz guardBandwidth); @@ -103,7 +103,7 @@ class WifiSpectrumValueHelper * \return a pointer to a newly allocated SpectrumValue representing the OFDM Transmit Power * Spectral Density in W/Hz for each Band */ - static Ptr CreateOfdmTxPowerSpectralDensity(uint16_t centerFrequency, + static Ptr CreateOfdmTxPowerSpectralDensity(double centerFrequency, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -128,7 +128,7 @@ class WifiSpectrumValueHelper * Transmit Power Spectral Density in W/Hz for each Band */ static Ptr CreateDuplicated20MhzTxPowerSpectralDensity( - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -154,7 +154,7 @@ class WifiSpectrumValueHelper * Spectral Density in W/Hz for each Band */ static Ptr CreateHtOfdmTxPowerSpectralDensity( - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -180,7 +180,7 @@ class WifiSpectrumValueHelper * Spectral Density in W/Hz for each Band */ static Ptr CreateHeOfdmTxPowerSpectralDensity( - uint16_t centerFrequency, + double centerFrequency, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -207,7 +207,7 @@ class WifiSpectrumValueHelper * Spectral Density in W/Hz for each Band */ static Ptr CreateHeOfdmTxPowerSpectralDensity( - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -230,7 +230,7 @@ class WifiSpectrumValueHelper * Spectral Density on the RU used by the STA in W/Hz for each Band */ static Ptr CreateHeMuOfdmTxPowerSpectralDensity( - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, ChannelWidthMhz channelWidth, double txPowerW, ChannelWidthMhz guardBandwidth, @@ -322,8 +322,8 @@ class WifiSpectrumValueHelper */ struct FrequencyRange { - uint16_t minFrequency{0}; ///< the minimum frequency in MHz - uint16_t maxFrequency{0}; ///< the maximum frequency in MHz + double minFrequency{0}; ///< the minimum frequency in MHz + double maxFrequency{0}; ///< the maximum frequency in MHz }; /** diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc index fe791c6c0..c661b7967 100644 --- a/src/wifi/test/spectrum-wifi-phy-test.cc +++ b/src/wifi/test/spectrum-wifi-phy-test.cc @@ -672,7 +672,7 @@ SpectrumWifiPhyFilterTest::DoTeardown() void SpectrumWifiPhyFilterTest::RunOne() { - uint16_t txFrequency; + double txFrequency; switch (static_cast(m_txChannelWidth)) { case 20: @@ -698,7 +698,7 @@ SpectrumWifiPhyFilterTest::RunOne() m_txPhy->SetOperatingChannel( WifiPhy::ChannelTuple{txChannelNum, m_txChannelWidth, WIFI_PHY_BAND_5GHZ, 0}); - uint16_t rxFrequency; + double rxFrequency; switch (static_cast(m_rxChannelWidth)) { case 20: @@ -941,8 +941,8 @@ SpectrumWifiPhyGetBandTest::DoRun() expectedStartIndice + (indicesPer20MhzBand * (bandWidth / 20)) - 1; std::vector expectedIndices{ {expectedStartIndice, expectedStopIndice}}; - const uint64_t expectedStartFrequency = 5170 * 1e6; - const uint64_t expectedStopFrequency = (5170 + bandWidth) * 1e6; + const double expectedStartFrequency = 5170 * 1e6; + const double expectedStopFrequency = (5170 + bandWidth) * 1e6; std::vector expectedFrequencies{ {expectedStartFrequency, expectedStopFrequency}}; const std::size_t numBands = (channelWidth / bandWidth); @@ -1262,7 +1262,7 @@ class SpectrumWifiPhy80Plus80Test : public TestCase * \param expectSuccess flag to indicate whether reception is expected to be successful */ void RunOne(const std::vector& channelNumbers, - uint16_t interferenceCenterFrequency, + double interferenceCenterFrequency, ChannelWidthMhz interferenceBandWidth, bool expectSuccess); @@ -1485,7 +1485,7 @@ SpectrumWifiPhy80Plus80Test::DoTeardown() void SpectrumWifiPhy80Plus80Test::RunOne(const std::vector& channelNumbers, - uint16_t interferenceCenterFrequency, + double interferenceCenterFrequency, ChannelWidthMhz interferenceBandWidth, bool expectSuccess) { diff --git a/src/wifi/test/wifi-non-ht-dup-test.cc b/src/wifi/test/wifi-non-ht-dup-test.cc index 57e1725a1..0d11cb90d 100644 --- a/src/wifi/test/wifi-non-ht-dup-test.cc +++ b/src/wifi/test/wifi-non-ht-dup-test.cc @@ -52,7 +52,7 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE("WifiNonHtDuplicateTest"); -constexpr uint32_t DEFAULT_FREQUENCY = 5180; // MHz +constexpr double DEFAULT_FREQUENCY = 5180; // MHz /** * HE PHY used for testing MU-RTS/CTS. @@ -205,7 +205,7 @@ class TestNonHtDuplicatePhyReception : public TestCase { public: /// A vector containing parameters per STA: the standard, the center frequency and the P20 index - using StasParams = std::vector>; + using StasParams = std::vector>; /** * Constructor @@ -218,7 +218,7 @@ class TestNonHtDuplicatePhyReception : public TestCase * interference. */ TestNonHtDuplicatePhyReception(WifiStandard apStandard, - uint16_t apFrequency, + double apFrequency, uint8_t apP20Index, StasParams stasParams, std::vector per20MhzInterference = {}); @@ -284,7 +284,7 @@ class TestNonHtDuplicatePhyReception : public TestCase void StopInterference(Ptr interferer); WifiStandard m_apStandard; ///< the standard to use for the AP - uint16_t m_apFrequency; ///< the center frequency of the AP (in MHz) + double m_apFrequency; ///< the center frequency of the AP (in MHz) uint8_t m_apP20Index; ///< the index of the primary 20 MHz channel of the AP StasParams m_stasParams; ///< the parameters of the STAs std::vector @@ -303,7 +303,7 @@ class TestNonHtDuplicatePhyReception : public TestCase TestNonHtDuplicatePhyReception::TestNonHtDuplicatePhyReception( WifiStandard apStandard, - uint16_t apFrequency, + double apFrequency, uint8_t apP20Index, StasParams stasParams, std::vector per20MhzInterference) diff --git a/src/wifi/test/wifi-phy-cca-test.cc b/src/wifi/test/wifi-phy-cca-test.cc index eb4193446..f8cefb13d 100644 --- a/src/wifi/test/wifi-phy-cca-test.cc +++ b/src/wifi/test/wifi-phy-cca-test.cc @@ -50,13 +50,13 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE("WifiPhyCcaTest"); -constexpr uint32_t P20_CENTER_FREQUENCY = 5180; // MHz -constexpr uint32_t S20_CENTER_FREQUENCY = P20_CENTER_FREQUENCY + 20; -constexpr uint32_t P40_CENTER_FREQUENCY = P20_CENTER_FREQUENCY + 10; -constexpr uint32_t S40_CENTER_FREQUENCY = P40_CENTER_FREQUENCY + 40; -constexpr uint32_t P80_CENTER_FREQUENCY = P40_CENTER_FREQUENCY + 20; -constexpr uint32_t S80_CENTER_FREQUENCY = P80_CENTER_FREQUENCY + 80; -constexpr uint32_t P160_CENTER_FREQUENCY = P80_CENTER_FREQUENCY + 40; +constexpr double P20_CENTER_FREQUENCY = 5180; // MHz +constexpr double S20_CENTER_FREQUENCY = P20_CENTER_FREQUENCY + 20; +constexpr double P40_CENTER_FREQUENCY = P20_CENTER_FREQUENCY + 10; +constexpr double S40_CENTER_FREQUENCY = P40_CENTER_FREQUENCY + 40; +constexpr double P80_CENTER_FREQUENCY = P40_CENTER_FREQUENCY + 20; +constexpr double S80_CENTER_FREQUENCY = P80_CENTER_FREQUENCY + 80; +constexpr double P160_CENTER_FREQUENCY = P80_CENTER_FREQUENCY + 40; const Time smallDelta = NanoSeconds(1); // add small delta to be right after aCCATime, since test checks are scheduled before wifi events const Time aCcaTime = MicroSeconds(4) + smallDelta; @@ -695,7 +695,7 @@ class WifiPhyCcaIndicationTest : public TestCase * \param frequency the center frequency the transmitter is operating on * \param bandwidth the bandwidth to use for the transmission in MHz */ - void SendHeSuPpdu(double txPowerDbm, uint16_t frequency, ChannelWidthMhz bandwidth); + void SendHeSuPpdu(double txPowerDbm, double frequency, ChannelWidthMhz bandwidth); /** * Start to generate a signal @@ -707,7 +707,7 @@ class WifiPhyCcaIndicationTest : public TestCase */ void StartSignal(Ptr signalGenerator, double txPowerDbm, - uint16_t frequency, + double frequency, ChannelWidthMhz bandwidth, Time duration); /** @@ -749,7 +749,7 @@ class WifiPhyCcaIndicationTest : public TestCase double power{0.0}; //!< transmit power to use in dBm Time startTime{Seconds(0)}; //!< time at which transmission will be started Time duration{Seconds(0)}; //!< the duration of the transmission - uint16_t centerFreq{0}; //!< center frequency to use in MHz + double centerFreq{0}; //!< center frequency to use in MHz ChannelWidthMhz bandwidth{0}; //!< bandwidth to use }; @@ -760,7 +760,7 @@ class WifiPhyCcaIndicationTest : public TestCase { double power{0.0}; //!< transmit power to use in dBm Time startTime{Seconds(0)}; //!< time at which transmission will be started - uint16_t centerFreq{0}; //!< center frequency to use in MHz + double centerFreq{0}; //!< center frequency to use in MHz ChannelWidthMhz bandwidth{0}; //!< bandwidth to use }; @@ -819,7 +819,7 @@ class WifiPhyCcaIndicationTest : public TestCase std::shared_ptr m_rxPhyStateListener; ///< Listener for PHY state transitions - uint16_t m_frequency; ///< Operating frequency in MHz + double m_frequency; ///< Operating frequency in MHz ChannelWidthMhz m_channelWidth; ///< Operating channel width }; @@ -834,7 +834,7 @@ WifiPhyCcaIndicationTest::WifiPhyCcaIndicationTest() void WifiPhyCcaIndicationTest::StartSignal(Ptr signalGenerator, double txPowerDbm, - uint16_t frequency, + double frequency, ChannelWidthMhz bandwidth, Time duration) { @@ -866,7 +866,7 @@ WifiPhyCcaIndicationTest::StopSignal(Ptr signalGenerator) void WifiPhyCcaIndicationTest::SendHeSuPpdu(double txPowerDbm, - uint16_t frequency, + double frequency, ChannelWidthMhz bandwidth) { NS_LOG_FUNCTION(this << txPowerDbm); diff --git a/src/wifi/test/wifi-phy-mu-mimo-test.cc b/src/wifi/test/wifi-phy-mu-mimo-test.cc index bf5684f29..f481024fb 100644 --- a/src/wifi/test/wifi-phy-mu-mimo-test.cc +++ b/src/wifi/test/wifi-phy-mu-mimo-test.cc @@ -49,7 +49,7 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE("WifiPhyMuMimoTest"); -constexpr uint32_t DEFAULT_FREQUENCY = 5180; // MHz +constexpr double DEFAULT_FREQUENCY = 5180; // MHz constexpr ChannelWidthMhz DEFAULT_CHANNEL_WIDTH = 20; /** @@ -495,7 +495,7 @@ class TestDlMuMimoPhyTransmission : public TestCase Ptr m_phySta3; ///< PHY of STA 3 uint8_t m_nss; ///< number of spatial streams per STA - uint16_t m_frequency; ///< frequency in MHz + double m_frequency; ///< frequency in MHz ChannelWidthMhz m_channelWidth; ///< channel width Time m_expectedPpduDuration; ///< expected duration to send MU PPDU }; @@ -1266,7 +1266,7 @@ class TestUlMuMimoPhyTransmission : public TestCase std::vector m_countRxBytesFromStas; ///< count RX bytes from STAs Time m_delayStart; ///< delay between the start of each HE TB PPDUs - uint16_t m_frequency; ///< frequency in MHz + double m_frequency; ///< frequency in MHz ChannelWidthMhz m_channelWidth; ///< channel width Time m_expectedPpduDuration; ///< expected duration to send MU PPDU }; diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index 0d5f8736c..906594f5d 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -61,7 +61,7 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE("WifiPhyOfdmaTest"); static const uint8_t DEFAULT_CHANNEL_NUMBER = 36; -static const uint32_t DEFAULT_FREQUENCY = 5180; // MHz +static const double DEFAULT_FREQUENCY = 5180; // MHz static const WifiPhyBand DEFAULT_WIFI_BAND = WIFI_PHY_BAND_5GHZ; static const ChannelWidthMhz DEFAULT_CHANNEL_WIDTH = 20; static const ChannelWidthMhz DEFAULT_GUARD_WIDTH = @@ -3200,7 +3200,7 @@ class TestUlOfdmaPhyTransmission : public TestCase uint32_t m_countRxBytesFromSta1; ///< count RX bytes from STA 1 uint32_t m_countRxBytesFromSta2; ///< count RX bytes from STA 2 - uint16_t m_frequency; ///< frequency in MHz + double m_frequency; ///< frequency in MHz ChannelWidthMhz m_channelWidth; ///< channel width in MHz Time m_expectedPpduDuration; ///< expected duration to send MU PPDU }; diff --git a/src/wifi/test/wifi-phy-reception-test.cc b/src/wifi/test/wifi-phy-reception-test.cc index 51ba632b4..17d29ab31 100644 --- a/src/wifi/test/wifi-phy-reception-test.cc +++ b/src/wifi/test/wifi-phy-reception-test.cc @@ -59,7 +59,7 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE("WifiPhyReceptionTest"); static const uint8_t CHANNEL_NUMBER = 36; -static const uint32_t FREQUENCY = 5180; // MHz +static const double FREQUENCY = 5180; // MHz static const ChannelWidthMhz CHANNEL_WIDTH = 20; static const ChannelWidthMhz GUARD_WIDTH = CHANNEL_WIDTH; // expanded to channel width to model spectrum mask @@ -4228,7 +4228,7 @@ class TestUnsupportedBandwidthReception : public TestCase * \param centerFreqMhz the center frequency used for the transmission of the PPDU (in MHz) * \param bandwidthMhz the bandwidth used for the transmission of the PPDU (in MHz) */ - void SendPpdu(uint16_t centerFreqMhz, ChannelWidthMhz bandwidthMhz); + void SendPpdu(double centerFreqMhz, ChannelWidthMhz bandwidthMhz); /** * Function called upon a PSDU received successfully @@ -4298,7 +4298,7 @@ TestUnsupportedBandwidthReception::TestUnsupportedBandwidthReception() } void -TestUnsupportedBandwidthReception::SendPpdu(uint16_t centerFreqMhz, ChannelWidthMhz bandwidthMhz) +TestUnsupportedBandwidthReception::SendPpdu(double centerFreqMhz, ChannelWidthMhz bandwidthMhz) { auto txVector = WifiTxVector(HePhy::GetHeMcs0(), 0, WIFI_PREAMBLE_HE_SU, 800, 1, 1, 0, bandwidthMhz, false); @@ -4509,7 +4509,7 @@ class TestPrimary20CoveredByPpdu : public TestCase * \param ppduCenterFreqMhz the center frequency used for the transmission of the PPDU (in MHz) * \return the created PPDU */ - Ptr CreatePpdu(uint16_t ppduCenterFreqMhz); + Ptr CreatePpdu(double ppduCenterFreqMhz); /** * Run one function @@ -4524,9 +4524,9 @@ class TestPrimary20CoveredByPpdu : public TestCase * primary 20 MHz channel is expected to overlap with the bandwidth of the incoming PPDU */ void RunOne(WifiPhyBand band, - uint16_t phyCenterFreqMhz, + double phyCenterFreqMhz, uint8_t p20Index, - uint16_t ppduCenterFreqMhz, + double ppduCenterFreqMhz, bool expectedP20Overlap, bool expectedP20Covered); @@ -4541,7 +4541,7 @@ TestPrimary20CoveredByPpdu::TestPrimary20CoveredByPpdu() } Ptr -TestPrimary20CoveredByPpdu::CreatePpdu(uint16_t ppduCenterFreqMhz) +TestPrimary20CoveredByPpdu::CreatePpdu(double ppduCenterFreqMhz) { const auto& channelInfo = (*WifiPhyOperatingChannel::FindFirst(0, ppduCenterFreqMhz, @@ -4600,9 +4600,9 @@ TestPrimary20CoveredByPpdu::DoTeardown() void TestPrimary20CoveredByPpdu::RunOne(WifiPhyBand band, - uint16_t phyCenterFreqMhz, + double phyCenterFreqMhz, uint8_t p20Index, - uint16_t ppduCenterFreqMhz, + double ppduCenterFreqMhz, bool expectedP20Overlap, bool expectedP20Covered) { diff --git a/src/wifi/test/wifi-phy-thresholds-test.cc b/src/wifi/test/wifi-phy-thresholds-test.cc index 833d26625..15f440c6e 100644 --- a/src/wifi/test/wifi-phy-thresholds-test.cc +++ b/src/wifi/test/wifi-phy-thresholds-test.cc @@ -40,7 +40,7 @@ using namespace ns3; NS_LOG_COMPONENT_DEFINE("WifiPhyThresholdsTest"); static const uint8_t CHANNEL_NUMBER = 36; -static const uint32_t FREQUENCY = 5180; // MHz +static const double FREQUENCY = 5180; // MHz static const ChannelWidthMhz CHANNEL_WIDTH = 20; /** diff --git a/src/wifi/test/wifi-transmit-mask-test.cc b/src/wifi/test/wifi-transmit-mask-test.cc index 1c9b9dc38..3ff4ffce8 100644 --- a/src/wifi/test/wifi-transmit-mask-test.cc +++ b/src/wifi/test/wifi-transmit-mask-test.cc @@ -71,7 +71,7 @@ class WifiOfdmMaskSlopesTestCase : public TestCase WifiStandard standard, WifiPhyBand band, ChannelWidthMhz channelWidth, - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, const IndexPowerVect& maskRefs, double tolerance, std::size_t precision, @@ -98,7 +98,7 @@ class WifiOfdmMaskSlopesTestCase : public TestCase WifiStandard m_standard; ///< the wifi standard to test WifiPhyBand m_band; ///< the wifi PHY band to test ChannelWidthMhz m_channelWidth; ///< the total channel width (MHz) to test - std::vector + std::vector m_centerFreqs; ///< the center frequency (MHz) per contiguous segment to test std::vector m_puncturedSubchannels; ///< bitmap indicating whether a 20 MHz subchannel is punctured or @@ -114,7 +114,7 @@ WifiOfdmMaskSlopesTestCase::WifiOfdmMaskSlopesTestCase( WifiStandard standard, WifiPhyBand band, ChannelWidthMhz channelWidth, - const std::vector& centerFrequencies, + const std::vector& centerFrequencies, const IndexPowerVect& maskRefs, double tolerance, std::size_t precision,