A Discrete-Event Network Simulator
API
ns3::SpectrumWifiPhyHelper Class Reference

Make it easy to create and manage PHY objects for the spectrum model. More...

#include "spectrum-wifi-helper.h"

+ Inheritance diagram for ns3::SpectrumWifiPhyHelper:
+ Collaboration diagram for ns3::SpectrumWifiPhyHelper:

Public Member Functions

 SpectrumWifiPhyHelper (uint8_t nLinks=1)
 Create a PHY helper. More...
 
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 AddPhyToFreqRangeMapping (uint8_t linkId, const FrequencyRange &freqRange)
 Add a given spectrum PHY interface to the PHY instance corresponding of a given link. More...
 
void ResetPhyToFreqRangeMapping ()
 Reset mapping of the spectrum PHY interfaces added to the PHY instances. More...
 
void SetChannel (const Ptr< SpectrumChannel > channel)
 
void SetChannel (const std::string &channelName)
 
- Public Member Functions inherited from ns3::WifiPhyHelper
 WifiPhyHelper (uint8_t nLinks=1)
 Constructor. More...
 
 ~WifiPhyHelper () override
 
void DisablePreambleDetectionModel ()
 Disable the preamble detection model on all links. More...
 
PcapHelper::DataLinkType GetPcapDataLinkType () const
 Get the data link type of PCAP traces to be used. More...
 
void Set (std::string name, const AttributeValue &v)
 
void Set (uint8_t linkId, std::string name, const AttributeValue &v)
 
template<typename... Args>
void SetErrorRateModel (std::string type, Args &&... args)
 Helper function used to set the error rate model. More...
 
template<typename... Args>
void SetErrorRateModel (uint8_t linkId, std::string type, Args &&... args)
 
template<typename... Args>
void SetFrameCaptureModel (std::string type, Args &&... args)
 Helper function used to set the frame capture model. More...
 
template<typename... Args>
void SetFrameCaptureModel (uint8_t linkId, std::string type, Args &&... args)
 
template<typename... Args>
void SetInterferenceHelper (std::string type, Args &&... args)
 Helper function used to set the interference helper. More...
 
void SetPcapDataLinkType (SupportedPcapDataLinkTypes dlt)
 Set the data link type of PCAP traces to be used. More...
 
template<typename... Args>
void SetPreambleDetectionModel (std::string type, Args &&... args)
 Helper function used to set the preamble detection model. More...
 
template<typename... Args>
void SetPreambleDetectionModel (uint8_t linkId, std::string type, Args &&... args)
 
- Public Member Functions inherited from ns3::PcapHelperForDevice
 PcapHelperForDevice ()
 Construct a PcapHelperForDevice. More...
 
virtual ~PcapHelperForDevice ()
 Destroy a PcapHelperForDevice. More...
 
void EnablePcap (std::string prefix, NetDeviceContainer d, bool promiscuous=false)
 Enable pcap output on each device in the container which is of the appropriate type. More...
 
void EnablePcap (std::string prefix, NodeContainer n, bool promiscuous=false)
 Enable pcap output on each device (which is of the appropriate type) in the nodes provided in the container. More...
 
void EnablePcap (std::string prefix, Ptr< NetDevice > nd, bool promiscuous=false, bool explicitFilename=false)
 Enable pcap output the indicated net device. More...
 
void EnablePcap (std::string prefix, std::string ndName, bool promiscuous=false, bool explicitFilename=false)
 Enable pcap output the indicated net device using a device previously named using the ns-3 object name service. More...
 
void EnablePcap (std::string prefix, uint32_t nodeid, uint32_t deviceid, bool promiscuous=false)
 Enable pcap output on the device specified by a global node-id (of a previously created node) and associated device-id. More...
 
void EnablePcapAll (std::string prefix, bool promiscuous=false)
 Enable pcap output on each device (which is of the appropriate type) in the set of all nodes created in the simulation. More...
 
- Public Member Functions inherited from ns3::AsciiTraceHelperForDevice
 AsciiTraceHelperForDevice ()
 Construct an AsciiTraceHelperForDevice. More...
 
