A Discrete-Event Network Simulator
API
dsss-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  * Mathieu Lacage <mathieu.lacage@sophia.inria.fr> (for logic ported from wifi-phy)
21  */
22 
23 #ifndef DSSS_PHY_H
24 #define DSSS_PHY_H
25 
26 #include "ns3/phy-entity.h"
27 #include <vector>
28 
35 namespace ns3 {
36 
45 class DsssPhy : public PhyEntity
46 {
47 public:
51  DsssPhy ();
55  virtual ~DsssPhy ();
56 
57  WifiMode GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const override;
58  const PpduFormats & GetPpduFormats (void) const override;
59  Time GetDuration (WifiPpduField field, const WifiTxVector& txVector) const override;
60  Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
61  bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
62  uint16_t staId) const override;
63  Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) override;
64  uint32_t GetMaxPsduSize (void) const override;
65 
69  static void InitializeModes (void);
77  static WifiMode GetDsssRate (uint64_t rate);
83  static WifiMode GetDsssRate1Mbps (void);
89  static WifiMode GetDsssRate2Mbps (void);
102 
111  static WifiCodeRate GetCodeRate (const std::string& name);
120  static uint16_t GetConstellationSize (const std::string& name);
131  static uint64_t GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId);
145  static uint64_t GetDataRate (const std::string& name, WifiModulationClass modClass, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss);
155  static bool IsModeAllowed (uint16_t channelWidth, uint8_t nss);
156 
157 private:
159  Ptr<SpectrumValue> GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const override;
160  uint16_t GetRxChannelWidth (const WifiTxVector& txVector) const override;
161 
166  WifiMode GetHeaderMode (const WifiTxVector& txVector) const;
167 
174  Time GetPreambleDuration (const WifiTxVector& txVector) const;
179  Time GetHeaderDuration (const WifiTxVector& txVector) const;
180 
189 
199  static WifiMode CreateDsssMode (std::string uniqueName, WifiModulationClass modClass);
200 
202 
204 }; //class DsssPhy
205 
206 } //namespace ns3
207 
208 #endif /* DSSS_PHY_H */
ns3::DsssPhy::GetPpduFormats
const PpduFormats & GetPpduFormats(void) const override
Return the PPDU formats of the PHY.
Definition: dsss-phy.cc:118
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::DsssPhy::GetDsssRate
static WifiMode GetDsssRate(uint64_t rate)
Return a WifiMode for HR/DSSS corresponding to the provided rate.
Definition: dsss-phy.cc:261
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::DsssPhy::GetCodeRate
static WifiCodeRate GetCodeRate(const std::string &name)
Return the WifiCodeRate from the DSSS or HR/DSSS mode's unique name using ModulationLookupTable.
Definition: dsss-phy.cc:317
ns3::DsssPhy::GetDataRateFromTxVector
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition: dsss-phy.cc:329
ns3::DsssPhy::m_dsssModulationLookupTable
static const ModulationLookupTable m_dsssModulationLookupTable
lookup table to retrieve code rate and constellation size corresponding to a unique name of modulatio...
Definition: dsss-phy.h:203
ns3::DsssPhy::CreateDsssMode
static WifiMode CreateDsssMode(std::string uniqueName, WifiModulationClass modClass)
Create a DSSS or HR/DSSS mode from a unique name, the unique name must already be contained inside Mo...
Definition: dsss-phy.cc:296
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::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::DsssPhy::GetPreambleDuration
Time GetPreambleDuration(const WifiTxVector &txVector) const
Definition: dsss-phy.cc:141
ns3::DsssPhy::m_dsssPpduFormats
static const PpduFormats m_dsssPpduFormats
DSSS and HR/DSSS PPDU formats.
Definition: dsss-phy.h:201
ns3::DsssPhy::GetDsssRate1Mbps
static WifiMode GetDsssRate1Mbps(void)
Return a WifiMode for DSSS at 1 Mbps.
ns3::DsssPhy::GetDsssRate2Mbps
static WifiMode GetDsssRate2Mbps(void)
Return a WifiMode for DSSS at 2 Mbps.
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::DsssPhy::GetMaxPsduSize
uint32_t GetMaxPsduSize(void) const override
Get the maximum PSDU size in bytes.
Definition: dsss-phy.cc:366
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:51
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
ns3::DsssPhy
PHY entity for HR/DSSS (11b)
Definition: dsss-phy.h:46
ns3::PhyEntity::PhyFieldRxStatus
Status of the reception of the PPDU field.
Definition: phy-entity.h:111
ns3::DsssPhy::~DsssPhy
virtual ~DsssPhy()
Destructor for HR/DSSS PHY.
Definition: dsss-phy.cc:83
ns3::DsssPhy::BuildPpdu
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition: dsss-phy.cc:181
ns3::DsssPhy::GetRxChannelWidth
uint16_t GetRxChannelWidth(const WifiTxVector &txVector) const override
Return the channel width used in the reception spectrum model.
Definition: dsss-phy.cc:224
ns3::DsssPhy::InitializeModes
static void InitializeModes(void)
Initialize all HR/DSSS modes.
Definition: dsss-phy.cc:252
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::DsssPhy::DsssPhy
DsssPhy()
Constructor for HR/DSSS PHY.
Definition: dsss-phy.cc:72
ns3::WifiPpduField
WifiPpduField
The type of PPDU field (grouped for convenience)
Definition: wifi-phy-common.h:166
ns3::DsssPhy::GetHeaderDuration
Time GetHeaderDuration(const WifiTxVector &txVector) const
Definition: dsss-phy.cc:157
ns3::DsssPhy::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: dsss-phy.cc:124
ns3::DsssPhy::GetConstellationSize
static uint16_t GetConstellationSize(const std::string &name)
Return the constellation size from the DSSS or HR/DSSS mode's unique name using ModulationLookupTable...
Definition: dsss-phy.cc:323
ns3::DsssPhy::GetHeaderMode
WifiMode GetHeaderMode(const WifiTxVector &txVector) const
Definition: dsss-phy.cc:102
ns3::DsssPhy::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: dsss-phy.cc:189
ns3::DsssPhy::GetDsssRate5_5Mbps
static WifiMode GetDsssRate5_5Mbps(void)
Return a WifiMode for HR/DSSS at 5.5 Mbps.
ns3::DsssPhy::IsModeAllowed
static bool IsModeAllowed(uint16_t channelWidth, uint8_t nss)
Check whether the combination of <WifiMode, channel width, NSS> is allowed.
Definition: dsss-phy.cc:360
ns3::PhyEntity::ModulationLookupTable
std::map< std::string, CodeRateConstellationSizePair > ModulationLookupTable
A modulation lookup table using unique name of modulation as key.
Definition: phy-entity.h:487
ns3::WifiPhyBand
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
ns3::DsssPhy::GetDsssRate11Mbps
static WifiMode GetDsssRate11Mbps(void)
Return a WifiMode for HR/DSSS at 11 Mbps.
ns3::PhyEntity
Abstract class for PHY entities.
Definition: phy-entity.h:94
ns3::DsssPhy::EndReceiveHeader
PhyFieldRxStatus EndReceiveHeader(Ptr< Event > event)
End receiving the header, perform DSSS-specific actions, and provide the status of the reception.
Definition: dsss-phy.cc:200
ns3::DsssPhy::GetDataRate
static uint64_t GetDataRate(const std::string &name, WifiModulationClass modClass, uint16_t channelWidth, uint16_t guardInterval, uint8_t nss)
Return the data rate from the DSSS or HR/DSSS mode's unique name and the supplied parameters.
Definition: dsss-phy.cc:338
ns3::DsssPhy::GetPayloadDuration
Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype, bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols, uint16_t staId) const override
Definition: dsss-phy.cc:173
ns3::WifiModulationClass
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
Definition: wifi-phy-common.h:117
ns3::DsssPhy::GetTxPowerSpectralDensity
Ptr< SpectrumValue > GetTxPowerSpectralDensity(double txPowerW, Ptr< const WifiPpdu > ppdu) const override
Definition: dsss-phy.cc:240
ns3::MpduType
MpduType
The type of an MPDU.
Definition: wifi-mpdu-type.h:31
ns3::DsssPhy::GetSigMode
WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const override
Get the WifiMode for the SIG field specified by the PPDU field.
Definition: dsss-phy.cc:89