A Discrete-Event Network Simulator
API
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;
122 
123  private:
125  std::size_t m_index;
128  };
129 
138  static std::size_t GetNRus(uint16_t bw, RuType ruType);
139 
148  static std::vector<HeRu::RuSpec> GetRusOfType(uint16_t bw, HeRu::RuType ruType);
149 
158  static std::vector<HeRu::RuSpec> GetCentral26TonesRus(uint16_t bw, HeRu::RuType ruType);
159 
174  static SubcarrierGroup GetSubcarrierGroup(uint16_t bw, RuType ruType, std::size_t phyIndex);
175 
186  static bool DoesOverlap(uint16_t bw, RuSpec ru, const std::vector<RuSpec>& v);
187 
199  static bool DoesOverlap(uint16_t bw,
200  RuSpec ru,
201  const SubcarrierGroup& toneRanges,
202  uint8_t p20Index);
203 
214  static RuSpec FindOverlappingRu(uint16_t bw, RuSpec referenceRu, RuType searchedRuType);
215 
222  static uint16_t GetBandwidth(RuType ruType);
223 
230  static RuType GetRuType(uint16_t bandwidth);
231 
245  static RuType GetEqualSizedRusForStations(uint16_t bandwidth,
246  std::size_t& nStations,
247  std::size_t& nCentral26TonesRus);
248 
250  typedef std::pair<uint8_t, RuType> BwTonesPair;
251 
253  typedef std::map<BwTonesPair, std::vector<SubcarrierGroup>> SubcarrierGroups;
254 
257 
259  using RuAllocationMap = std::map<uint8_t, std::vector<RuSpec>>;
260 
263 
267  static std::vector<RuSpec> GetRuSpecs(uint8_t ruAllocation);
268 
273  static uint8_t GetEqualizedRuAllocation(RuType ruType, bool isOdd);
274 
276  static constexpr uint8_t EMPTY_242_TONE_RU = 113;
277 };
278 
286 std::ostream& operator<<(std::ostream& os, const HeRu::RuType& ruType);
287 
295 std::ostream& operator<<(std::ostream& os, const HeRu::RuSpec& ru);
296 
297 } // namespace ns3
298 
299 #endif /* HE_RU_H */
RU Specification.
Definition: he-ru.h:66
std::size_t GetIndex() const
Get the RU index.
Definition: he-ru.cc:442
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:435
RuSpec()
Default constructor.
Definition: he-ru.cc:421
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:456
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:860
bool GetPrimary80MHz() const
Get the primary 80 MHz flag.
Definition: he-ru.cc:449
bool operator!=(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:870
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:666
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:607
static std::vector< RuSpec > GetRuSpecs(uint8_t ruAllocation)
Get the RU specs based on RU_ALLOCATION.
Definition: he-ru.cc:374
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:744
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:568
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:472
static constexpr uint8_t EMPTY_242_TONE_RU
Empty 242-tone RU identifier.
Definition: he-ru.h:276
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:492
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:259
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:522
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:256
static uint8_t GetEqualizedRuAllocation(RuType ruType, bool isOdd)
Get the RU_ALLOCATION value for equal size RUs.
Definition: he-ru.cc:402
std::pair< uint8_t, RuType > BwTonesPair
(bandwidth, number of tones) pair
Definition: he-ru.h:250
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:794
static RuType GetRuType(uint16_t bandwidth)
Get the RU corresponding to the approximate bandwidth.
Definition: he-ru.cc:769
static const RuAllocationMap m_heRuAllocations
Table 27-26 of IEEE 802.11ax-2021.
Definition: he-ru.h:262
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
Definition: he-ru.h:253
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