diff --git a/src/spectrum/model/wifi-spectrum-value-helper.cc b/src/spectrum/model/wifi-spectrum-value-helper.cc index f72dfd08c..7ba35919e 100644 --- a/src/spectrum/model/wifi-spectrum-value-helper.cc +++ b/src/spectrum/model/wifi-spectrum-value-helper.cc @@ -507,7 +507,7 @@ WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity(uint32_t centerFre uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, - WifiSpectrumBandIndices ru) + const WifiSpectrumBandIndices& ru) { NS_LOG_FUNCTION(centerFrequency << channelWidth << txPowerW << guardBandwidth << ru.first << ru.second); @@ -570,7 +570,7 @@ void WifiSpectrumValueHelper::CreateSpectrumMaskForOfdm( Ptr c, const std::vector& allocatedSubBands, - WifiSpectrumBandIndices maskBand, + const WifiSpectrumBandIndices& maskBand, double txPowerPerBandW, uint32_t nGuardBands, uint32_t innerSlopeWidth, diff --git a/src/spectrum/model/wifi-spectrum-value-helper.h b/src/spectrum/model/wifi-spectrum-value-helper.h index 7361da705..341ebe890 100644 --- a/src/spectrum/model/wifi-spectrum-value-helper.h +++ b/src/spectrum/model/wifi-spectrum-value-helper.h @@ -198,11 +198,12 @@ class WifiSpectrumValueHelper * \return a pointer to a newly allocated SpectrumValue representing the HE OFDM Transmit Power * Spectral Density on the RU used by the STA in W/Hz for each Band */ - static Ptr CreateHeMuOfdmTxPowerSpectralDensity(uint32_t centerFrequency, - uint16_t channelWidth, - double txPowerW, - uint16_t guardBandwidth, - WifiSpectrumBandIndices ru); + static Ptr CreateHeMuOfdmTxPowerSpectralDensity( + uint32_t centerFrequency, + uint16_t channelWidth, + double txPowerW, + uint16_t guardBandwidth, + const WifiSpectrumBandIndices& ru); /** * Create a power spectral density corresponding to the noise @@ -282,7 +283,7 @@ class WifiSpectrumValueHelper static void CreateSpectrumMaskForOfdm( Ptr c, const std::vector& allocatedSubBands, - WifiSpectrumBandIndices maskBand, + const WifiSpectrumBandIndices& maskBand, double txPowerPerBandW, uint32_t nGuardBands, uint32_t innerSlopeWidth, diff --git a/src/wifi/model/interference-helper.cc b/src/wifi/model/interference-helper.cc index cd95ffd4d..fad130d02 100644 --- a/src/wifi/model/interference-helper.cc +++ b/src/wifi/model/interference-helper.cc @@ -99,7 +99,7 @@ Event::GetRxPowerW() const } double -Event::GetRxPowerW(WifiSpectrumBandIndices band) const +Event::GetRxPowerW(const WifiSpectrumBandIndices& band) const { const auto it = m_rxPowerW.find(band); NS_ASSERT(it != m_rxPowerW.cend()); @@ -274,14 +274,15 @@ InterferenceHelper::RemoveBands(FrequencyRange freqRange) } bool -InterferenceHelper::HasBand(WifiSpectrumBandIndices band, const FrequencyRange& freqRange) const +InterferenceHelper::HasBand(const WifiSpectrumBandIndices& band, + const FrequencyRange& freqRange) const { NS_LOG_FUNCTION(this << band.first << band.second << freqRange); return (m_niChanges.count(freqRange) > 0 && m_niChanges.at(freqRange).count(band) > 0); } void -InterferenceHelper::AddBand(WifiSpectrumBandIndices band, const FrequencyRange& freqRange) +InterferenceHelper::AddBand(const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange) { NS_LOG_FUNCTION(this << band.first << band.second << freqRange); NS_ASSERT(m_niChanges.count(freqRange) == 0 || m_niChanges.at(freqRange).count(band) == 0); @@ -388,7 +389,7 @@ InterferenceHelper::SetNumberOfReceiveAntennas(uint8_t rx) Time InterferenceHelper::GetEnergyDuration(double energyW, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange) { NS_LOG_FUNCTION(this << energyW << band.first << band.second << freqRange); @@ -507,7 +508,7 @@ InterferenceHelper::CalculateSnr(double signal, double InterferenceHelper::CalculateNoiseInterferenceW(Ptr event, NiChangesPerBand* nis, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange) const { NS_LOG_FUNCTION(this << band.first << band.second << freqRange); @@ -589,7 +590,7 @@ double InterferenceHelper::CalculatePayloadPer(Ptr event, uint16_t channelWidth, NiChangesPerBand* nis, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, uint16_t staId, std::pair window) const @@ -663,7 +664,7 @@ InterferenceHelper::CalculatePhyHeaderSectionPsr( Ptr event, NiChangesPerBand* nis, uint16_t channelWidth, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, PhyEntity::PhyHeaderSections phyHeaderSections) const { @@ -728,7 +729,7 @@ double InterferenceHelper::CalculatePhyHeaderPer(Ptr event, NiChangesPerBand* nis, uint16_t channelWidth, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, WifiPpduField header) const { @@ -757,7 +758,7 @@ InterferenceHelper::CalculatePhyHeaderPer(Ptr event, PhyEntity::SnrPer InterferenceHelper::CalculatePayloadSnrPer(Ptr event, uint16_t channelWidth, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, uint16_t staId, std::pair relativeMpduStartStop) const @@ -789,7 +790,7 @@ double InterferenceHelper::CalculateSnr(Ptr event, uint16_t channelWidth, uint8_t nss, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange) const { NiChangesPerBand ni; @@ -801,7 +802,7 @@ InterferenceHelper::CalculateSnr(Ptr event, PhyEntity::SnrPer InterferenceHelper::CalculatePhyHeaderSnrPer(Ptr event, uint16_t channelWidth, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, WifiPpduField header) const { diff --git a/src/wifi/model/interference-helper.h b/src/wifi/model/interference-helper.h index 00ce5df61..4bec8b755 100644 --- a/src/wifi/model/interference-helper.h +++ b/src/wifi/model/interference-helper.h @@ -90,7 +90,7 @@ class Event : public SimpleRefCount * \param band the band for which the power should be returned * \return the received power (W) for a given band */ - double GetRxPowerW(WifiSpectrumBandIndices band) const; + double GetRxPowerW(const WifiSpectrumBandIndices& band) const; /** * Return the received power (W) for all bands. * @@ -150,7 +150,7 @@ class InterferenceHelper : public Object * \param band the band to be added * \param freqRange the frequency range the band to add belongs to */ - void AddBand(WifiSpectrumBandIndices band, const FrequencyRange& freqRange); + void AddBand(const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange); /** * Remove the frequency bands for a given frequency range. @@ -166,7 +166,7 @@ class InterferenceHelper : public Object * \param freqRange the frequency range the band to check belongs to * \return true if the band is already tracked by this interference helper, false otherwise */ - bool HasBand(WifiSpectrumBandIndices band, const FrequencyRange& freqRange) const; + bool HasBand(const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange) const; /** * Update the frequency bands for a given frequency range when the spectrum model is changed. @@ -216,7 +216,7 @@ class InterferenceHelper : public Object * be higher than the requested threshold. */ Time GetEnergyDuration(double energyW, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange); /** @@ -268,7 +268,7 @@ class InterferenceHelper : public Object */ PhyEntity::SnrPer CalculatePayloadSnrPer(Ptr event, uint16_t channelWidth, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, uint16_t staId, std::pair relativeMpduStartStop) const; @@ -286,7 +286,7 @@ class InterferenceHelper : public Object double CalculateSnr(Ptr event, uint16_t channelWidth, uint8_t nss, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange) const; /** * Calculate the SNIR at the start of the PHY header and accumulate @@ -302,7 +302,7 @@ class InterferenceHelper : public Object */ PhyEntity::SnrPer CalculatePhyHeaderSnrPer(Ptr event, uint16_t channelWidth, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, WifiPpduField header) const; @@ -466,7 +466,7 @@ class InterferenceHelper : public Object */ double CalculateNoiseInterferenceW(Ptr event, NiChangesPerBand* nis, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange) const; /** * Calculate the error rate of the given PHY payload only in the provided time @@ -486,7 +486,7 @@ class InterferenceHelper : public Object double CalculatePayloadPer(Ptr event, uint16_t channelWidth, NiChangesPerBand* nis, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, uint16_t staId, std::pair window) const; @@ -506,7 +506,7 @@ class InterferenceHelper : public Object double CalculatePhyHeaderPer(Ptr event, NiChangesPerBand* nis, uint16_t channelWidth, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, WifiPpduField header) const; /** @@ -524,7 +524,7 @@ class InterferenceHelper : public Object double CalculatePhyHeaderSectionPsr(Ptr event, NiChangesPerBand* nis, uint16_t channelWidth, - WifiSpectrumBandIndices band, + const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange, PhyEntity::PhyHeaderSections phyHeaderSections) const; diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index e93fa235a..59a86e7a3 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -1235,7 +1235,7 @@ PhyEntity::GetCcaThreshold(const Ptr ppdu, } Time -PhyEntity::GetDelayUntilCcaEnd(double thresholdDbm, WifiSpectrumBandIndices band) +PhyEntity::GetDelayUntilCcaEnd(double thresholdDbm, const WifiSpectrumBandIndices& band) { return m_wifiPhy->m_interference->GetEnergyDuration(DbmToW(thresholdDbm), band, diff --git a/src/wifi/model/phy-entity.h b/src/wifi/model/phy-entity.h index 3a54a29ec..78096f942 100644 --- a/src/wifi/model/phy-entity.h +++ b/src/wifi/model/phy-entity.h @@ -939,7 +939,7 @@ class PhyEntity : public SimpleRefCount * \param band identify the requested band * \return the delay until CCA busy is ended */ - Time GetDelayUntilCcaEnd(double thresholdDbm, WifiSpectrumBandIndices band); + Time GetDelayUntilCcaEnd(double thresholdDbm, const WifiSpectrumBandIndices& band); /** * \param currentChannelWidth channel width of the current transmission (MHz)