A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
erp-ofdm-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 ERP_OFDM_PHY_H
23#define ERP_OFDM_PHY_H
24
25#include "ofdm-phy.h"
26
27/**
28 * \file
29 * \ingroup wifi
30 * Declaration of ns3::ErpOfdmPhy class.
31 */
32
33namespace ns3
34{
35
36/**
37 * \brief PHY entity for ERP-OFDM (11g)
38 * \ingroup wifi
39 *
40 * ERP-OFDM PHY is based on OFDM PHY.
41 * ERP-DSSS/CCK mode is not supported.
42 *
43 * Refer to IEEE 802.11-2016, clause 18.
44 */
45class ErpOfdmPhy : public OfdmPhy
46{
47 public:
48 /**
49 * Constructor for ERP-OFDM PHY
50 */
51 ErpOfdmPhy();
52 /**
53 * Destructor for ERP-OFDM PHY
54 */
55 ~ErpOfdmPhy() override;
56
58 const WifiTxVector& txVector,
59 Time ppduDuration) override;
60 uint32_t GetMaxPsduSize() const override;
61
62 /**
63 * Initialize all ERP-OFDM modes.
64 */
65 static void InitializeModes();
66 /**
67 * Return a WifiMode for ERP-OFDM
68 * corresponding to the provided rate.
69 *
70 * \param rate the rate in bps
71 * \return a WifiMode for ERP-OFDM
72 */
73 static WifiMode GetErpOfdmRate(uint64_t rate);
74
75 /**
76 * Return a WifiMode for ERP-OFDM at 6 Mbps.
77 *
78 * \return a WifiMode for ERP-OFDM at 6 Mbps
79 */
81 /**
82 * Return a WifiMode for ERP-OFDM at 9 Mbps.
83 *
84 * \return a WifiMode for ERP-OFDM at 9 Mbps
85 */
87 /**
88 * Return a WifiMode for ERP-OFDM at 12 Mbps.
89 *
90 * \return a WifiMode for ERP-OFDM at 12 Mbps
91 */
93 /**
94 * Return a WifiMode for ERP-OFDM at 18 Mbps.
95 *
96 * \return a WifiMode for ERP-OFDM at 18 Mbps
97 */
99 /**
100 * Return a WifiMode for ERP-OFDM at 24 Mbps.
101 *
102 * \return a WifiMode for ERP-OFDM at 24 Mbps
103 */
105 /**
106 * Return a WifiMode for ERP-OFDM at 36 Mbps.
107 *
108 * \return a WifiMode for ERP-OFDM at 36 Mbps
109 */
111 /**
112 * Return a WifiMode for ERP-OFDM at 48 Mbps.
113 *
114 * \return a WifiMode for ERP-OFDM at 48 Mbps
115 */
117 /**
118 * Return a WifiMode for ERP-OFDM at 54 Mbps.
119 *
120 * \return a WifiMode for ERP-OFDM at 54 Mbps
121 */
123
124 /**
125 * Return the WifiCodeRate from the ERP-OFDM mode's unique name using
126 * ModulationLookupTable. This is mainly used as a callback for
127 * WifiMode operation.
128 *
129 * \param name the unique name of the ERP-OFDM mode
130 * \return WifiCodeRate corresponding to the unique name
131 */
132 static WifiCodeRate GetCodeRate(const std::string& name);
133 /**
134 * Return the constellation size from the ERP-OFDM mode's unique name using
135 * ModulationLookupTable. This is mainly used as a callback for
136 * WifiMode operation.
137 *
138 * \param name the unique name of the ERP-OFDM mode
139 * \return constellation size corresponding to the unique name
140 */
141 static uint16_t GetConstellationSize(const std::string& name);
142 /**
143 * Return the PHY rate from the ERP-OFDM mode's unique name and
144 * the supplied parameters. This function calls OfdmPhy::CalculatePhyRate
145 * and is mainly used as a callback for WifiMode operation.
146 *
147 * \param name the unique name of the ERP-OFDM mode
148 * \param channelWidth the considered channel width in MHz
149 *
150 * \return the physical bit rate of this signal in bps.
151 */
152 static uint64_t GetPhyRate(const std::string& name, uint16_t channelWidth);
153 /**
154 * Return the PHY rate corresponding to
155 * the supplied TXVECTOR.
156 * This function is mainly used as a callback
157 * for WifiMode operation.
158 *
159 * \param txVector the TXVECTOR used for the transmission
160 * \param staId the station ID (only here to have a common signature for all callbacks)
161 * \return the physical bit rate of this signal in bps.
162 */
163 static uint64_t GetPhyRateFromTxVector(const WifiTxVector& txVector, uint16_t staId);
164 /**
165 * Return the data rate corresponding to
166 * the supplied TXVECTOR.
167 * This function is mainly used as a callback
168 * for WifiMode operation.
169 *
170 * \param txVector the TXVECTOR used for the transmission
171 * \param staId the station ID (only here to have a common signature for all callbacks)
172 * \return the data bit rate in bps.
173 */
174 static uint64_t GetDataRateFromTxVector(const WifiTxVector& txVector, uint16_t staId);
175 /**
176 * Return the data rate from the ERP-OFDM mode's unique name and
177 * the supplied parameters. This function calls OfdmPhy::CalculateDataRate
178 * and is mainly used as a callback for WifiMode operation.
179 *
180 * \param name the unique name of the ERP-OFDM mode
181 * \param channelWidth the considered channel width in MHz
182 *
183 * \return the data bit rate of this signal in bps.
184 */
185 static uint64_t GetDataRate(const std::string& name, uint16_t channelWidth);
186 /**
187 * Check whether the combination in TXVECTOR is allowed.
188 * This function is used as a callback for WifiMode operation.
189 *
190 * \param txVector the TXVECTOR
191 * \returns true if this combination is allowed, false otherwise.
192 */
193 static bool IsAllowed(const WifiTxVector& txVector);
194
195 private:
196 WifiMode GetHeaderMode(const WifiTxVector& txVector) const override;
197 Time GetPreambleDuration(const WifiTxVector& txVector) const override;
198 Time GetHeaderDuration(const WifiTxVector& txVector) const override;
199
200 /**
201 * Create an ERP-OFDM mode from a unique name, the unique name
202 * must already be contained inside ModulationLookupTable.
203 * This method binds all the callbacks used by WifiMode.
204 *
205 * \param uniqueName the unique name of the WifiMode
206 * \param isMandatory whether the WifiMode is mandatory
207 * \return the ERP-OFDM WifiMode
208 */
209 static WifiMode CreateErpOfdmMode(std::string uniqueName, bool isMandatory);
210
211 static const ModulationLookupTable
212 m_erpOfdmModulationLookupTable; //!< lookup table to retrieve code rate and constellation
213 //!< size corresponding to a unique name of modulation
214}; // class ErpOfdmPhy
215
216} // namespace ns3
217
218#endif /* ERP_OFDM_PHY_H */
PHY entity for ERP-OFDM (11g)
Definition: erp-ofdm-phy.h:46
~ErpOfdmPhy() override
Destructor for ERP-OFDM PHY.
Definition: erp-ofdm-phy.cc:89
static uint64_t GetPhyRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the PHY rate corresponding to the supplied TXVECTOR.
static const ModulationLookupTable m_erpOfdmModulationLookupTable
lookup table to retrieve code rate and constellation size corresponding to a unique name of modulatio...
Definition: erp-ofdm-phy.h:212
static WifiCodeRate GetCodeRate(const std::string &name)
Return the WifiCodeRate from the ERP-OFDM mode's unique name using ModulationLookupTable.
Time GetPreambleDuration(const WifiTxVector &txVector) const override
Time GetHeaderDuration(const WifiTxVector &txVector) const override
static void InitializeModes()
Initialize all ERP-OFDM modes.
Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration) override
Build amendment-specific PPDU.
static uint64_t GetDataRateFromTxVector(const WifiTxVector &txVector, uint16_t staId)
Return the data rate corresponding to the supplied TXVECTOR.
uint32_t GetMaxPsduSize() const override
Get the maximum PSDU size in bytes.
static uint64_t GetPhyRate(const std::string &name, uint16_t channelWidth)
Return the PHY rate from the ERP-OFDM mode's unique name and the supplied parameters.
static WifiMode GetErpOfdmRate(uint64_t rate)
Return a WifiMode for ERP-OFDM corresponding to the provided rate.
static bool IsAllowed(const WifiTxVector &txVector)
Check whether the combination in TXVECTOR is allowed.
static WifiMode GetErpOfdmRate6Mbps()
Return a WifiMode for ERP-OFDM at 6 Mbps.
ErpOfdmPhy()
Constructor for ERP-OFDM PHY.
Definition: erp-ofdm-phy.cc:77
static WifiMode GetErpOfdmRate18Mbps()
Return a WifiMode for ERP-OFDM at 18 Mbps.
static WifiMode GetErpOfdmRate24Mbps()
Return a WifiMode for ERP-OFDM at 24 Mbps.
static uint16_t GetConstellationSize(const std::string &name)
Return the constellation size from the ERP-OFDM mode's unique name using ModulationLookupTable.
static WifiMode GetErpOfdmRate12Mbps()
Return a WifiMode for ERP-OFDM at 12 Mbps.
static WifiMode CreateErpOfdmMode(std::string uniqueName, bool isMandatory)
Create an ERP-OFDM mode from a unique name, the unique name must already be contained inside Modulati...
static WifiMode GetErpOfdmRate9Mbps()
Return a WifiMode for ERP-OFDM at 9 Mbps.
static WifiMode GetErpOfdmRate48Mbps()
Return a WifiMode for ERP-OFDM at 48 Mbps.
static WifiMode GetErpOfdmRate54Mbps()
Return a WifiMode for ERP-OFDM at 54 Mbps.
WifiMode GetHeaderMode(const WifiTxVector &txVector) const override
Definition: erp-ofdm-phy.cc:95
static WifiMode GetErpOfdmRate36Mbps()
Return a WifiMode for ERP-OFDM at 36 Mbps.
static uint64_t GetDataRate(const std::string &name, uint16_t channelWidth)
Return the data rate from the ERP-OFDM mode's unique name and the supplied parameters.
PHY entity for OFDM (11a)
Definition: ofdm-phy.h:61
std::map< std::string, CodeRateConstellationSizePair > ModulationLookupTable
A modulation lookup table using unique name of modulation as key.
Definition: phy-entity.h:571
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...
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...
Declaration of ns3::OfdmPhy class and ns3::OfdmPhyVariant enum.