wifi: Pass WifiSpectrumBandIndices by const reference

This commit is contained in:
Sébastien Deronne
2023-02-15 22:50:20 +01:00
committed by Sébastien Deronne
parent 48c2845987
commit 909e6df324
6 changed files with 34 additions and 32 deletions

View File

@@ -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<SpectrumValue> c,
const std::vector<WifiSpectrumBandIndices>& allocatedSubBands,
WifiSpectrumBandIndices maskBand,
const WifiSpectrumBandIndices& maskBand,
double txPowerPerBandW,
uint32_t nGuardBands,
uint32_t innerSlopeWidth,

View File

@@ -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<SpectrumValue> CreateHeMuOfdmTxPowerSpectralDensity(uint32_t centerFrequency,
uint16_t channelWidth,
double txPowerW,
uint16_t guardBandwidth,
WifiSpectrumBandIndices ru);
static Ptr<SpectrumValue> 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<SpectrumValue> c,
const std::vector<WifiSpectrumBandIndices>& allocatedSubBands,
WifiSpectrumBandIndices maskBand,
const WifiSpectrumBandIndices& maskBand,
double txPowerPerBandW,
uint32_t nGuardBands,
uint32_t innerSlopeWidth,

View File

@@ -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> 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<const Event> event,
uint16_t channelWidth,
NiChangesPerBand* nis,
WifiSpectrumBandIndices band,
const WifiSpectrumBandIndices& band,
const FrequencyRange& freqRange,
uint16_t staId,
std::pair<Time, Time> window) const
@@ -663,7 +664,7 @@ InterferenceHelper::CalculatePhyHeaderSectionPsr(
Ptr<const Event> 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<const Event> event,
NiChangesPerBand* nis,
uint16_t channelWidth,
WifiSpectrumBandIndices band,
const WifiSpectrumBandIndices& band,
const FrequencyRange& freqRange,
WifiPpduField header) const
{
@@ -757,7 +758,7 @@ InterferenceHelper::CalculatePhyHeaderPer(Ptr<const Event> event,
PhyEntity::SnrPer
InterferenceHelper::CalculatePayloadSnrPer(Ptr<Event> event,
uint16_t channelWidth,
WifiSpectrumBandIndices band,
const WifiSpectrumBandIndices& band,
const FrequencyRange& freqRange,
uint16_t staId,
std::pair<Time, Time> relativeMpduStartStop) const
@@ -789,7 +790,7 @@ double
InterferenceHelper::CalculateSnr(Ptr<Event> 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> event,
PhyEntity::SnrPer
InterferenceHelper::CalculatePhyHeaderSnrPer(Ptr<Event> event,
uint16_t channelWidth,
WifiSpectrumBandIndices band,
const WifiSpectrumBandIndices& band,
const FrequencyRange& freqRange,
WifiPpduField header) const
{

View File

@@ -90,7 +90,7 @@ class Event : public SimpleRefCount<Event>
* \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> event,
uint16_t channelWidth,
WifiSpectrumBandIndices band,
const WifiSpectrumBandIndices& band,
const FrequencyRange& freqRange,
uint16_t staId,
std::pair<Time, Time> relativeMpduStartStop) const;
@@ -286,7 +286,7 @@ class InterferenceHelper : public Object
double CalculateSnr(Ptr<Event> 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> 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> 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<const Event> event,
uint16_t channelWidth,
NiChangesPerBand* nis,
WifiSpectrumBandIndices band,
const WifiSpectrumBandIndices& band,
const FrequencyRange& freqRange,
uint16_t staId,
std::pair<Time, Time> window) const;
@@ -506,7 +506,7 @@ class InterferenceHelper : public Object
double CalculatePhyHeaderPer(Ptr<const Event> 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<const Event> event,
NiChangesPerBand* nis,
uint16_t channelWidth,
WifiSpectrumBandIndices band,
const WifiSpectrumBandIndices& band,
const FrequencyRange& freqRange,
PhyEntity::PhyHeaderSections phyHeaderSections) const;

View File

@@ -1235,7 +1235,7 @@ PhyEntity::GetCcaThreshold(const Ptr<const WifiPpdu> ppdu,
}
Time
PhyEntity::GetDelayUntilCcaEnd(double thresholdDbm, WifiSpectrumBandIndices band)
PhyEntity::GetDelayUntilCcaEnd(double thresholdDbm, const WifiSpectrumBandIndices& band)
{
return m_wifiPhy->m_interference->GetEnergyDuration(DbmToW(thresholdDbm),
band,

View File

@@ -939,7 +939,7 @@ class PhyEntity : public SimpleRefCount<PhyEntity>
* \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)