A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
spectrum-wifi-phy.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 * Ghada Badawy <gbadawy@gmail.com>
19 * Sébastien Deronne <sebastien.deronne@gmail.com>
20 *
21 * Ported from yans-wifi-phy.h by several contributors starting
22 * with Nicola Baldo and Dean Armstrong
23 */
24
25#ifndef SPECTRUM_WIFI_PHY_H
26#define SPECTRUM_WIFI_PHY_H
27
28#include "wifi-phy.h"
29
30#include "ns3/antenna-model.h"
31#include "ns3/spectrum-channel.h"
32#include "ns3/spectrum-model.h"
33
34#include <map>
35
37
38namespace ns3
39{
40
41class WifiSpectrumPhyInterface;
42struct WifiSpectrumSignalParameters;
43
57{
58 public:
60 friend class ::SpectrumWifiPhyFilterTest;
61
66 static TypeId GetTypeId();
67
69 ~SpectrumWifiPhy() override;
70
71 // Implementation of pure virtual method.
72 void StartTx(Ptr<const WifiPpdu> ppdu) override;
73 Ptr<Channel> GetChannel() const override;
74 uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override;
75 std::tuple<double, double, double> GetTxMaskRejectionParams() const override;
76
82 void SetChannel(const Ptr<SpectrumChannel> channel);
83
91
111 void SetAntenna(const Ptr<AntennaModel> antenna);
117 Ptr<Object> GetAntenna() const;
124
129
138 typedef void (*SignalArrivalCallback)(bool signalType,
139 uint32_t senderNodeId,
140 double rxPower,
141 Time duration);
142
143 // The following method calls the base WifiPhy class method
144 // but also generates a new SpectrumModel if called during runtime
145 void DoChannelSwitch() override;
146
154
162
163 protected:
164 void DoDispose() override;
165 void DoInitialize() override;
166
175 WifiSpectrumBand GetBand(uint16_t bandWidth, uint8_t bandIndex = 0) override;
176
177 private:
189 WifiSpectrumBand ConvertHeRuSubcarriers(uint16_t bandWidth,
190 uint16_t guardBandwidth,
192 uint8_t bandIndex = 0) const override;
193
197 void ResetSpectrumModel();
202
212 bool CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const;
213
215
219
221 typedef std::map<WifiSpectrumBand, HeRu::RuSpec> RuBand;
222
223 std::map<uint16_t, RuBand>
228
235};
236
237} // namespace ns3
238
239#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:52
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
802.11 PHY layer model
TracedCallback< bool, uint32_t, double, Time > m_signalCb
Signal callback.
std::tuple< double, double, double > GetTxMaskRejectionParams() const override
bool CanStartRx(Ptr< const WifiPpdu > ppdu, uint16_t txChannelWidth) const
Determine whether the PHY shall issue a PHY-RXSTART.indication primitive in response to a given PPDU.
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 ...
void DoInitialize() override
Initialize() implementation.
Ptr< SpectrumChannel > m_channel
SpectrumChannel that this SpectrumWifiPhy is connected to.
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...
Ptr< const WifiPpdu > GetRxPpduFromTxPpdu(Ptr< const WifiPpdu > ppdu)
Determine the WifiPpdu to be used by the RX PHY based on the WifiPpdu sent by the TX PHY.
void ResetSpectrumModel()
Perform run-time spectrum model change.
void(* SignalArrivalCallback)(bool signalType, uint32_t senderNodeId, double rxPower, Time duration)
Callback invoked when the PHY model starts to process a signal.
Ptr< Channel > GetChannel() const override
Return the Channel this WifiPhy is connected to.
void SetChannel(const Ptr< SpectrumChannel > channel)
Set the SpectrumChannel this SpectrumWifiPhy is to be connected to.
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.
void DoDispose() override
Destructor implementation.
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override
uint32_t GetBandBandwidth() const
static TypeId GetTypeId()
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
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.
Ptr< Object > GetAntenna() const
Get the antenna model used for reception.
void UpdateInterferenceHelperBands()
This function is called to update the bands handled by the InterferenceHelper.
Ptr< const SpectrumModel > m_rxSpectrumModel
receive spectrum model
void StartTx(Ptr< const WifiPpdu > ppdu) override
void DoChannelSwitch() override
Actually switch channel based on the stored channel settings.
void StartRx(Ptr< SpectrumSignalParameters > rxParams)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void CreateWifiSpectrumPhyInterface(Ptr< NetDevice > device)
Method to encapsulate the creation of the WifiSpectrumPhyInterface object (used to bind the WifiSpect...
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:60
802.11 PHY layer model
Definition: wifi-phy.h:53
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