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 <map>
15
#include <set>
16
17
namespace
ns3
18
{
19
20
class
SpectrumChannel;
21
class
SpectrumWifiPhy;
22
23
/**
24
* @brief Make it easy to create and manage PHY objects for the spectrum model.
25
*
26
* The Pcap and ASCII traces generated by the EnableAscii and EnablePcap methods defined
27
* in this class correspond to PHY-level traces and come to us via WifiPhyHelper
28
*
29
* This helper will install an instance of a WifiBandwidthFilter on any SpectrumChannel
30
* added to this helper (via one of the SetChannel methods), unless one has
31
* previously been installed on the channel object.
32
*/
33
class
SpectrumWifiPhyHelper
:
public
WifiPhyHelper
34
{
35
public
:
36
/**
37
* Create a PHY helper.
38
*
39
* @param nLinks the number of links to configure (>1 only for 11be devices)
40
*/
41
SpectrumWifiPhyHelper
(uint8_t nLinks = 1);
42
43
/**
44
* @param channel the default spectrum channel to associate to this helper
45
*
46
* Every PHY created by a call to Install is associated to this default spectrum channel.
47
*/
48
void
SetChannel
(
const
Ptr<SpectrumChannel>
channel);
49
/**
50
* @param channelName The name of the default spectrum channel to associate to this helper
51
*
52
* Every PHY created by a call to Install is associated to this default spectrum channel.
53
*/
54
void
SetChannel
(
const
std::string& channelName);
55
56
/**
57
* @param channel the spectrum channel to add to this helper
58
* @param freqRange the frequency range, bounded by a minFrequency and a maxFrequency in MHz
59
*
60
* Every PHY created by a call to Install is added to this spectrum channel.
61
* If a PHY is requested to operate or scan a channel with the specified frequency and width
62
* combination, it will activate that channel and deactivate the current channel for that PHY.
63
*/
64
void
AddChannel
(
const
Ptr<SpectrumChannel>
channel,
65
const
FrequencyRange
& freqRange =
WHOLE_WIFI_SPECTRUM
);
66
/**
67
* @param channelName The name of the spectrum channel to add to this helper
68
* @param freqRange the frequency range, bounded by a minFrequency and a maxFrequency in MHz
69
*
70
* Every PHY created by a call to Install is added to this spectrum channel.
71
* If a PHY is requested to operate or scan a channel with the specified frequency and width
72
* combination, it will activate that channel and deactivate the current channel for that PHY.
73
*/
74
void
AddChannel
(
const
std::string& channelName,
75
const
FrequencyRange
& freqRange =
WHOLE_WIFI_SPECTRUM
);
76
77
/**
78
* Add a given spectrum PHY interface to the PHY instance corresponding of a given link.
79
* If no mapping has been specified for a given link, all spectrum PHY interfaces will
80
* be added to the PHY instance of that link.
81
*
82
* @param linkId ID of the link to setup
83
* @param freqRange frequency range handled by of the spectrum PHY interface
84
*/
85
void
AddPhyToFreqRangeMapping
(uint8_t linkId,
const
FrequencyRange
& freqRange);
86
87
/**
88
* Reset mapping of the spectrum PHY interfaces added to the PHY instances.
89
*/
90
void
ResetPhyToFreqRangeMapping
();
91
92
private
:
93
/**
94
* @param node the node on which we wish to create a wifi PHY
95
* @param device the device within which this PHY will be created
96
* @returns newly-created PHY objects.
97
*
98
* This method implements the pure virtual method defined in \ref ns3::WifiPhyHelper.
99
*/
100
std::vector<Ptr<WifiPhy>>
Create
(
Ptr<Node>
node,
Ptr<WifiNetDevice>
device)
const override
;
101
102
/**
103
* @brief Install PHY interfaces to the PHY instance of a given link
104
* based on the currently configured mapping (\see AddPhyInterface).
105
*
106
* @param linkId ID of the link to setup
107
* @param phy spectrum PHY instance of the link
108
*/
109
void
InstallPhyInterfaces
(uint8_t linkId,
Ptr<SpectrumWifiPhy>
phy)
const
;
110
111
/**
112
* @param channel The channel to inspect to possibly add a WifiBandwidthFilter
113
*
114
* This method will add a WifiBandwidthFilter object to the SpectrumChannel, only if
115
* one has not yet been added.
116
*/
117
void
AddWifiBandwidthFilter
(
Ptr<SpectrumChannel>
channel);
118
119
/**
120
* Function that is notified when a spectrum channel switched
121
* @param phy spectrum PHY instance that has switched its channel
122
*/
123
static
void
SpectrumChannelSwitched
(
Ptr<SpectrumWifiPhy>
phy);
124
125
std::map<FrequencyRange, Ptr<SpectrumChannel>>
m_channels
;
///< the spectrum channels
126
std::map<uint8_t
/* linkId */
, std::set<FrequencyRange>>
127
m_interfacesMap
;
///< map of the spectrum PHY interfaces to be added to the PHY instance
128
///< corresponding to a given link ID
129
};
130
131
}
// namespace ns3
132
133
#endif
/* SPECTRUM_WIFI_HELPER_H */
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3::SpectrumWifiPhyHelper
Make it easy to create and manage PHY objects for the spectrum model.
Definition
spectrum-wifi-helper.h:34
ns3::SpectrumWifiPhyHelper::Create
std::vector< Ptr< WifiPhy > > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const override
Definition
spectrum-wifi-helper.cc:116
ns3::SpectrumWifiPhyHelper::ResetPhyToFreqRangeMapping
void ResetPhyToFreqRangeMapping()
Reset mapping of the spectrum PHY interfaces added to the PHY instances.
Definition
spectrum-wifi-helper.cc:110
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:127
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:150
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:170
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:125
ns3::WifiPhyHelper
create PHY objects
Definition
wifi-helper.h:39
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-spectrum-value-helper.h:357
ns3::FrequencyRange
Struct defining a frequency range between minFrequency and maxFrequency.
Definition
wifi-spectrum-value-helper.h:309
wifi-helper.h
src
wifi
helper
spectrum-wifi-helper.h
Generated on Wed Dec 4 2024 09:20:51 for ns-3 by
1.11.0