A Discrete-Event Network Simulator
QKDNetSim v2.0 (NS-3 v3.41) @ (+)
API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
28 namespace ns3
29 {
30 
34 class 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;
128  bool operator<(const RuSpec& other) const;
129 
130  private:
132  std::size_t m_index;
135  };
136 
141  {
148  RuSpecCompare(uint16_t channelWidth, uint8_t p20Index);
158  bool operator()(const RuSpec& lhs, const RuSpec& rhs) const;
159 
160  private:
161  uint16_t m_channelWidth;
162  uint8_t m_p20Index;
163  };
164 
173  static std::size_t GetNRus(uint16_t bw, RuType ruType);
174 
183  static std::vector<HeRu::RuSpec> GetRusOfType(uint16_t bw, HeRu::RuType ruType);
184 
193  static std::vector<HeRu::RuSpec> GetCentral26TonesRus(uint16_t bw, HeRu::RuType ruType);
194 
209  static SubcarrierGroup GetSubcarrierGroup(uint16_t bw, RuType ruType, std::size_t phyIndex);
210 
221  static bool DoesOverlap(uint16_t bw, RuSpec ru, const std::vector<RuSpec>& v);
222 
234  static bool DoesOverlap(uint16_t bw,
235  RuSpec ru,
236  const SubcarrierGroup& toneRanges,
237  uint8_t p20Index);
238 
249  static RuSpec FindOverlappingRu(uint16_t bw, RuSpec referenceRu, RuType searchedRuType);
250 
257  static uint16_t GetBandwidth(RuType ruType);
258 
265  static RuType GetRuType(uint16_t bandwidth);
266 
280  static RuType GetEqualSizedRusForStations(uint16_t bandwidth,
281  std::size_t& nStations,
282  std::size_t& nCentral26TonesRus);
283 
285  typedef std::pair<uint8_t, RuType> BwTonesPair;
286 
288  typedef std::map<BwTonesPair, std::vector<SubcarrierGroup>> SubcarrierGroups;
289 
292 
294  using RuAllocationMap = std::map<uint8_t, std::vector<RuSpec>>;
295 
298 
302  static std::vector<RuSpec> GetRuSpecs(uint8_t ruAllocation);
303 
308  static uint8_t GetEqualizedRuAllocation(RuType ruType, bool isOdd);
309 
311  static constexpr uint8_t EMPTY_242_TONE_RU = 113;
312 };
313 
321 std::ostream& operator<<(std::ostream& os, const HeRu::RuType& ruType);
322 
330 std::ostream& operator<<(std::ostream& os, const HeRu::RuSpec& ru);
331 
332 } // namespace ns3
333 
334 #endif /* HE_RU_H */
RU Specification.
Definition: he-ru.h:66
std::size_t GetIndex() const
Get the RU index.
Definition: he-ru.cc:461
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:132
RuType GetRuType() const
Get the RU type.
Definition: he-ru.cc:454
bool operator<(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:895
RuSpec()
Default constructor.
Definition: he-ru.cc:440
bool m_primary80MHz
true if the RU is allocated in the primary 80MHz channel
Definition: he-ru.h:134
std::size_t GetPhyIndex(uint16_t bw, uint8_t p20Index) const
Get the RU PHY index.
Definition: he-ru.cc:475
RuType m_ruType
RU type.
Definition: he-ru.h:131
bool operator==(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:879
bool GetPrimary80MHz() const
Get the primary 80 MHz flag.
Definition: he-ru.cc:468
bool operator!=(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:889
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:685
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:626
static std::vector< RuSpec > GetRuSpecs(uint8_t ruAllocation)
Get the RU specs based on RU_ALLOCATION.
Definition: he-ru.cc:393
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:763
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:587
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:491
static constexpr uint8_t EMPTY_242_TONE_RU
Empty 242-tone RU identifier.
Definition: he-ru.h:311
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:511
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:294
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:541
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:291
static uint8_t GetEqualizedRuAllocation(RuType ruType, bool isOdd)
Get the RU_ALLOCATION value for equal size RUs.
Definition: he-ru.cc:421
std::pair< uint8_t, RuType > BwTonesPair
(bandwidth, number of tones) pair
Definition: he-ru.h:285
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:813
static RuType GetRuType(uint16_t bandwidth)
Get the RU corresponding to the approximate bandwidth.
Definition: he-ru.cc:788
static const RuAllocationMap m_heRuAllocations
Table 27-26 of IEEE 802.11ax-2021.
Definition: he-ru.h:297
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
Definition: he-ru.h:288
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:159
Struct providing a function call operator to compare two RUs.
Definition: he-ru.h:141
RuSpecCompare(uint16_t channelWidth, uint8_t p20Index)
Constructor.
Definition: he-ru.cc:374
uint8_t m_p20Index
Primary20 channel index.
Definition: he-ru.h:162
uint16_t m_channelWidth
The channel width in MHz.
Definition: he-ru.h:161
bool operator()(const RuSpec &lhs, const RuSpec &rhs) const
Function call operator.
Definition: he-ru.cc:381