23 #include "ns3/error-rate-model.h"
24 #include "ns3/frame-capture-model.h"
25 #include "ns3/interference-helper.h"
27 #include "ns3/mobility-model.h"
28 #include "ns3/names.h"
29 #include "ns3/preamble-detection-model.h"
30 #include "ns3/spectrum-channel.h"
31 #include "ns3/spectrum-transmit-filter.h"
32 #include "ns3/spectrum-wifi-phy.h"
33 #include "ns3/wifi-bandwidth-filter.h"
34 #include "ns3/wifi-net-device.h"
35 #include "ns3/wifi-spectrum-value-helper.h"
48 phy.SetTypeId(
"ns3::SpectrumWifiPhy");
88 if (DynamicCast<const WifiBandwidthFilter>(p))
102 channel->AddSpectrumTransmitFilter(pWifi);
116 it->second.emplace(freqRange);
126 std::vector<Ptr<WifiPhy>>
129 std::vector<Ptr<WifiPhy>> ret;
131 for (std::size_t i = 0; i <
m_phys.size(); i++)
135 phy->SetInterferenceHelper(interference);
137 phy->SetErrorRateModel(error);
141 phy->SetFrameCaptureModel(frameCapture);
145 auto preambleDetection =
147 phy->SetPreambleDetectionModel(preambleDetection);
150 phy->SetChannelSwitchedCallback(
152 phy->SetDevice(device);
154 ret.emplace_back(
phy);
183 for (
const auto& otherPhy :
phy->GetDevice()->GetPhys())
185 auto spectrumPhy = DynamicCast<SpectrumWifiPhy>(otherPhy);
187 if (spectrumPhy ==
phy)
192 if (spectrumPhy->GetCurrentFrequencyRange() ==
phy->GetCurrentFrequencyRange())
197 if (
const auto&
interfaces = spectrumPhy->GetSpectrumPhyInterfaces();
203 spectrumPhy->ConfigureInterface(
phy->GetFrequency(),
phy->GetChannelWidth());
the interface for Wifi's error models
the interface for Wifi's frame capture models
handles interference calculations
Keep track of the current position and velocity of an object.
Ptr< Object > Create() const
Create an Object instance of the configured TypeId.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
the interface for Wifi's preamble detection models
Smart pointer class similar to boost::intrusive_ptr.
std::vector< Ptr< WifiPhy > > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const override
void ResetPhyToFreqRangeMapping()
Reset mapping of the spectrum PHY interfaces added to the PHY instances.
SpectrumWifiPhyHelper(uint8_t nLinks=1)
Create a PHY helper.
std::map< uint8_t, std::set< FrequencyRange > > m_interfacesMap
map of the spectrum PHY interfaces to be added to the PHY instance corresponding to a given link ID
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
void InstallPhyInterfaces(uint8_t linkId, Ptr< SpectrumWifiPhy > phy) const
Install PHY interfaces to the PHY instance of a given link based on the currently configured mapping ...
void SetChannel(const Ptr< SpectrumChannel > channel)
static void SpectrumChannelSwitched(Ptr< SpectrumWifiPhy > phy)
Function that is notified when a spectrum channel switched.
void AddPhyToFreqRangeMapping(uint8_t linkId, const FrequencyRange &freqRange)
Add a given spectrum PHY interface to the PHY instance corresponding of a given link.
void AddWifiBandwidthFilter(Ptr< SpectrumChannel > channel)
std::map< FrequencyRange, Ptr< SpectrumChannel > > m_channels
the spectrum channels
void SetErrorRateModel(std::string type, Args &&... args)
Helper function used to set the error rate model.
void SetInterferenceHelper(std::string type, Args &&... args)
Helper function used to set the interference helper.
std::vector< ObjectFactory > m_frameCaptureModel
frame capture model
std::vector< ObjectFactory > m_preambleDetectionModel
preamble detection model
std::vector< ObjectFactory > m_phys
PHY objects.
std::vector< ObjectFactory > m_errorRateModel
error rate model
ObjectFactory m_interferenceHelper
interference helper
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).