virtual ~AsciiTraceHelperForDevice ()
 Destroy an AsciiTraceHelperForDevice. More...
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, NetDeviceContainer d)
 Enable ascii trace output on each device in the container which is of the appropriate type. More...
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, NodeContainer n)
 Enable ascii trace output on each device (which is of the appropriate type) in the nodes provided in the container. More...
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, Ptr< NetDevice > nd)
 Enable ascii trace output on the indicated net device. More...
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, std::string ndName)
 Enable ascii trace output the indicated net device using a device previously named using the ns-3 object name service. More...
 
void EnableAscii (Ptr< OutputStreamWrapper > stream, uint32_t nodeid, uint32_t deviceid)
 Enable ascii trace output on the device specified by a global node-id (of a previously created node) and associated device-id. More...
 
void EnableAscii (std::string prefix, NetDeviceContainer d)
 Enable ascii trace output on each device in the container which is of the appropriate type. More...
 
void EnableAscii (std::string prefix, NodeContainer n)
 Enable ascii trace output on each device (which is of the appropriate type) in the nodes provided in the container. More...
 
void EnableAscii (std::string prefix, Ptr< NetDevice > nd, bool explicitFilename=false)
 Enable ascii trace output on the indicated net device. More...
 
void EnableAscii (std::string prefix, std::string ndName, bool explicitFilename=false)
 Enable ascii trace output the indicated net device using a device previously named using the ns-3 object name service. More...
 
void EnableAscii (std::string prefix, uint32_t nodeid, uint32_t deviceid, bool explicitFilename)
 Enable ascii trace output on the device specified by a global node-id (of a previously created node) and associated device-id. More...
 
void EnableAsciiAll (Ptr< OutputStreamWrapper > stream)
 Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes created in the simulation. More...
 
void EnableAsciiAll (std::string prefix)
 Enable ascii trace output on each device (which is of the appropriate type) in the set of all nodes created in the simulation. More...
 

Private Member Functions

void AddWifiBandwidthFilter (Ptr< SpectrumChannel > channel)
 
