A Discrete-Event Network Simulator
API
he-ru.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2018
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Stefano Avallone <stavallo@unina.it>
19  */
20 
21 #ifndef HE_RU_H
22 #define HE_RU_H
23 
24 #include <map>
25 #include <vector>
26 #include <cstdint>
27 #include <ostream>
28 
29 namespace ns3 {
30 
31 
35 class HeRu
36 {
37 public:
41  enum RuType
42  {
50  };
51 
53  typedef std::pair<int16_t, int16_t> SubcarrierRange;
54 
56  typedef std::vector<SubcarrierRange> SubcarrierGroup;
57 
58 
67  class RuSpec
68  {
69  public:
73  RuSpec ();
81  RuSpec (RuType ruType, std::size_t index, bool primary80MHz);
82 
88  RuType GetRuType (void) const;
94  std::size_t GetIndex (void) const;
100  bool GetPrimary80MHz (void) const;
107  void SetPhyIndex (uint16_t bw, uint8_t p20Index);
113  bool IsPhyIndexSet (void) const;
119  std::size_t GetPhyIndex (void) const;
120 
127  bool operator== (const RuSpec& other) const;
134  bool operator!= (const RuSpec& other) const;
135 
136  private:
138  std::size_t m_index;
141  std::size_t m_phyIndex;
145  };
146 
147 
156  static std::size_t GetNRus (uint16_t bw, RuType ruType);
157 
166  static std::vector<HeRu::RuSpec> GetRusOfType (uint16_t bw, HeRu::RuType ruType);
167 
176  static std::vector<HeRu::RuSpec> GetCentral26TonesRus (uint16_t bw, HeRu::RuType ruType);
177 
192  static SubcarrierGroup GetSubcarrierGroup (uint16_t bw, RuType ruType, std::size_t phyIndex);
193 
204  static bool DoesOverlap (uint16_t bw, RuSpec ru, const std::vector<RuSpec> &v);
205 
216  static bool DoesOverlap (uint16_t bw, RuSpec ru, const SubcarrierGroup &toneRanges);
217 
228  static RuSpec FindOverlappingRu (uint16_t bw, RuSpec referenceRu, RuType searchedRuType);
229 
236  static uint16_t GetBandwidth (RuType ruType);
237 
244  static RuType GetRuType (uint16_t bandwidth);
245 
259  static RuType GetEqualSizedRusForStations (uint16_t bandwidth, std::size_t& nStations,
260  std::size_t& nCentral26TonesRus);
261 
263  typedef std::pair<uint8_t, RuType> BwTonesPair;
264 
266  typedef std::map<BwTonesPair, std::vector<SubcarrierGroup> > SubcarrierGroups;
267 
270 };
271 
279 std::ostream& operator<< (std::ostream& os, const HeRu::RuType &ruType);
280 
288 std::ostream& operator<< (std::ostream& os, const HeRu::RuSpec &ru);
289 
290 } //namespace ns3
291 
292 #endif /* HE_RU_H */
RU Specification.
Definition: he-ru.h:68
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:138
RuType GetRuType(void) const
Get the RU type.
Definition: he-ru.cc:167
RuSpec()
Default constructor.
Definition: he-ru.cc:152
bool GetPrimary80MHz(void) const
Get the primary 80 MHz flag.
Definition: he-ru.cc:181
bool m_primary80MHz
true if the RU is allocated in the primary 80MHz channel
Definition: he-ru.h:140
bool IsPhyIndexSet(void) const
Return true if the RU PHY index has been set, false otherwise.
Definition: he-ru.cc:206
RuType m_ruType
RU type.
Definition: he-ru.h:137
bool operator==(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:602
std::size_t m_phyIndex
the RU PHY index, which is used to indicate whether an RU is located in the lower half or the higher ...
Definition: he-ru.h:141
std::size_t GetIndex(void) const
Get the RU index.
Definition: he-ru.cc:174
void SetPhyIndex(uint16_t bw, uint8_t p20Index)
Set the RU PHY index.
Definition: he-ru.cc:188
bool operator!=(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:613
std::size_t GetPhyIndex(void) const
Get the RU PHY index.
Definition: he-ru.cc:212
This class stores the subcarrier groups of all the available HE RUs.
Definition: he-ru.h:36
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:410
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:352
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:487
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:313
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:219
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:239
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:56
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:267
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
static const SubcarrierGroups m_heRuSubcarrierGroups
Subcarrier groups for all RUs (with indices being applicable to primary 80 MHz channel)
Definition: he-ru.h:269
std::pair< uint8_t, RuType > BwTonesPair
(bandwidth, number of tones) pair
Definition: he-ru.h:263
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:42
@ RU_26_TONE
Definition: he-ru.h:43
@ RU_484_TONE
Definition: he-ru.h:47
@ RU_996_TONE
Definition: he-ru.h:48
@ RU_106_TONE
Definition: he-ru.h:45
@ RU_52_TONE
Definition: he-ru.h:44
@ RU_242_TONE
Definition: he-ru.h:46
@ RU_2x996_TONE
Definition: he-ru.h:49
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:537
static RuType GetRuType(uint16_t bandwidth)
Get the RU corresponding to the approximate bandwidth.
Definition: he-ru.cc:512
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
Definition: he-ru.h:266
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:139