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"
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"
46 for (
auto& phy :
m_phy)
48 phy.SetTypeId(
"ns3::SpectrumWifiPhy");
92 if (DynamicCast<const WifiBandwidthFilter>(p))
94 NS_LOG_DEBUG(
"Found existing WifiBandwidthFilter for channel " << channel);
99 NS_LOG_DEBUG(
"Found different SpectrumTransmitFilter for channel " << channel);
106 channel->AddSpectrumTransmitFilter(pWifi);
107 NS_LOG_DEBUG(
"Adding WifiBandwidthFilter to channel " << channel);
111std::vector<Ptr<WifiPhy>>
114 std::vector<Ptr<WifiPhy>> ret;
116 for (std::size_t i = 0; i <
m_phy.size(); i++)
120 phy->SetInterferenceHelper(interference);
122 phy->SetErrorRateModel(error);
126 phy->SetFrameCaptureModel(frameCapture);
130 auto preambleDetection =
132 phy->SetPreambleDetectionModel(preambleDetection);
134 for (
const auto& [freqRange, channel] :
m_channels)
136 phy->AddChannel(channel, freqRange);
138 phy->SetDevice(device);
140 ret.emplace_back(phy);
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.
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
SpectrumWifiPhyHelper(uint8_t nLinks=1)
Create a PHY helper.
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
void AddChannel(const std::string &channelName, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
void SetChannel(const Ptr< SpectrumChannel > channel)
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_phy
PHY object.
std::vector< ObjectFactory > m_errorRateModel
error rate model
ObjectFactory m_interferenceHelper
interference helper
#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.
constexpr FrequencyRange WHOLE_WIFI_SPECTRUM
Identifier for the frequency range covering the whole wifi spectrum.
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).