std::vector< Ptr< WifiPhy > > Create (Ptr< Node > node, Ptr< WifiNetDevice > device) const override
 
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 (. More...
 

Static Private Member Functions

static void SpectrumChannelSwitched (Ptr< SpectrumWifiPhy > phy)
 Function that is notified when a spectrum channel switched. More...
 

Private Attributes

std::map< FrequencyRange, Ptr< SpectrumChannel > > m_channels
 the spectrum channels More...
 
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 More...
 

Additional Inherited Members

- Public Types inherited from ns3::WifiPhyHelper
enum  SupportedPcapDataLinkTypes { DLT_IEEE802_11 , DLT_PRISM_HEADER , DLT_IEEE802_11_RADIO }
 An enumeration of the pcap data link types (DLTs) which this helper supports. More...
 
- Static Protected Member Functions inherited from ns3::WifiPhyHelper
static void PcapSniffRxEvent (Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, SignalNoiseDbm signalNoise, uint16_t staId=SU_STA_ID)
 
static void PcapSniffTxEvent (Ptr< PcapFileWrapper > file, Ptr< const Packet > packet, uint16_t channelFreqMhz, WifiTxVector txVector, MpduInfo aMpdu, uint16_t staId=SU_STA_ID)
 
- Protected Attributes inherited from ns3::WifiPhyHelper
std::vector< ObjectFactorym_errorRateModel
 error rate model More...
 
std::vector< ObjectFactorym_frameCaptureModel
 frame capture model More...
 
ObjectFactory m_interferenceHelper
 interference helper More...
 
std::vector< ObjectFactorym_phys
 PHY objects. More...
 
std::vector< ObjectFactorym_preambleDetectionModel
 preamble detection model More...
 

Detailed Description

Make it easy to create and manage PHY objects for the spectrum model.

The Pcap and ASCII traces generated by the EnableAscii and EnablePcap methods defined in this class correspond to PHY-level traces and come to us via WifiPhyHelper

This helper will install an instance of a WifiBandwidthFilter on any SpectrumChannel added to this helper (via one of the SetChannel methods), unless one has previously been installed on the channel object.

Definition at line 44 of file spectrum-wifi-helper.h.

Constructor & Destructor Documentation

◆ SpectrumWifiPhyHelper()

ns3::SpectrumWifiPhyHelper::SpectrumWifiPhyHelper ( uint8_t  nLinks = 1)

Create a PHY helper.

Parameters
nLinksthe number of links to configure (>1 only for 11be devices)

Definition at line 42 of file spectrum-wifi-helper.cc.

References ns3::WifiPhyHelper::m_phys, NS_ABORT_IF, third::phy, ns3::WifiPhyHelper::SetErrorRateModel(), and ns3::WifiPhyHelper::SetInterferenceHelper().

+ Here is the call graph for this function:

Member Function Documentation

◆ AddChannel() [1/2]

void ns3::SpectrumWifiPhyHelper::AddChannel ( const Ptr< SpectrumChannel channel,
const FrequencyRange freqRange = WHOLE_WIFI_SPECTRUM 
)
Parameters
channelthe spectrum channel to add to this helper
freqRangethe frequency range, bounded by a minFrequency and a maxFrequency in MHz

Every PHY created by a call to Install is added to this spectrum channel. If a PHY is requested to operate or scan a channel with the specified frequency and width combination, it will activate that channel and deactivate the current channel for that PHY.

Definition at line 67 of file spectrum-wifi-helper.cc.

References AddWifiBandwidthFilter(), third::channel, and m_channels.

Referenced by AddChannel(), SpectrumWifiPhyInterfacesHelperTest::DoRun(), SpectrumWifiPhyMultipleInterfacesTest::DoSetup(), EmlsrOperationsTestBase::DoSetup(), SetChannel(), and MultiLinkOperationsTestBase::SetChannels().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddChannel() [2/2]

void ns3::SpectrumWifiPhyHelper::AddChannel ( const std::string &  channelName,
const FrequencyRange freqRange = WHOLE_WIFI_SPECTRUM 
)
Parameters
channelNameThe name of the spectrum channel to add to this helper
freqRangethe frequency range, bounded by a minFrequency and a maxFrequency in MHz

Every PHY created by a call to Install is added to this spectrum channel. If a PHY is requested to operate or scan a channel with the specified frequency and width combination, it will activate that channel and deactivate the current channel for that PHY.

Definition at line 75 of file spectrum-wifi-helper.cc.

References AddChannel(), and third::channel.

+ Here is the call graph for this function:

◆ AddPhyToFreqRangeMapping()

void ns3::SpectrumWifiPhyHelper::AddPhyToFreqRangeMapping ( uint8_t  linkId,
const FrequencyRange freqRange 
)

Add a given spectrum PHY interface to the PHY instance corresponding of a given link.

If no mapping has been specified for a given link, all spectrum PHY interfaces will be added to the PHY instance of that link.

Parameters
linkIdID of the link to setup
freqRangefrequency range handled by of the spectrum PHY interface

Definition at line 108 of file spectrum-wifi-helper.cc.

References m_interfacesMap.

Referenced by SpectrumWifiPhyInterfacesHelperTest::DoRun().

+ Here is the caller graph for this function:

◆ AddWifiBandwidthFilter()

void ns3::SpectrumWifiPhyHelper::AddWifiBandwidthFilter ( Ptr< SpectrumChannel channel)
private
Parameters
channelThe channel to inspect to possibly add a WifiBandwidthFilter

This method will add a WifiBandwidthFilter object to the SpectrumChannel, only if one has not yet been added.

Definition at line 82 of file spectrum-wifi-helper.cc.

References third::channel, and NS_LOG_DEBUG.

Referenced by AddChannel().

+ Here is the caller graph for this function:

◆ Create()

std::vector< Ptr< WifiPhy > > ns3::SpectrumWifiPhyHelper::Create ( Ptr< Node node,
Ptr< WifiNetDevice device 
) const
overrideprivatevirtual
Parameters
nodethe node on which we wish to create a wifi PHY
devicethe device within which this PHY will be created
Returns
newly-created PHY objects.

This method implements the pure virtual method defined in ns3::WifiPhyHelper.

Implements ns3::WifiPhyHelper.

Definition at line 127 of file spectrum-wifi-helper.cc.

References ns3::ObjectFactory::Create(), ns3::Object::GetObject(), InstallPhyInterfaces(), ns3::WifiPhyHelper::m_errorRateModel, ns3::WifiPhyHelper::m_frameCaptureModel, ns3::WifiPhyHelper::m_interferenceHelper, ns3::WifiPhyHelper::m_phys, ns3::WifiPhyHelper::m_preambleDetectionModel, ns3::MakeCallback(), third::phy, and SpectrumChannelSwitched().

+ Here is the call graph for this function:

◆ InstallPhyInterfaces()

void ns3::SpectrumWifiPhyHelper::InstallPhyInterfaces ( uint8_t  linkId,
Ptr< SpectrumWifiPhy phy 
) const
private

Install PHY interfaces to the PHY instance of a given link based on the currently configured mapping (.

See also
AddPhyInterface).
Parameters
linkIdID of the link to setup
physpectrum PHY instance of the link

Definition at line 161 of file spectrum-wifi-helper.cc.

References third::channel, m_channels, m_interfacesMap, and third::phy.

Referenced by Create().

+ Here is the caller graph for this function:

◆ ResetPhyToFreqRangeMapping()

void ns3::SpectrumWifiPhyHelper::ResetPhyToFreqRangeMapping ( )

Reset mapping of the spectrum PHY interfaces added to the PHY instances.

Definition at line 121 of file spectrum-wifi-helper.cc.

References m_interfacesMap.

Referenced by SpectrumWifiPhyInterfacesHelperTest::DoRun().

+ Here is the caller graph for this function:

◆ SetChannel() [1/2]

void ns3::SpectrumWifiPhyHelper::SetChannel ( const Ptr< SpectrumChannel channel)
Parameters
channelthe default spectrum channel to associate to this helper

Every PHY created by a call to Install is associated to this default spectrum channel.

Definition at line 55 of file spectrum-wifi-helper.cc.

References AddChannel(), and third::channel.

Referenced by Bug2843TestCase::DoRun(), and TestUlOfdmaPowerControl::DoSetup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetChannel() [2/2]

void ns3::SpectrumWifiPhyHelper::SetChannel ( const std::string &  channelName)
Parameters
channelNameThe name of the default spectrum channel to associate to this helper

Every PHY created by a call to Install is associated to this default spectrum channel.

Definition at line 61 of file spectrum-wifi-helper.cc.

References AddChannel().

+ Here is the call graph for this function:

◆ SpectrumChannelSwitched()

void ns3::SpectrumWifiPhyHelper::SpectrumChannelSwitched ( Ptr< SpectrumWifiPhy phy)
staticprivate

Function that is notified when a spectrum channel switched.

Parameters
physpectrum PHY instance that has switched its channel

Definition at line 181 of file spectrum-wifi-helper.cc.

References first::interfaces, NS_ASSERT, and third::phy.

Referenced by Create().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_channels

std::map<FrequencyRange, Ptr<SpectrumChannel> > ns3::SpectrumWifiPhyHelper::m_channels
private

the spectrum channels

Definition at line 136 of file spectrum-wifi-helper.h.

Referenced by AddChannel(), and InstallPhyInterfaces().

◆ m_interfacesMap

std::map<uint8_t , std::set<FrequencyRange> > ns3::SpectrumWifiPhyHelper::m_interfacesMap
private

map of the spectrum PHY interfaces to be added to the PHY instance corresponding to a given link ID

Definition at line 138 of file spectrum-wifi-helper.h.

Referenced by AddPhyToFreqRangeMapping(), InstallPhyInterfaces(), and ResetPhyToFreqRangeMapping().


The documentation for this class was generated from the following files: