A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
vht-phy.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 * Authors: Rediet <getachew.redieteab@orange.com>
7 * Sébastien Deronne <sebastien.deronne@gmail.com> (for logic ported from wifi-phy)
8 */
9
10#ifndef VHT_PHY_H
11#define VHT_PHY_H
12
13#include "ns3/ht-phy.h"
14
15/**
16 * \file
17 * \ingroup wifi
18 * Declaration of ns3::VhtPhy class.
19 */
20
21namespace ns3
22{
23
24/**
25 * This defines the BSS membership value for VHT PHY.
26 */
27#define VHT_PHY 126
28
29/**
30 * \brief PHY entity for VHT (11ac)
31 * \ingroup wifi
32 *
33 * VHT PHY is based on HT PHY.
34 *
35 * Refer to IEEE 802.11-2016, clause 21.
36 */
37class VhtPhy : public HtPhy
38{
39 public:
40 /**
41 * Constructor for VHT PHY
42 *
43 * \param buildModeList flag used to add VHT modes to list (disabled
44 * by child classes to only add child classes' modes)
45 */
46 VhtPhy(bool buildModeList = true);
47 /**
48 * Destructor for VHT PHY
49 */
50 ~VhtPhy() override;
51
52 WifiMode GetSigMode(WifiPpduField field, const WifiTxVector& txVector) const override;
53 const PpduFormats& GetPpduFormats() const override;
54 Time GetDuration(WifiPpduField field, const WifiTxVector& txVector) const override;
55 Time GetLSigDuration(WifiPreamble preamble) const override;
57 uint8_t nDataLtf,
58 uint8_t nExtensionLtf = 0) const override;
60 const WifiTxVector& txVector,
61 Time ppduDuration) override;
63 WifiChannelListType channelType) const override;
64
65 /**
66 * \return the WifiMode used for the SIG-A field
67 */
68 virtual WifiMode GetSigAMode() const;
69 /**
70 * \param txVector the transmission parameters
71 * \return the WifiMode used for the SIG-B field
72 */
73 virtual WifiMode GetSigBMode(const WifiTxVector& txVector) const;
74
75 /**
76 * \param preamble the type of preamble
77 * \return the duration of the SIG-A field
78 */
79 virtual Time GetSigADuration(WifiPreamble preamble) const;
80 /**
81 * \param txVector the transmission parameters
82 * \return the duration of the SIG-B field
83 */
84 virtual Time GetSigBDuration(const WifiTxVector& txVector) const;
85
86 /**
87 * Initialize all VHT modes.
88 */
89 static void InitializeModes();
90 /**
91 * Return the VHT MCS corresponding to
92 * the provided index.
93 *
94 * \param index the index of the MCS
95 * \return an VHT MCS
96 */
97 static WifiMode GetVhtMcs(uint8_t index);
98
99 /**
100 * Return MCS 0 from VHT MCS values.
101 *
102 * \return MCS 0 from VHT MCS values
103 */
105 /**
106 * Return MCS 1 from VHT MCS values.
107 *
108 * \return MCS 1 from VHT MCS values
109 */
111 /**
112 * Return MCS 2 from VHT MCS values.
113 *
114 * \return MCS 2 from VHT MCS values
115 */
117 /**
118 * Return MCS 3 from VHT MCS values.
119 *
120 * \return MCS 3 from VHT MCS values
121 */
123 /**
124 * Return MCS 4 from VHT MCS values.
125 *
126 * \return MCS 4 from VHT MCS values
127 */
129 /**
130 * Return MCS 5 from VHT MCS values.
131 *
132 * \return MCS 5 from VHT MCS values
133 */
135 /**
136 * Return MCS 6 from VHT MCS values.
137 *
138 * \return MCS 6 from VHT MCS values
139 */
141 /**
142 * Return MCS 7 from VHT MCS values.
143 *
144 * \return MCS 7 from VHT MCS values
145 */
147 /**
148 * Return MCS 8 from VHT MCS values.
149 *
150 * \return MCS 8 from VHT MCS values
151 */
153 /**
154 * Return MCS 9 from VHT MCS values.
155 *
156 * \return MCS 9 from VHT MCS values
157 */
159
160 /**
161 * Return the coding rate corresponding to
162 * the supplied VHT MCS index. This function is
163 * reused by child classes and is used as a callback
164 * for WifiMode operation.
165 *
166 * \param mcsValue the MCS index
167 * \return the coding rate.
168 */
169 static WifiCodeRate GetCodeRate(uint8_t mcsValue);
170 /**
171 * Return the constellation size corresponding
172 * to the supplied VHT MCS index. This function is
173 * reused by child classes and is used as a callback for
174 * WifiMode operation.
175 *
176 * \param mcsValue the MCS index
177 * \return the size of modulation constellation.
178 */
179 static uint16_t GetConstellationSize(uint8_t mcsValue);
180 /**
181 * Return the PHY rate corresponding to the supplied VHT MCS
182 * index, channel width, guard interval, and number of
183 * spatial stream. This function calls HtPhy::CalculatePhyRate
184 * and is mainly used as a callback for WifiMode operation.
185 *
186 * \param mcsValue the VHT MCS index
187 * \param channelWidth the considered channel width
188 * \param guardInterval the considered guard interval duration
189 * \param nss the considered number of stream
190 *
191 * \return the physical bit rate of this signal in bps.
192 */
193 static uint64_t GetPhyRate(uint8_t mcsValue,
194 MHz_u channelWidth,
195 Time guardInterval,
196 uint8_t nss);
197 /**
198 * Return the PHY rate corresponding to
199 * the supplied TXVECTOR.
200 * This function is mainly used as a callback
201 * for WifiMode operation.
202 *
203 * \param txVector the TXVECTOR used for the transmission
204 * \param staId the station ID (only here to have a common signature for all callbacks)
205 * \return the physical bit rate of this signal in bps.
206 */
207 static uint64_t GetPhyRateFromTxVector(const WifiTxVector& txVector, uint16_t staId);
208 /**
209 * Return the data rate corresponding to
210 * the supplied TXVECTOR.
211 * This function is mainly used as a callback
212 * for WifiMode operation.
213 *
214 * \param txVector the TXVECTOR used for the transmission
215 * \param staId the station ID (only here to have a common signature for all callbacks)
216 * \return the data bit rate in bps.
217 */
218 static uint64_t GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t staId);
219 /**
220 * Return the data rate corresponding to
221 * the supplied VHT MCS index, channel width,
222 * guard interval, and number of spatial
223 * streams.
224 *
225 * \param mcsValue the MCS index
226 * \param channelWidth the channel width
227 * \param guardInterval the guard interval duration
228 * \param nss the number of spatial streams
229 * \return the data bit rate in bps.
230 */
231 static uint64_t GetDataRate(uint8_t mcsValue,
232 MHz_u channelWidth,
233 Time guardInterval,
234 uint8_t nss);
235 /**
236 * Calculate the rate in bps of the non-HT Reference Rate corresponding
237 * to the supplied VHT MCS index. This function calls CalculateNonHtReferenceRate
238 * and is used as a callback for WifiMode operation.
239 *
240 * \param mcsValue the VHT MCS index
241 * \return the rate in bps of the non-HT Reference Rate.
242 */
243 static uint64_t GetNonHtReferenceRate(uint8_t mcsValue);
244 /**
245 * Check whether the combination of <MCS, channel width, NSS> is allowed.
246 * This function is used as a callback for WifiMode operation.
247 *
248 * \param mcsValue the considered MCS index
249 * \param channelWidth the considered channel width
250 * \param nss the considered number of streams
251 * \returns true if this <MCS, channel width, NSS> combination is allowed, false otherwise.
252 */
253 static bool IsCombinationAllowed(uint8_t mcsValue, MHz_u channelWidth, uint8_t nss);
254 /**
255 * Check whether the combination in TXVECTOR is allowed.
256 * This function is used as a callback for WifiMode operation.
257 *
258 * \param txVector the TXVECTOR
259 * \returns true if this combination is allowed, false otherwise.
260 */
261 static bool IsAllowed(const WifiTxVector& txVector);
262
263 protected:
264 WifiMode GetHtSigMode() const override;
265 Time GetHtSigDuration() const override;
266 uint8_t GetNumberBccEncoders(const WifiTxVector& txVector) const override;
268 bool IsAllConfigSupported(WifiPpduField field, Ptr<const WifiPpdu> ppdu) const override;
269 uint32_t GetMaxPsduSize() const override;
271
272 /**
273 * End receiving the SIG-A or SIG-B, perform VHT-specific actions, and
274 * provide the status of the reception.
275 *
276 * Child classes can perform amendment-specific actions by specializing
277 * \see ProcessSig.
278 *
279 * \param event the event holding incoming PPDU's information
280 * \param field the current PPDU field
281 * \return status of the reception of the SIG-A of SIG-B
282 */
284
285 /**
286 * Get the failure reason corresponding to the unsuccessful processing of a given PPDU field.
287 *
288 * \param field the PPDU field
289 * \return the failure reason corresponding to the unsuccessful processing of the PPDU field
290 */
292
293 /**
294 * Process SIG-A or SIG-B, perform amendment-specific actions, and
295 * provide an updated status of the reception.
296 *
297 * \param event the event holding incoming PPDU's information
298 * \param status the status of the reception of the correctly received SIG-A or SIG-B after the
299 * configuration support check
300 * \param field the current PPDU field to identify whether it is SIG-A or SIG-B
301 * \return the updated status of the reception of the SIG-A or SIG-B
302 */
304 PhyFieldRxStatus status,
305 WifiPpduField field);
306
307 /**
308 * Return the rate (in bps) of the non-HT Reference Rate
309 * which corresponds to the supplied code rate and
310 * constellation size.
311 *
312 * \param codeRate the convolutional coding rate
313 * \param constellationSize the size of modulation constellation
314 * \returns the rate in bps.
315 *
316 * To convert an VHT MCS to its corresponding non-HT Reference Rate
317 * use the modulation and coding rate of the HT MCS
318 * and lookup in Table 10-7 of IEEE 802.11-2016.
319 */
320 static uint64_t CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize);
321 /**
322 * \param channelWidth the channel width
323 * \return he number of usable subcarriers for data
324 */
325 static uint16_t GetUsableSubcarriers(MHz_u channelWidth);
326
327 private:
328 void BuildModeList() override;
329
330 /**
331 * Return the VHT MCS corresponding to
332 * the provided index.
333 * This method binds all the callbacks used by WifiMode.
334 *
335 * \param index the index of the MCS
336 * \return a VHT MCS
337 */
338 static WifiMode CreateVhtMcs(uint8_t index);
339
340 /**
341 * Typedef for storing exceptions in the number of BCC encoders for VHT MCSs
342 */
343 typedef std::map<
344 std::tuple<MHz_u /* channelWidth */, uint8_t /* Nss */, uint8_t /* MCS index */>,
345 uint8_t /* Nes */>
347 static const NesExceptionMap m_exceptionsMap; //!< exception map for number of BCC encoders
348 //!< (extracted from VHT-MCS tables)
349 static const PpduFormats m_vhtPpduFormats; //!< VHT PPDU formats
350}; // class VhtPhy
351
352} // namespace ns3
353
354#endif /* VHT_PHY_H */
PHY entity for HT (11n)
Definition ht-phy.h:43
static uint16_t GetUsableSubcarriers()
Definition ofdm-phy.cc:624
std::optional< std::pair< Time, WifiChannelListType > > CcaIndication
CCA end time and its corresponding channel list type (can be std::nullopt if IDLE)
Definition phy-entity.h:924
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition phy-entity.h:529
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
PHY entity for VHT (11ac)
Definition vht-phy.h:38
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
Definition vht-phy.cc:509
static WifiMode GetVhtMcs0()
Return MCS 0 from VHT MCS values.
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied VHT MCS index.
Definition vht-phy.cc:395
Time GetDuration(WifiPpduField field, const WifiTxVector &txVector) const override
Get the duration of the PPDU field (or group of fields) used by this entity for the given transmissio...
Definition vht-phy.cc:165
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
Definition vht-phy.h:347
~VhtPhy() override
Destructor for VHT PHY.
Definition vht-phy.cc:102
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
Definition vht-phy.h:349
bool IsAllConfigSupported(WifiPpduField field, Ptr< const WifiPpdu > ppdu) const override
Checks if the signaled configuration (including bandwidth) is supported by the PHY.
Definition vht-phy.cc:315
static WifiMode GetVhtMcs5()
Return MCS 5 from VHT MCS values.
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition vht-phy.cc:439
PhyFieldRxStatus EndReceiveSig(Ptr< Event > event, WifiPpduField field)
End receiving the SIG-A or SIG-B, perform VHT-specific actions, and provide the status of the recepti...
Definition vht-phy.cc:266
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Definition vht-phy.cc:215
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
Definition vht-phy.cc:191
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
Definition vht-phy.cc:207
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
Definition vht-phy.cc:430
static bool IsCombinationAllowed(uint8_t mcsValue, MHz_u channelWidth, uint8_t nss)
Check whether the combination of <MCS, channel width, NSS> is allowed.
Definition vht-phy.cc:517
static uint64_t GetDataRate(uint8_t mcsValue, MHz_u channelWidth, Time guardInterval, uint8_t nss)
Return the data rate corresponding to the supplied VHT MCS index, channel width, guard interval,...
Definition vht-phy.cc:448
CcaIndication GetCcaIndication(const Ptr< const WifiPpdu > ppdu) override
Get CCA end time and its corresponding channel list type when a new signal has been received by the P...
Definition vht-phy.cc:577
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition vht-phy.cc:334
static uint64_t CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize)
Return the rate (in bps) of the non-HT Reference Rate which corresponds to the supplied code rate and...
Definition vht-phy.cc:486
static WifiMode GetVhtMcs3()
Return MCS 3 from VHT MCS values.
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition vht-phy.cc:240
dBm_u GetCcaThreshold(const Ptr< const WifiPpdu > ppdu, WifiChannelListType channelType) const override
Return the CCA threshold for a given channel type.
Definition vht-phy.cc:537
static WifiMode GetVhtMcs1()
Return MCS 1 from VHT MCS values.
static uint64_t GetPhyRate(uint8_t mcsValue, MHz_u channelWidth, Time guardInterval, uint8_t nss)
Return the PHY rate corresponding to the supplied VHT MCS index, channel width, guard interval,...
Definition vht-phy.cc:422
void BuildModeList() override
Build mode list.
Definition vht-phy.cc:108
virtual WifiMode GetSigAMode() const
Definition vht-phy.cc:151
static WifiMode GetVhtMcs4()
Return MCS 4 from VHT MCS values.
Time GetLSigDuration(WifiPreamble preamble) const override
Definition vht-phy.cc:179
std::map< std::tuple< MHz_u, uint8_t, uint8_t >, uint8_t > NesExceptionMap
Typedef for storing exceptions in the number of BCC encoders for VHT MCSs.
Definition vht-phy.h:346
virtual PhyFieldRxStatus ProcessSig(Ptr< Event > event, PhyFieldRxStatus status, WifiPpduField field)
Process SIG-A or SIG-B, perform amendment-specific actions, and provide an updated status of the rece...
Definition vht-phy.cc:306
static WifiMode GetVhtMcs2()
Return MCS 2 from VHT MCS values.
PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event) override
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
Definition vht-phy.cc:251
static void InitializeModes()
Initialize all VHT modes.
Definition vht-phy.cc:325
static WifiMode GetVhtMcs9()
Return MCS 9 from VHT MCS values.
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition vht-phy.cc:379
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition vht-phy.cc:409
static WifiMode GetVhtMcs6()
Return MCS 6 from VHT MCS values.
uint32_t GetMaxPsduSize() const override
Get the maximum PSDU size in bytes.
Definition vht-phy.cc:531
static uint64_t GetNonHtReferenceRate(uint8_t mcsValue)
Calculate the rate in bps of the non-HT Reference Rate corresponding to the supplied VHT MCS index.
Definition vht-phy.cc:478
virtual Time GetSigADuration(WifiPreamble preamble) const
Definition vht-phy.cc:201
const PpduFormats & GetPpduFormats() const override
Return the PPDU formats of the PHY.
Definition vht-phy.cc:121
static WifiMode GetVhtMcs8()
Return MCS 8 from VHT MCS values.
static WifiMode GetVhtMcs7()
Return MCS 7 from VHT MCS values.
WifiMode GetHtSigMode() const override
Definition vht-phy.cc:143
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
Definition vht-phy.cc:89
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Definition vht-phy.cc:157
virtual WifiPhyRxfailureReason GetFailureReason(WifiPpduField field) const
Get the failure reason corresponding to the unsuccessful processing of a given PPDU field.
Definition vht-phy.cc:291
Time GetHtSigDuration() const override
Definition vht-phy.cc:185
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
Definition vht-phy.cc:127
represent a single transmission mode
Definition wifi-mode.h:40
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiChannelListType
Enumeration of the possible channel-list parameter elements defined in Table 8-5 of IEEE 802....
WifiPpduField
The type of PPDU field (grouped for convenience)
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.
WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
Status of the reception of the PPDU field.
Definition phy-entity.h:80