wifi: Add 80+80MHz support for SpectrumWifiPhy::ConfigureInterface

This commit is contained in:
Sébastien Deronne
2023-11-19 09:39:13 +01:00
parent 09c5dbaa51
commit 0d9303ae64
3 changed files with 40 additions and 20 deletions

View File

@@ -200,7 +200,8 @@ SpectrumWifiPhyHelper::SpectrumChannelSwitched(Ptr<SpectrumWifiPhy> phy)
// no interface attached to that channel
continue;
}
spectrumPhy->ConfigureInterface(phy->GetFrequency(), phy->GetChannelWidth());
spectrumPhy->ConfigureInterface(phy->GetOperatingChannel().GetFrequencies(),
phy->GetChannelWidth());
}
}

View File

@@ -404,9 +404,14 @@ SpectrumWifiPhy::NotifyChannelSwitched()
}
void
SpectrumWifiPhy::ConfigureInterface(uint16_t frequency, ChannelWidthMhz width)
SpectrumWifiPhy::ConfigureInterface(const std::vector<uint16_t>& frequencies, ChannelWidthMhz width)
{
NS_LOG_FUNCTION(this << frequency << width);
std::stringstream ss;
for (const auto& centerFrequency : frequencies)
{
ss << centerFrequency << " ";
}
NS_LOG_FUNCTION(this << ss.str() << width);
if (!m_trackSignalsInactiveInterfaces)
{
@@ -414,25 +419,39 @@ SpectrumWifiPhy::ConfigureInterface(uint16_t frequency, ChannelWidthMhz width)
return;
}
auto spectrumPhyInterface = GetInterfaceCoveringChannelBand(frequency, width);
NS_ABORT_MSG_IF(!spectrumPhyInterface,
"No spectrum channel covers frequency range ["
<< frequency - (width / 2) << " MHz - " << frequency + (width / 2)
<< " MHz]");
Ptr<WifiSpectrumPhyInterface> spectrumPhyInterface;
const auto numSegments = frequencies.size();
const auto segmentWidth = width / numSegments;
for (std::size_t i = 0; i < numSegments; ++i)
{
auto interfaceCoveringBand =
GetInterfaceCoveringChannelBand(frequencies.at(i), segmentWidth);
NS_ABORT_MSG_IF(!interfaceCoveringBand,
"No spectrum channel covers frequency range ["
<< frequencies.at(i) - (segmentWidth / 2) << " MHz - "
<< frequencies.at(i) + (segmentWidth / 2) << " MHz]");
if (!spectrumPhyInterface)
{
spectrumPhyInterface = interfaceCoveringBand;
}
else
{
NS_ABORT_MSG_IF(interfaceCoveringBand != spectrumPhyInterface,
"All segments are not covered by the same spectrum channel");
}
}
NS_ABORT_MSG_IF(spectrumPhyInterface == m_currentSpectrumPhyInterface,
"This method should not be called for the current interface");
if (!spectrumPhyInterface->GetCenterFrequencies().empty() &&
(frequency == spectrumPhyInterface->GetCenterFrequencies().front()) &&
if ((frequencies == spectrumPhyInterface->GetCenterFrequencies()) &&
(width == spectrumPhyInterface->GetChannelWidth()))
{
NS_LOG_DEBUG("Same RF channel as before on that interface, do nothing");
return;
}
ResetSpectrumModel(spectrumPhyInterface, {frequency}, width);
ResetSpectrumModel(spectrumPhyInterface, frequencies, width);
}
bool

View File

@@ -135,16 +135,16 @@ class SpectrumWifiPhy : public WifiPhy
Time duration);
/**
* Configure a non-active spectrum PHY interface to operate on a given frequency with a given
* width. The function searches for the non-active PHY interface that operates on the frequency
* range corresponding to the spectrum portion specified by the caller. It takes care to
* configure the RX spectrum model of the PHY interface and to update the bands tracked in
* interference helper.
* Configure a non-active spectrum PHY interface to operate on a given frequency (or several
* frequencies for non-contiguous) with a given total width. The function searches for the
* non-active PHY interface that operates on the frequency range corresponding to the spectrum
* portion specified by the caller. It takes care to configure the RX spectrum model of the PHY
* interface and to update the bands tracked in interference helper.
*
* \param frequency the center frequency in MHz the PHY interface should use
* \param width the channel width in MHz the PHY interface should use
* \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(uint16_t frequency, ChannelWidthMhz width);
void ConfigureInterface(const std::vector<uint16_t>& frequencies, ChannelWidthMhz width);
/**
* This function is sending the signal to the Spectrum channel