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 
64  struct RuSpec
65  {
66  bool primary80MHz;
68  std::size_t index;
69  };
70 
71 
80  static std::size_t GetNRus (uint16_t bw, RuType ruType);
81 
96  static SubcarrierGroup GetSubcarrierGroup (uint16_t bw, RuType ruType, std::size_t index);
97 
108  static bool DoesOverlap (uint16_t bw, RuSpec ru, const std::vector<RuSpec> &v);
109 
120  static bool DoesOverlap (uint16_t bw, RuSpec ru, const SubcarrierGroup &toneRanges);
121 
132  static RuSpec FindOverlappingRu (uint16_t bw, RuSpec referenceRu, RuType searchedRuType);
133 
140  static uint16_t GetBandwidth (RuType ruType);
141 
148  static RuType GetRuType (uint16_t bandwidth);
149 
151  typedef std::pair<uint8_t, RuType> BwTonesPair;
152 
154  typedef std::map<BwTonesPair, std::vector<SubcarrierGroup> > SubcarrierGroups;
155 
158 };
159 
167 std::ostream& operator<< (std::ostream& os, const HeRu::RuType &ruType);
168 
176 std::ostream& operator<< (std::ostream& os, const HeRu::RuSpec &ru);
177 
178 } //namespace ns3
179 
180 #endif /* HE_RU_H */
RuType ruType
RU type.
Definition: he-ru.h:67
std::vector< SubcarrierRange > SubcarrierGroup
a vector of subcarrier ranges defining a subcarrier group
Definition: he-ru.h:56
bool primary80MHz
true if the RU is allocated in the primary 80MHz channel
Definition: he-ru.h:66
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:211
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:258
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
Definition: he-ru.h:154
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:333
static const SubcarrierGroups m_heRuSubcarrierGroups
Definition: he-ru.h:157
RU Specification.
Definition: he-ru.h:64
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:152
static RuType GetRuType(uint16_t bandwidth)
Get the RU corresponding to the approximate bandwidth.
Definition: he-ru.cc:358
Every class exported by the ns3 library is enclosed in the ns3 namespace.
RuType
The different HE Resource Unit (RU) types.
Definition: he-ru.h:41
static SubcarrierGroup GetSubcarrierGroup(uint16_t bw, RuType ruType, std::size_t index)
Get the subcarrier group of the RU having the given index among all the RUs of the given type (number...
Definition: he-ru.cc:172
std::pair< uint8_t, RuType > BwTonesPair
(bandwidth, number of tones) pair
Definition: he-ru.h:151
This class stores the subcarrier groups of all the available HE RUs.
Definition: he-ru.h:35
std::size_t index
index (starting at 1)
Definition: he-ru.h:68