wifi: Use WifiSpectrumBandInfo and get rid of bands offset calculation

This commit is contained in:
Sébastien Deronne
2023-02-18 10:52:30 +01:00
committed by Sébastien Deronne
parent 039d310981
commit eaeb098720
14 changed files with 163 additions and 228 deletions

View File

@@ -975,7 +975,7 @@ HePhy::StartReceiveOfdmaPayload(Ptr<Event> event)
NotifyPayloadBegin(ppdu->GetTxVector(), payloadDuration);
}
std::pair<uint16_t, WifiSpectrumBandIndices>
std::pair<uint16_t, WifiSpectrumBandInfo>
HePhy::GetChannelWidthAndBand(const WifiTxVector& txVector, uint16_t staId) const
{
if (txVector.IsMu())
@@ -989,7 +989,7 @@ HePhy::GetChannelWidthAndBand(const WifiTxVector& txVector, uint16_t staId) cons
}
}
WifiSpectrumBandIndices
WifiSpectrumBandInfo
HePhy::GetRuBandForTx(const WifiTxVector& txVector, uint16_t staId) const
{
NS_ASSERT(txVector.IsMu());
@@ -1004,14 +1004,16 @@ HePhy::GetRuBandForTx(const WifiTxVector& txVector, uint16_t staId) const
std::make_pair(group.front().first, group.back().second);
// for a TX spectrum, the guard bandwidth is a function of the transmission channel width
// and the spectrum width equals the transmission channel width (hence bandIndex equals 0)
return ConvertHeRuSubcarriers(channelWidth,
GetGuardBandwidth(channelWidth),
m_wifiPhy->GetSubcarrierSpacing(),
subcarrierRange,
0);
auto indices = ConvertHeRuSubcarriers(channelWidth,
GetGuardBandwidth(channelWidth),
m_wifiPhy->GetSubcarrierSpacing(),
subcarrierRange,
0);
auto frequencies = m_wifiPhy->ConvertIndicesToFrequencies(indices);
return {indices, frequencies};
}
WifiSpectrumBandIndices
WifiSpectrumBandInfo
HePhy::GetRuBandForRx(const WifiTxVector& txVector, uint16_t staId) const
{
NS_ASSERT(txVector.IsMu());
@@ -1026,15 +1028,17 @@ HePhy::GetRuBandForRx(const WifiTxVector& txVector, uint16_t staId) const
std::make_pair(group.front().first, group.back().second);
// for an RX spectrum, the guard bandwidth is a function of the operating channel width
// and the spectrum width equals the operating channel width
return ConvertHeRuSubcarriers(
auto indices = ConvertHeRuSubcarriers(
channelWidth,
GetGuardBandwidth(m_wifiPhy->GetChannelWidth()),
m_wifiPhy->GetSubcarrierSpacing(),
subcarrierRange,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelIndex(channelWidth));
auto frequencies = m_wifiPhy->ConvertIndicesToFrequencies(indices);
return {indices, frequencies};
}
WifiSpectrumBandIndices
WifiSpectrumBandInfo
HePhy::GetNonOfdmaBand(const WifiTxVector& txVector, uint16_t staId) const
{
NS_ASSERT(txVector.IsUlMu() && (txVector.GetModulationClass() >= WIFI_MOD_CLASS_HE));
@@ -1055,12 +1059,14 @@ HePhy::GetNonOfdmaBand(const WifiTxVector& txVector, uint16_t staId) const
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelIndex(20)));
HeRu::SubcarrierRange subcarrierRange =
std::make_pair(groupPreamble.front().first, groupPreamble.back().second);
return ConvertHeRuSubcarriers(
auto indices = ConvertHeRuSubcarriers(
channelWidth,
GetGuardBandwidth(m_wifiPhy->GetChannelWidth()),
m_wifiPhy->GetSubcarrierSpacing(),
subcarrierRange,
m_wifiPhy->GetOperatingChannel().GetPrimaryChannelIndex(channelWidth));
auto frequencies = m_wifiPhy->ConvertIndicesToFrequencies(indices);
return {indices, frequencies};
}
uint16_t
@@ -1206,7 +1212,7 @@ HePhy::GetPer20MHzDurations(const Ptr<const WifiPpdu> ppdu)
* busy while the threshold continues to be exceeded.
*/
double ccaThresholdDbm = -62;
Time delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, band.indices);
Time delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, band);
if (ppdu)
{
@@ -1266,7 +1272,7 @@ HePhy::GetPer20MHzDurations(const Ptr<const WifiPpdu> ppdu)
NS_ASSERT_MSG(false, "Invalid channel width: " << ppduBw);
}
}
Time ppduCcaDuration = GetDelayUntilCcaEnd(ccaThresholdDbm, band.indices);
Time ppduCcaDuration = GetDelayUntilCcaEnd(ccaThresholdDbm, band);
delayUntilCcaEnd = std::max(delayUntilCcaEnd, ppduCcaDuration);
}
per20MhzDurations.push_back(delayUntilCcaEnd);
@@ -1365,7 +1371,7 @@ HePhy::GetTxPowerSpectralDensity(double txPowerW,
}
else
{
const auto band = GetRuBandForTx(txVector, GetStaId(ppdu));
const auto band = GetRuBandForTx(txVector, GetStaId(ppdu)).indices;
return WifiSpectrumValueHelper::CreateHeMuOfdmTxPowerSpectralDensity(
centerFrequency,
channelWidth,
@@ -1906,7 +1912,7 @@ HePhy::GetRuBands(Ptr<const WifiPhy> phy, uint16_t channelWidth, uint16_t guardB
(!primary80IsLower80 && phyIndex > nRus / 2));
HeRu::RuSpec ru(ruType, index, primary80);
NS_ABORT_IF(ru.GetPhyIndex(bw, p20Index) != phyIndex);
ruBands.insert({band.indices, ru});
ruBands.insert({band, ru});
}
}
}

View File

