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<Object> GetAntenna (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 method calls the base WifiPhy class method
139  // but also generates a new SpectrumModel if called during runtime
140  void DoChannelSwitch (void) override;
141 
149 
150 protected:
151  void DoDispose (void) override;
152  void DoInitialize (void) override;
153 
162  WifiSpectrumBand GetBand (uint16_t bandWidth, uint8_t bandIndex = 0) override;
163 
164 private:
175  WifiSpectrumBand ConvertHeRuSubcarriers (uint16_t bandWidth, uint16_t guardBandwidth,
176  HeRu::SubcarrierRange range, uint8_t bandIndex = 0) const override;
177 
181  void ResetSpectrumModel (void);
185  void UpdateInterferenceHelperBands (void);
186 
188 
192 
194  typedef std::map<WifiSpectrumBand, HeRu::RuSpec> RuBand;
195 
196  std::map<uint16_t, RuBand> m_ruBands;
200 
204 };
205 
206 } //namespace ns3
207 
208 #endif /* SPECTRUM_WIFI_PHY_H */
Spectrum Wifi Phy Filter Test.
std::pair< int16_t, int16_t > SubcarrierRange
(lowest index, highest index) pair defining a subcarrier range
Definition: he-ru.h:53
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
802.11 PHY layer model
TracedCallback< bool, uint32_t, double, Time > m_signalCb
Signal callback.
std::map< WifiSpectrumBand, HeRu::RuSpec > RuBand
Map a spectrum band associated with an RU to the RU specification.
void Transmit(Ptr< WifiSpectrumSignalParameters > txParams)
This function is sending the signal to the Spectrum channel after finishing the configuration of the ...
uint32_t GetBandBandwidth(void) const
Ptr< SpectrumChannel > m_channel
SpectrumChannel that this SpectrumWifiPhy is connected to.
void StartTx(Ptr< WifiPpdu > ppdu) override
Ptr< AntennaModel > m_antenna
antenna model
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...
void DoChannelSwitch(void) override
Actually switch channel based on the stored channel settings.
void(* SignalArrivalCallback)(bool signalType, uint32_t senderNodeId, double rxPower, Time duration)
Callback invoked when the PHY model starts to process a signal.
std::tuple< double, double, double > GetTxMaskRejectionParams(void) const override
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
void DoDispose(void) override
Destructor implementation.
Ptr< WifiSpectrumPhyInterface > m_wifiSpectrumPhyInterface
Spectrum PHY interface.
double m_txMaskInnerBandMinimumRejection
The minimum rejection (in dBr) for the inner band of the transmit spectrum mask.
double m_txMaskOuterBandMinimumRejection
The minimum rejection (in dBr) for the outer band of the transmit spectrum mask.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
static TypeId GetTypeId(void)
Get the type ID.
void SetAntenna(const Ptr< AntennaModel > antenna)
double m_txMaskOuterBandMaximumRejection
The maximum rejection (in dBr) for the outer band of the transmit spectrum mask.
WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth, uint16_t guardBandwidth, HeRu::SubcarrierRange range, uint8_t bandIndex=0) const override
Ptr< Object > GetAntenna(void) const
Get the antenna model used for reception.
bool m_disableWifiReception
forces this PHY to fail to sync on any signal
Ptr< const SpectrumModel > GetRxSpectrumModel()
WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex=0) override
Get the start band index and the stop band index for a given band.
void ResetSpectrumModel(void)
Perform run-time spectrum model change.
Ptr< const SpectrumModel > m_rxSpectrumModel
receive spectrum model
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void UpdateInterferenceHelperBands(void)
This function is called to update the bands handled by the InterferenceHelper.
Ptr< Channel > GetChannel(void) const override
Return the Channel this WifiPhy is connected to.
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...
void DoInitialize(void) override
Initialize() implementation.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
802.11 PHY layer model
Definition: wifi-phy.h:50
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:92