12#include "ns3/assert.h"
364 : m_channelWidth(channelWidth),
372 const auto lhsIndex =
lhs.GetPhyIndex(m_channelWidth, m_p20Index);
381std::vector<HeRu::RuSpec>
384 std::optional<std::size_t>
idx;
421 return isOdd ? 15 : 112;
423 return isOdd ? 128 : 96;
464 return m_primary80MHz;
479 return m_index +
GetNRus(bw, m_ruType) / 2;
500 return (bw ==
MHz_u{160} ? 2 : 1) *
it->second.size();
503std::vector<HeRu::RuSpec>
509 return {{
ruType, 1,
true}};
512 std::vector<HeRu::RuSpec>
ret;
515 if (bw ==
MHz_u{160})
533std::vector<HeRu::RuSpec>
536 std::vector<std::size_t> indices;
542 indices.push_back(5);
544 else if (bw ==
MHz_u{40})
546 indices.insert(indices.end(), {5, 14});
548 else if (bw >=
MHz_u{80})
550 indices.insert(indices.end(), {5, 14, 19, 24, 33});
557 indices.push_back(19);
561 std::vector<HeRu::RuSpec>
ret;
564 if (bw ==
MHz_u{160})
571 for (
const auto& index : indices)
585 return {{-1012, -3}, {3, 1012}};
593 int16_t shift = (bw ==
MHz_u{160}) ? -512 : 0;
607 if (bw ==
MHz_u{160})
609 for (
auto& range :
group)
611 range.first += shift;
612 range.second += shift;
668 if (range.second >= r.first && r.second >= range.first)
684 if (bw ==
MHz_u{160})
698 std::size_t index = 1;
783 switch (
static_cast<uint16_t
>(bandwidth))
816 if (ru.first.first == bandwidth && ru.second.size() <=
nStations)
822 else if (bandwidth ==
MHz_u{160} && ru.first.first ==
MHz_u{80} &&
843 if (bandwidth ==
MHz_u{20})
847 else if (bandwidth ==
MHz_u{40})
864 if (bandwidth ==
MHz_u{160})
878 return m_ruType ==
other.m_ruType && m_index ==
other.m_index &&
879 m_primary80MHz ==
other.m_primary80MHz;
885 return !(*
this ==
other);
894 return std::tie(m_ruType, m_index, m_primary80MHz) <
std::size_t GetIndex() const
Get the RU index.
RuType GetRuType() const
Get the RU type.
bool operator<(const RuSpec &other) const
Compare this RU to the given RU.
RuSpec()
Default constructor.
std::size_t GetPhyIndex(MHz_u bw, uint8_t p20Index) const
Get the RU PHY index.
bool operator==(const RuSpec &other) const
Compare this RU to the given RU.
bool GetPrimary80MHz() const
Get the primary 80 MHz flag.
bool operator!=(const RuSpec &other) const
Compare this RU to the given RU.
static std::vector< HeRu::RuSpec > GetCentral26TonesRus(MHz_u bw, HeRu::RuType ruType)
Get the set of 26-tone RUs that can be additionally allocated if the given bandwidth is split in RUs ...
static std::vector< RuSpec > GetRuSpecs(uint8_t ruAllocation)
Get the RU specs based on RU_ALLOCATION.
static bool DoesOverlap(MHz_u bw, RuSpec ru, const std::vector< RuSpec > &v)
Check whether the given RU overlaps with the given set of RUs.
static MHz_u GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
static RuType GetRuType(MHz_u bandwidth)
Get the RU corresponding to the approximate bandwidth.
static std::vector< HeRu::RuSpec > GetRusOfType(MHz_u bw, HeRu::RuType ruType)
Get the set of distinct RUs of the given type (number of tones) available in a HE PPDU of the given b...
static RuType GetEqualSizedRusForStations(MHz_u bandwidth, std::size_t &nStations, std::size_t &nCentral26TonesRus)
Given the channel bandwidth and the number of stations candidate for being assigned an RU,...
static SubcarrierGroup GetSubcarrierGroup(MHz_u bw, RuType ruType, std::size_t phyIndex)
Get the subcarrier group of the RU having the given PHY index among all the RUs of the given type (nu...
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
std::map< uint8_t, std::vector< RuSpec > > RuAllocationMap
RU allocation map.
static RuSpec FindOverlappingRu(MHz_u bw, RuSpec referenceRu, RuType searchedRuType)
Find the RU allocation of the given RU type overlapping the given reference RU allocation.
static const SubcarrierGroups m_heRuSubcarrierGroups
Subcarrier groups for all RUs (with indices being applicable to primary 80 MHz channel)
static uint8_t GetEqualizedRuAllocation(RuType ruType, bool isOdd)
Get the RU_ALLOCATION value for equal size RUs.
static std::size_t GetNRus(MHz_u bw, RuType ruType)
Get the number of distinct RUs of the given type (number of tones) available in a HE PPDU of the give...
RuType
The different HE Resource Unit (RU) types.
static const RuAllocationMap m_heRuAllocations
Table 27-26 of IEEE 802.11ax-2021.
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double MHz_u
MHz weak type.
std::ostream & operator<<(std::ostream &os, const Angles &a)
RuSpecCompare(MHz_u channelWidth, uint8_t p20Index)
Constructor.
bool operator()(const RuSpec &lhs, const RuSpec &rhs) const
Function call operator.