A Discrete-Event Network Simulator
API
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 
27 namespace ns3
28 {
29 
33 typedef std::pair<uint32_t, uint32_t> WifiSpectrumBand;
34 
43 {
44  public:
48  virtual ~WifiSpectrumValueHelper();
49 
64  static Ptr<SpectrumModel> GetSpectrumModel(uint32_t centerFrequency,
65  uint16_t channelWidth,
66  uint32_t bandBandwidth,
67  uint16_t guardBandwidth);
68 
83  static Ptr<SpectrumValue> CreateDsssTxPowerSpectralDensity(uint32_t centerFrequency,
84  double txPowerW,
85  uint16_t guardBandwidth);
86 
103  static Ptr<SpectrumValue> CreateOfdmTxPowerSpectralDensity(uint32_t centerFrequency,
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 
153  static Ptr<SpectrumValue> CreateHtOfdmTxPowerSpectralDensity(uint32_t centerFrequency,
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(uint32_t centerFrequency,
202  uint16_t channelWidth,
203  double txPowerW,
204  uint16_t guardBandwidth,
205  WifiSpectrumBand ru);
206 
218  static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity(uint32_t centerFrequency,
219  uint16_t channelWidth,
220  uint32_t bandBandwidth,
221  double noiseFigure,
222  uint16_t guardBandwidth);
223 
232  static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity(double noiseFigure,
233  Ptr<SpectrumModel> spectrumModel);
234 
247  static Ptr<SpectrumValue> CreateRfFilter(uint32_t centerFrequency,
248  uint16_t totalChannelWidth,
249  uint32_t bandBandwidth,
250  uint16_t guardBandwidth,
251  WifiSpectrumBand band);
252 
300  static void CreateSpectrumMaskForOfdm(
302  const std::vector<WifiSpectrumBand>& allocatedSubBands,
303  WifiSpectrumBand maskBand,
304  double txPowerPerBandW,
305  uint32_t nGuardBands,
306  uint32_t innerSlopeWidth,
307  double minInnerBandDbr,
308  double minOuterbandDbr,
309  double lowestPointDbr,
310  const std::vector<WifiSpectrumBand>& puncturedSubBands = std::vector<WifiSpectrumBand>{},
311  uint32_t puncturedSlopeWidth = 0);
312 
320  static void NormalizeSpectrumMask(Ptr<SpectrumValue> c, double txPowerW);
321 
331  static double DbmToW(double dbm);
332 
341  static double GetBandPowerW(Ptr<SpectrumValue> psd, const WifiSpectrumBand& band);
342 };
343 
352 {
353  public:
365  virtual Ptr<SpectrumValue> CreateConstant(double psd);
385  virtual Ptr<SpectrumValue> CreateTxPowerSpectralDensity(double txPower, uint8_t channel);
395  virtual Ptr<SpectrumValue> CreateRfFilter(uint8_t channel);
396 };
397 
398 } // namespace ns3
399 
400 #endif /* WIFI_SPECTRUM_VALUE_HELPER_H */
Implements Wifi SpectrumValue for the 2.4 GHz ISM band only, with a 5 MHz spectrum resolution.
virtual Ptr< SpectrumValue > CreateConstant(double psd)
Creates a SpectrumValue instance with a constant value for all frequencies.
virtual Ptr< SpectrumValue > CreateRfFilter(uint8_t channel)
Creates a SpectrumValue instance which represents the frequency response of the RF filter which is us...
virtual Ptr< SpectrumValue > CreateTxPowerSpectralDensity(double txPower, uint8_t channel)
Creates a SpectrumValue instance that represents the TX Power Spectral Density of a wifi device corre...
This class defines all functions to create a spectrum model for Wi-Fi based on a a spectral model ali...
static void CreateSpectrumMaskForOfdm(Ptr< SpectrumValue > c, const std::vector< WifiSpectrumBand > &allocatedSubBands, WifiSpectrumBand maskBand, double txPowerPerBandW, uint32_t nGuardBands, uint32_t innerSlopeWidth, double minInnerBandDbr, double minOuterbandDbr, double lowestPointDbr, const std::vector< WifiSpectrumBand > &puncturedSubBands=std::vector< WifiSpectrumBand >{}, uint32_t puncturedSlopeWidth=0)
Create a transmit power spectral density corresponding to OFDM transmit spectrum mask requirements fo...
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 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).
static Ptr< SpectrumValue > CreateDsssTxPowerSpectralDensity(uint32_t centerFrequency, double txPowerW, uint16_t guardBandwidth)
Create a transmit power spectral density corresponding to DSSS.
static Ptr< SpectrumModel > GetSpectrumModel(uint32_t centerFrequency, uint16_t channelWidth, uint32_t bandBandwidth, uint16_t guardBandwidth)
Return a SpectrumModel instance corresponding to the center frequency and channel width.
static Ptr< SpectrumValue > CreateNoisePowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, uint32_t bandBandwidth, double noiseFigure, uint16_t guardBandwidth)
Create a power spectral density corresponding to the noise.
static Ptr< SpectrumValue > CreateHeMuOfdmTxPowerSpectralDensity(uint32_t centerFrequency, uint16_t channelWidth, double txPowerW, uint16_t guardBandwidth, WifiSpectrumBand ru)
Create a transmit power spectral density corresponding to the OFDMA part of HE TB PPDUs for a given R...
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 double GetBandPowerW(Ptr< SpectrumValue > psd, const WifiSpectrumBand &band)
Calculate the power of the specified band composed of uniformly-sized sub-bands.
static Ptr< SpectrumValue > CreateRfFilter(uint32_t centerFrequency, uint16_t totalChannelWidth, uint32_t bandBandwidth, uint16_t guardBandwidth, WifiSpectrumBand band)
Create a spectral density corresponding to the RF filter.
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.
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
channel
Definition: third.py:81