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 * 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 * Authors: Rediet <getachew.redieteab@orange.com>
18 * Sébastien Deronne <sebastien.deronne@gmail.com> (for logic ported from wifi-phy)
19 */
20
21#ifndef VHT_PHY_H
22#define VHT_PHY_H
23
24#include "ns3/ht-phy.h"
25
26/**
27 * \file
28 * \ingroup wifi
29 * Declaration of ns3::VhtPhy class.
30 */
31
32namespace ns3
33{
34
35/**
36 * This defines the BSS membership value for VHT PHY.
37 */
38#define VHT_PHY 126
39
40/**
41 * \brief PHY entity for VHT (11ac)
42 * \ingroup wifi
43 *
44 * VHT PHY is based on HT PHY.
45 *
46 * Refer to IEEE 802.11-2016, clause 21.
47 */
48class VhtPhy : public HtPhy
49{
50 public:
51 /**
52 * Constructor for VHT PHY
53 *
54 * \param buildModeList flag used to add VHT modes to list (disabled
55 * by child classes to only add child classes' modes)
56 */
57 VhtPhy(bool buildModeList = true);
58 /**
59 * Destructor for VHT PHY
60 */
61 ~VhtPhy() override;
62
63 WifiMode GetSigMode(WifiPpduField field, const WifiTxVector& txVector) const override;
64 const PpduFormats& GetPpduFormats() const override;
65 Time GetDuration(WifiPpduField field, const WifiTxVector& txVector) const override;
66 Time GetLSigDuration(WifiPreamble preamble) const override;
68 uint8_t nDataLtf,
69 uint8_t nExtensionLtf = 0) const override;
71 const WifiTxVector& txVector,
72 Time ppduDuration) override;
73 double GetCcaThreshold(const Ptr<const WifiPpdu> ppdu,
74 WifiChannelListType channelType) const override;
75
76 /**
77 * \return the WifiMode used for the SIG-A field
78 */
79 virtual WifiMode GetSigAMode() const;
80 /**
81 * \param txVector the transmission parameters
82 * \return the WifiMode used for the SIG-B field
83 */
84 virtual WifiMode GetSigBMode(const WifiTxVector& txVector) const;
85
86 /**
87 * \param preamble the type of preamble
88 * \return the duration of the SIG-A field
89 */
90 virtual Time GetSigADuration(WifiPreamble preamble) const;
91 /**
92 * \param txVector the transmission parameters
93 * \return the duration of the SIG-B field
94 */
95 virtual Time GetSigBDuration(const WifiTxVector& txVector) const;
96
97 /**
98 * Initialize all VHT modes.
99 */
100 static void InitializeModes();
101 /**
102 * Return the VHT MCS corresponding to
103 * the provided index.
104 *
105 * \param index the index of the MCS
106 * \return an VHT MCS
107 */
108 static WifiMode GetVhtMcs(uint8_t index);
109
110 /**
111 * Return MCS 0 from VHT MCS values.
112 *
113 * \return MCS 0 from VHT MCS values
114 */
116 /**
117 * Return MCS 1 from VHT MCS values.
118 *
119 * \return MCS 1 from VHT MCS values
120 */
122 /**
123 * Return MCS 2 from VHT MCS values.
124 *
125 * \return MCS 2 from VHT MCS values
126 */
128 /**
129 * Return MCS 3 from VHT MCS values.
130 *
131 * \return MCS 3 from VHT MCS values
132 */
134 /**
135 * Return MCS 4 from VHT MCS values.
136 *
137 * \return MCS 4 from VHT MCS values
138 */
140 /**
141 * Return MCS 5 from VHT MCS values.
142 *
143 * \return MCS 5 from VHT MCS values
144 */
146 /**
147 * Return MCS 6 from VHT MCS values.
148 *
149 * \return MCS 6 from VHT MCS values
150 */
152 /**
153 * Return MCS 7 from VHT MCS values.
154 *
155 * \return MCS 7 from VHT MCS values
156 */
158 /**
159 * Return MCS 8 from VHT MCS values.
160 *
161 * \return MCS 8 from VHT MCS values
162 */
164 /**
165 * Return MCS 9 from VHT MCS values.
166 *
167 * \return MCS 9 from VHT MCS values
168 */
170
171 /**
172 * Return the coding rate corresponding to
173 * the supplied VHT MCS index. This function is
174 * reused by child classes and is used as a callback
175 * for WifiMode operation.
176 *
177 * \param mcsValue the MCS index
178 * \return the coding rate.
179 */
180 static WifiCodeRate GetCodeRate(uint8_t mcsValue);
181 /**
182 * Return the constellation size corresponding
183 * to the supplied VHT MCS index. This function is
184 * reused by child classes and is used as a callback for
185 * WifiMode operation.
186 *
187 * \param mcsValue the MCS index
188 * \return the size of modulation constellation.
189 */
190 static uint16_t GetConstellationSize(uint8_t mcsValue);
191 /**
192 * Return the PHY rate corresponding to the supplied VHT MCS
193 * index, channel width, guard interval, and number of
194 * spatial stream. This function calls HtPhy::CalculatePhyRate
195 * and is mainly used as a callback for WifiMode operation.
196 *
197 * \param mcsValue the VHT MCS index
198 * \param channelWidth the considered channel width in MHz
199 * \param guardInterval the considered guard interval duration in nanoseconds
200 * \param nss the considered number of stream
201 *
202 * \return the physical bit rate of this signal in bps.
203 */
204 static uint64_t GetPhyRate(uint8_t mcsValue,
205 uint16_t channelWidth,
206 uint16_t guardInterval,
207 uint8_t nss);
208 /**
209 * Return the PHY 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 physical bit rate of this signal in bps.
217 */
218 static uint64_t GetPhyRateFromTxVector(const WifiTxVector& txVector, uint16_t staId);
219 /**
220 * Return the data rate corresponding to
221 * the supplied TXVECTOR.
222 * This function is mainly used as a callback
223 * for WifiMode operation.
224 *
225 * \param txVector the TXVECTOR used for the transmission
226 * \param staId the station ID (only here to have a common signature for all callbacks)
227 * \return the data bit rate in bps.
228 */
229 static uint64_t GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t staId);
230 /**
231 * Return the data rate corresponding to
232 * the supplied VHT MCS index, channel width,
233 * guard interval, and number of spatial
234 * streams.
235 *
236 * \param mcsValue the MCS index
237 * \param channelWidth the channel width in MHz
238 * \param guardInterval the guard interval duration in nanoseconds
239 * \param nss the number of spatial streams
240 * \return the data bit rate in bps.
241 */
242 static uint64_t GetDataRate(uint8_t mcsValue,
243 uint16_t channelWidth,
244 uint16_t guardInterval,
245 uint8_t nss);
246 /**
247 * Calculate the rate in bps of the non-HT Reference Rate corresponding
248 * to the supplied VHT MCS index. This function calls CalculateNonHtReferenceRate
249 * and is used as a callback for WifiMode operation.
250 *
251 * \param mcsValue the VHT MCS index
252 * \return the rate in bps of the non-HT Reference Rate.
253 */
254 static uint64_t GetNonHtReferenceRate(uint8_t mcsValue);
255 /**
256 * Check whether the combination of <MCS, channel width, NSS> is allowed.
257 * This function is used as a callback for WifiMode operation.
258 *
259 * \param mcsValue the considered MCS index
260 * \param channelWidth the considered channel width in MHz
261 * \param nss the considered number of streams
262 * \returns true if this <MCS, channel width, NSS> combination is allowed, false otherwise.
263 */
264 static bool IsCombinationAllowed(uint8_t mcsValue, uint16_t channelWidth, uint8_t nss);
265 /**
266 * Check whether the combination in TXVECTOR is allowed.
267 * This function is used as a callback for WifiMode operation.
268 *
269 * \param txVector the TXVECTOR
270 * \returns true if this combination is allowed, false otherwise.
271 */
272 static bool IsAllowed(const WifiTxVector& txVector);
273
274 protected:
275 WifiMode GetHtSigMode() const override;
276 Time GetHtSigDuration() const override;
277 uint8_t GetNumberBccEncoders(const WifiTxVector& txVector) const override;
279 bool IsAllConfigSupported(WifiPpduField field, Ptr<const WifiPpdu> ppdu) const override;
280 uint32_t GetMaxPsduSize() const override;
282
283 /**
284 * End receiving the SIG-A or SIG-B, perform VHT-specific actions, and
285 * provide the status of the reception.
286 *
287 * Child classes can perform amendment-specific actions by specializing
288 * \see ProcessSig.
289 *
290 * \param event the event holding incoming PPDU's information
291 * \param field the current PPDU field
292 * \return status of the reception of the SIG-A of SIG-B
293 */
295
296 /**
297 * Get the failure reason corresponding to the unsuccessful processing of a given PPDU field.
298 *
299 * \param field the PPDU field
300 * \return the failure reason corresponding to the unsuccessful processing of the PPDU field
301 */
303
304 /**
305 * Process SIG-A or SIG-B, perform amendment-specific actions, and
306 * provide an updated status of the reception.
307 *
308 * \param event the event holding incoming PPDU's information
309 * \param status the status of the reception of the correctly received SIG-A or SIG-B after the
310 * configuration support check
311 * \param field the current PPDU field to identify whether it is SIG-A or SIG-B
312 * \return the updated status of the reception of the SIG-A or SIG-B
313 */
315 PhyFieldRxStatus status,
316 WifiPpduField field);
317
318 /**
319 * Return the rate (in bps) of the non-HT Reference Rate
320 * which corresponds to the supplied code rate and
321 * constellation size.
322 *
323 * \param codeRate the convolutional coding rate
324 * \param constellationSize the size of modulation constellation
325 * \returns the rate in bps.
326 *
327 * To convert an VHT MCS to its corresponding non-HT Reference Rate
328 * use the modulation and coding rate of the HT MCS
329 * and lookup in Table 10-7 of IEEE 802.11-2016.
330 */
331 static uint64_t CalculateNonHtReferenceRate(WifiCodeRate codeRate, uint16_t constellationSize);
332 /**
333 * \param channelWidth the channel width in MHz
334 * \return he number of usable subcarriers for data
335 */
336 static uint16_t GetUsableSubcarriers(uint16_t channelWidth);
337
338 private:
339 void BuildModeList() override;
340
341 /**
342 * Return the VHT MCS corresponding to
343 * the provided index.
344 * This method binds all the callbacks used by WifiMode.
345 *
346 * \param index the index of the MCS
347 * \return a VHT MCS
348 */
349 static WifiMode CreateVhtMcs(uint8_t index);
350
351 /**
352 * Typedef for storing exceptions in the number of BCC encoders for VHT MCSs
353 */
354 typedef std::map<
355 std::tuple<uint16_t /* channelWidth in MHz */, uint8_t /* Nss */, uint8_t /* MCS index */>,
356 uint8_t /* Nes */>
358 static const NesExceptionMap m_exceptionsMap; //!< exception map for number of BCC encoders
359 //!< (extracted from VHT-MCS tables)
360 static const PpduFormats m_vhtPpduFormats; //!< VHT PPDU formats
361}; // class VhtPhy
362
363} // namespace ns3
364
365#endif /* VHT_PHY_H */
PHY entity for HT (11n)
Definition: ht-phy.h:54
static uint16_t GetUsableSubcarriers()
Definition: ofdm-phy.cc:634
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:561
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:969
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
PHY entity for VHT (11ac)
Definition: vht-phy.h:49
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
Definition: vht-phy.cc:519
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:406
static bool IsCombinationAllowed(uint8_t mcsValue, uint16_t channelWidth, uint8_t nss)
Check whether the combination of <MCS, channel width, NSS> is allowed.
Definition: vht-phy.cc:527
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:176
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
Definition: vht-phy.h:358
~VhtPhy() override
Destructor for VHT PHY.
Definition: vht-phy.cc:113
double GetCcaThreshold(const Ptr< const WifiPpdu > ppdu, WifiChannelListType channelType) const override
Return the CCA threshold in dBm for a given channel type.
Definition: vht-phy.cc:547
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
Definition: vht-phy.h:360
std::map< std::tuple< uint16_t, uint8_t, uint8_t >, uint8_t > NesExceptionMap
Typedef for storing exceptions in the number of BCC encoders for VHT MCSs.
Definition: vht-phy.h:357
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:326
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:450
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:277
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Definition: vht-phy.cc:226
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
Definition: vht-phy.cc:202
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
Definition: vht-phy.cc:218
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:441
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:587
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:345
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:496
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:251
static uint64_t GetPhyRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the PHY rate corresponding to the supplied VHT MCS index, channel width, guard interval,...
Definition: vht-phy.cc:433
static WifiMode GetVhtMcs1()
Return MCS 1 from VHT MCS values.
void BuildModeList() override
Build mode list.
Definition: vht-phy.cc:119
virtual WifiMode GetSigAMode() const
Definition: vht-phy.cc:162
static WifiMode GetVhtMcs4()
Return MCS 4 from VHT MCS values.
Time GetLSigDuration(WifiPreamble preamble) const override
Definition: vht-phy.cc:190
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:317
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:262
static void InitializeModes()
Initialize all VHT modes.
Definition: vht-phy.cc:336
static uint64_t GetDataRate(uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the data rate corresponding to the supplied VHT MCS index, channel width, guard interval,...
Definition: vht-phy.cc:459
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:390
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:420
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:541
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:488
virtual Time GetSigADuration(WifiPreamble preamble) const
Definition: vht-phy.cc:212
const PpduFormats & GetPpduFormats() const override
Return the PPDU formats of the PHY.
Definition: vht-phy.cc:132
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:154
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Definition: vht-phy.cc:168
virtual WifiPhyRxfailureReason GetFailureReason(WifiPpduField field) const
Get the failure reason corresponding to the unsuccessful processing of a given PPDU field.
Definition: vht-phy.cc:302
Time GetHtSigDuration() const override
Definition: vht-phy.cc:196
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:138
represent a single transmission mode
Definition: wifi-mode.h:51
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:112