A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
he-ru.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19
20#ifndef HE_RU_H
21#define HE_RU_H
22
23#include <cstdint>
24#include <map>
25#include <ostream>
26#include <vector>
27
28namespace ns3
29{
30
34class HeRu
35{
36 public:
40 enum RuType
41 {
49 };
50
52 typedef std::pair<int16_t, int16_t> SubcarrierRange;
53
55 typedef std::vector<SubcarrierRange> SubcarrierGroup;
56
65 class RuSpec
66 {
67 public:
71 RuSpec();
79 RuSpec(RuType ruType, std::size_t index, bool primary80MHz);
80
86 RuType GetRuType() const;
92 std::size_t GetIndex() const;
98 bool GetPrimary80MHz() const;
106 std::size_t GetPhyIndex(uint16_t bw, uint8_t p20Index) const;
107
114 bool operator==(const RuSpec& other) const;
121 bool operator!=(const RuSpec& other) const;
122
123 private:
125 std::size_t m_index;
128 };
129
134 {
141 RuSpecCompare(uint16_t channelWidth, uint8_t p20Index);
151 bool operator()(const RuSpec& lhs, const RuSpec& rhs) const;
152
153 private:
154 uint16_t m_channelWidth;
155 uint8_t m_p20Index;
156 };
157
166 static std::size_t GetNRus(uint16_t bw, RuType ruType);
167
176 static std::vector<HeRu::RuSpec> GetRusOfType(uint16_t bw, HeRu::RuType ruType);
177
186 static std::vector<HeRu::RuSpec> GetCentral26TonesRus(uint16_t bw, HeRu::RuType ruType);
187
202 static SubcarrierGroup GetSubcarrierGroup(uint16_t bw, RuType ruType, std::size_t phyIndex);
203
214 static bool DoesOverlap(uint16_t bw, RuSpec ru, const std::vector<RuSpec>& v);
215
227 static bool DoesOverlap(uint16_t bw,
228 RuSpec ru,
229 const SubcarrierGroup& toneRanges,
230 uint8_t p20Index);
231
242 static RuSpec FindOverlappingRu(uint16_t bw, RuSpec referenceRu, RuType searchedRuType);
243
250 static uint16_t GetBandwidth(RuType ruType);
251
258 static RuType GetRuType(uint16_t bandwidth);
259
273 static RuType GetEqualSizedRusForStations(uint16_t bandwidth,
274 std::size_t& nStations,
275 std::size_t& nCentral26TonesRus);
276
278 typedef std::pair<uint8_t, RuType> BwTonesPair;
279
281 typedef std::map<BwTonesPair, std::vector<SubcarrierGroup>> SubcarrierGroups;
282
285
287 using RuAllocationMap = std::map<uint8_t, std::vector<RuSpec>>;
288
291
295 static std::vector<RuSpec> GetRuSpecs(uint8_t ruAllocation);
296
301 static uint8_t GetEqualizedRuAllocation(RuType ruType, bool isOdd);
302
304 static constexpr uint8_t EMPTY_242_TONE_RU = 113;
305};
306
314std::ostream& operator<<(std::ostream& os, const HeRu::RuType& ruType);
315
323std::ostream& operator<<(std::ostream& os, const HeRu::RuSpec& ru);
324
325} // namespace ns3
326
327#endif /* HE_RU_H */
RU Specification.
Definition: he-ru.h:66
std::size_t GetIndex() const
Get the RU index.
Definition: he-ru.cc:460
std::size_t m_index
RU index (starting at 1) as defined by Tables 27-7 to 27-9 of 802.11ax D8.0.
Definition: he-ru.h:125
RuType GetRuType() const
Get the RU type.
Definition: he-ru.cc:453
RuSpec()
Default constructor.
Definition: he-ru.cc:439
bool m_primary80MHz
true if the RU is allocated in the primary 80MHz channel
Definition: he-ru.h:127
std::size_t GetPhyIndex(uint16_t bw, uint8_t p20Index) const
Get the RU PHY index.
Definition: he-ru.cc:474
RuType m_ruType
RU type.
Definition: he-ru.h:124
bool operator==(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:878
bool GetPrimary80MHz() const
Get the primary 80 MHz flag.
Definition: he-ru.cc:467
bool operator!=(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:888
This class stores the subcarrier groups of all the available HE RUs.
Definition: he-ru.h:35
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.
Definition: he-ru.cc:684
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.
Definition: he-ru.cc:625
static std::vector< RuSpec > GetRuSpecs(uint8_t ruAllocation)
Get the RU specs based on RU_ALLOCATION.
Definition: he-ru.cc:392
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:762
static SubcarrierGroup GetSubcarrierGroup(uint16_t 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...
Definition: he-ru.cc:586
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...
Definition: he-ru.cc:490
static constexpr uint8_t EMPTY_242_TONE_RU
Empty 242-tone RU identifier.
Definition: he-ru.h:304
static std::vector< HeRu::RuSpec > GetRusOfType(uint16_t 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...
Definition: he-ru.cc:510
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:55
std::map< uint8_t, std::vector< RuSpec > > RuAllocationMap
RU allocation map.
Definition: he-ru.h:287
static std::vector< HeRu::RuSpec > GetCentral26TonesRus(uint16_t bw, HeRu::RuType ruType)
Get the set of 26-tone RUs that can be additionally allocated if the given bandwidth is split in RUs ...
Definition: he-ru.cc:540
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:52
static const SubcarrierGroups m_heRuSubcarrierGroups
Subcarrier groups for all RUs (with indices being applicable to primary 80 MHz channel)
Definition: he-ru.h:284
static uint8_t GetEqualizedRuAllocation(RuType ruType, bool isOdd)
Get the RU_ALLOCATION value for equal size RUs.
Definition: he-ru.cc:420
std::pair< uint8_t, RuType > BwTonesPair
(bandwidth, number of tones) pair
Definition: he-ru.h:278
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:41
@ RU_26_TONE
Definition: he-ru.h:42
@ RU_484_TONE
Definition: he-ru.h:46
@ RU_996_TONE
Definition: he-ru.h:47
@ RU_106_TONE
Definition: he-ru.h:44
@ RU_52_TONE
Definition: he-ru.h:43
@ RU_242_TONE
Definition: he-ru.h:45
@ RU_2x996_TONE
Definition: he-ru.h:48
static RuType GetEqualSizedRusForStations(uint16_t bandwidth, std::size_t &nStations, std::size_t &nCentral26TonesRus)
Given the channel bandwidth and the number of stations candidate for being assigned an RU,...
Definition: he-ru.cc:812
static RuType GetRuType(uint16_t bandwidth)
Get the RU corresponding to the approximate bandwidth.
Definition: he-ru.cc:787
static const RuAllocationMap m_heRuAllocations
Table 27-26 of IEEE 802.11ax-2021.
Definition: he-ru.h:290
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
Definition: he-ru.h:281
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129
Struct providing a function call operator to compare two RUs.
Definition: he-ru.h:134
uint8_t m_p20Index
Primary20 channel index.
Definition: he-ru.h:155
uint16_t m_channelWidth
The channel width in MHz.
Definition: he-ru.h:154
bool operator()(const RuSpec &lhs, const RuSpec &rhs) const
Function call operator.
Definition: he-ru.cc:380