A Discrete-Event Network Simulator
API
spectrum-wifi-phy.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005,2006 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  * Ghada Badawy <gbadawy@gmail.com>
20  * Sébastien Deronne <sebastien.deronne@gmail.com>
21  *
22  * Ported from yans-wifi-phy.h by several contributors starting
23  * with Nicola Baldo and Dean Armstrong
24  */
25 
26 #ifndef SPECTRUM_WIFI_PHY_H
27 #define SPECTRUM_WIFI_PHY_H
28 
29 #include "ns3/antenna-model.h"
30 #include "ns3/spectrum-channel.h"
31 #include "ns3/spectrum-model.h"
32 #include "wifi-phy.h"
33 #include <map>
34 
36 
37 namespace ns3 {
38 
39 class WifiSpectrumPhyInterface;
40 struct WifiSpectrumSignalParameters;
41 
54 class SpectrumWifiPhy : public WifiPhy
55 {
56 public:
58  friend class ::SpectrumWifiPhyFilterTest;
59 
64  static TypeId GetTypeId (void);
65 
66  SpectrumWifiPhy ();
67  virtual ~SpectrumWifiPhy ();
68 
69  // Implementation of pure virtual method.
70  void StartTx (Ptr<WifiPpdu> ppdu) override;
71  Ptr<Channel> GetChannel (void) const override;
72  uint16_t GetGuardBandwidth (uint16_t currentChannelWidth) const override;
73  std::tuple<double, double, double> GetTxMaskRejectionParams (void) const override;
74 
81 
88  void StartRx (Ptr<SpectrumSignalParameters> rxParams);
89 
109  void SetAntenna (const Ptr<AntennaModel> antenna);
115  Ptr<AntennaModel> GetRxAntenna (void) const;
122 
126  uint32_t GetBandBandwidth (void) const;
127 
136  typedef void (* SignalArrivalCallback) (bool signalType, uint32_t senderNodeId, double rxPower, Time duration);
137 
138  // The following four methods call to the base WifiPhy class method
139  // but also generate a new SpectrumModel if called during runtime
140  void SetChannelNumber (uint8_t id) override;
141  void SetFrequency (uint16_t freq) override;
142  void SetChannelWidth (uint16_t channelwidth) override;
143  void ConfigureStandardAndBand (WifiPhyStandard standard, WifiPhyBand band) override;
144 
152 
153 protected:
154  void DoDispose (void) override;
155  void DoInitialize (void) override;
156 
165  WifiSpectrumBand GetBand (uint16_t bandWidth, uint8_t bandIndex = 0) override;
166 
167 private:
178  WifiSpectrumBand ConvertHeRuSubcarriers (uint16_t bandWidth, uint16_t guardBandwidth,
179  HeRu::SubcarrierRange range, uint8_t bandIndex = 0) const override;
180 
184  void ResetSpectrumModel (void);
188  void UpdateInterferenceHelperBands (void);
189 
191 
195 
197  typedef std::map<WifiSpectrumBand, HeRu::RuSpec> RuBand;
198 
199  std::map<uint16_t, RuBand> m_ruBands;
203 
207 };
208 
209 } //namespace ns3
210 
211 #endif /* SPECTRUM_WIFI_PHY_H */
WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0) override
Get the start band index and the stop band index for a given band.
std::map< uint16_t, RuBand > m_ruBands
For each channel width, store all the distinct spectrum bands associated with every RU in a channel o...
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
TracedCallback< bool, uint32_t, double, Time > m_signalCb
Signal callback.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
802.11 PHY layer model
Definition: wifi-phy.h:48
Ptr< const SpectrumModel > GetRxSpectrumModel()
Forward calls to a chain of Callback.
void DoDispose(void) override
Destructor implementation.
static TypeId GetTypeId(void)
Get the type ID.
bool m_disableWifiReception
forces this PHY to fail to sync on any signal
void StartTx(Ptr< WifiPpdu > ppdu) override
void SetAntenna(const Ptr< AntennaModel > antenna)
void(* SignalArrivalCallback)(bool signalType, uint32_t senderNodeId, double rxPower, Time duration)
Callback invoked when the PHY model starts to process a signal.
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
channel
Definition: third.py:92
Ptr< SpectrumChannel > m_channel
SpectrumChannel that this SpectrumWifiPhy is connected to.
void Transmit(Ptr< WifiSpectrumSignalParameters > txParams)
This function is sending the signal to the Spectrum channel after finishing the configuration of the ...
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
double m_txMaskOuterBandMaximumRejection
The maximum rejection (in dBr) for the outer band of the transmit spectrum mask.
double m_txMaskOuterBandMinimumRejection
The minimum rejection (in dBr) for the outer band of the transmit spectrum mask.
void DoInitialize(void) override
Initialize() implementation.
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
802.11 PHY layer modelThis PHY implements a spectrum-aware enhancement of the 802.11 SpectrumWifiPhy model.
Ptr< const SpectrumModel > m_rxSpectrumModel
receive spectrum model
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::map< WifiSpectrumBand, HeRu::RuSpec > RuBand
Map a spectrum band associated with an RU to the RU specification.
uint32_t GetBandBandwidth(void) const
std::tuple< double, double, double > GetTxMaskRejectionParams(void) const override
Ptr< Channel > GetChannel(void) const override
Return the Channel this WifiPhy is connected to.
Spectrum Wifi Phy Filter Test.
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:32
void UpdateInterferenceHelperBands(void)
This function is called to update the bands handled by the InterferenceHelper.
void SetFrequency(uint16_t freq) override
If the operating channel for this object has not been set yet, the given center frequency is saved an...
Ptr< AntennaModel > GetRxAntenna(void) const
Get the antenna model used for reception.
Ptr< AntennaModel > m_antenna
antenna model
void SetChannelNumber(uint8_t id) override
Set channel number.
Ptr< WifiSpectrumPhyInterface > m_wifiSpectrumPhyInterface
Spectrum PHY interface.
void ResetSpectrumModel(void)
Perform run-time spectrum model change.
double m_txMaskInnerBandMinimumRejection
The minimum rejection (in dBr) for the inner band of the transmit spectrum mask.
WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const override
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
void SetChannelWidth(uint16_t channelwidth) override
If the operating channel for this object has not been set yet, the given channel width is saved and w...
a unique identifier for an interface.
Definition: type-id.h:58
void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band) override
Configure the PHY-level parameters for different Wi-Fi standard.
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...