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
32#include <map>
33#include <optional>
34
36
37namespace ns3
38{
39
40class SpectrumChannel;
41struct SpectrumSignalParameters;
42class WifiSpectrumPhyInterface;
43struct WifiSpectrumSignalParameters;
44
58{
59 public:
61 friend class ::SpectrumWifiPhyFilterTest;
62
67 static TypeId GetTypeId();
68
70 ~SpectrumWifiPhy() override;
71
72 // Implementation of pure virtual method.
73 void SetDevice(const Ptr<WifiNetDevice> device) override;
74 void StartTx(Ptr<const WifiPpdu> ppdu) override;
75 Ptr<Channel> GetChannel() const override;
76 uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const override;
77 std::tuple<double, double, double> GetTxMaskRejectionParams() const override;
78 WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex = 0) override;
81 const WifiSpectrumBandIndices& indices) const override;
82
89 void AddChannel(const Ptr<SpectrumChannel> channel,
90 const FrequencyRange& freqRange = WHOLE_WIFI_SPECTRUM);
91
101
113 void SetAntenna(const Ptr<AntennaModel> antenna);
120
129 typedef void (*SignalArrivalCallback)(bool signalType,
130 uint32_t senderNodeId,
131 double rxPower,
132 Time duration);
133
134 // The following method calls the base WifiPhy class method
135 // but also generates a new SpectrumModel if called during runtime
136 void DoChannelSwitch() override;
137
145
153
160
161 protected:
162 void DoDispose() override;
163 void DoInitialize() override;
164
165 std::map<FrequencyRange, Ptr<WifiSpectrumPhyInterface>>
167
171
172 private:
178
183
193 bool CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const;
194
203 uint16_t width) const;
204
206
210
212
219};
220
221} // namespace ns3
222
223#endif /* SPECTRUM_WIFI_PHY_H */
Spectrum Wifi Phy Filter Test.
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.
void SetDevice(const Ptr< WifiNetDevice > device) override
Sets the device this PHY is associated with.
void Transmit(Ptr< WifiSpectrumSignalParameters > txParams)
This function is sending the signal to the Spectrum channel after finishing the configuration of the ...
void StartRx(Ptr< SpectrumSignalParameters > rxParams, Ptr< const WifiSpectrumPhyInterface > interface)
Input method for delivering a signal from the spectrum channel and low-level PHY interface to this Sp...
void DoInitialize() override
Initialize() implementation.
std::map< FrequencyRange, Ptr< WifiSpectrumPhyInterface > > m_spectrumPhyInterfaces
Spectrum PHY interfaces.
Ptr< AntennaModel > m_antenna
antenna model
FrequencyRange GetCurrentFrequencyRange() const override
Get the frequency range of the current RF interface.
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.
Ptr< WifiSpectrumPhyInterface > GetInterfaceCoveringChannelBand(uint16_t frequency, uint16_t width) const
Get the spectrum PHY interface that covers a band portion of the RF channel.
Ptr< AntennaModel > GetAntenna() const
Get the antenna model used for reception.
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 AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
Attach a SpectrumChannel to use for a given frequency range.
Ptr< WifiSpectrumPhyInterface > m_currentSpectrumPhyInterface
The current Spectrum PHY interface (held for performance reasons)
Ptr< WifiSpectrumPhyInterface > GetCurrentInterface() const
Get the currently active spectrum PHY interface.
double m_txMaskInnerBandMinimumRejection
The minimum rejection (in dBr) for the inner band of the transmit spectrum mask.
bool m_trackSignalsInactiveInterfaces
flag whether signals coming from inactive spectrum PHY interfaces are tracked
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
void ResetSpectrumModelIfNeeded()
Perform run-time spectrum model change if the one used by the current Spectrum PHY interface has chan...
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.
WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex=0) override
Get the info of a given band.
bool m_disableWifiReception
forces this PHY to fail to sync on any signal
void UpdateInterferenceHelperBands()
This function is called to update the bands handled by the InterferenceHelper.
void StartTx(Ptr< const WifiPpdu > ppdu) override
void DoChannelSwitch() override
Actually switch channel based on the stored channel settings.
WifiSpectrumBandFrequencies ConvertIndicesToFrequencies(const WifiSpectrumBandIndices &indices) const override
This is a helper function to convert start and stop indices to start and stop frequencies.
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:59
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< uint64_t, uint64_t > WifiSpectrumBandFrequencies
typedef for a pair of start and stop frequencies in Hz to represent a band
constexpr FrequencyRange WHOLE_WIFI_SPECTRUM
Identifier for the frequency range covering the whole wifi spectrum.
std::pair< uint32_t, uint32_t > WifiSpectrumBandIndices
typedef for a pair of start and stop sub-band indices
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
WifiSpectrumBandInfo structure containing info about a spectrum band.