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
29/**
30 * \file
31 * \ingroup wifi
32 * Declaration of ns3::HePpdu class.
33 */
34
35namespace ns3
36{
37
38/// HE SIG-B Content Channels
40
41class WifiPsdu;
42
43/**
44 * \brief HE PPDU (11ax)
45 * \ingroup wifi
46 *
47 * HePpdu stores a preamble, PHY headers and a map of PSDUs of a PPDU with HE header
48 */
49class HePpdu : public OfdmPpdu
50{
51 public:
52 /// User Specific Fields in HE-SIG-Bs.
54 {
55 uint16_t staId : 11; ///< STA-ID
56 uint8_t nss : 4; ///< number of spatial streams
57 uint8_t mcs : 4; ///< MCS index
58 };
59
60 /// HE SIG-B Content Channels
61 using HeSigBContentChannels = std::vector<std::vector<HeSigBUserSpecificField>>;
62
63 /**
64 * HE-SIG PHY header for HE SU PPDUs (HE-SIG-A1/A2)
65 */
67 {
68 uint8_t m_format{1}; ///< Format bit
69 uint8_t m_bssColor{0}; ///< BSS color field
70 uint8_t m_mcs{0}; ///< MCS field
71 uint8_t m_bandwidth{0}; ///< Bandwidth field
72 uint8_t m_giLtfSize{0}; ///< GI+LTF Size field
73 uint8_t m_nsts{0}; ///< NSTS
74 }; // struct HeSuSigHeader
75
76 /**
77 * HE-SIG PHY header for HE TB PPDUs (HE-SIG-A1/A2)
78 */
80 {
81 uint8_t m_format{0}; ///< Format bit
82 uint8_t m_bssColor{0}; ///< BSS color field
83 uint8_t m_bandwidth{0}; ///< Bandwidth field
84 }; // struct HeTbSigHeader
85
86 /**
87 * HE-SIG PHY header for HE MU PPDUs (HE-SIG-A1/A2/B)
88 */
90 {
91 // HE-SIG-A fields
92 uint8_t m_bssColor{0}; ///< BSS color field
93 uint8_t m_bandwidth{0}; ///< Bandwidth field
94 uint8_t m_sigBMcs{0}; ///< HE-SIG-B MCS
95 uint8_t m_muMimoUsers; ///< MU-MIMO users
96 uint8_t m_sigBCompression{0}; ///< SIG-B compression
97 uint8_t m_giLtfSize{0}; ///< GI+LTF Size field
98
99 // HE-SIG-B fields
100 RuAllocation m_ruAllocation; //!< RU allocations that are going to be carried in SIG-B
101 //!< common subfields
102 HeSigBContentChannels m_contentChannels; //!< HE SIG-B Content Channels
103 std::optional<Center26ToneRuIndication>
104 m_center26ToneRuIndication; //!< center 26 tone RU indication in SIG-B common subfields
105 }; // struct HeMuSigHeader
106
107 /// type of the HE-SIG PHY header
108 using HeSigHeader = std::variant<std::monostate, HeSuSigHeader, HeTbSigHeader, HeMuSigHeader>;
109
110 /**
111 * The transmit power spectral density flag, namely used
112 * to correctly build PSDs for pre-HE and HE portions.
113 */
115 {
116 PSD_NON_HE_PORTION, //!< Non-HE portion of an HE PPDU
117 PSD_HE_PORTION //!< HE portion of an HE PPDU
118 };
119
120 /**
121 * Create an SU HE PPDU, storing a PSDU.
122 *
123 * \param psdu the PHY payload (PSDU)
124 * \param txVector the TXVECTOR that was used for this PPDU
125 * \param channel the operating channel of the PHY used to transmit this PPDU
126 * \param ppduDuration the transmission duration of this PPDU
127 * \param uid the unique ID of this PPDU
128 */
130 const WifiTxVector& txVector,
131 const WifiPhyOperatingChannel& channel,
132 Time ppduDuration,
133 uint64_t uid);
134 /**
135 * Create an MU HE PPDU, storing a map of PSDUs.
136 *
137 * This PPDU can either be UL or DL.
138 *
139 * \param psdus the PHY payloads (PSDUs)
140 * \param txVector the TXVECTOR that was used for this PPDU
141 * \param channel the operating channel of the PHY used to transmit this PPDU
142 * \param ppduDuration the transmission duration of this PPDU
143 * \param uid the unique ID of this PPDU or of the triggering PPDU if this is an HE TB PPDU
144 * \param flag the flag indicating the type of Tx PSD to build
145 */
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
159 /**
160 * Get the payload of the PPDU.
161 *
162 * \param bssColor the BSS color of the PHY calling this function.
163 * \param staId the STA-ID of the PHY calling this function.
164 * \return the PSDU
165 */
166 Ptr<const WifiPsdu> GetPsdu(uint8_t bssColor, uint16_t staId = SU_STA_ID) const;
167
168 /**
169 * \return the transmit PSD flag set for this PPDU
170 *
171 * \see TxPsdFlag
172 */
173 TxPsdFlag GetTxPsdFlag() const;
174
175 /**
176 * \param flag the transmit PSD flag set for this PPDU
177 *
178 * \see TxPsdFlag
179 */
180 void SetTxPsdFlag(TxPsdFlag flag) const;
181
182 /**
183 * Update the TXVECTOR for HE TB PPDUs, since the information to decode HE TB PPDUs
184 * is not available from the PHY headers but it requires information from the TRIGVECTOR
185 * of the AP expecting these HE TB PPDUs.
186 *
187 * \param trigVector the TRIGVECTOR or std::nullopt if no TRIGVECTOR is available at the caller
188 */
189 void UpdateTxVectorForUlMu(const std::optional<WifiTxVector>& trigVector) const;
190
191 /**
192 * Get the number of STAs per HE-SIG-B content channel.
193 * This is applicable only for MU.
194 * See section 27.3.10.8.3 of IEEE 802.11ax draft 4.0.
195 *
196 * \param channelWidth the channel width occupied by the PPDU (in MHz)
197 * \param ruAllocation 8 bit RU_ALLOCATION per 20 MHz
198 * \param sigBCompression flag whether SIG-B compression is used by the PPDU
199 * \param numMuMimoUsers the number of MU-MIMO users addressed by the PPDU
200 * \return a pair containing the number of RUs in each HE-SIG-B content channel (resp. 1 and 2)
201 */
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
208 /**
209 * Get the HE SIG-B content channels for a given PPDU
210 * IEEE 802.11ax-2021 27.3.11.8.2 HE-SIG-B content channels
211 *
212 * \param txVector the TXVECTOR used for the PPDU
213 * \param p20Index the index of the primary20 channel
214 * \return HE-SIG-B content channels
215 */
217 uint8_t p20Index);
218
219 /**
220 * Get variable length HE SIG-B field size
221 * \param channelWidth the channel width occupied by the PPDU (in MHz)
222 * \param ruAllocation 8 bit RU_ALLOCATION per 20 MHz
223 * \param sigBCompression flag whether SIG-B compression is used by the PPDU
224 * \param numMuMimoUsers the number of MU-MIMO users addressed by the PPDU
225 * \return field size in bytes
226 */
227 static uint32_t GetSigBFieldSize(uint16_t channelWidth,
228 const RuAllocation& ruAllocation,
229 bool sigBCompression,
230 std::size_t numMuMimoUsers);
231
232 protected:
233 /**
234 * Fill in the TXVECTOR from PHY headers.
235 *
236 * \param txVector the TXVECTOR to fill in
237 */
238 virtual void SetTxVectorFromPhyHeaders(WifiTxVector& txVector) const;
239
240 /**
241 * Reconstruct HeMuUserInfoMap from HE-SIG-B header.
242 *
243 * \param txVector the TXVECTOR to set its HeMuUserInfoMap
244 * \param ruAllocation the RU_ALLOCATION per 20 MHz
245 * \param contentChannels the HE-SIG-B content channels
246 * \param sigBCompression flag whether SIG-B compression is used by the PPDU
247 * \param numMuMimoUsers the number of MU-MIMO users addressed by the PPDU
248 */
249 void SetHeMuUserInfos(WifiTxVector& txVector,
250 const RuAllocation& ruAllocation,
251 const HeSigBContentChannels& contentChannels,
252 bool sigBCompression,
253 uint8_t numMuMimoUsers) const;
254
255 /**
256 * Convert channel width expressed in MHz to bandwidth field encoding in HE-SIG-A.
257 *
258 * \param channelWidth the channel width in MHz
259 * \return the value used to encode the bandwidth field in HE-SIG-A
260 */
261 static uint8_t GetChannelWidthEncodingFromMhz(uint16_t channelWidth);
262
263 /**
264 * Convert number of spatial streams to NSTS field encoding in HE-SIG-A.
265 *
266 * \param nss the number of spatial streams
267 * \return the value used to encode the NSTS field in HE-SIG-A
268 */
269 static uint8_t GetNstsEncodingFromNss(uint8_t nss);
270
271 /**
272 * Convert guard interval (in ns) and NLTF to its encoding in HE-SIG-A.
273 *
274 * \param gi the guard interval in nanoseconds
275 * \param nltf the the number of long training symbols
276 * \return the value used to encode the NSTS field in HE-SIG-A
277 */
278 static uint8_t GetGuardIntervalAndNltfEncoding(uint16_t gi, uint8_t nltf);
279
280 /**
281 * Convert number of spatial streams from NSTS field encoding in HE-SIG-A.
282 *
283 * \param nsts the value of the NSTS field in HE-SIG-A
284 * \return the number of spatial streams
285 */
286 static uint8_t GetNssFromNstsEncoding(uint8_t nsts);
287
288 /**
289 * Convert channel width expressed in MHz from bandwidth field encoding in HE-SIG-A.
290 *
291 * \param bandwidth the value of the bandwidth field in HE-SIG-A
292 * \return the channel width in MHz
293 */
294 static uint16_t GetChannelWidthMhzFromEncoding(uint8_t bandwidth);
295
296 /**
297 * Convert guard interval (in ns) from its encoding in HE-SIG-A.
298 *
299 * \param giAndNltfSize the value used to encode the guard interval and NLTF field in HE-SIG-A
300 * \return the guard interval in nanoseconds
301 */
302 static uint16_t GetGuardIntervalFromEncoding(uint8_t giAndNltfSize);
303
304 /**
305 * Convert number of MU-MIMO users to its encoding in HE-SIG-A.
306 *
307 * \param nUsers the number of MU-MIMO users
308 * \return the number of MU-MIMO users to its encoding in HE-SIG-A
309 */
310 static uint8_t GetMuMimoUsersEncoding(uint8_t nUsers);
311
312 /**
313 * Convert number of MU-MIMO users from its encoding in HE-SIG-A.
314 *
315 * \param encoding the number of MU-MIMO users encoded in HE-SIG-A
316 * \return the number of MU-MIMO users from its encoding in HE-SIG-A
317 */
318 static uint8_t GetMuMimoUsersFromEncoding(uint8_t encoding);
319
320 mutable TxPsdFlag m_txPsdFlag; //!< the transmit power spectral density flag
321
322 private:
323 std::string PrintPayload() const override;
324 WifiTxVector DoGetTxVector() const override;
325
326 /**
327 * Fill in the PHY headers.
328 *
329 * \param txVector the TXVECTOR that was used for this PPDU
330 * \param ppduDuration the transmission duration of this PPDU
331 */
332 void SetPhyHeaders(const WifiTxVector& txVector, Time ppduDuration);
333
334 /**
335 * Fill in the L-SIG header.
336 *
337 * \param ppduDuration the transmission duration of this PPDU
338 */
339 void SetLSigHeader(Time ppduDuration);
340
341 /**
342 * Fill in the HE-SIG header.
343 *
344 * \param txVector the TXVECTOR that was used for this PPDU
345 */
346 void SetHeSigHeader(const WifiTxVector& txVector);
347
348 /**
349 * Return true if the PPDU is a MU PPDU
350 * \return true if the PPDU is a MU PPDU
351 */
352 virtual bool IsMu() const;
353
354 /**
355 * Return true if the PPDU is a DL MU PPDU
356 * \return true if the PPDU is a DL MU PPDU
357 */
358 virtual bool IsDlMu() const;
359
360 /**
361 * Return true if the PPDU is an UL MU PPDU
362 * \return true if the PPDU is an UL MU PPDU
363 */
364 virtual bool IsUlMu() const;
365
366 HeSigHeader m_heSig; //!< the HE-SIG PHY header
367}; // class HePpdu
368
369/**
370 * \brief Stream insertion operator.
371 *
372 * \param os the stream
373 * \param flag the transmit power spectral density flag
374 * \returns a reference to the stream
375 */
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:77
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