@@ -172,7 +172,7 @@ class HePhy : public VhtPhy
*
* \return the RU band in the TX spectrum
*/
WifiSpectrumBandIndices GetRuBandForTx(const WifiTxVector& txVector, uint16_t staId) const;
WifiSpectrumBandInfo GetRuBandForTx(const WifiTxVector& txVector, uint16_t staId) const;
/**
* Get the band in the RX spectrum associated with the RU used by the PSDU
* transmitted to/by a given STA in a DL MU PPDU/HE TB PPDU
@@ -182,7 +182,7 @@ class HePhy : public VhtPhy
*
* \return the RU band in the RX spectrum
*/
WifiSpectrumBandIndices GetRuBandForRx(const WifiTxVector& txVector, uint16_t staId) const;
WifiSpectrumBandInfo GetRuBandForRx(const WifiTxVector& txVector, uint16_t staId) const;
/**
* Get the band used to transmit the non-OFDMA part of an HE TB PPDU.
*
@@ -191,7 +191,7 @@ class HePhy : public VhtPhy
*
* \return the spectrum band used to transmit the non-OFDMA part of an HE TB PPDU
*/
WifiSpectrumBandIndices GetNonOfdmaBand(const WifiTxVector& txVector, uint16_t staId) const;
WifiSpectrumBandInfo GetNonOfdmaBand(const WifiTxVector& txVector, uint16_t staId) const;
/**
* Get the width in MHz of the non-OFDMA portion of an HE TB PPDU
*
@@ -452,7 +452,7 @@ class HePhy : public VhtPhy
uint8_t bandIndex = 0);
/// Map a spectrum band associated with an RU to the RU specification
using RuBands = std::map<WifiSpectrumBandIndices, HeRu::RuSpec>;
using RuBands = std::map<WifiSpectrumBandInfo, HeRu::RuSpec>;
/**
* Static function to compute the RU bands that belong to a given channel width.
@@ -473,9 +473,8 @@ class HePhy : public VhtPhy
Ptr<Event> DoGetEvent(Ptr<const WifiPpdu> ppdu, RxPowerWattPerChannelBand& rxPowersW) override;
bool IsConfigSupported(Ptr<const WifiPpdu> ppdu) const override;
Time DoStartReceivePayload(Ptr<Event> event) override;
std::pair<uint16_t, WifiSpectrumBandIndices> GetChannelWidthAndBand(
const WifiTxVector& txVector,
uint16_t staId) const override;
std::pair<uint16_t, WifiSpectrumBandInfo> GetChannelWidthAndBand(const WifiTxVector& txVector,
uint16_t staId) const override;
void RxPayloadSucceeded(Ptr<const WifiPsdu> psdu,
RxSignalInfo rxSignalInfo,
const WifiTxVector& txVector,

View File

@@ -827,7 +827,7 @@ HtPhy::GetCcaIndication(const Ptr<const WifiPpdu> ppdu)
return PhyEntity::GetCcaIndication(ppdu);
}
double ccaThresholdDbm = GetCcaThreshold(ppdu, WIFI_CHANLIST_PRIMARY);
Time delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(20).indices);
Time delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(20));
if (delayUntilCcaEnd.IsStrictlyPositive())
{
return std::make_pair(
@@ -863,7 +863,7 @@ HtPhy::GetCcaIndication(const Ptr<const WifiPpdu> ppdu)
if (!ppdu || ppdu->DoesOverlapChannel(s20MinFreq, s20MaxFreq))
{
ccaThresholdDbm = GetCcaThreshold(ppdu, WIFI_CHANLIST_SECONDARY);
delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetSecondaryBand(20).indices);
delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetSecondaryBand(20));
if (delayUntilCcaEnd.IsStrictlyPositive())
{
return std::make_pair(delayUntilCcaEnd, WIFI_CHANLIST_SECONDARY);

View File

@@ -99,7 +99,7 @@ Event::GetRxPowerW() const
}
double
Event::GetRxPowerW(const WifiSpectrumBandIndices& band) const
Event::GetRxPowerW(const WifiSpectrumBandInfo& band) const
{
const auto it = m_rxPowerW.find(band);
NS_ASSERT(it != m_rxPowerW.cend());
@@ -254,37 +254,24 @@ InterferenceHelper::AddForeignSignal(Time duration,
Add(fakePpdu, WifiTxVector(), duration, rxPowerW, freqRange);
}
void
InterferenceHelper::RemoveBands(FrequencyRange freqRange)
bool
InterferenceHelper::HasBands(const FrequencyRange& freqRange) const
{
NS_LOG_FUNCTION(this << freqRange);
if ((m_niChanges.count(freqRange) == 0) && (m_firstPowers.count(freqRange) == 0))
{
return;
}
auto niChangesPerBand = m_niChanges.at(freqRange);
for (auto it : niChangesPerBand)
{
it.second.clear();
}
niChangesPerBand.clear();
m_niChanges.erase(freqRange);
m_firstPowers.at(freqRange).clear();
m_firstPowers.erase(freqRange);
return (m_niChanges.count(freqRange) > 0);
}
bool
InterferenceHelper::HasBand(const WifiSpectrumBandIndices& band,
const FrequencyRange& freqRange) const
InterferenceHelper::HasBand(const WifiSpectrumBandInfo& band, const FrequencyRange& freqRange) const
{
NS_LOG_FUNCTION(this << band.first << band.second << freqRange);
NS_LOG_FUNCTION(this << band << freqRange);
return (m_niChanges.count(freqRange) > 0 && m_niChanges.at(freqRange).count(band) > 0);
}
void
InterferenceHelper::AddBand(const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange)
InterferenceHelper::AddBand(const WifiSpectrumBandInfo& band, const FrequencyRange& freqRange)
{
NS_LOG_FUNCTION(this << band.first << band.second << freqRange);
NS_LOG_FUNCTION(this << band << freqRange);
NS_ASSERT(m_niChanges.count(freqRange) == 0 || m_niChanges.at(freqRange).count(band) == 0);
NS_ASSERT(m_firstPowers.count(freqRange) == 0 || m_firstPowers.at(freqRange).count(band) == 0);
NiChanges niChanges;
@@ -296,59 +283,33 @@ InterferenceHelper::AddBand(const WifiSpectrumBandIndices& band, const Frequency
}
void
InterferenceHelper::UpdateBands(const std::vector<WifiSpectrumBandIndices>& bands,
const FrequencyRange& freqRange,
int32_t offset)
InterferenceHelper::UpdateBands(const std::vector<WifiSpectrumBandInfo>& bands,
const FrequencyRange& freqRange)
{
NS_LOG_FUNCTION(this << freqRange << offset);
NS_LOG_FUNCTION(this << freqRange);
NS_ABORT_IF(m_niChanges.count(freqRange) == 0);
auto& niChangesPerBand = m_niChanges.at(freqRange);
auto& firstPowerPerBand = m_firstPowers.at(freqRange);
// start index of the lowest band
const auto minStartIndex =
(std::min_element(bands.cbegin(), bands.cend(), [](const auto& lhs, const auto& rhs) {
return lhs.first < rhs.first;
}))->first;
// stop index of the highest band
const auto maxStopIndex =
(std::max_element(bands.cbegin(), bands.cend(), [](const auto& lhs, const auto& rhs) {
return lhs.second < rhs.second;
}))->second;
// index of DC so that it can be skipped
const auto dcIndex =
static_cast<uint32_t>(minStartIndex + ((maxStopIndex - minStartIndex) / 2) + 0.5);
NiChangesPerBand newNiChangesPerBand{};
FirstPowerPerBand newFirstPowerPerBand{};
for (auto it = niChangesPerBand.begin(); it != niChangesPerBand.end();)
{
// apply offset to start index and stop index to get the corresponding ones in the new
// spectrum model
auto newBandStartIndex =
static_cast<uint32_t>(static_cast<int32_t>(it->first.first) + offset);
auto newBandStopIndex =
static_cast<uint32_t>(static_cast<int32_t>(it->first.second) + offset);
const auto erase = std::find_if(bands.cbegin(),
bands.cend(),
[newBandStartIndex, newBandStopIndex](const auto& item) {
return ((newBandStartIndex == item.first) &&
(newBandStopIndex == item.second));
}) == std::end(bands);
if (erase)
const auto frequencies = it->first.frequencies;
const auto itEqual =
std::find_if(bands.cbegin(), bands.cend(), [frequencies](const auto& item) {
return frequencies == item.frequencies;
});
if (itEqual == std::end(bands))
{
// band does not belong to the new bands, erase it
it->second.clear();
}
else
{
if (newBandStartIndex >= dcIndex)
{
// skip DC
newBandStartIndex++;
}
const auto band = std::make_pair(newBandStartIndex, newBandStopIndex);
newNiChangesPerBand.insert({band, std::move(it->second)});
newFirstPowerPerBand.insert({band, firstPowerPerBand.at(it->first)});
newNiChangesPerBand.insert({*itEqual, std::move(it->second)});
newFirstPowerPerBand.insert({*itEqual, firstPowerPerBand.at(it->first)});
}
firstPowerPerBand.erase(it->first);
it = niChangesPerBand.erase(it);
}
niChangesPerBand.swap(newNiChangesPerBand);
@@ -389,10 +350,10 @@ InterferenceHelper::SetNumberOfReceiveAntennas(uint8_t rx)
Time
InterferenceHelper::GetEnergyDuration(double energyW,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange)
{
NS_LOG_FUNCTION(this << energyW << band.first << band.second << freqRange);
NS_LOG_FUNCTION(this << energyW << band << freqRange);
Time now = Simulator::Now();
NS_ABORT_IF(m_niChanges.count(freqRange) == 0);
auto niIt = m_niChanges.at(freqRange).find(band);
@@ -508,10 +469,10 @@ InterferenceHelper::CalculateSnr(double signal,
double
InterferenceHelper::CalculateNoiseInterferenceW(Ptr<Event> event,
NiChangesPerBand* nis,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange) const
{
NS_LOG_FUNCTION(this << band.first << band.second << freqRange);
NS_LOG_FUNCTION(this << band << freqRange);
NS_ABORT_IF(m_firstPowers.count(freqRange) == 0);
auto firstPower_it = m_firstPowers.at(freqRange).find(band);
NS_ABORT_IF(firstPower_it == m_firstPowers.at(freqRange).end());
@@ -590,13 +551,12 @@ double
InterferenceHelper::CalculatePayloadPer(Ptr<const Event> event,
uint16_t channelWidth,
NiChangesPerBand* nis,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange,
uint16_t staId,
std::pair<Time, Time> window) const
{
NS_LOG_FUNCTION(this << channelWidth << band.first << band.second << staId << window.first
<< window.second);
NS_LOG_FUNCTION(this << channelWidth << band << staId << window.first << window.second);
double psr = 1.0; /* Packet Success Rate */
const auto& niIt = nis->find(band)->second;
auto j = niIt.cbegin();
@@ -664,11 +624,11 @@ InterferenceHelper::CalculatePhyHeaderSectionPsr(
Ptr<const Event> event,
NiChangesPerBand* nis,
uint16_t channelWidth,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange,
PhyEntity::PhyHeaderSections phyHeaderSections) const
{
NS_LOG_FUNCTION(this << band.first << band.second << freqRange);
NS_LOG_FUNCTION(this << band << freqRange);
double psr = 1.0; /* Packet Success Rate */
auto niIt = nis->find(band)->second;
auto j = niIt.begin();
@@ -729,11 +689,11 @@ double
InterferenceHelper::CalculatePhyHeaderPer(Ptr<const Event> event,
NiChangesPerBand* nis,
uint16_t channelWidth,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange,
WifiPpduField header) const
{
NS_LOG_FUNCTION(this << band.first << band.second << freqRange << header);
NS_LOG_FUNCTION(this << band << freqRange << header);
auto niIt = nis->find(band)->second;
auto phyEntity = WifiPhy::GetStaticPhyEntity(event->GetTxVector().GetModulationClass());
@@ -758,12 +718,12 @@ InterferenceHelper::CalculatePhyHeaderPer(Ptr<const Event> event,
PhyEntity::SnrPer
InterferenceHelper::CalculatePayloadSnrPer(Ptr<Event> event,
uint16_t channelWidth,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange,
uint16_t staId,
std::pair<Time, Time> relativeMpduStartStop) const
{
NS_LOG_FUNCTION(this << channelWidth << band.first << band.second << freqRange << staId
NS_LOG_FUNCTION(this << channelWidth << band << freqRange << staId
<< relativeMpduStartStop.first << relativeMpduStartStop.second);
NiChangesPerBand ni;
double noiseInterferenceW = CalculateNoiseInterferenceW(event, &ni, band, freqRange);
@@ -790,7 +750,7 @@ double
InterferenceHelper::CalculateSnr(Ptr<Event> event,
uint16_t channelWidth,
uint8_t nss,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange) const
{
NiChangesPerBand ni;
@@ -802,11 +762,11 @@ InterferenceHelper::CalculateSnr(Ptr<Event> event,
PhyEntity::SnrPer
InterferenceHelper::CalculatePhyHeaderSnrPer(Ptr<Event> event,
uint16_t channelWidth,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange,
WifiPpduField header) const
{
NS_LOG_FUNCTION(this << band.first << band.second << header);
NS_LOG_FUNCTION(this << band << header);
NiChangesPerBand ni;
double noiseInterferenceW = CalculateNoiseInterferenceW(event, &ni, band, freqRange);
double snr = CalculateSnr(event->GetRxPowerW(band), noiseInterferenceW, channelWidth, 1);

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(const WifiSpectrumBandIndices& band) const;
double GetRxPowerW(const WifiSpectrumBandInfo& band) const;
/**
* Return the received power (W) for all bands.
*
@@ -150,34 +150,25 @@ class InterferenceHelper : public Object
* \param band the band to be added
* \param freqRange the frequency range the band to add belongs to
*/
void AddBand(const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange);
void AddBand(const WifiSpectrumBandInfo& band, const FrequencyRange& freqRange);
/**
* Remove the frequency bands for a given frequency range.
* Check whether a given frequency range is already tracked by this interference helper.
*
* \param freqRange the frequency range the bands to remove belong to
* \param freqRange the frequency range to check
* \return true if bands are tracked by this interference helper for a given frequency range,
* false otherwise
*/
void RemoveBands(FrequencyRange freqRange);
/**
* Check whether a given band is tracked by this interference helper.
*
* \param band the band to be checked
* \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(const WifiSpectrumBandIndices& band, const FrequencyRange& freqRange) const;
bool HasBands(const FrequencyRange& freqRange) const;
/**
* Update the frequency bands for a given frequency range when the spectrum model is changed.
*
* \param bands the bands to be added in the new spectrum model
* \param freqRange the frequency range the bands belong to
* \param offset the offset to convert start and stop indices from old to new spectrum model
*/
void UpdateBands(const std::vector<WifiSpectrumBandIndices>& bands,
const FrequencyRange& freqRange,
int32_t offset);
void UpdateBands(const std::vector<WifiSpectrumBandInfo>& bands,
const FrequencyRange& freqRange);
/**
* Set the noise figure.
@@ -216,7 +207,7 @@ class InterferenceHelper : public Object
* be higher than the requested threshold.
*/
Time GetEnergyDuration(double energyW,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange);
/**
@@ -268,7 +259,7 @@ class InterferenceHelper : public Object
*/
PhyEntity::SnrPer CalculatePayloadSnrPer(Ptr<Event> event,
uint16_t channelWidth,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange,
uint16_t staId,
std::pair<Time, Time> relativeMpduStartStop) const;
@@ -286,7 +277,7 @@ class InterferenceHelper : public Object
double CalculateSnr(Ptr<Event> event,
uint16_t channelWidth,
uint8_t nss,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange) const;
/**
* Calculate the SNIR at the start of the PHY header and accumulate
@@ -302,7 +293,7 @@ class InterferenceHelper : public Object
*/
PhyEntity::SnrPer CalculatePhyHeaderSnrPer(Ptr<Event> event,
uint16_t channelWidth,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange,
WifiPpduField header) const;
@@ -427,7 +418,7 @@ class InterferenceHelper : public Object
/**
* Map of NiChanges per band
*/
using NiChangesPerBand = std::map<WifiSpectrumBandIndices, NiChanges>;
using NiChangesPerBand = std::map<WifiSpectrumBandInfo, NiChanges>;
/**
* Map of NiChanges per band and per range
@@ -437,13 +428,22 @@ class InterferenceHelper : public Object
/**
* Map of first power per band
*/
using FirstPowerPerBand = std::map<WifiSpectrumBandIndices, double>;
using FirstPowerPerBand = std::map<WifiSpectrumBandInfo, double>;
/**
* Map of first power per band and per range
*/
using FirstPowerPerBandPerRange = std::map<FrequencyRange, FirstPowerPerBand>;
/**
* Check whether a given band is tracked by this interference helper.
*
* \param band the band to be checked
* \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(const WifiSpectrumBandInfo& band, const FrequencyRange& freqRange) const;
/**
* Append the given Event.
*
@@ -466,7 +466,7 @@ class InterferenceHelper : public Object
*/
double CalculateNoiseInterferenceW(Ptr<Event> event,
NiChangesPerBand* nis,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& 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,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& 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,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& 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,
const WifiSpectrumBandIndices& band,
const WifiSpectrumBandInfo& band,
const FrequencyRange& freqRange,
PhyEntity::PhyHeaderSections phyHeaderSections) const;

View File

@@ -272,7 +272,7 @@ PhyEntity::GetPhyHeaderSnrPer(WifiPpduField field, Ptr<Event> event) const
return m_wifiPhy->m_interference->CalculatePhyHeaderSnrPer(
event,
measurementChannelWidth,
GetPrimaryBand(measurementChannelWidth).indices,
GetPrimaryBand(measurementChannelWidth),
m_wifiPhy->GetCurrentFrequencyRange(),
field);
}
@@ -401,11 +401,10 @@ PhyEntity::StartReceivePreamble(Ptr<const WifiPpdu> ppdu,
Time rxDuration)
{
// The total RX power corresponds to the maximum over all the bands
auto it = std::max_element(
rxPowersW.begin(),
rxPowersW.end(),
[](const std::pair<WifiSpectrumBandIndices, double>& p1,
const std::pair<WifiSpectrumBandIndices, double>& p2) { return p1.second < p2.second; });
auto it =
std::max_element(rxPowersW.begin(), rxPowersW.end(), [](const auto& p1, const auto& p2) {
return p1.second < p2.second;
});
NS_LOG_FUNCTION(this << ppdu << it->second);
auto event = DoGetEvent(ppdu, rxPowersW);
@@ -826,11 +825,11 @@ PhyEntity::GetReceptionStatus(Ptr<const WifiPsdu> psdu,
}
}
std::pair<uint16_t, WifiSpectrumBandIndices>
std::pair<uint16_t, WifiSpectrumBandInfo>
PhyEntity::GetChannelWidthAndBand(const WifiTxVector& txVector, uint16_t /* staId */) const
{
uint16_t channelWidth = GetRxChannelWidth(txVector);
return std::make_pair(channelWidth, GetPrimaryBand(channelWidth).indices);
return std::make_pair(channelWidth, GetPrimaryBand(channelWidth));
}
const std::map<std::pair<uint64_t, WifiPreamble>, Ptr<Event>>&
@@ -965,7 +964,7 @@ PhyEntity::EndPreambleDetectionPeriod(Ptr<Event> event)
NS_ASSERT(!m_wifiPhy->m_currentPreambleEvents.empty());
for (auto preambleEvent : m_wifiPhy->m_currentPreambleEvents)
{
double rxPowerW = preambleEvent.second->GetRxPowerW(measurementBand.indices);
double rxPowerW = preambleEvent.second->GetRxPowerW(measurementBand);
if (rxPowerW > maxRxPowerW)
{
maxRxPowerW = rxPowerW;
@@ -998,14 +997,14 @@ PhyEntity::EndPreambleDetectionPeriod(Ptr<Event> event)
double snr = m_wifiPhy->m_interference->CalculateSnr(m_wifiPhy->m_currentEvent,
measurementChannelWidth,
1,
measurementBand.indices,
measurementBand,
m_wifiPhy->GetCurrentFrequencyRange());
NS_LOG_DEBUG("SNR(dB)=" << RatioToDb(snr) << " at end of preamble detection period");
if ((!m_wifiPhy->m_preambleDetectionModel && maxRxPowerW > 0.0) ||
(m_wifiPhy->m_preambleDetectionModel &&
m_wifiPhy->m_preambleDetectionModel->IsPreambleDetected(
m_wifiPhy->m_currentEvent->GetRxPowerW(measurementBand.indices),
m_wifiPhy->m_currentEvent->GetRxPowerW(measurementBand),
snr,
measurementChannelWidth)))
{
@@ -1193,7 +1192,7 @@ PhyEntity::GetRandomValue() const
double
PhyEntity::GetRxPowerWForPpdu(Ptr<Event> event) const
{
return event->GetRxPowerW(GetPrimaryBand(GetMeasurementChannelWidth(event->GetPpdu())).indices);
return event->GetRxPowerW(GetPrimaryBand(GetMeasurementChannelWidth(event->GetPpdu())));
}
Ptr<const Event>
@@ -1235,7 +1234,7 @@ PhyEntity::GetCcaThreshold(const Ptr<const WifiPpdu> ppdu,
}
Time
PhyEntity::GetDelayUntilCcaEnd(double thresholdDbm, const WifiSpectrumBandIndices& band)
PhyEntity::GetDelayUntilCcaEnd(double thresholdDbm, const WifiSpectrumBandInfo& band)
{
return m_wifiPhy->m_interference->GetEnergyDuration(DbmToW(thresholdDbm),
band,
@@ -1272,7 +1271,7 @@ PhyEntity::GetCcaIndication(const Ptr<const WifiPpdu> ppdu)
NS_LOG_FUNCTION(this << channelWidth);
const double ccaThresholdDbm = GetCcaThreshold(ppdu, WIFI_CHANLIST_PRIMARY);
const Time delayUntilCcaEnd =
GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(channelWidth).indices);
GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(channelWidth));
if (delayUntilCcaEnd.IsStrictlyPositive())
{
return std::make_pair(delayUntilCcaEnd, WIFI_CHANLIST_PRIMARY);

View File

@@ -75,7 +75,7 @@ struct RxSignalInfo
/**
* A map of the received power (Watts) for each band
*/
typedef std::map<WifiSpectrumBandIndices, double> RxPowerWattPerChannelBand;
using RxPowerWattPerChannelBand = std::map<WifiSpectrumBandInfo, double>;
class WifiPsdu;
class WifiPhy;
@@ -775,7 +775,7 @@ class PhyEntity : public SimpleRefCount<PhyEntity>
* \param staId the station ID of the PSDU
* \return a pair of channel width (MHz) and band
*/
virtual std::pair<uint16_t, WifiSpectrumBandIndices> GetChannelWidthAndBand(
virtual std::pair<uint16_t, WifiSpectrumBandInfo> GetChannelWidthAndBand(
const WifiTxVector& txVector,
uint16_t staId) const;
@@ -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, const WifiSpectrumBandIndices& band);
Time GetDelayUntilCcaEnd(double thresholdDbm, const WifiSpectrumBandInfo& band);
/**
* \param currentChannelWidth channel width of the current transmission (MHz)

View File

@@ -122,16 +122,15 @@ SpectrumWifiPhy::DoInitialize()
}
void
SpectrumWifiPhy::UpdateInterferenceHelperBands(std::optional<int32_t> indicesOffset)
SpectrumWifiPhy::UpdateInterferenceHelperBands()
{
NS_LOG_FUNCTION(this);
NS_ASSERT(!m_spectrumPhyInterfaces.empty());
uint16_t channelWidth = GetChannelWidth();
std::vector<WifiSpectrumBandIndices> ccaBands{};
std::vector<WifiSpectrumBandIndices> ruBands{};
std::vector<WifiSpectrumBandInfo> bands{};
if (channelWidth < 20)
{
ccaBands.push_back(GetBand(channelWidth).indices);
bands.push_back(GetBand(channelWidth));
}
else
{
@@ -139,49 +138,30 @@ SpectrumWifiPhy::UpdateInterferenceHelperBands(std::optional<int32_t> indicesOff
{
for (uint32_t i = 0; i < (channelWidth / bw); ++i)
{
ccaBands.push_back(GetBand(bw, i).indices);
bands.push_back(GetBand(bw, i));
}
}
}
if (GetStandard() >= WIFI_STANDARD_80211ax)
{
auto&& ruBandsMap = HePhy::GetRuBands(this, channelWidth, GetGuardBandwidth(channelWidth));
for (const auto& bandRuPair : ruBandsMap)
auto&& ruBands = HePhy::GetRuBands(this, channelWidth, GetGuardBandwidth(channelWidth));
for (const auto& bandRuPair : ruBands)
{
ruBands.push_back(bandRuPair.first);
bands.push_back(bandRuPair.first);
}
m_currentSpectrumPhyInterface->SetRuBands(std::move(ruBandsMap));
m_currentSpectrumPhyInterface->SetRuBands(std::move(ruBands));
}
auto bands{ccaBands};
bands.insert(bands.end(), ruBands.begin(), ruBands.end());
const auto bandsChanged = std::any_of(bands.cbegin(), bands.cend(), [&](const auto& band) {
return !m_interference->HasBand(band, GetCurrentFrequencyRange());
});
if (!bandsChanged)
if (m_interference->HasBands(GetCurrentFrequencyRange()))
{
return;
m_interference->UpdateBands(bands, GetCurrentFrequencyRange());
}
if (indicesOffset.has_value())
else
{
// indicesOffset is computed for multiple of 20 MHz subchannels, and since RU bands are not
// used for CCA, we can here safely erase RU bands (UpdateBands will erase them since they
// are not passed to the call)
m_interference->UpdateBands(ccaBands, GetCurrentFrequencyRange(), *indicesOffset);
// add new RU bands
if (!ruBands.empty())
for (const auto& band : bands)
{
for (const auto& band : ruBands)
{
NS_ASSERT(!m_interference->HasBand(band, GetCurrentFrequencyRange()));
m_interference->AddBand(band, GetCurrentFrequencyRange());
}
m_interference->AddBand(band, GetCurrentFrequencyRange());
}
return;
}
m_interference->RemoveBands(GetCurrentFrequencyRange());
for (const auto& band : bands)
{
m_interference->AddBand(band, GetCurrentFrequencyRange());
}
}
@@ -226,14 +206,6 @@ SpectrumWifiPhy::ResetSpectrumModel()
{
NS_LOG_FUNCTION(this);
std::optional<int32_t> indicesOffset{};
if (m_currentSpectrumPhyInterface->GetCenterFrequency() > 0)
{
indicesOffset =
(2e6 * (GetFrequency() - m_currentSpectrumPhyInterface->GetCenterFrequency())) /
GetSubcarrierSpacing();
}
// Replace existing spectrum model with new one
const auto channelWidth = GetChannelWidth();
m_currentSpectrumPhyInterface->SetRxSpectrumModel(GetFrequency(),
@@ -243,7 +215,7 @@ SpectrumWifiPhy::ResetSpectrumModel()
m_currentSpectrumPhyInterface->GetChannel()->AddRx(m_currentSpectrumPhyInterface);
UpdateInterferenceHelperBands(indicesOffset);
UpdateInterferenceHelperBands();
}
void
@@ -339,7 +311,7 @@ SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams,
NS_LOG_DEBUG("Signal power received (watts) before antenna gain: " << rxPowerPerBandW);
rxPowerPerBandW *= DbToRatio(GetRxGain());
totalRxPowerW += rxPowerPerBandW;
rxPowerW.insert({filteredBand.indices, rxPowerPerBandW});
rxPowerW.insert({filteredBand, rxPowerPerBandW});
NS_LOG_DEBUG("Signal power received after antenna gain for "
<< channelWidth << " MHz channel: " << rxPowerPerBandW << " W ("
<< WToDbm(rxPowerPerBandW) << " dBm)");
@@ -359,7 +331,7 @@ SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams,
{
totalRxPowerW += rxPowerPerBandW;
}
rxPowerW.insert({filteredBand.indices, rxPowerPerBandW});
rxPowerW.insert({filteredBand, rxPowerPerBandW});
NS_LOG_DEBUG("Signal power received after antenna gain for "
<< bw << " MHz channel band " << +i << ": " << rxPowerPerBandW << " W ("
<< WToDbm(rxPowerPerBandW) << " dBm)");
@@ -374,15 +346,16 @@ SpectrumWifiPhy::StartRx(Ptr<SpectrumSignalParameters> rxParams,
for (const auto& [band, ru] : ruBands)
{
double rxPowerPerBandW =
WifiSpectrumValueHelper::GetBandPowerW(receivedSignalPsd, band);
WifiSpectrumValueHelper::GetBandPowerW(receivedSignalPsd, band.indices);
NS_LOG_DEBUG("Signal power received (watts) before antenna gain for RU with type "
<< ru.GetRuType() << " and index " << ru.GetIndex() << " -> ("
<< band.first << "; " << band.second << "): " << rxPowerPerBandW);
<< band.indices.first << "; " << band.indices.second
<< "): " << rxPowerPerBandW);
rxPowerPerBandW *= DbToRatio(GetRxGain());
NS_LOG_DEBUG("Signal power received after antenna gain for RU with type "
<< ru.GetRuType() << " and index " << ru.GetIndex() << " -> ("
<< band.first << "; " << band.second << "): " << rxPowerPerBandW << " W ("
<< WToDbm(rxPowerPerBandW) << " dBm)");
<< band.indices.first << "; " << band.indices.second << "): "
<< rxPowerPerBandW << " W (" << WToDbm(rxPowerPerBandW) << " dBm)");
rxPowerW.insert({band, rxPowerPerBandW});
}
}

View File

@@ -195,10 +195,8 @@ class SpectrumWifiPhy : public WifiPhy
/**
* This function is called to update the bands handled by the InterferenceHelper.
* \param indicesOffset the offset to convert start and stop indices from old to new spectrum
* model, if bands are already handled by the InterferenceHelper
*/
void UpdateInterferenceHelperBands(std::optional<int32_t> indicesOffset);
void UpdateInterferenceHelperBands();
/**
* Determine whether the PHY shall issue a PHY-RXSTART.indication primitive in response to a

View File

@@ -591,7 +591,7 @@ VhtPhy::GetCcaIndication(const Ptr<const WifiPpdu> ppdu)
}
double ccaThresholdDbm = GetCcaThreshold(ppdu, WIFI_CHANLIST_PRIMARY);
Time delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(20).indices);
Time delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(20));
if (delayUntilCcaEnd.IsStrictlyPositive())
{
return std::make_pair(
@@ -653,7 +653,7 @@ VhtPhy::GetCcaIndication(const Ptr<const WifiPpdu> ppdu)
{
auto channelType = secondaryChannels.at(secondaryWidth);
ccaThresholdDbm = GetCcaThreshold(ppdu, channelType);
delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetSecondaryBand(secondaryWidth).indices);
delayUntilCcaEnd = GetDelayUntilCcaEnd(ccaThresholdDbm, GetSecondaryBand(secondaryWidth));
if (delayUntilCcaEnd.IsStrictlyPositive())
{
return std::make_pair(delayUntilCcaEnd, channelType);

View File

@@ -145,7 +145,7 @@ YansWifiChannel::Receive(Ptr<YansWifiPhy> phy, Ptr<const WifiPpdu> ppdu, double
}
RxPowerWattPerChannelBand rxPowerW;
rxPowerW.insert(
{std::make_pair(0, 0), (DbmToW(rxPowerDbm + phy->GetRxGain()))}); // dummy band for YANS
{{{0, 0}, {0, 0}}, (DbmToW(rxPowerDbm + phy->GetRxGain()))}); // dummy band for YANS
phy->StartReceivePreamble(ppdu, rxPowerW, ppdu->GetTxDuration());
}

View File

@@ -53,7 +53,7 @@ YansWifiPhy::SetInterferenceHelper(const Ptr<InterferenceHelper> helper)
{
WifiPhy::SetInterferenceHelper(helper);
// add dummy band for Yans
m_interference->AddBand({0, 0}, GetCurrentFrequencyRange());
m_interference->AddBand({{0, 0}, {0, 0}}, GetCurrentFrequencyRange());
}
YansWifiPhy::~YansWifiPhy()

View File

@@ -520,8 +520,8 @@ SpectrumWifiPhyFilterTest::RxCallback(Ptr<const Packet> p, RxPowerWattPerChannel
{
for (const auto& pair : rxPowersW)
{
NS_LOG_INFO("band: (" << pair.first.first << ";" << pair.first.second << ") -> powerW="
<< pair.second << " (" << WToDbm(pair.second) << " dBm)");
NS_LOG_INFO("band: (" << pair.first << ") -> powerW=" << pair.second << " ("
<< WToDbm(pair.second) << " dBm)");
}
size_t numBands = rxPowersW.size();
@@ -537,7 +537,7 @@ SpectrumWifiPhyFilterTest::RxCallback(Ptr<const Packet> p, RxPowerWattPerChannel
uint16_t channelWidth = std::min(m_txChannelWidth, m_rxChannelWidth);
auto band = m_rxPhy->GetBand(channelWidth, 0);
auto it = rxPowersW.find(band.indices);
auto it = rxPowersW.find(band);
NS_LOG_INFO("powerW total band: " << it->second << " (" << WToDbm(it->second) << " dBm)");
int totalRxPower = static_cast<int>(WToDbm(it->second) + 0.5);
int expectedTotalRxPower;
@@ -560,7 +560,7 @@ SpectrumWifiPhyFilterTest::RxCallback(Ptr<const Packet> p, RxPowerWattPerChannel
if ((m_txChannelWidth <= m_rxChannelWidth) && (channelWidth >= 20))
{
band = m_rxPhy->GetBand(20, 0); // primary 20 MHz
it = rxPowersW.find(band.indices);
it = rxPowersW.find(band);
NS_LOG_INFO("powerW in primary 20 MHz channel: " << it->second << " (" << WToDbm(it->second)
<< " dBm)");
int rxPowerPrimaryChannel20 = static_cast<int>(WToDbm(it->second) + 0.5);
@@ -1016,7 +1016,7 @@ SpectrumWifiPhyMultipleInterfacesTest::DoCheckInterferences(Ptr<ExtSpectrumWifiP
auto interferenceHelper = DynamicCast<InterferenceHelper>(ptr.Get<InterferenceHelper>());
NS_ASSERT(interferenceHelper);
const auto band = phy->GetBandForInterface(channelWidth, 0, freqRange, channelWidth);
const auto energyDuration = interferenceHelper->GetEnergyDuration(0, band.indices, freqRange);
const auto energyDuration = interferenceHelper->GetEnergyDuration(0, band, freqRange);
NS_TEST_ASSERT_MSG_EQ(energyDuration.IsStrictlyPositive(),
interferencesExpected,
"Incorrect interferences detection");

View File

@@ -192,7 +192,7 @@ class OfdmaSpectrumWifiPhy : public SpectrumWifiPhy
* energy on the medium for a given band will
* be higher than the requested threshold.
*/
Time GetEnergyDuration(double energyW, WifiSpectrumBandIndices band);
Time GetEnergyDuration(double energyW, WifiSpectrumBandInfo band);
/**
* \return a const pointer to the HE PHY instance
@@ -278,7 +278,7 @@ OfdmaSpectrumWifiPhy::GetCurrentEvent()
}
Time
OfdmaSpectrumWifiPhy::GetEnergyDuration(double energyW, WifiSpectrumBandIndices band)
OfdmaSpectrumWifiPhy::GetEnergyDuration(double energyW, WifiSpectrumBandInfo band)
{
return m_interference->GetEnergyDuration(energyW, band, WHOLE_WIFI_SPECTRUM);
}
@@ -2466,7 +2466,7 @@ TestMultipleHeTbPreambles::RxHeTbPpdu(uint64_t uid,
DEFAULT_CHANNEL_WIDTH,
txPowerWatts,
DEFAULT_GUARD_WIDTH,
band);
band.indices);
Ptr<WifiSpectrumSignalParameters> rxParamsOfdma = Create<WifiSpectrumSignalParameters>();
rxParamsOfdma->psd = rxPsd;
rxParamsOfdma->txPhy = nullptr;
@@ -3056,7 +3056,7 @@ class TestUlOfdmaPhyTransmission : public TestCase
* \param expectedRxPower the expected received power in W
*/
void CheckNonOfdmaRxPower(Ptr<OfdmaSpectrumWifiPhy> phy,
WifiSpectrumBandIndices band,
WifiSpectrumBandInfo band,
double expectedRxPower);
/**
* Check the received power for the OFDMA part of the HE TB PPDUs over the given band
@@ -3065,7 +3065,7 @@ class TestUlOfdmaPhyTransmission : public TestCase
* \param expectedRxPower the expected received power in W
*/
void CheckOfdmaRxPower(Ptr<OfdmaSpectrumWifiPhy> phy,
WifiSpectrumBandIndices band,
WifiSpectrumBandInfo band,
double expectedRxPower);
/**
@@ -3534,25 +3534,25 @@ TestUlOfdmaPhyTransmission::CheckRxFromSta2(uint32_t expectedSuccess,
void
TestUlOfdmaPhyTransmission::CheckNonOfdmaRxPower(Ptr<OfdmaSpectrumWifiPhy> phy,
WifiSpectrumBandIndices band,
WifiSpectrumBandInfo band,
double expectedRxPower)
{
Ptr<Event> event = phy->GetCurrentEvent();
NS_ASSERT(event);
double rxPower = event->GetRxPowerW(band);
NS_LOG_FUNCTION(this << band.first << band.second << expectedRxPower << rxPower);
auto rxPower = event->GetRxPowerW(band);
NS_LOG_FUNCTION(this << band << expectedRxPower << rxPower);
// Since there is out of band emission due to spectrum mask, the tolerance cannot be very low
NS_TEST_ASSERT_MSG_EQ_TOL(rxPower,
expectedRxPower,
5e-3,
"RX power " << rxPower << " over (" << band.first << ", "
<< band.second << ") does not match expected power "
<< expectedRxPower << " at " << Simulator::Now());
"RX power " << rxPower << " over (" << band
<< ") does not match expected power " << expectedRxPower
<< " at " << Simulator::Now());
}
void
TestUlOfdmaPhyTransmission::CheckOfdmaRxPower(Ptr<OfdmaSpectrumWifiPhy> phy,
WifiSpectrumBandIndices band,
WifiSpectrumBandInfo band,
double expectedRxPower)
{
/**
@@ -3560,28 +3560,28 @@ TestUlOfdmaPhyTransmission::CheckOfdmaRxPower(Ptr<OfdmaSpectrumWifiPhy> phy,
* We will have to check if the expected power is indeed the max power returning a positive
* duration when calling GetEnergyDuration.
*/
NS_LOG_FUNCTION(this << band.first << band.second << expectedRxPower);
NS_LOG_FUNCTION(this << band << expectedRxPower);
double step = 5e-3;
if (expectedRxPower > 0.0)
{
NS_TEST_ASSERT_MSG_EQ(
phy->GetEnergyDuration(expectedRxPower - step, band).IsStrictlyPositive(),
true,
"At least " << expectedRxPower << " W expected for OFDMA part over (" << band.first
<< ", " << band.second << ") at " << Simulator::Now());
"At least " << expectedRxPower << " W expected for OFDMA part over (" << band << ") at "
<< Simulator::Now());
NS_TEST_ASSERT_MSG_EQ(
phy->GetEnergyDuration(expectedRxPower + step, band).IsStrictlyPositive(),
false,
"At most " << expectedRxPower << " W expected for OFDMA part over (" << band.first
<< ", " << band.second << ") at " << Simulator::Now());
"At most " << expectedRxPower << " W expected for OFDMA part over (" << band << ") at "
<< Simulator::Now());
}
else
{
NS_TEST_ASSERT_MSG_EQ(
phy->GetEnergyDuration(expectedRxPower + step, band).IsStrictlyPositive(),
false,
"At most " << expectedRxPower << " W expected for OFDMA part over (" << band.first
<< ", " << band.second << ") at " << Simulator::Now());
"At most " << expectedRxPower << " W expected for OFDMA part over (" << band << ") at "
<< Simulator::Now());
}
}
@@ -3986,11 +3986,11 @@ TestUlOfdmaPhyTransmission::SchedulePowerMeasurementChecks(Time delay,
NS_ASSERT(nonOfdmaDuration == hePhy->CalculateNonOfdmaDurationForHeTb(txVectorSta1));
std::vector<double> rxPowerNonOfdma{rxPowerNonOfdmaRu1, rxPowerNonOfdmaRu2};
std::vector<WifiSpectrumBandIndices> nonOfdmaBand{hePhy->GetNonOfdmaBand(txVectorSta1, 1),
hePhy->GetNonOfdmaBand(txVectorSta2, 2)};
std::vector<WifiSpectrumBandInfo> nonOfdmaBand{hePhy->GetNonOfdmaBand(txVectorSta1, 1),
hePhy->GetNonOfdmaBand(txVectorSta2, 2)};
std::vector<double> rxPowerOfdma{rxPowerOfdmaRu1, rxPowerOfdmaRu2};
std::vector<WifiSpectrumBandIndices> ofdmaBand{hePhy->GetRuBandForRx(txVectorSta1, 1),
hePhy->GetRuBandForRx(txVectorSta2, 2)};
std::vector<WifiSpectrumBandInfo> ofdmaBand{hePhy->GetRuBandForRx(txVectorSta1, 1),
hePhy->GetRuBandForRx(txVectorSta2, 2)};
for (uint8_t i = 0; i < 2; ++i)
{