A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
he-ppdu.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Orange Labs
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: Rediet <getachew.redieteab@orange.com>
18 * Muhammad Iqbal Rochman <muhiqbalcr@uchicago.edu>
19 * Sébastien Deronne <sebastien.deronne@gmail.com> (HeSigHeader)
20 */
21
22#ifndef HE_PPDU_H
23#define HE_PPDU_H
24
25#include "ns3/ofdm-ppdu.h"
26
27#include <variant>
28
35namespace ns3
36{
37
40
41class WifiPsdu;
42
49class HePpdu : public OfdmPpdu
50{
51 public:
54 {
55 uint16_t staId : 11;
56 uint8_t nss : 4;
57 uint8_t mcs : 4;
58 };
59
61 using HeSigBContentChannels = std::vector<std::vector<HeSigBUserSpecificField>>;
62
67 {
68 uint8_t m_format{1};
69 uint8_t m_bssColor{0};
70 uint8_t m_mcs{0};
71 uint8_t m_bandwidth{0};
72 uint8_t m_giLtfSize{0};
73 uint8_t m_nsts{0};
74 }; // struct HeSuSigHeader
75
80 {
81 uint8_t m_format{0};
82 uint8_t m_bssColor{0};
83 uint8_t m_bandwidth{0};
84 }; // struct HeTbSigHeader
85
90 {
91 // HE-SIG-A fields
92 uint8_t m_bssColor{0};
93 uint8_t m_bandwidth{0};
94 uint8_t m_sigBMcs{0};
95 uint8_t m_muMimoUsers;
96 uint8_t m_sigBCompression{0};
97 uint8_t m_giLtfSize{0};
98
99 // HE-SIG-B fields
103 std::optional<Center26ToneRuIndication>
105 }; // struct HeMuSigHeader
106
108 using HeSigHeader = std::variant<std::monostate, HeSuSigHeader, HeTbSigHeader, HeMuSigHeader>;
109
115 {
118 };
119
130 const WifiTxVector& txVector,
131 const WifiPhyOperatingChannel& channel,
132 Time ppduDuration,
133 uint64_t uid);
146 HePpdu(const WifiConstPsduMap& psdus,
147 const WifiTxVector& txVector,
148 const WifiPhyOperatingChannel& channel,
149 Time ppduDuration,
150 uint64_t uid,
151 TxPsdFlag flag);
152
153 Time GetTxDuration() const override;
154 Ptr<WifiPpdu> Copy() const override;
155 WifiPpduType GetType() const override;
156 uint16_t GetStaId() const override;
157 uint16_t GetTxChannelWidth() const override;
158
166 Ptr<const WifiPsdu> GetPsdu(uint8_t bssColor, uint16_t staId = SU_STA_ID) const;
167
173 TxPsdFlag GetTxPsdFlag() const;
174
180 void SetTxPsdFlag(TxPsdFlag flag) const;
181
189 void UpdateTxVectorForUlMu(const std::optional<WifiTxVector>& trigVector) const;
190
202 static std::pair<std::size_t, std::size_t> GetNumRusPerHeSigBContentChannel(
203 uint16_t channelWidth,
204 const RuAllocation& ruAllocation,
205 bool sigBCompression,
206 uint8_t numMuMimoUsers);
207
217 uint8_t p20Index);
218
227 static uint32_t GetSigBFieldSize(uint16_t channelWidth,
228 const RuAllocation& ruAllocation,
229 bool sigBCompression,
230 std::size_t numMuMimoUsers);
231
232 protected:
238 virtual void SetTxVectorFromPhyHeaders(WifiTxVector& txVector) const;
239
249 void SetHeMuUserInfos(WifiTxVector& txVector,
250 const RuAllocation& ruAllocation,
251 const HeSigBContentChannels& contentChannels,
252 bool sigBCompression,
253 uint8_t numMuMimoUsers) const;
254
261 static uint8_t GetChannelWidthEncodingFromMhz(uint16_t channelWidth);
262
269 static uint8_t GetNstsEncodingFromNss(uint8_t nss);
270
278 static uint8_t GetGuardIntervalAndNltfEncoding(uint16_t gi, uint8_t nltf);
279
286 static uint8_t GetNssFromNstsEncoding(uint8_t nsts);
287
294 static uint16_t GetChannelWidthMhzFromEncoding(uint8_t bandwidth);
295
302 static uint16_t GetGuardIntervalFromEncoding(uint8_t giAndNltfSize);
303
310 static uint8_t GetMuMimoUsersEncoding(uint8_t nUsers);
311
318 static uint8_t GetMuMimoUsersFromEncoding(uint8_t encoding);
319
321
322 private:
323 std::string PrintPayload() const override;
324 WifiTxVector DoGetTxVector() const override;
325
332 void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration);
333
339 void SetLSigHeader(Time ppduDuration);
340
346 void SetHeSigHeader(const WifiTxVector& txVector);
347
352 virtual bool IsMu() const;
353
358 virtual bool IsDlMu() const;
359
364 virtual bool IsUlMu() const;
365
367}; // class HePpdu
368
376std::ostream& operator<<(std::ostream& os, const HePpdu::TxPsdFlag& flag);
377
378} // namespace ns3
379
380#endif /* HE_PPDU_H */
HE PPDU (11ax)
Definition: he-ppdu.h:50
std::vector< std::vector< HeSigBUserSpecificField > > HeSigBContentChannels
HE SIG-B Content Channels.
Definition: he-ppdu.h:61
HeSigHeader m_heSig
the HE-SIG PHY header
Definition: he-ppdu.h:366
void SetTxPsdFlag(TxPsdFlag flag) const
Definition: he-ppdu.cc:443
WifiTxVector DoGetTxVector() const override
Get the TXVECTOR used to send the PPDU.
Definition: he-ppdu.cc:167
virtual void SetTxVectorFromPhyHeaders(WifiTxVector &txVector) const
Fill in the TXVECTOR from PHY headers.
Definition: he-ppdu.cc:176
void UpdateTxVectorForUlMu(const std::optional< WifiTxVector > &trigVector) const
Update the TXVECTOR for HE TB PPDUs, since the information to decode HE TB PPDUs is not available fro...
Definition: he-ppdu.cc:450
Ptr< WifiPpdu > Copy() const override
Copy this instance.
Definition: he-ppdu.cc:336
static uint16_t GetGuardIntervalFromEncoding(uint8_t giAndNltfSize)
Convert guard interval (in ns) from its encoding in HE-SIG-A.
Definition: he-ppdu.cc:758
static uint16_t GetChannelWidthMhzFromEncoding(uint8_t bandwidth)
Convert channel width expressed in MHz from bandwidth field encoding in HE-SIG-A.
Definition: he-ppdu.cc:716
TxPsdFlag
The transmit power spectral density flag, namely used to correctly build PSDs for pre-HE and HE porti...
Definition: he-ppdu.h:115
@ PSD_HE_PORTION
HE portion of an HE PPDU.
Definition: he-ppdu.h:117
@ PSD_NON_HE_PORTION
Non-HE portion of an HE PPDU.
Definition: he-ppdu.h:116
virtual bool IsDlMu() const
Return true if the PPDU is a DL MU PPDU.
Definition: he-ppdu.cc:362
Time GetTxDuration() const override
Get the total transmission duration of the PPDU.
Definition: he-ppdu.cc:314
virtual bool IsUlMu() const
Return true if the PPDU is an UL MU PPDU.
Definition: he-ppdu.cc:368
static std::pair< std::size_t, std::size_t > GetNumRusPerHeSigBContentChannel(uint16_t channelWidth, const RuAllocation &ruAllocation, bool sigBCompression, uint8_t numMuMimoUsers)
Get the number of STAs per HE-SIG-B content channel.
Definition: he-ppdu.cc:486
static uint8_t GetNstsEncodingFromNss(uint8_t nss)
Convert number of spatial streams to NSTS field encoding in HE-SIG-A.
Definition: he-ppdu.cc:776
void SetHeSigHeader(const WifiTxVector &txVector)
Fill in the HE-SIG header.
Definition: he-ppdu.cc:121
static uint8_t GetNssFromNstsEncoding(uint8_t nsts)
Convert number of spatial streams from NSTS field encoding in HE-SIG-A.
Definition: he-ppdu.cc:783
std::variant< std::monostate, HeSuSigHeader, HeTbSigHeader, HeMuSigHeader > HeSigHeader
type of the HE-SIG PHY header
Definition: he-ppdu.h:108
void SetPhyHeaders(const WifiTxVector &txVector, Time ppduDuration)
Fill in the PHY headers.
Definition: he-ppdu.cc:94
uint16_t GetTxChannelWidth() const override
Get the channel width over which the PPDU will effectively be transmitted.
Definition: he-ppdu.cc:418
std::string PrintPayload() const override
Print the payload of the PPDU.
Definition: he-ppdu.cc:679
uint16_t GetStaId() const override
Get the ID of the STA that transmitted the PPDU for UL MU, SU_STA_ID otherwise.
Definition: he-ppdu.cc:411
static HeSigBContentChannels GetHeSigBContentChannels(const WifiTxVector &txVector, uint8_t p20Index)
Get the HE SIG-B content channels for a given PPDU IEEE 802.11ax-2021 27.3.11.8.2 HE-SIG-B content ch...
Definition: he-ppdu.cc:554
void SetHeMuUserInfos(WifiTxVector &txVector, const RuAllocation &ruAllocation, const HeSigBContentChannels &contentChannels, bool sigBCompression, uint8_t numMuMimoUsers) const
Reconstruct HeMuUserInfoMap from HE-SIG-B header.
Definition: he-ppdu.cc:225
WifiPpduType GetType() const override
Return the PPDU type (.
Definition: he-ppdu.cc:342
TxPsdFlag GetTxPsdFlag() const
Definition: he-ppdu.cc:437
static uint8_t GetMuMimoUsersEncoding(uint8_t nUsers)
Convert number of MU-MIMO users to its encoding in HE-SIG-A.
Definition: he-ppdu.cc:789
virtual bool IsMu() const
Return true if the PPDU is a MU PPDU.
Definition: he-ppdu.cc:356
static uint8_t GetGuardIntervalAndNltfEncoding(uint16_t gi, uint8_t nltf)
Convert guard interval (in ns) and NLTF to its encoding in HE-SIG-A.
Definition: he-ppdu.cc:737
void SetLSigHeader(Time ppduDuration)
Fill in the L-SIG header.
Definition: he-ppdu.cc:102
static uint32_t GetSigBFieldSize(uint16_t channelWidth, const RuAllocation &ruAllocation, bool sigBCompression, std::size_t numMuMimoUsers)
Get variable length HE SIG-B field size.
Definition: he-ppdu.cc:639
static uint8_t GetChannelWidthEncodingFromMhz(uint16_t channelWidth)
Convert channel width expressed in MHz to bandwidth field encoding in HE-SIG-A.
Definition: he-ppdu.cc:695
TxPsdFlag m_txPsdFlag
the transmit power spectral density flag
Definition: he-ppdu.h:320
static uint8_t GetMuMimoUsersFromEncoding(uint8_t encoding)
Convert number of MU-MIMO users from its encoding in HE-SIG-A.
Definition: he-ppdu.cc:796
OFDM PPDU (11a)
Definition: ofdm-ppdu.h:47
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Class that keeps track of all information about the current PHY operating channel.
Ptr< const WifiPsdu > GetPsdu() const
Get the payload of the PPDU.
Definition: wifi-ppdu.cc:121
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each cons...
Definition: wifi-psdu.h:43
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiPpduType
The type of PPDU (SU, DL MU, or UL MU)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
std::vector< uint8_t > RuAllocation
8 bit RU_ALLOCATION per 20 MHz
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Definition: wifi-mode.h:35
constexpr size_t WIFI_MAX_NUM_HE_SIGB_CONTENT_CHANNELS
HE SIG-B Content Channels.
Definition: he-ppdu.h:39
HE-SIG PHY header for HE MU PPDUs (HE-SIG-A1/A2/B)
Definition: he-ppdu.h:90
uint8_t m_giLtfSize
GI+LTF Size field.
Definition: he-ppdu.h:97
uint8_t m_bssColor
BSS color field.
Definition: he-ppdu.h:92
HeSigBContentChannels m_contentChannels
HE SIG-B Content Channels.
Definition: he-ppdu.h:102
RuAllocation m_ruAllocation
RU allocations that are going to be carried in SIG-B common subfields.
Definition: he-ppdu.h:100
uint8_t m_sigBMcs
HE-SIG-B MCS.
Definition: he-ppdu.h:94
uint8_t m_sigBCompression
SIG-B compression.
Definition: he-ppdu.h:96
std::optional< Center26ToneRuIndication > m_center26ToneRuIndication
center 26 tone RU indication in SIG-B common subfields
Definition: he-ppdu.h:104
uint8_t m_muMimoUsers
MU-MIMO users.
Definition: he-ppdu.h:95
uint8_t m_bandwidth
Bandwidth field.
Definition: he-ppdu.h:93
User Specific Fields in HE-SIG-Bs.
Definition: he-ppdu.h:54
uint8_t nss
number of spatial streams
Definition: he-ppdu.h:56
HE-SIG PHY header for HE SU PPDUs (HE-SIG-A1/A2)
Definition: he-ppdu.h:67
uint8_t m_bssColor
BSS color field.
Definition: he-ppdu.h:69
uint8_t m_mcs
MCS field.
Definition: he-ppdu.h:70
uint8_t m_giLtfSize
GI+LTF Size field.
Definition: he-ppdu.h:72
uint8_t m_bandwidth
Bandwidth field.
Definition: he-ppdu.h:71
uint8_t m_nsts
NSTS.
Definition: he-ppdu.h:73
uint8_t m_format
Format bit.
Definition: he-ppdu.h:68
HE-SIG PHY header for HE TB PPDUs (HE-SIG-A1/A2)
Definition: he-ppdu.h:80
uint8_t m_format
Format bit.
Definition: he-ppdu.h:81
uint8_t m_bandwidth
Bandwidth field.
Definition: he-ppdu.h:83
uint8_t m_bssColor
BSS color field.
Definition: he-ppdu.h:82