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 "wifi-phy.h"
32 #include "ns3/spectrum-channel.h"
33 #include "ns3/spectrum-interference.h"
34 
35 namespace ns3 {
36 
49 class SpectrumWifiPhy : public WifiPhy
50 {
51 public:
56  static TypeId GetTypeId (void);
57 
58  SpectrumWifiPhy ();
59  virtual ~SpectrumWifiPhy ();
60 
73  void AddOperationalChannel (uint8_t channelNumber);
81  std::vector<uint8_t> GetOperationalChannelList (void) const;
85  void ClearOperationalChannelList (void);
86 
93  void StartRx (Ptr<SpectrumSignalParameters> rxParams);
94 
102  void StartTx (Ptr<Packet> packet, WifiTxVector txVector, Time txDuration);
103 
127  void SetAntenna (const Ptr<AntennaModel> antenna);
133  Ptr<AntennaModel> GetRxAntenna (void) const;
140 
144  double GetBandBandwidth (void) const;
145 
149  uint32_t GetGuardBandwidth (void) const;
150 
159  typedef void (* SignalArrivalCallback) (bool signalType, uint32_t senderNodeId, double rxPower, Time duration);
160 
161  Ptr<Channel> GetChannel (void) const;
162 
163  // The following four methods call to the base WifiPhy class method
164  // but also generate a new SpectrumModel if called during runtime
165 
166  virtual void SetChannelNumber (uint8_t id);
167 
168  virtual void SetFrequency (uint16_t freq);
169 
170  virtual void SetChannelWidth (uint8_t channelwidth);
171 
172  virtual void ConfigureStandard (WifiPhyStandard standard);
173 
174 protected:
175  // Inherited
176  void DoDispose (void);
177  void DoInitialize (void);
178 
179 
180 private:
191  Ptr<SpectrumValue> GetTxPowerSpectralDensity (uint16_t centerFrequency, uint8_t channelWidth, double txPowerW, WifiModulationClass modulationClass) const;
192 
196  void ResetSpectrumModel (void);
197 
199  std::vector<uint8_t> m_operationalChannelList;
200 
206 
207 };
208 
209 } //namespace ns3
210 
211 #endif /* SPECTRUM_WIFI_PHY_H */
tuple channel
Definition: third.py:85
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
TracedCallback< bool, uint32_t, double, Time > m_signalCb
Signal callback.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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:164
Ptr< Channel > GetChannel(void) const
Return the Channel this WifiPhy is connected to.
Forward calls to a chain of Callback.
void StartTx(Ptr< Packet > packet, WifiTxVector txVector, Time txDuration)
static TypeId GetTypeId(void)
Get the type ID.
bool m_disableWifiReception
forces this Phy to fail to sync on any signal
Ptr< const SpectrumModel > GetRxSpectrumModel() const
Ptr< WifiSpectrumPhyInterface > GetSpectrumPhy(void) const
void SetAntenna(const Ptr< AntennaModel > antenna)
double GetBandBandwidth(void) const
virtual void SetChannelNumber(uint8_t id)
Set channel number.
void(* SignalArrivalCallback)(bool signalType, uint32_t senderNodeId, double rxPower, Time duration)
Callback invoked when the Phy model starts to process a signal.
void DoInitialize(void)
Initialize() implementation.
Ptr< SpectrumChannel > m_channel
SpectrumChannel that this SpectrumWifiPhy is connected to.
uint32_t GetGuardBandwidth(void) const
std::vector< uint8_t > GetOperationalChannelList(void) const
Return a list of channels to which it may be possible to roam By default, this method will return the...
WifiPhyStandard
Identifies the PHY specification that a Wifi device is configured to use.
Ptr< AntennaModel > GetRxAntenna(void) const
Get the antenna model used for reception.
virtual void ConfigureStandard(WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Ptr< SpectrumValue > GetTxPowerSpectralDensity(uint16_t centerFrequency, uint8_t channelWidth, double txPowerW, WifiModulationClass modulationClass) const
void DoDispose(void)
Destructor implementation.
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
virtual void SetFrequency(uint16_t freq)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiModulationClass
This enumeration defines the modulation classes per (Table 9-4 "Modulation classes"; IEEE 802...
Definition: wifi-mode.h:36
Ptr< AntennaModel > m_antenna
antenna model
std::vector< uint8_t > m_operationalChannelList
List of possible channels.
virtual void SetChannelWidth(uint8_t channelwidth)
void ClearOperationalChannelList(void)
Clear the list of operational channels.
Ptr< WifiSpectrumPhyInterface > m_wifiSpectrumPhyInterface
Spectrum phy interface.
void ResetSpectrumModel(void)
Perform run-time spectrum model change.
void AddOperationalChannel(uint8_t channelNumber)
Add a channel number to the list of operational channels.
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
a unique identifier for an interface.
Definition: type-id.h:58
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...