A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
spectrum-wifi-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7
*/
8
9
#ifndef SPECTRUM_WIFI_HELPER_H
10
#define SPECTRUM_WIFI_HELPER_H
11
12
#include "
wifi-helper.h
"
13
14
#include "ns3/wifi-export.h"
15
16
#include <map>
17
#include <set>
18
19
namespace
ns3
20
{
21
22
class
SpectrumChannel
;
23
class
SpectrumWifiPhy
;
24
25
/**
26
* @brief Make it easy to create and manage PHY objects for the spectrum model.
27
*
28
* The Pcap and ASCII traces generated by the EnableAscii and EnablePcap methods defined
29
* in this class correspond to PHY-level traces and come to us via WifiPhyHelper
30
*
31
* This helper will install an instance of a WifiBandwidthFilter on any SpectrumChannel
32
* added to this helper (via one of the SetChannel methods), unless one has
33
* previously been installed on the channel object.
34
*/
35
class
WIFI_EXPORT
SpectrumWifiPhyHelper
:
public
WifiPhyHelper
36
{
37
public
:
38
/**
39
* Create a PHY helper.
40
*
41
* @param nLinks the number of links to configure (>1 only for 11be devices)
42
*/
43
SpectrumWifiPhyHelper
(uint8_t nLinks = 1);
44
45
/**
46
* @param channel the default spectrum channel to associate to this helper
47
*
48
* Every PHY created by a call to Install is associated to this default spectrum channel.
49
*/
50
void
SetChannel
(
const
Ptr<SpectrumChannel>
channel);
51
/**
52
* @param channelName The name of the default spectrum channel to associate to this helper
53
*
54
* Every PHY created by a call to Install is associated to this default spectrum channel.
55
*/
56
void
SetChannel
(
const
std::string& channelName);
57
58
/**
59
* @param channel the spectrum channel to add to this helper
60
* @param freqRange the frequency range, bounded by a minFrequency and a maxFrequency in MHz
61
*
62
* Every PHY created by a call to Install is added to this spectrum channel.
63
* If a PHY is requested to operate or scan a channel with the specified frequency and width
64
* combination, it will activate that channel and deactivate the current channel for that PHY.
65
*/
66
void
AddChannel
(
const
Ptr<SpectrumChannel>
channel,
67
const
FrequencyRange
& freqRange =
WHOLE_WIFI_SPECTRUM
);
68
/**
69
* @param channelName The name of the spectrum channel to add to this helper
70
* @param freqRange the frequency range, bounded by a minFrequency and a maxFrequency in MHz
71
*
72
* Every PHY created by a call to Install is added to this spectrum channel.
73
* If a PHY is requested to operate or scan a channel with the specified frequency and width
74
* combination, it will activate that channel and deactivate the current channel for that PHY.
75
*/
76
void
AddChannel
(
const
std::string& channelName,
77
const
FrequencyRange
& freqRange =
WHOLE_WIFI_SPECTRUM
);
78
79
/**
80
* Add a given spectrum PHY interface to the PHY instance corresponding of a given link.
81
* If no mapping has been specified for a given link, all spectrum PHY interfaces will
82
* be added to the PHY instance of that link.
83
*
84
* @param linkId ID of the link to setup
85
* @param freqRange frequency range handled by of the spectrum PHY interface
86
*/
87
void
AddPhyToFreqRangeMapping
(uint8_t linkId,
const
FrequencyRange
& freqRange);
88
89
/**
90
* Reset mapping of the spectrum PHY interfaces added to the PHY instances.
91
*/
92
void
ResetPhyToFreqRangeMapping
();
93
94
private
:
95
/**
96
* @param node the node on which we wish to create a wifi PHY
97
* @param device the device within which this PHY will be created
98
* @returns newly-created PHY objects.
99
*
100
* This method implements the pure virtual method defined in \ref ns3::WifiPhyHelper.
101
*/
102
std::vector<Ptr<WifiPhy>>
Create
(
Ptr<Node>
node,
Ptr<WifiNetDevice>
device)
const override
;
103
104
/**
105
* @brief Install PHY interfaces to the PHY instance of a given link
106
* based on the currently configured mapping (\see AddPhyInterface).
107
*
108
* @param linkId ID of the link to setup
109
* @param phy spectrum PHY instance of the link
110
*/
111
void
InstallPhyInterfaces
(uint8_t linkId,
Ptr<SpectrumWifiPhy>
phy)
const
;
112
113
/**
114
* @param channel The channel to inspect to possibly add a WifiBandwidthFilter
115
*
116
* This method will add a WifiBandwidthFilter object to the SpectrumChannel, only if
117
* one has not yet been added.
118
*/
119
void
AddWifiBandwidthFilter
(
Ptr<SpectrumChannel>
channel);
120
121
/**
122
* Function that is notified when a spectrum channel switched
123
* @param phy spectrum PHY instance that has switched its channel
124
*/
125
static
void
SpectrumChannelSwitched
(
Ptr<SpectrumWifiPhy>
phy);
126
127
std::map<FrequencyRange, Ptr<SpectrumChannel>>
m_channels
;
///< the spectrum channels
128
std::map<uint8_t
/* linkId */
, std::set<FrequencyRange>>
129
m_interfacesMap
;
///< map of the spectrum PHY interfaces to be added to the PHY instance
130
///< corresponding to a given link ID
131
};
132
133
}
// namespace ns3
134
135
#endif
/* SPECTRUM_WIFI_HELPER_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:70
ns3::SpectrumChannel
Defines the interface for spectrum-aware channel implementations.
Definition
spectrum-channel.h:39
ns3::SpectrumWifiPhyHelper::Create
std::vector< Ptr< WifiPhy > > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const override
Definition
spectrum-wifi-helper.cc:118
ns3::SpectrumWifiPhyHelper::ResetPhyToFreqRangeMapping
void ResetPhyToFreqRangeMapping()
Reset mapping of the spectrum PHY interfaces added to the PHY instances.
Definition
spectrum-wifi-helper.cc:111
ns3::SpectrumWifiPhyHelper::SpectrumWifiPhyHelper
SpectrumWifiPhyHelper(uint8_t nLinks=1)
Create a PHY helper.
Definition
spectrum-wifi-helper.cc:31
ns3::SpectrumWifiPhyHelper::m_interfacesMap
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
Definition
spectrum-wifi-helper.h:129
ns3::SpectrumWifiPhyHelper::AddChannel
void AddChannel(const Ptr< SpectrumChannel > channel, const FrequencyRange &freqRange=WHOLE_WIFI_SPECTRUM)
Definition
spectrum-wifi-helper.cc:56
ns3::SpectrumWifiPhyHelper::InstallPhyInterfaces
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 ...
Definition
spectrum-wifi-helper.cc:152
ns3::SpectrumWifiPhyHelper::SetChannel
void SetChannel(const Ptr< SpectrumChannel > channel)
Definition
spectrum-wifi-helper.cc:44
ns3::SpectrumWifiPhyHelper::SpectrumChannelSwitched
static void SpectrumChannelSwitched(Ptr< SpectrumWifiPhy > phy)
Function that is notified when a spectrum channel switched.
Definition
spectrum-wifi-helper.cc:173
ns3::SpectrumWifiPhyHelper::AddPhyToFreqRangeMapping
void AddPhyToFreqRangeMapping(uint8_t linkId, const FrequencyRange &freqRange)
Add a given spectrum PHY interface to the PHY instance corresponding of a given link.
Definition
spectrum-wifi-helper.cc:97
ns3::SpectrumWifiPhyHelper::AddWifiBandwidthFilter
void AddWifiBandwidthFilter(Ptr< SpectrumChannel > channel)
Definition
spectrum-wifi-helper.cc:71
ns3::SpectrumWifiPhyHelper::m_channels
std::map< FrequencyRange, Ptr< SpectrumChannel > > m_channels
the spectrum channels
Definition
spectrum-wifi-helper.h:127
ns3::SpectrumWifiPhy
802.11 PHY layer model
Definition
spectrum-wifi-phy.h:53
ns3::WifiPhyHelper::WifiPhyHelper
WifiPhyHelper(uint8_t nLinks=1)
Constructor.
Definition
wifi-helper.cc:170
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WHOLE_WIFI_SPECTRUM
constexpr FrequencyRange WHOLE_WIFI_SPECTRUM
Identifier for the frequency range covering the whole wifi spectrum.
Definition
wifi-types.h:124
ns3::FrequencyRange
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
Definition
wifi-types.h:94
wifi-helper.h
src
wifi
helper
spectrum-wifi-helper.h
Generated on
for ns-3 by
1.16.1