A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
dsss-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 * Mathieu Lacage <mathieu.lacage@sophia.inria.fr> (for logic ported from wifi-phy)
9 */
10
11#ifndef DSSS_PHY_H
12#define DSSS_PHY_H
13
14#include "ns3/phy-entity.h"
15
16#include <vector>
17
18/**
19 * @file
20 * @ingroup wifi
21 * Declaration of ns3::DsssPhy class.
22 */
23
24namespace ns3
25{
26
27/**
28 * @brief PHY entity for HR/DSSS (11b)
29 * @ingroup wifi
30 *
31 * Refer to IEEE 802.11-2016, clause 16 (HR/DSSS).
32 * Note that DSSS rates (clause 15) are a subset
33 * of HR/DSSS rates.
34 */
35class DsssPhy : public PhyEntity
36{
37 public:
38 /**
39 * Constructor for HR/DSSS PHY
40 */
41 DsssPhy();
42 /**
43 * Destructor for HR/DSSS PHY
44 */
45 ~DsssPhy() override;
46
47 WifiMode GetSigMode(WifiPpduField field, const WifiTxVector& txVector) const override;
48 const PpduFormats& GetPpduFormats() const override;
49 Time GetDuration(WifiPpduField field, const WifiTxVector& txVector) const override;
51 const WifiTxVector& txVector,
52 WifiPhyBand band,
54 bool incFlag,
57 uint16_t staId) const override;
59 const WifiTxVector& txVector,
60 Time ppduDuration) override;
61 uint32_t GetMaxPsduSize() const override;
62
63 /**
64 * Initialize all HR/DSSS modes.
65 */
66 static void InitializeModes();
67 /**
68 * Return a WifiMode for HR/DSSS
69 * corresponding to the provided rate.
70 *
71 * @param rate the rate in bps
72 * @return a WifiMode for HR/DSSS
73 */
74 static WifiMode GetDsssRate(uint64_t rate);
75 /**
76 * Return a WifiMode for DSSS at 1 Mbps.
77 *
78 * @return a WifiMode for DSSS at 1 Mbps
79 */
81 /**
82 * Return a WifiMode for DSSS at 2 Mbps.
83 *
84 * @return a WifiMode for DSSS at 2 Mbps
85 */
87 /**
88 * Return a WifiMode for HR/DSSS at 5.5 Mbps.
89 *
90 * @return a WifiMode for HR/DSSS at 5.5 Mbps
91 */
93 /**
94 * Return a WifiMode for HR/DSSS at 11 Mbps.
95 *
96 * @return a WifiMode for HR/DSSS at 11 Mbps
97 */
99
100 /**
101 * Return the WifiCodeRate from the DSSS or HR/DSSS mode's unique
102 * name using ModulationLookupTable. This is mainly used as a
103 * callback for WifiMode operation.
104 *
105 * @param name the unique name of the DSSS or HR/DSSS mode
106 * @return WifiCodeRate corresponding to the unique name
107 */
108 static WifiCodeRate GetCodeRate(const std::string& name);
109 /**
110 * Return the constellation size from the DSSS or HR/DSSS mode's
111 * unique name using ModulationLookupTable. This is mainly used
112 * as a callback for WifiMode operation.
113 *
114 * @param name the unique name of the DSSS or HR/DSSS mode
115 * @return constellation size corresponding to the unique name
116 */
117 static uint16_t GetConstellationSize(const std::string& name);
118 /**
119 * Return the data rate corresponding to
120 * the supplied TXVECTOR.
121 * This function is mainly used as a callback
122 * for WifiMode operation.
123 *
124 * @param txVector the TXVECTOR used for the transmission
125 * @param staId the station ID (only here to have a common signature for all callbacks)
126 * @return the data bit rate in bps.
127 */
128 static uint64_t GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t staId);
129 /**
130 * Return the data rate from the DSSS or HR/DSSS mode's unique name and
131 * the supplied parameters. This function is mainly used as a callback
132 * for WifiMode operation.
133 *
134 * @param name the unique name of the DSSS or HR/DSSS mode
135 * @param modClass the modulation class, must be either WIFI_MOD_CLASS_DSSS or
136 * WIFI_MOD_CLASS_HR_DSSS
137 *
138 * @return the data bit rate of this signal in bps.
139 */
140 static uint64_t GetDataRate(const std::string& name, WifiModulationClass modClass);
141 /**
142 * Check whether the combination in TXVECTOR is allowed.
143 * This function is used as a callback for WifiMode operation.
144 *
145 * @param txVector the TXVECTOR
146 * @returns true if this combination is allowed, false otherwise.
147 */
148 static bool IsAllowed(const WifiTxVector& txVector);
149
150 private:
153 Ptr<const WifiPpdu> ppdu) const override;
154 MHz_u GetRxChannelWidth(const WifiTxVector& txVector) const override;
155 MHz_u GetMeasurementChannelWidth(const Ptr<const WifiPpdu> ppdu) const override;
156
157 /**
158 * @param txVector the transmission parameters
159 * @return the WifiMode used for the PHY header field
160 */
161 WifiMode GetHeaderMode(const WifiTxVector& txVector) const;
162
163 /**
164 * @param txVector the transmission parameters
165 * @return the duration of the PHY preamble field
166 *
167 * @see WIFI_PPDU_FIELD_PREAMBLE
168 */
169 Time GetPreambleDuration(const WifiTxVector& txVector) const;
170 /**
171 * @param txVector the transmission parameters
172 * @return the duration of the PHY header field
173 */
174 Time GetHeaderDuration(const WifiTxVector& txVector) const;
175
176 /**
177 * End receiving the header, perform DSSS-specific actions, and
178 * provide the status of the reception.
179 *
180 * @param event the event holding incoming PPDU's information
181 * @return status of the reception of the header
182 */
184
185 /**
186 * Create a DSSS or HR/DSSS mode from a unique name, the unique name
187 * must already be contained inside ModulationLookupTable.
188 * This method binds all the callbacks used by WifiMode.
189 *
190 * @param uniqueName the unique name of the WifiMode
191 * @param modClass the modulation class of the WifiMode, must be either WIFI_MOD_CLASS_DSSS or
192 * WIFI_MOD_CLASS_HR_DSSS
193 * @return the DSSS or HR/DSSS WifiMode
194 */
195 static WifiMode CreateDsssMode(std::string uniqueName, WifiModulationClass modClass);
196
197 static const PpduFormats m_dsssPpduFormats; //!< DSSS and HR/DSSS PPDU formats
198
199 static const ModulationLookupTable
200 m_dsssModulationLookupTable; //!< lookup table to retrieve code rate and constellation size
201 //!< corresponding to a unique name of modulation
202}; // class DsssPhy
203
204} // namespace ns3
205
206#endif /* DSSS_PHY_H */
PHY entity for HR/DSSS (11b)
Definition dsss-phy.h:36
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:202
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:347
static const PpduFormats m_dsssPpduFormats
DSSS and HR/DSSS PPDU formats.
Definition dsss-phy.h:197
PhyFieldRxStatus EndReceiveHeader(Ptr< Event > event)
End receiving the header, perform DSSS-specific actions, and provide the status of the reception.
Definition dsss-phy.cc:213
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:319
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:341
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:200
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
Definition dsss-phy.cc:353
~DsssPhy() override
Destructor for HR/DSSS PHY.
Definition dsss-phy.cc:82
static WifiMode GetDsssRate5_5Mbps()
Return a WifiMode for HR/DSSS at 5.5 Mbps.
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:88
static uint64_t GetDataRate(const std::string &name, WifiModulationClass modClass)
Return the data rate from the DSSS or HR/DSSS mode's unique name and the supplied parameters.
Definition dsss-phy.cc:360
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
Definition dsss-phy.cc:383
Time GetHeaderDuration(const WifiTxVector &txVector) const
Definition dsss-phy.cc:159
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:177
DsssPhy()
Constructor for HR/DSSS PHY.
Definition dsss-phy.cc:71
static WifiMode GetDsssRate(uint64_t rate)
Return a WifiMode for HR/DSSS corresponding to the provided rate.
Definition dsss-phy.cc:285
const PpduFormats & GetPpduFormats() const override
Return the PPDU formats of the PHY.
Definition dsss-phy.cc:119
MHz_u GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const override
Return the channel width used to measure the RSSI.
Definition dsss-phy.cc:254
uint32_t GetMaxPsduSize() const override
Get the maximum PSDU size in bytes.
Definition dsss-phy.cc:389
Time GetPreambleDuration(const WifiTxVector &txVector) const
Definition dsss-phy.cc:142
static WifiMode GetDsssRate1Mbps()
Return a WifiMode for DSSS at 1 Mbps.
WifiMode GetHeaderMode(const WifiTxVector &txVector) const
Definition dsss-phy.cc:102
MHz_u GetRxChannelWidth(const WifiTxVector &txVector) const override
Return the channel width used in the reception spectrum model.
Definition dsss-phy.cc:238
static void InitializeModes()
Initialize all HR/DSSS modes.
Definition dsss-phy.cc:276
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
Definition dsss-phy.cc:191
Ptr< SpectrumValue > GetTxPowerSpectralDensity(Watt_u txPower, Ptr< const WifiPpdu > ppdu) const override
Definition dsss-phy.cc:260
static WifiMode GetDsssRate11Mbps()
Return a WifiMode for HR/DSSS at 11 Mbps.
static WifiMode GetDsssRate2Mbps()
Return a WifiMode for DSSS at 2 Mbps.
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:125
Abstract class for PHY entities.
Definition phy-entity.h:64
std::map< std::string, CodeRateConstellationSizePair > ModulationLookupTable
A modulation lookup table using unique name of modulation as key.
Definition phy-entity.h:548
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition phy-entity.h:538
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:66
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
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...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
WifiPhyBand
Identifies the PHY band.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
WifiPpduField
The type of PPDU field (grouped for convenience)
MpduType
The type of an MPDU.
Definition wifi-types.h:41
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.
Definition wifi-ppdu.h:38
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