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 
121  private:
123  std::size_t m_index;
126  std::size_t m_phyIndex;
130  };
131 
132 
141  static std::size_t GetNRus (uint16_t bw, RuType ruType);
142 
151  static std::vector<HeRu::RuSpec> GetRusOfType (uint16_t bw, HeRu::RuType ruType);
152 
161  static std::vector<HeRu::RuSpec> GetCentral26TonesRus (uint16_t bw, HeRu::RuType ruType);
162 
177  static SubcarrierGroup GetSubcarrierGroup (uint16_t bw, RuType ruType, std::size_t phyIndex);
178 
189  static bool DoesOverlap (uint16_t bw, RuSpec ru, const std::vector<RuSpec> &v);
190 
201  static bool DoesOverlap (uint16_t bw, RuSpec ru, const SubcarrierGroup &toneRanges);
202 
213  static RuSpec FindOverlappingRu (uint16_t bw, RuSpec referenceRu, RuType searchedRuType);
214 
221  static uint16_t GetBandwidth (RuType ruType);
222 
229  static RuType GetRuType (uint16_t bandwidth);
230 
244  static RuType GetEqualSizedRusForStations (uint16_t bandwidth, std::size_t& nStations,
245  std::size_t& nCentral26TonesRus);
246 
248  typedef std::pair<uint8_t, RuType> BwTonesPair;
249 
251  typedef std::map<BwTonesPair, std::vector<SubcarrierGroup> > SubcarrierGroups;
252 
255 };
256 
264 std::ostream& operator<< (std::ostream& os, const HeRu::RuType &ruType);
265 
273 std::ostream& operator<< (std::ostream& os, const HeRu::RuSpec &ru);
274 
275 } //namespace ns3
276 
277 #endif /* HE_RU_H */
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:56
RuSpec()
Default constructor.
Definition: he-ru.cc:152
RU Specification.
Definition: he-ru.h:67
bool GetPrimary80MHz(void) const
Get the primary 80 MHz flag.
Definition: he-ru.cc:181
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
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:137
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
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
Definition: he-ru.h:251
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:487
static const SubcarrierGroups m_heRuSubcarrierGroups
Subcarrier groups for all RUs (with indices being applicable to primary 80 MHz channel) ...
Definition: he-ru.h:254
void SetPhyIndex(uint16_t bw, uint8_t p20Index)
Set the RU PHY index.
Definition: he-ru.cc:188
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 RuType GetRuType(uint16_t bandwidth)
Get the RU corresponding to the approximate bandwidth.
Definition: he-ru.cc:512
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
Every class exported by the ns3 library is enclosed in the ns3 namespace.
RuType GetRuType(void) const
Get the RU type.
Definition: he-ru.cc:167
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:41
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
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:123
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
bool m_primary80MHz
true if the RU is allocated in the primary 80MHz channel
Definition: he-ru.h:125
std::pair< uint8_t, RuType > BwTonesPair
(bandwidth, number of tones) pair
Definition: he-ru.h:248
This class stores the subcarrier groups of all the available HE RUs.
Definition: he-ru.h:35
RuType m_ruType
RU type.
Definition: he-ru.h:122
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:126
std::size_t GetIndex(void) const
Get the RU index.
Definition: he-ru.cc:174
bool IsPhyIndexSet(void) const
Return true if the RU PHY index has been set, false otherwise.
Definition: he-ru.cc:206
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::size_t GetPhyIndex(void) const
Get the RU PHY index.
Definition: he-ru.cc:212