A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-spectrum-value-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 CTTC
3 * Copyright (c) 2017 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: Nicola Baldo <nbaldo@cttc.es>
19 * Rediet <getachew.redieteab@orange.com>
20 */
21
22#ifndef WIFI_SPECTRUM_VALUE_HELPER_H
23#define WIFI_SPECTRUM_VALUE_HELPER_H
24
25#include <ns3/spectrum-value.h>
26
27namespace ns3
28{
29
33using WifiSpectrumBandIndices = std::pair<uint32_t, uint32_t>;
34
43{
44 public:
48 virtual ~WifiSpectrumValueHelper() = default;
49
64 static Ptr<SpectrumModel> GetSpectrumModel(uint32_t centerFrequency,
65 uint16_t channelWidth,
66 uint32_t carrierSpacing,
67 uint16_t guardBandwidth);
68
84 double txPowerW,
85 uint16_t guardBandwidth);
86
104 uint16_t channelWidth,
105 double txPowerW,
106 uint16_t guardBandwidth,
107 double minInnerBandDbr = -20,
108 double minOuterbandDbr = -28,
109 double lowestPointDbr = -40);
110
128 uint32_t centerFrequency,
129 uint16_t channelWidth,
130 double txPowerW,
131 uint16_t guardBandwidth,
132 double minInnerBandDbr = -20,
133 double minOuterbandDbr = -28,
134 double lowestPointDbr = -40,
135 const std::vector<bool>& puncturedSubchannels = std::vector<bool>{});
136
154 uint16_t channelWidth,
155 double txPowerW,
156 uint16_t guardBandwidth,
157 double minInnerBandDbr = -20,
158 double minOuterbandDbr = -28,
159 double lowestPointDbr = -40);
160
179 uint32_t centerFrequency,
180 uint16_t channelWidth,
181 double txPowerW,
182 uint16_t guardBandwidth,
183 double minInnerBandDbr = -20,
184 double minOuterbandDbr = -28,
185 double lowestPointDbr = -40,
186 const std::vector<bool>& puncturedSubchannels = std::vector<bool>{});
187
201 static Ptr<SpectrumValue> CreateHeMuOfdmTxPowerSpectralDensity(
202 uint32_t centerFrequency,
203 uint16_t channelWidth,
204 double txPowerW,
205 uint16_t guardBandwidth,
206 const WifiSpectrumBandIndices& ru);
207
219 static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity(uint32_t centerFrequency,
220 uint16_t channelWidth,
221 uint32_t carrierSpacing,
222 double noiseFigure,
223 uint16_t guardBandwidth);
224
233 static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity(double noiseFigure,
234 Ptr<SpectrumModel> spectrumModel);
235
283 static void CreateSpectrumMaskForOfdm(
284 Ptr<SpectrumValue> c,
285 const std::vector<WifiSpectrumBandIndices>& allocatedSubBands,
286 const WifiSpectrumBandIndices& maskBand,
287 double txPowerPerBandW,
288 uint32_t nGuardBands,
289 uint32_t innerSlopeWidth,
290 double minInnerBandDbr,
291 double minOuterbandDbr,
292 double lowestPointDbr,
293 const std::vector<WifiSpectrumBandIndices>& puncturedSubBands =
294 std::vector<WifiSpectrumBandIndices>{},
295 uint32_t puncturedSlopeWidth = 0);
296
304 static void NormalizeSpectrumMask(Ptr<SpectrumValue> c, double txPowerW);
305
315 static double DbmToW(double dbm);
316
325 static double GetBandPowerW(Ptr<SpectrumValue> psd, const WifiSpectrumBandIndices& band);
326};
327
333{
334 uint16_t minFrequency{0};
335 uint16_t maxFrequency{0};
336};
337
346bool operator<(const FrequencyRange& lhs, const FrequencyRange& rhs);
347
357bool operator==(const FrequencyRange& lhs, const FrequencyRange& rhs);
358
368bool operator!=(const FrequencyRange& lhs, const FrequencyRange& rhs);
369
378std::ostream& operator<<(std::ostream& os, const FrequencyRange& freqRange);
379
381constexpr FrequencyRange WHOLE_WIFI_SPECTRUM = {2401, 7125};
382
384constexpr FrequencyRange WIFI_SPECTRUM_2_4_GHZ = {2401, 2483};
385
387constexpr FrequencyRange WIFI_SPECTRUM_5_GHZ = {5170, 5915};
388
390constexpr FrequencyRange WIFI_SPECTRUM_6_GHZ = {5945, 7125};
391
392} // namespace ns3
393
394#endif /* WIFI_SPECTRUM_VALUE_HELPER_H */
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
This class defines all functions to create a spectrum model for Wi-Fi based on a a spectral model ali...
static Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, uint32_t carrierSpacing, double noiseFigure, uint16_t guardBandwidth)
Create a power spectral density corresponding to the noise.
static Ptr< SpectrumValue > CreateDuplicated20MhzTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40, const std::vector< bool > &puncturedSubchannels=std::vector< bool >{})
Create a transmit power spectral density corresponding to OFDM duplicated over multiple 20 MHz subcha...
static void CreateSpectrumMaskForOfdm(Ptr< SpectrumValue > c, const std::vector< WifiSpectrumBandIndices > &allocatedSubBands, const WifiSpectrumBandIndices &maskBand, double txPowerPerBandW, uint32_t nGuardBands, uint32_t innerSlopeWidth, double minInnerBandDbr, double minOuterbandDbr, double lowestPointDbr, const std::vector< WifiSpectrumBandIndices > &puncturedSubBands=std::vector< WifiSpectrumBandIndices >{}, uint32_t puncturedSlopeWidth=0)
Create a transmit power spectral density corresponding to OFDM transmit spectrum mask requirements fo...
static Ptr< SpectrumValue > CreateHtOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40)
Create a transmit power spectral density corresponding to OFDM High Throughput (HT) (802....
static Ptr< SpectrumValue > CreateOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40)
Create a transmit power spectral density corresponding to OFDM (802.11a/g).
virtual ~WifiSpectrumValueHelper()=default
Destructor.
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t centerFrequency, uint16_t channelWidth, uint32_t carrierSpacing, uint16_t guardBandwidth)
Return a SpectrumModel instance corresponding to the center frequency and channel width.
static Ptr< SpectrumValue > CreateDsssTxPowerSpectralDensity(uint32_t centerFrequency, double txPowerW, uint16_t guardBandwidth)
Create a transmit power spectral density corresponding to DSSS.
static double GetBandPowerW(Ptr< SpectrumValue > psd, const WifiSpectrumBandIndices &band)
Calculate the power of the specified band composed of uniformly-sized sub-bands.
static double DbmToW(double dbm)
Convert from dBm to Watts.
static void NormalizeSpectrumMask(Ptr< SpectrumValue > c, double txPowerW)
Normalize the transmit spectrum mask generated by CreateSpectrumMaskForOfdm so that the total transmi...
static Ptr< SpectrumValue > CreateHeMuOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, const WifiSpectrumBandIndices &ru)
Create a transmit power spectral density corresponding to the OFDMA part of HE TB PPDUs for a given R...
static Ptr< SpectrumValue > CreateHeOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, double minInnerBandDbr=-20, double minOuterbandDbr=-28, double lowestPointDbr=-40, const std::vector< bool > &puncturedSubchannels=std::vector< bool >{})
Create a transmit power spectral density corresponding to OFDM High Efficiency (HE) (802....
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr FrequencyRange WIFI_SPECTRUM_6_GHZ
Identifier for the frequency range covering the wifi spectrum in the 6 GHz band.
bool operator!=(Callback< R, Args... > a, Callback< R, Args... > b)
Inequality test.
Definition: callback.h:676
bool operator==(const EventId &a, const EventId &b)
Definition: event-id.h:157
constexpr FrequencyRange WHOLE_WIFI_SPECTRUM
Identifier for the frequency range covering the whole wifi spectrum.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129
std::pair< uint32_t, uint32_t > WifiSpectrumBandIndices
typedef for a pair of start and stop sub-band indices
bool operator<(const EventId &a, const EventId &b)
Definition: event-id.h:170
constexpr FrequencyRange WIFI_SPECTRUM_5_GHZ
Identifier for the frequency range covering the wifi spectrum in the 5 GHz band.
constexpr FrequencyRange WIFI_SPECTRUM_2_4_GHZ
Identifier for the frequency range covering the wifi spectrum in the 2.4 GHz band.
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
uint16_t maxFrequency
the maximum frequency in MHz
uint16_t minFrequency
the minimum frequency in MHz