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
yans-wifi-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008 INRIA
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 2 as
6
* published by the Free Software Foundation;
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
12
*
13
* You should have received a copy of the GNU General Public License
14
* along with this program; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
*
17
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18
*/
19
20
#ifndef YANS_WIFI_HELPER_H
21
#define YANS_WIFI_HELPER_H
22
23
#include "
wifi-helper.h
"
24
25
#include "ns3/yans-wifi-channel.h"
26
27
namespace
ns3
28
{
29
30
/**
31
* \brief manage and create wifi channel objects for the YANS model.
32
*
33
* The intent of this class is to make it easy to create a channel object
34
* which implements the YANS channel model. The YANS channel model is described
35
* in "Yet Another Network Simulator"; an author-prepared version of this paper * is at:
36
* https://hal.inria.fr/file/index/docid/78318/filename/yans-rr.pdf
37
*/
38
class
YansWifiChannelHelper
39
{
40
public
:
41
/**
42
* Create a channel helper without any parameter set. The user must set
43
* them all to be able to call Create later.
44
*/
45
YansWifiChannelHelper
();
46
47
/**
48
* Create a channel helper in a default working state. By default, we create
49
* a channel model with a propagation delay equal to a constant, the speed of light,
50
* and a propagation loss based on a log distance model with a reference loss of 46.6777 dB
51
* at reference distance of 1m.
52
* \returns YansWifiChannelHelper
53
*/
54
static
YansWifiChannelHelper
Default
();
55
56
/**
57
* \tparam Ts \deduced Argument types
58
* \param name the name of the model to add
59
* \param [in] args Name and AttributeValue pairs to set.
60
*
61
* Add a propagation loss model to the set of currently-configured loss models.
62
* This method is additive to allow you to construct complex propagation loss models
63
* such as a log distance + Jakes model, etc.
64
*
65
* The order in which PropagationLossModels are added may be significant. Some
66
* propagation models are dependent of the "txPower" (e.g. Nakagami model), and
67
* are therefore not commutative. The final receive power (excluding receiver
68
* gains) are calculated in the order the models are added.
69
*/
70
template
<
typename
... Ts>
71
void
AddPropagationLoss
(std::string name, Ts&&... args);
72
/**
73
* \tparam Ts \deduced Argument types
74
* \param name the name of the model to set
75
* \param [in] args Name and AttributeValue pairs to set.
76
*
77
* Configure a propagation delay for this channel.
78
*/
79
template
<
typename
... Ts>
80
void
SetPropagationDelay
(std::string name, Ts&&... args);
81
82
/**
83
* \returns a new channel
84
*
85
* Create a channel based on the configuration parameters set previously.
86
*/
87
Ptr<YansWifiChannel>
Create
()
const
;
88
89
/**
90
* Assign a fixed random variable stream number to the random variables
91
* used by the channel. Typically this corresponds to random variables
92
* used in the propagation loss models. Return the number of streams
93
* (possibly zero) that have been assigned.
94
*
95
* \param c NetDeviceContainer of the set of net devices for which the
96
* WifiNetDevice should be modified to use fixed streams
97
* \param stream first stream index to use
98
*
99
* \return the number of stream indices assigned by this helper
100
*/
101
int64_t
AssignStreams
(
Ptr<YansWifiChannel>
c, int64_t stream);
102
103
private
:
104
std::vector<ObjectFactory>
m_propagationLoss
;
///< vector of propagation loss models
105
ObjectFactory
m_propagationDelay
;
///< propagation delay model
106
};
107
108
/**
109
* \brief Make it easy to create and manage PHY objects for the YANS model.
110
*
111
* The YANS PHY model is described in "Yet Another Network Simulator",
112
* published in WNS2 2006; an author-prepared version of this paper
113
* is at: https://hal.inria.fr/file/index/docid/78318/filename/yans-rr.pdf
114
*
115
* The Pcap and ASCII traces generated by the EnableAscii and EnablePcap methods defined
116
* in this class correspond to PHY-level traces and come to us via WifiPhyHelper
117
*
118
*/
119
class
YansWifiPhyHelper
:
public
WifiPhyHelper
120
{
121
public
:
122
/**
123
* Create a PHY helper.
124
*/
125
YansWifiPhyHelper
();
126
127
/**
128
* \param channel the channel to associate to this helper
129
*
130
* Every PHY created by a call to Install is associated to this channel.
131
*/
132
void
SetChannel
(
Ptr<YansWifiChannel>
channel);
133
/**
134
* \param channelName The name of the channel to associate to this helper
135
*
136
* Every PHY created by a call to Install is associated to this channel.
137
*/
138
void
SetChannel
(std::string channelName);
139
140
private
:
141
/**
142
* \param node the node on which we wish to create a wifi PHY
143
* \param device the device within which this PHY will be created
144
* \returns newly-created PHY objects.
145
*
146
* This method implements the pure virtual method defined in \ref ns3::WifiPhyHelper.
147
*/
148
std::vector<Ptr<WifiPhy>>
Create
(
Ptr<Node>
node,
Ptr<WifiNetDevice>
device)
const override
;
149
150
Ptr<YansWifiChannel>
m_channel
;
///< YANS wifi channel
151
};
152
153
/***************************************************************
154
* Implementation of the templates declared above.
155
***************************************************************/
156
157
template
<
typename
... Ts>
158
void
159
YansWifiChannelHelper::AddPropagationLoss
(std::string name, Ts&&... args)
160
{
161
m_propagationLoss
.push_back(
ObjectFactory
(name, std::forward<Ts>(args)...));
162
}
163
164
template
<
typename
... Ts>
165
void
166
YansWifiChannelHelper::SetPropagationDelay
(std::string name, Ts&&... args)
167
{
168
m_propagationDelay
=
ObjectFactory
(name, std::forward<Ts>(args)...);
169
}
170
171
}
// namespace ns3
172
173
#endif
/* YANS_WIFI_HELPER_H */
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition:
object-factory.h:48
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:77
ns3::WifiPhyHelper
create PHY objects
Definition:
wifi-helper.h:49
ns3::YansWifiChannelHelper
manage and create wifi channel objects for the YANS model.
Definition:
yans-wifi-helper.h:39
ns3::YansWifiChannelHelper::m_propagationDelay
ObjectFactory m_propagationDelay
propagation delay model
Definition:
yans-wifi-helper.h:105
ns3::YansWifiChannelHelper::AssignStreams
int64_t AssignStreams(Ptr< YansWifiChannel > c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the channel.
Definition:
yans-wifi-helper.cc:76
ns3::YansWifiChannelHelper::YansWifiChannelHelper
YansWifiChannelHelper()
Create a channel helper without any parameter set.
Definition:
yans-wifi-helper.cc:39
ns3::YansWifiChannelHelper::Default
static YansWifiChannelHelper Default()
Create a channel helper in a default working state.
Definition:
yans-wifi-helper.cc:44
ns3::YansWifiChannelHelper::SetPropagationDelay
void SetPropagationDelay(std::string name, Ts &&... args)
Definition:
yans-wifi-helper.h:166
ns3::YansWifiChannelHelper::AddPropagationLoss
void AddPropagationLoss(std::string name, Ts &&... args)
Definition:
yans-wifi-helper.h:159
ns3::YansWifiChannelHelper::Create
Ptr< YansWifiChannel > Create() const
Definition:
yans-wifi-helper.cc:53
ns3::YansWifiChannelHelper::m_propagationLoss
std::vector< ObjectFactory > m_propagationLoss
vector of propagation loss models
Definition:
yans-wifi-helper.h:104
ns3::YansWifiPhyHelper
Make it easy to create and manage PHY objects for the YANS model.
Definition:
yans-wifi-helper.h:120
ns3::YansWifiPhyHelper::m_channel
Ptr< YansWifiChannel > m_channel
YANS wifi channel.
Definition:
yans-wifi-helper.h:150
ns3::YansWifiPhyHelper::YansWifiPhyHelper
YansWifiPhyHelper()
Create a PHY helper.
Definition:
yans-wifi-helper.cc:81
ns3::YansWifiPhyHelper::Create
std::vector< Ptr< WifiPhy > > Create(Ptr< Node > node, Ptr< WifiNetDevice > device) const override
Definition:
yans-wifi-helper.cc:104
ns3::YansWifiPhyHelper::SetChannel
void SetChannel(Ptr< YansWifiChannel > channel)
Definition:
yans-wifi-helper.cc:91
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
wifi-helper.h
src
wifi
helper
yans-wifi-helper.h
Generated on Tue May 28 2024 23:40:04 for ns-3 by
1.9.6