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 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Rediet <getachew.redieteab@orange.com>
7 * Muhammad Iqbal Rochman <muhiqbalcr@uchicago.edu>
8 * Sébastien Deronne <sebastien.deronne@gmail.com> (HeSigHeader)
9 */
10
11#ifndef HE_PPDU_H
12#define HE_PPDU_H
13
14#include "ns3/ofdm-ppdu.h"
15
16#include <variant>
17
18/**
19 * @file
20 * @ingroup wifi
21 * Declaration of ns3::HePpdu class.
22 */
23
24namespace ns3
25{
26
27/// HE SIG-B Content Channels
29
30class WifiPsdu;
31
32/**
33 * @brief HE PPDU (11ax)
34 * @ingroup wifi
35 *
36 * HePpdu stores a preamble, PHY headers and a map of PSDUs of a PPDU with HE header
37 */
38class HePpdu : public OfdmPpdu
39{
40 public:
41 /// User Specific Fields in HE-SIG-Bs.
43 {
44 uint16_t staId : 11; ///< STA-ID
45 uint8_t nss : 4; ///< number of spatial streams
46 uint8_t mcs : 4; ///< MCS index
47 };
48
49 /// HE SIG-B Content Channels
50 using HeSigBContentChannels = std::vector<std::vector<HeSigBUserSpecificField>>;
51
52 /**
53 * HE-SIG PHY header for HE SU PPDUs (HE-SIG-A1/A2)
54 */
56 {
57 uint8_t m_format{1}; ///< Format bit
58 uint8_t m_bssColor{0}; ///< BSS color field
59 uint8_t m_mcs{0}; ///< MCS field
60 uint8_t m_bandwidth{0}; ///< Bandwidth field
61 uint8_t m_giLtfSize{0}; ///< GI+LTF Size field
62 uint8_t m_nsts{0}; ///< NSTS
63 }; // struct HeSuSigHeader
64
65 /**
66 * HE-SIG PHY header for HE TB PPDUs (HE-SIG-A1/A2)
67 */
69 {
70 uint8_t m_format{0}; ///< Format bit
71 uint8_t m_bssColor{0}; ///< BSS color field
72 uint8_t m_bandwidth{0}; ///< Bandwidth field
73 }; // struct HeTbSigHeader
74
75 /**
76 * HE-SIG PHY header for HE MU PPDUs (HE-SIG-A1/A2/B)
77 */
79 {
80 // HE-SIG-A fields
81 uint8_t m_bssColor{0}; ///< BSS color field
82 uint8_t m_bandwidth{0}; ///< Bandwidth field
83 uint8_t m_sigBMcs{0}; ///< HE-SIG-B MCS
84 uint8_t m_muMimoUsers; ///< MU-MIMO users
85 uint8_t m_sigBCompression{0}; ///< SIG-B compression
86 uint8_t m_giLtfSize{0}; ///< GI+LTF Size field
87
88 // HE-SIG-B fields
89 RuAllocation m_ruAllocation; //!< RU allocations that are going to be carried in SIG-B
90 //!< common subfields
91 HeSigBContentChannels m_contentChannels; //!< HE SIG-B Content Channels
92 std::optional<Center26ToneRuIndication>
93 m_center26ToneRuIndication; //!< center 26 tone RU indication in SIG-B common subfields
94 }; // struct HeMuSigHeader
95
96 /// type of the HE-SIG PHY header
97 using HeSigHeader = std::variant<std::monostate, HeSuSigHeader, HeTbSigHeader, HeMuSigHeader>;
98
99 /**
100 * The transmit power spectral density flag, namely used
101 * to correctly build PSDs for pre-HE and HE portions.
102 */
104 {
105 PSD_NON_HE_PORTION, //!< Non-HE portion of an HE PPDU
106 PSD_HE_PORTION //!< HE portion of an HE PPDU
107 };
108
109 /**
110 * Create an SU HE PPDU, storing a PSDU.
111 *
112 * @param psdu the PHY payload (PSDU)
113 * @param txVector the TXVECTOR that was used for this PPDU
114 * @param channel the operating channel of the PHY used to transmit this PPDU
115 * @param ppduDuration the transmission duration of this PPDU
116 * @param uid the unique ID of this PPDU
117 */
119 const WifiTxVector& txVector,
120 const WifiPhyOperatingChannel& channel,
121 Time ppduDuration,
122 uint64_t uid);
123 /**
124 * Create an MU HE PPDU, storing a map of PSDUs.
125 *
126 * This PPDU can either be UL or DL.
127 *
128 * @param psdus the PHY payloads (PSDUs)
129 * @param txVector the TXVECTOR that was used for this PPDU
130 * @param channel the operating channel of the PHY used to transmit this PPDU
131 * @param ppduDuration the transmission duration of this PPDU
132 * @param uid the unique ID of this PPDU or of the triggering PPDU if this is an HE TB PPDU
133 * @param flag the flag indicating the type of Tx PSD to build
134 */
135 HePpdu(const WifiConstPsduMap& psdus,
136 const WifiTxVector& txVector,
137 const WifiPhyOperatingChannel& channel,
138 Time ppduDuration,
139 uint64_t uid,
140 TxPsdFlag flag);
141
142 Time GetTxDuration() const override;
143 Ptr<WifiPpdu> Copy() const override;
144 WifiPpduType GetType() const override;
145 uint16_t GetStaId() const override;
146 MHz_u GetTxChannelWidth() const override;
147
148 /**
149 * Get the payload of the PPDU.
150 *
151 * @param bssColor the BSS color of the PHY calling this function.
152 * @param staId the STA-ID of the PHY calling this function.
153 * @return the PSDU
154 */
155 Ptr<const WifiPsdu> GetPsdu(uint8_t bssColor, uint16_t staId = SU_STA_ID) const;
156
157 /**
158 * @return the transmit PSD flag set for this PPDU
159 *
160 * @see TxPsdFlag
161 */
162 TxPsdFlag GetTxPsdFlag() const;
163
164 /**
165 * @param flag the transmit PSD flag set for this PPDU
166 *
167 * @see TxPsdFlag
168 */
169 void SetTxPsdFlag(TxPsdFlag flag) const;
170
171 /**
172 * Update the TXVECTOR for HE TB PPDUs, since the information to decode HE TB PPDUs
173 * is not available from the PHY headers but it requires information from the TRIGVECTOR
174 * of the AP expecting these HE TB PPDUs.
175 *
176 * @param trigVector the TRIGVECTOR or std::nullopt if no TRIGVECTOR is available at the caller
177 */
178 void UpdateTxVectorForUlMu(const std::optional<WifiTxVector>& trigVector) const;
179
180 /**
181 * Get the number of STAs per HE-SIG-B content channel.
182 * This is applicable only for MU.
183 * See section 27.3.10.8.3 of IEEE 802.11ax draft 4.0.
184 *
185 * @param channelWidth the channel width occupied by the PPDU
186 * @param ruAllocation 8 bit RU_ALLOCATION per 20 MHz
187 * @param sigBCompression flag whether SIG-B compression is used by the PPDU
188 * @param numMuMimoUsers the number of MU-MIMO users addressed by the PPDU
189 * @return a pair containing the number of RUs in each HE-SIG-B content channel (resp. 1 and 2)
190 */
191 static std::pair<std::size_t, std::size_t> GetNumRusPerHeSigBContentChannel(
192 MHz_u channelWidth,
193 const RuAllocation& ruAllocation,
194 bool sigBCompression,
195 uint8_t numMuMimoUsers);
196
197 /**
198 * Get the HE SIG-B content channels for a given PPDU
199 * IEEE 802.11ax-2021 27.3.11.8.2 HE-SIG-B content channels
200 *
201 * @param txVector the TXVECTOR used for the PPDU
202 * @param p20Index the index of the primary20 channel
203 * @return HE-SIG-B content channels
204 */
205 static HeSigBContentChannels GetHeSigBContentChannels(const WifiTxVector& txVector,
206 uint8_t p20Index);
207
208 /**
209 * Get variable length HE SIG-B field size
210 * @param channelWidth the channel width occupied by the PPDU
211 * @param ruAllocation 8 bit RU_ALLOCATION per 20 MHz
212 * @param sigBCompression flag whether SIG-B compression is used by the PPDU
213 * @param numMuMimoUsers the number of MU-MIMO users addressed by the PPDU
214 * @return field size in bytes
215 */
216 static uint32_t GetSigBFieldSize(MHz_u channelWidth,
217 const RuAllocation& ruAllocation,
218 bool sigBCompression,
219 std::size_t numMuMimoUsers);
220
221 protected:
222 /**
223 * Fill in the TXVECTOR from PHY headers.
224 *
225 * @param txVector the TXVECTOR to fill in
226 */
227 virtual void SetTxVectorFromPhyHeaders(WifiTxVector& txVector) const;
228
229 /**
230 * Reconstruct HeMuUserInfoMap from HE-SIG-B header.
231 *
232 * @param txVector the TXVECTOR to set its HeMuUserInfoMap
233 * @param ruAllocation the RU_ALLOCATION per 20 MHz
234 * @param contentChannels the HE-SIG-B content channels
235 * @param sigBCompression flag whether SIG-B compression is used by the PPDU
236 * @param numMuMimoUsers the number of MU-MIMO users addressed by the PPDU
237 */
238 void SetHeMuUserInfos(WifiTxVector& txVector,
239 const RuAllocation& ruAllocation,
240 const HeSigBContentChannels& contentChannels,
241 bool sigBCompression,
242 uint8_t numMuMimoUsers) const;
243
244 /**
245 * Convert channel width expressed in MHz to bandwidth field encoding in HE-SIG-A.
246 *
247 * @param channelWidth the channel width in MHz
248 * @return the value used to encode the bandwidth field in HE-SIG-A
249 */
250 static uint8_t GetChannelWidthEncodingFromMhz(MHz_u channelWidth);
251
252 /**
253 * Convert number of spatial streams to NSTS field encoding in HE-SIG-A.
254 *
255 * @param nss the number of spatial streams
256 * @return the value used to encode the NSTS field in HE-SIG-A
257 */
258 static uint8_t GetNstsEncodingFromNss(uint8_t nss);
259
260 /**
261 * Convert guard interval and NLTF to its encoding in HE-SIG-A.
262 *
263 * @param guardInterval the guard interval
264 * @param nltf the the number of long training symbols
265 * @return the value used to encode the NSTS field in HE-SIG-A
266 */
267 static uint8_t GetGuardIntervalAndNltfEncoding(Time guardInterval, uint8_t nltf);
268
269 /**
270 * Convert number of spatial streams from NSTS field encoding in HE-SIG-A.
271 *
272 * @param nsts the value of the NSTS field in HE-SIG-A
273 * @return the number of spatial streams
274 */
275 static uint8_t GetNssFromNstsEncoding(uint8_t nsts);
276
277 /**
278 * Convert channel width expressed in MHz from bandwidth field encoding in HE-SIG-A.
279 *
280 * @param bandwidth the value of the bandwidth field in HE-SIG-A
281 * @return the channel width in MHz
282 */
283 static MHz_u GetChannelWidthMhzFromEncoding(uint8_t bandwidth);
284
285 /**
286 * Convert guard interval from its encoding in HE-SIG-A.
287 *
288 * @param giAndNltfSize the value used to encode the guard interval and NLTF field in HE-SIG-A
289 * @return the guard interval
290 */
291 static Time GetGuardIntervalFromEncoding(uint8_t giAndNltfSize);
292
293 /**
294 * Convert number of MU-MIMO users to its encoding in HE-SIG-A.
295 *
296 * @param nUsers the number of MU-MIMO users
297 * @return the number of MU-MIMO users to its encoding in HE-SIG-A
298 */
299 static uint8_t GetMuMimoUsersEncoding(uint8_t nUsers);
300
301 /**
302 * Convert number of MU-MIMO users from its encoding in HE-SIG-A.
303 *
304 * @param encoding the number of MU-MIMO users encoded in HE-SIG-A
305 * @return the number of MU-MIMO users from its encoding in HE-SIG-A
306 */
307 static uint8_t GetMuMimoUsersFromEncoding(uint8_t encoding);
308
309 mutable TxPsdFlag m_txPsdFlag; //!< the transmit power spectral density flag
310
311 private:
312 std::string PrintPayload() const override;
313 WifiTxVector DoGetTxVector() const override;
314
315 /**
316 * Fill in the PHY headers.
317 *
318 * @param txVector the TXVECTOR that was used for this PPDU
319 * @param ppduDuration the transmission duration of this PPDU
320 */
321 void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration);
322
323 /**
324 * Fill in the L-SIG header.
325 *
326 * @param ppduDuration the transmission duration of this PPDU
327 */
328 void SetLSigHeader(Time ppduDuration);
329
330 /**
331 * Fill in the HE-SIG header.
332 *
333 * @param txVector the TXVECTOR that was used for this PPDU
334 */
335 void SetHeSigHeader(const WifiTxVector& txVector);
336
337 /**
338 * Return true if the PPDU is a MU PPDU
339 * @return true if the PPDU is a MU PPDU
340 */
341 virtual bool IsMu() const;
342
343 /**
344 * Return true if the PPDU is a DL MU PPDU
345 * @return true if the PPDU is a DL MU PPDU
346 */
347 virtual bool IsDlMu() const;
348
349 /**
350 * Return true if the PPDU is an UL MU PPDU
351 * @return true if the PPDU is an UL MU PPDU
352 */
353 virtual bool IsUlMu() const;
354
355 HeSigHeader m_heSig; //!< the HE-SIG PHY header
356}; // class HePpdu
357
358/**
359 * @brief Stream insertion operator.
360 *
361 * @param os the stream
362 * @param flag the transmit power spectral density flag
363 * @returns a reference to the stream
364 */
365std::ostream& operator<<(std::ostream& os, const HePpdu::TxPsdFlag& flag);
366
367} // namespace ns3
368
369#endif /* HE_PPDU_H */
HE PPDU (11ax)
Definition he-ppdu.h:39
HeSigHeader m_heSig
the HE-SIG PHY header
Definition he-ppdu.h:355
void SetTxPsdFlag(TxPsdFlag flag) const
Definition he-ppdu.cc:432
WifiTxVector DoGetTxVector() const override
Get the TXVECTOR used to send the PPDU.
Definition he-ppdu.cc:156
virtual void SetTxVectorFromPhyHeaders(WifiTxVector &txVector) const
Fill in the TXVECTOR from PHY headers.
Definition he-ppdu.cc:165
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:439
Ptr< WifiPpdu > Copy() const override
Copy this instance.
Definition he-ppdu.cc:325
MHz_u GetTxChannelWidth() const override
Get the channel width over which the PPDU will effectively be transmitted.
Definition he-ppdu.cc:407
TxPsdFlag
The transmit power spectral density flag, namely used to correctly build PSDs for pre-HE and HE porti...
Definition he-ppdu.h:104
@ PSD_HE_PORTION
HE portion of an HE PPDU.
Definition he-ppdu.h:106
@ PSD_NON_HE_PORTION
Non-HE portion of an HE PPDU.
Definition he-ppdu.h:105
virtual bool IsDlMu() const
Return true if the PPDU is a DL MU PPDU.
Definition he-ppdu.cc:351
Time GetTxDuration() const override
Get the total transmission duration of the PPDU.
Definition he-ppdu.cc:303
virtual bool IsUlMu() const
Return true if the PPDU is an UL MU PPDU.
Definition he-ppdu.cc:357
static uint32_t GetSigBFieldSize(MHz_u channelWidth, const RuAllocation &ruAllocation, bool sigBCompression, std::size_t numMuMimoUsers)
Get variable length HE SIG-B field size.
Definition he-ppdu.cc:629
static uint8_t GetNstsEncodingFromNss(uint8_t nss)
Convert number of spatial streams to NSTS field encoding in HE-SIG-A.
Definition he-ppdu.cc:767
void SetHeSigHeader(const WifiTxVector &txVector)
Fill in the HE-SIG header.
Definition he-ppdu.cc:110
static uint8_t GetNssFromNstsEncoding(uint8_t nsts)
Convert number of spatial streams from NSTS field encoding in HE-SIG-A.
Definition he-ppdu.cc:774
static Time GetGuardIntervalFromEncoding(uint8_t giAndNltfSize)
Convert guard interval from its encoding in HE-SIG-A.
Definition he-ppdu.cc:749
std::variant< std::monostate, HeSuSigHeader, HeTbSigHeader, HeMuSigHeader > HeSigHeader
type of the HE-SIG PHY header
Definition he-ppdu.h:97
void SetPhyHeaders(const WifiTxVector &txVector, Time ppduDuration)
Fill in the PHY headers.
Definition he-ppdu.cc:83
std::string PrintPayload() const override
Print the payload of the PPDU.
Definition he-ppdu.cc:669
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:400
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:544
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:214
std::vector< std::vector< HeSigBUserSpecificField > > HeSigBContentChannels
HE SIG-B Content Channels.
Definition he-ppdu.h:50
WifiPpduType GetType() const override
Return the PPDU type (.
Definition he-ppdu.cc:331
static std::pair< std::size_t, std::size_t > GetNumRusPerHeSigBContentChannel(MHz_u channelWidth, const RuAllocation &ruAllocation, bool sigBCompression, uint8_t numMuMimoUsers)
Get the number of STAs per HE-SIG-B content channel.
Definition he-ppdu.cc:475
TxPsdFlag GetTxPsdFlag() const
Definition he-ppdu.cc:426
static uint8_t GetMuMimoUsersEncoding(uint8_t nUsers)
Convert number of MU-MIMO users to its encoding in HE-SIG-A.
Definition he-ppdu.cc:780
static MHz_u GetChannelWidthMhzFromEncoding(uint8_t bandwidth)
Convert channel width expressed in MHz from bandwidth field encoding in HE-SIG-A.
Definition he-ppdu.cc:706
virtual bool IsMu() const
Return true if the PPDU is a MU PPDU.
Definition he-ppdu.cc:345
static uint8_t GetChannelWidthEncodingFromMhz(MHz_u channelWidth)
Convert channel width expressed in MHz to bandwidth field encoding in HE-SIG-A.
Definition he-ppdu.cc:685
void SetLSigHeader(Time ppduDuration)
Fill in the L-SIG header.
Definition he-ppdu.cc:91
HePpdu(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, const WifiPhyOperatingChannel &channel, Time ppduDuration, uint64_t uid)
Create an SU HE PPDU, storing a PSDU.
Definition he-ppdu.cc:65
static uint8_t GetGuardIntervalAndNltfEncoding(Time guardInterval, uint8_t nltf)
Convert guard interval and NLTF to its encoding in HE-SIG-A.
Definition he-ppdu.cc:727
TxPsdFlag m_txPsdFlag
the transmit power spectral density flag
Definition he-ppdu.h:309
static uint8_t GetMuMimoUsersFromEncoding(uint8_t encoding)
Convert number of MU-MIMO users from its encoding in HE-SIG-A.
Definition he-ppdu.cc:787
OFDM PPDU (11a)
Definition ofdm-ppdu.h:36
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
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:140
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each cons...
Definition wifi-psdu.h:32
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:148
double MHz_u
MHz weak type.
Definition wifi-units.h:31
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Definition wifi-mode.h:24
constexpr size_t WIFI_MAX_NUM_HE_SIGB_CONTENT_CHANNELS
HE SIG-B Content Channels.
Definition he-ppdu.h:28
std::vector< uint16_t > RuAllocation
9 bits RU_ALLOCATION per 20 MHz
HE-SIG PHY header for HE MU PPDUs (HE-SIG-A1/A2/B)
Definition he-ppdu.h:79
uint8_t m_giLtfSize
GI+LTF Size field.
Definition he-ppdu.h:86
uint8_t m_bssColor
BSS color field.
Definition he-ppdu.h:81
HeSigBContentChannels m_contentChannels
HE SIG-B Content Channels.
Definition he-ppdu.h:91
RuAllocation m_ruAllocation
RU allocations that are going to be carried in SIG-B common subfields.
Definition he-ppdu.h:89
uint8_t m_sigBMcs
HE-SIG-B MCS.
Definition he-ppdu.h:83
uint8_t m_sigBCompression
SIG-B compression.
Definition he-ppdu.h:85
std::optional< Center26ToneRuIndication > m_center26ToneRuIndication
center 26 tone RU indication in SIG-B common subfields
Definition he-ppdu.h:93
uint8_t m_muMimoUsers
MU-MIMO users.
Definition he-ppdu.h:84
uint8_t m_bandwidth
Bandwidth field.
Definition he-ppdu.h:82
User Specific Fields in HE-SIG-Bs.
Definition he-ppdu.h:43
uint8_t nss
number of spatial streams
Definition he-ppdu.h:45
HE-SIG PHY header for HE SU PPDUs (HE-SIG-A1/A2)
Definition he-ppdu.h:56
uint8_t m_bssColor
BSS color field.
Definition he-ppdu.h:58
uint8_t m_mcs
MCS field.
Definition he-ppdu.h:59
uint8_t m_giLtfSize
GI+LTF Size field.
Definition he-ppdu.h:61
uint8_t m_bandwidth
Bandwidth field.
Definition he-ppdu.h:60
uint8_t m_format
Format bit.
Definition he-ppdu.h:57
HE-SIG PHY header for HE TB PPDUs (HE-SIG-A1/A2)
Definition he-ppdu.h:69
uint8_t m_format
Format bit.
Definition he-ppdu.h:70
uint8_t m_bandwidth
Bandwidth field.
Definition he-ppdu.h:72
uint8_t m_bssColor
BSS color field.
Definition he-ppdu.h:71