wifi: Move some more 802.11ax specific to HE PHY
This commit is contained in:
committed by
Sébastien Deronne
parent
f91edb5507
commit
15d068c016
@@ -1873,6 +1873,47 @@ HePhy::ConvertHeRuSubcarriers(uint16_t bandWidth,
|
||||
return convertedSubcarriers;
|
||||
}
|
||||
|
||||
HePhy::RuBands
|
||||
HePhy::GetRuBands(Ptr<const WifiPhy> phy, uint16_t channelWidth, uint16_t guardBandwidth)
|
||||
{
|
||||
HePhy::RuBands ruBands{};
|
||||
for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
|
||||
{
|
||||
for (uint32_t i = 0; i < (channelWidth / bw); ++i)
|
||||
{
|
||||
for (uint32_t type = 0; type < 7; type++)
|
||||
{
|
||||
HeRu::RuType ruType = static_cast<HeRu::RuType>(type);
|
||||
std::size_t nRus = HeRu::GetNRus(bw, ruType);
|
||||
for (std::size_t phyIndex = 1; phyIndex <= nRus; phyIndex++)
|
||||
{
|
||||
HeRu::SubcarrierGroup group = HeRu::GetSubcarrierGroup(bw, ruType, phyIndex);
|
||||
HeRu::SubcarrierRange subcarrierRange =
|
||||
std::make_pair(group.front().first, group.back().second);
|
||||
const auto bandIndices = ConvertHeRuSubcarriers(bw,
|
||||
guardBandwidth,
|
||||
phy->GetSubcarrierSpacing(),
|
||||
subcarrierRange,
|
||||
i);
|
||||
const auto bandFrequencies = phy->ConvertIndicesToFrequencies(bandIndices);
|
||||
WifiSpectrumBandInfo band = {bandIndices, bandFrequencies};
|
||||
std::size_t index =
|
||||
(bw == 160 && phyIndex > nRus / 2 ? phyIndex - nRus / 2 : phyIndex);
|
||||
const auto p20Index = phy->GetOperatingChannel().GetPrimaryChannelIndex(20);
|
||||
bool primary80IsLower80 = (p20Index < bw / 40);
|
||||
bool primary80 = (bw < 160 || ruType == HeRu::RU_2x996_TONE ||
|
||||
(primary80IsLower80 && phyIndex <= nRus / 2) ||
|
||||
(!primary80IsLower80 && phyIndex > nRus / 2));
|
||||
HeRu::RuSpec ru(ruType, index, primary80);
|
||||
NS_ABORT_IF(ru.GetPhyIndex(bw, p20Index) != phyIndex);
|
||||
ruBands.insert({band.indices, ru});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ruBands;
|
||||
}
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
namespace
|
||||
|
||||
@@ -451,6 +451,21 @@ class HePhy : public VhtPhy
|
||||
HeRu::SubcarrierRange subcarrierRange,
|
||||
uint8_t bandIndex = 0);
|
||||
|
||||
/// Map a spectrum band associated with an RU to the RU specification
|
||||
using RuBands = std::map<WifiSpectrumBandIndices, HeRu::RuSpec>;
|
||||
|
||||
/**
|
||||
* Static function to compute the RU bands that belong to a given channel width.
|
||||
*
|
||||
* \param phy the PHY that issued the function call
|
||||
* \param channelWidth the channelWidth the channel width in MHz
|
||||
* \param guardBandwidth width of the guard band in MHz
|
||||
* \returns the computed RU bands that belong to the channel width
|
||||
*/
|
||||
static RuBands GetRuBands(Ptr<const WifiPhy> phy,
|
||||
uint16_t channelWidth,
|
||||
uint16_t guardBandwidth);
|
||||
|
||||
protected:
|
||||
PhyFieldRxStatus ProcessSig(Ptr<Event> event,
|
||||
PhyFieldRxStatus status,
|
||||
|
||||
@@ -145,54 +145,7 @@ SpectrumWifiPhy::UpdateInterferenceHelperBands(std::optional<int32_t> indicesOff
|
||||
}
|
||||
if (GetStandard() >= WIFI_STANDARD_80211ax)
|
||||
{
|
||||
// For a given RU type, some RUs over a channel occupy the same tones as
|
||||
// the corresponding RUs over a subchannel, while some others not. For instance,
|
||||
// the first nine 26-tone RUs over an 80 MHz channel occupy the same tones as
|
||||
// the first nine 26-tone RUs over the lowest 40 MHz subchannel. Therefore, we
|
||||
// need to store all the bands in a set (which removes duplicates) and then
|
||||
// pass the elements in the set to AddBand (to which we cannot pass duplicates)
|
||||
WifiSpectrumPhyInterface::RuBands ruBandsMap{};
|
||||
for (uint16_t bw = 160; bw >= 20; bw = bw / 2)
|
||||
{
|
||||
for (uint32_t i = 0; i < (channelWidth / bw); ++i)
|
||||
{
|
||||
for (uint32_t type = 0; type < 7; type++)
|
||||
{
|
||||
HeRu::RuType ruType = static_cast<HeRu::RuType>(type);
|
||||
std::size_t nRus = HeRu::GetNRus(bw, ruType);
|
||||
for (std::size_t phyIndex = 1; phyIndex <= nRus; phyIndex++)
|
||||
{
|
||||
HeRu::RuType ruType = static_cast<HeRu::RuType>(type);
|
||||
std::size_t nRus = HeRu::GetNRus(bw, ruType);
|
||||
for (std::size_t phyIndex = 1; phyIndex <= nRus; phyIndex++)
|
||||
{
|
||||
HeRu::SubcarrierGroup group =
|
||||
HeRu::GetSubcarrierGroup(bw, ruType, phyIndex);
|
||||
HeRu::SubcarrierRange subcarrierRange =
|
||||
std::make_pair(group.front().first, group.back().second);
|
||||
const auto band =
|
||||
HePhy::ConvertHeRuSubcarriers(bw,
|
||||
GetGuardBandwidth(channelWidth),
|
||||
GetSubcarrierSpacing(),
|
||||
subcarrierRange,
|
||||
i);
|
||||
std::size_t index =
|
||||
(bw == 160 && phyIndex > nRus / 2 ? phyIndex - nRus / 2 : phyIndex);
|
||||
bool primary80IsLower80 =
|
||||
(GetOperatingChannel().GetPrimaryChannelIndex(20) < bw / 40);
|
||||
bool primary80 = (bw < 160 || ruType == HeRu::RU_2x996_TONE ||
|
||||
(primary80IsLower80 && phyIndex <= nRus / 2) ||
|
||||
(!primary80IsLower80 && phyIndex > nRus / 2));
|
||||
HeRu::RuSpec ru(ruType, index, primary80);
|
||||
NS_ABORT_IF(ru.GetPhyIndex(bw,
|
||||
GetOperatingChannel().GetPrimaryChannelIndex(
|
||||
20)) != phyIndex);
|
||||
ruBandsMap.insert({band, ru});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
auto&& ruBandsMap = HePhy::GetRuBands(this, channelWidth, GetGuardBandwidth(channelWidth));
|
||||
for (const auto& bandRuPair : ruBandsMap)
|
||||
{
|
||||
ruBands.push_back(bandRuPair.first);
|
||||
|
||||
@@ -156,12 +156,12 @@ WifiSpectrumPhyInterface::GetChannelWidth() const
|
||||
}
|
||||
|
||||
void
|
||||
WifiSpectrumPhyInterface::SetRuBands(WifiSpectrumPhyInterface::RuBands&& ruBands)
|
||||
WifiSpectrumPhyInterface::SetRuBands(HePhy::RuBands&& ruBands)
|
||||
{
|
||||
m_ruBands = std::move(ruBands);
|
||||
}
|
||||
|
||||
const WifiSpectrumPhyInterface::RuBands&
|
||||
const HePhy::RuBands&
|
||||
WifiSpectrumPhyInterface::GetRuBands() const
|
||||
{
|
||||
return m_ruBands;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "spectrum-wifi-phy.h"
|
||||
|
||||
#include "ns3/he-phy.h"
|
||||
#include "ns3/spectrum-phy.h"
|
||||
|
||||
namespace ns3
|
||||
@@ -125,21 +126,18 @@ class WifiSpectrumPhyInterface : public SpectrumPhy
|
||||
uint32_t bandBandwidth,
|
||||
uint16_t guardBandwidth);
|
||||
|
||||
/// Map a spectrum band associated with an RU to the RU specification
|
||||
using RuBands = std::map<WifiSpectrumBandIndices, HeRu::RuSpec>;
|
||||
|
||||
/**
|
||||
* Set the HE RU spectrum bands handled by this interface (if any)
|
||||
*
|
||||
* \param ruBands the HE RU spectrum bands
|
||||
*/
|
||||
void SetRuBands(RuBands&& ruBands);
|
||||
void SetRuBands(HePhy::RuBands&& ruBands);
|
||||
/**
|
||||
* Get the HE RU spectrum bands handled by this interface
|
||||
*
|
||||
* \return the HE RU spectrum bands
|
||||
*/
|
||||
const RuBands& GetRuBands() const;
|
||||
const HePhy::RuBands& GetRuBands() const;
|
||||
|
||||
private:
|
||||
void DoDispose() override;
|
||||
@@ -152,7 +150,7 @@ class WifiSpectrumPhyInterface : public SpectrumPhy
|
||||
uint16_t m_channelWidth; ///< channel width in MHz
|
||||
Ptr<const SpectrumModel> m_rxSpectrumModel; ///< receive spectrum model
|
||||
|
||||
RuBands m_ruBands; /**< Store all the distinct spectrum bands associated with every RU */
|
||||
HePhy::RuBands m_ruBands; /**< Store all the distinct spectrum bands associated with every RU */
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
Reference in New Issue
Block a user