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