22 #include "ns3/abort.h" 168 return (bw == 160 ? 2 : 1) * it->second.size ();
176 NS_ABORT_MSG_IF (bw != 160,
"2x996 tone RU can only be used on 160 MHz band");
177 return {{-1012, -3}, {3, 1012}};
183 std::size_t indexInPrimary80MHz = index;
184 std::size_t numRus =
GetNRus (bw, ruType);
185 int16_t shift = (bw == 160) ? -512 : 0;
186 if (bw == 160 && index > (numRus / 2))
189 indexInPrimary80MHz = index - (numRus / 2);
196 NS_ABORT_MSG_IF (!indexInPrimary80MHz || indexInPrimary80MHz > it->second.size (),
"RU index not available");
201 for (
auto & range : group)
203 range.first += shift;
204 range.second += shift;
238 for (
const auto & range : toneRanges)
246 for (
auto& r : rangesRu)
248 if (range.second >= r.first && r.second >= range.first)
261 searchedRu.
ruType = searchedRuType;
264 std::size_t numRusPer80Mhz;
265 std::vector<bool> primary80MhzFlags;
268 primary80MhzFlags.push_back (
true);
269 primary80MhzFlags.push_back (
false);
270 numRusPer80Mhz = numRus / 2;
275 numRusPer80Mhz = numRus;
278 std::size_t index = 1;
279 for (
const auto primary80Mhz : primary80MhzFlags)
282 for (std::size_t indexPer80Mhz = 1; indexPer80Mhz <= numRusPer80Mhz; ++indexPer80Mhz, ++index)
284 searchedRu.
index = index;
291 NS_ABORT_MSG (
"The searched RU type " << searchedRuType <<
" was not found for bw=" << bw <<
" and referenceRu=" << referenceRu);
328 os <<
"RU{" << ru.
ruType <<
"/" << ru.
index <<
"/" << (ru.
primary80MHz ?
"primary80MHz" :
"secondary80MHz") <<
"}";
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
bool primary80MHz
true if the RU is allocated in the primary 80MHz channel
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
static bool DoesOverlap(uint16_t bw, RuSpec ru, const std::vector< RuSpec > &v)
Check whether the given RU overlaps with the given set of RUs.
std::ostream & operator<<(std::ostream &os, const Angles &a)
static RuSpec FindOverlappingRu(uint16_t bw, RuSpec referenceRu, RuType searchedRuType)
Find the RU allocation of the given RU type overlapping the given reference RU allocation.
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
static const SubcarrierGroups m_heRuSubcarrierGroups
static std::size_t GetNRus(uint16_t bw, RuType ruType)
Get the number of distinct RUs of the given type (number of tones) available in a HE PPDU of the give...
static RuType GetRuType(uint16_t bandwidth)
Get the RU corresponding to the approximate bandwidth.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
RuType
The different HE Resource Unit (RU) types.
static SubcarrierGroup GetSubcarrierGroup(uint16_t bw, RuType ruType, std::size_t index)
Get the subcarrier group of the RU having the given index among all the RUs of the given type (number...
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
std::size_t index
index (starting at 1)