A Discrete-Event Network Simulator
API
vht-phy.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2020 Orange Labs
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Rediet <getachew.redieteab@orange.com>
19  * S├ębastien Deronne <sebastien.deronne@gmail.com> (for logic ported from wifi-phy)
20  */
21 
22 #ifndef VHT_PHY_H
23 #define VHT_PHY_H
24 
25 #include "ns3/ht-phy.h"
26 
33 namespace ns3 {
34 
38 #define VHT_PHY 126
39 
48 class VhtPhy : public HtPhy
49 {
50 public:
57  VhtPhy (bool buildModeList = true);
61  virtual ~VhtPhy ();
62 
63  WifiMode GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const override;
64  const PpduFormats & GetPpduFormats (void) const override;
65  Time GetDuration (WifiPpduField field, const WifiTxVector& txVector) const override;
66  Time GetLSigDuration (WifiPreamble preamble) const override;
67  Time GetTrainingDuration (const WifiTxVector& txVector,
68  uint8_t nDataLtf,
69  uint8_t nExtensionLtf = 0) const override;
71  const WifiTxVector& txVector,
72  Time ppduDuration) override;
73 
77  virtual WifiMode GetSigAMode (void) const;
82  virtual WifiMode GetSigBMode (const WifiTxVector& txVector) const;
83 
88  virtual Time GetSigADuration (WifiPreamble preamble) const;
93  virtual Time GetSigBDuration (const WifiTxVector& txVector) const;
94 
98  static void InitializeModes (void);
106  static WifiMode GetVhtMcs (uint8_t index);
107 
113  static WifiMode GetVhtMcs0 (void);
119  static WifiMode GetVhtMcs1 (void);
125  static WifiMode GetVhtMcs2 (void);
131  static WifiMode GetVhtMcs3 (void);
137  static WifiMode GetVhtMcs4 (void);
143  static WifiMode GetVhtMcs5 (void);
149  static WifiMode GetVhtMcs6 (void);
155  static WifiMode GetVhtMcs7 (void);
161  static WifiMode GetVhtMcs8 (void);
167  static WifiMode GetVhtMcs9 (void);
168 
178  static WifiCodeRate GetCodeRate (uint8_t mcsValue);
188  static uint16_t GetConstellationSize (uint8_t mcsValue);
202  static uint64_t GetPhyRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss);
213  static uint64_t GetPhyRateFromTxVector (const WifiTxVector& txVector, uint16_t staId);
224  static uint64_t GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId);
237  static uint64_t GetDataRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss);
246  static uint64_t GetNonHtReferenceRate (uint8_t mcsValue);
256  static bool IsCombinationAllowed (uint8_t mcsValue, uint16_t channelWidth, uint8_t nss);
264  static bool IsAllowed (const WifiTxVector& txVector);
265 
266 protected:
267  WifiMode GetHtSigMode (void) const override;
268  Time GetHtSigDuration (void) const override;
269  uint8_t GetNumberBccEncoders (const WifiTxVector& txVector) const override;
271  bool IsAllConfigSupported (WifiPpduField field, Ptr<const WifiPpdu> ppdu) const override;
272  uint32_t GetMaxPsduSize (void) const override;
273 
296 
315 
329  static uint64_t CalculateNonHtReferenceRate (WifiCodeRate codeRate, uint16_t constellationSize);
334  static uint16_t GetUsableSubcarriers (uint16_t channelWidth);
335 
336 private:
337  void BuildModeList (void) override;
338 
347  static WifiMode CreateVhtMcs (uint8_t index);
348 
352  typedef std::map< std::tuple<uint16_t /* channelWidth in MHz */,
353  uint8_t /* Nss */,
354  uint8_t /* MCS index */>, uint8_t /* Nes */ > NesExceptionMap;
357 }; //class VhtPhy
358 
359 } //namespace ns3
360 
361 #endif /* VHT_PHY_H */
ns3::PhyEntity::PpduFormats
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:477
ns3::VhtPhy::EndReceiveSigA
PhyFieldRxStatus EndReceiveSigA(Ptr< Event > event)
End receiving the SIG-A, perform VHT-specific actions, and provide the status of the reception.
Definition: vht-phy.cc:241
ns3::VhtPhy::EndReceiveSigB
PhyFieldRxStatus EndReceiveSigB(Ptr< Event > event)
End receiving the SIG-B, perform VHT-specific actions, and provide the status of the reception.
Definition: vht-phy.cc:275
ns3::VhtPhy::IsAllConfigSupported
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:309
ns3::VhtPhy::IsAllowed
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
Definition: vht-phy.cc:498
ns3::VhtPhy::NesExceptionMap
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:354
ns3::VhtPhy::VhtPhy
VhtPhy(bool buildModeList=true)
Constructor for VHT PHY.
Definition: vht-phy.cc:71
ns3::VhtPhy::CalculateNonHtReferenceRate
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:476
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::VhtPhy::GetHtSigMode
WifiMode GetHtSigMode(void) const override
Definition: vht-phy.cc:124
ns3::VhtPhy::IsCombinationAllowed
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:506
ns3::VhtPhy::GetVhtMcs7
static WifiMode GetVhtMcs7(void)
Return MCS 7 from VHT MCS values.
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
ns3::VhtPhy::GetMaxPsduSize
uint32_t GetMaxPsduSize(void) const override
Get the maximum PSDU size in bytes.
Definition: vht-phy.cc:520
ns3::VhtPhy::GetVhtMcs8
static WifiMode GetVhtMcs8(void)
Return MCS 8 from VHT MCS values.
ns3::WifiConstPsduMap
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition: he-frame-exchange-manager.h:43
ns3::VhtPhy::GetDuration
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:145
ns3::VhtPhy::GetPhyRate
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:416
ns3::VhtPhy::CreateVhtMcs
static WifiMode CreateVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:374
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::VhtPhy::GetDataRate
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:442
ns3::VhtPhy::InitializeModes
static void InitializeModes(void)
Initialize all VHT modes.
Definition: vht-phy.cc:319
ns3::VhtPhy::GetVhtMcs3
static WifiMode GetVhtMcs3(void)
Return MCS 3 from VHT MCS values.
ns3::WifiCodeRate
uint16_t WifiCodeRate
These constants define the various convolutional coding rates used for the OFDM transmission modes in...
Definition: wifi-phy-common.h:45
ns3::VhtPhy::GetNumberBccEncoders
uint8_t GetNumberBccEncoders(const WifiTxVector &txVector) const override
Definition: vht-phy.cc:192
ns3::VhtPhy::GetHtSigDuration
Time GetHtSigDuration(void) const override
Definition: vht-phy.cc:165
ns3::VhtPhy::DoEndReceiveField
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:226
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
ns3::VhtPhy::GetVhtMcs9
static WifiMode GetVhtMcs9(void)
Return MCS 9 from VHT MCS values.
ns3::PhyEntity::PhyFieldRxStatus
Status of the reception of the PPDU field.
Definition: phy-entity.h:111
ns3::VhtPhy::GetTrainingDuration
Time GetTrainingDuration(const WifiTxVector &txVector, uint8_t nDataLtf, uint8_t nExtensionLtf=0) const override
Definition: vht-phy.cc:171
ns3::VhtPhy::GetVhtMcs5
static WifiMode GetVhtMcs5(void)
Return MCS 5 from VHT MCS values.
ns3::VhtPhy::m_exceptionsMap
static const NesExceptionMap m_exceptionsMap
exception map for number of BCC encoders (extracted from VHT-MCS tables)
Definition: vht-phy.h:355
ns3::VhtPhy::GetSigAMode
virtual WifiMode GetSigAMode(void) const
Definition: vht-phy.cc:132
ns3::VhtPhy::GetVhtMcs0
static WifiMode GetVhtMcs0(void)
Return MCS 0 from VHT MCS values.
ns3::VhtPhy::BuildModeList
void BuildModeList(void) override
Build mode list.
Definition: vht-phy.cc:90
ns3::VhtPhy::GetDataRateFromTxVector
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:433
ns3::VhtPhy::GetNonHtReferenceRate
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:468
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::VhtPhy::GetUsableSubcarriers
static uint16_t GetUsableSubcarriers(uint16_t channelWidth)
Definition: vht-phy.cc:454
ns3::WifiPpduField
WifiPpduField
The type of PPDU field (grouped for convenience)
Definition: wifi-phy-common.h:171
ns3::VhtPhy::GetVhtMcs2
static WifiMode GetVhtMcs2(void)
Return MCS 2 from VHT MCS values.
ns3::WifiPreamble
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
Definition: wifi-phy-common.h:68
ns3::VhtPhy::~VhtPhy
virtual ~VhtPhy()
Destructor for VHT PHY.
Definition: vht-phy.cc:84
ns3::VhtPhy::ProcessSigA
virtual PhyFieldRxStatus ProcessSigA(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-A, perform amendment-specific actions, and provide an updated status of the reception.
Definition: vht-phy.cc:267
ns3::VhtPhy::GetVhtMcs
static WifiMode GetVhtMcs(uint8_t index)
Return the VHT MCS corresponding to the provided index.
Definition: vht-phy.cc:328
ns3::VhtPhy::GetVhtMcs6
static WifiMode GetVhtMcs6(void)
Return MCS 6 from VHT MCS values.
ns3::VhtPhy::ProcessSigB
virtual PhyFieldRxStatus ProcessSigB(Ptr< Event > event, PhyFieldRxStatus status)
Process SIG-B, perform amendment-specific actions, and provide an updated status of the reception.
Definition: vht-phy.cc:301
ns3::VhtPhy
PHY entity for VHT (11ac)
Definition: vht-phy.h:49
ns3::VhtPhy::GetConstellationSize
static uint16_t GetConstellationSize(uint8_t mcsValue)
Return the constellation size corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:403
ns3::VhtPhy::GetLSigDuration
Time GetLSigDuration(WifiPreamble preamble) const override
Definition: vht-phy.cc:159
ns3::VhtPhy::GetVhtMcs4
static WifiMode GetVhtMcs4(void)
Return MCS 4 from VHT MCS values.
ns3::VhtPhy::GetPhyRateFromTxVector
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
Definition: vht-phy.cc:424
ns3::VhtPhy::GetSigBDuration
virtual Time GetSigBDuration(const WifiTxVector &txVector) const
Definition: vht-phy.cc:186
ns3::HtPhy
PHY entity for HT (11n)
Definition: ht-phy.h:51
ns3::VhtPhy::GetVhtMcs1
static WifiMode GetVhtMcs1(void)
Return MCS 1 from VHT MCS values.
ns3::VhtPhy::GetSigBMode
virtual WifiMode GetSigBMode(const WifiTxVector &txVector) const
Definition: vht-phy.cc:138
ns3::VhtPhy::m_vhtPpduFormats
static const PpduFormats m_vhtPpduFormats
VHT PPDU formats.
Definition: vht-phy.h:356
ns3::VhtPhy::GetSigADuration
virtual Time GetSigADuration(WifiPreamble preamble) const
Definition: vht-phy.cc:180
ns3::VhtPhy::GetPpduFormats
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
Definition: vht-phy.cc:103
ns3::VhtPhy::GetCodeRate
static WifiCodeRate GetCodeRate(uint8_t mcsValue)
Return the coding rate corresponding to the supplied VHT MCS index.
Definition: vht-phy.cc:389
ns3::VhtPhy::BuildPpdu
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition: vht-phy.cc:218
ns3::VhtPhy::GetSigMode
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:109