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