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
28namespace ns3
29{
30
34class 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;
105 void SetPhyIndex(uint16_t bw, uint8_t p20Index);
111 bool IsPhyIndexSet() const;
117 std::size_t GetPhyIndex() const;
118
125 bool operator==(const RuSpec& other) const;
132 bool operator!=(const RuSpec& other) const;
133
134 private:
136 std::size_t m_index;
139 std::size_t m_phyIndex;
143 };
144
153 static std::size_t GetNRus(uint16_t bw, RuType ruType);
154
163 static std::vector<HeRu::RuSpec> GetRusOfType(uint16_t bw, HeRu::RuType ruType);
164
173 static std::vector<HeRu::RuSpec> GetCentral26TonesRus(uint16_t bw, HeRu::RuType ruType);
174
189 static SubcarrierGroup GetSubcarrierGroup(uint16_t bw, RuType ruType, std::size_t phyIndex);
190
201 static bool DoesOverlap(uint16_t bw, RuSpec ru, const std::vector<RuSpec>& v);
202
213 static bool DoesOverlap(uint16_t bw, RuSpec ru, const SubcarrierGroup& toneRanges);
214
225 static RuSpec FindOverlappingRu(uint16_t bw, RuSpec referenceRu, RuType searchedRuType);
226
233 static uint16_t GetBandwidth(RuType ruType);
234
241 static RuType GetRuType(uint16_t bandwidth);
242
256 static RuType GetEqualSizedRusForStations(uint16_t bandwidth,
257 std::size_t& nStations,
258 std::size_t& nCentral26TonesRus);
259
261 typedef std::pair<uint8_t, RuType> BwTonesPair;
262
264 typedef std::map<BwTonesPair, std::vector<SubcarrierGroup>> SubcarrierGroups;
265
268
270 using RuAllocationMap = std::map<uint8_t, std::vector<RuSpec>>;
271
274
278 static std::vector<RuSpec> GetRuSpecs(uint8_t ruAllocation);
279
284 static uint8_t GetEqualizedRuAllocation(RuType ruType, bool isOdd);
285
287 static constexpr uint8_t EMPTY_242_TONE_RU = 113;
288};
289
297std::ostream& operator<<(std::ostream& os, const HeRu::RuType& ruType);
298
306std::ostream& operator<<(std::ostream& os, const HeRu::RuSpec& ru);
307
308} // namespace ns3
309
310#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:136
RuType GetRuType() const
Get the RU type.
Definition: he-ru.cc:435
std::size_t GetPhyIndex() const
Get the RU PHY index.
Definition: he-ru.cc:478
RuSpec()
Default constructor.
Definition: he-ru.cc:420
bool IsPhyIndexSet() const
Return true if the RU PHY index has been set, false otherwise.
Definition: he-ru.cc:472
bool m_primary80MHz
true if the RU is allocated in the primary 80MHz channel
Definition: he-ru.h:138
RuType m_ruType
RU type.
Definition: he-ru.h:135
bool operator==(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:876
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:139
bool GetPrimary80MHz() const
Get the primary 80 MHz flag.
Definition: he-ru.cc:449
void SetPhyIndex(uint16_t bw, uint8_t p20Index)
Set the RU PHY index.
Definition: he-ru.cc:456
bool operator!=(const RuSpec &other) const
Compare this RU to the given RU.
Definition: he-ru.cc:886
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:678
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:620
static std::vector< RuSpec > GetRuSpecs(uint8_t ruAllocation)
Get the RU specs based on RU_ALLOCATION.
Definition: he-ru.cc:373
static uint16_t GetBandwidth(RuType ruType)
Get the approximate bandwidth occupied by a RU.
Definition: he-ru.cc:760
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:581
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:485
static constexpr uint8_t EMPTY_242_TONE_RU
Empty 242-tone RU identifier.
Definition: he-ru.h:287
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:505
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:270
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:535
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:267
static uint8_t GetEqualizedRuAllocation(RuType ruType, bool isOdd)
Get the RU_ALLOCATION value for equal size RUs.
Definition: he-ru.cc:401
std::pair< uint8_t, RuType > BwTonesPair
(bandwidth, number of tones) pair
Definition: he-ru.h:261
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:810
static RuType GetRuType(uint16_t bandwidth)
Get the RU corresponding to the approximate bandwidth.
Definition: he-ru.cc:785
static const RuAllocationMap m_heRuAllocations
Table 27-26 of IEEE 802.11ax-2021.
Definition: he-ru.h:273
std::map< BwTonesPair, std::vector< SubcarrierGroup > > SubcarrierGroups
map (bandwidth, number of tones) pairs to the group of subcarrier ranges
Definition: he-ru.h:264
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