author | Tom Henderson <tomh@tomh.org> |
Mon, 14 Sep 2015 13:34:07 -0700 | |
changeset 11665 | bb52e7eaaf33 |
parent 11646 | 56d62956a729 |
child 11673 | ea9789e18a84 |
permissions | -rw-r--r-- |
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
1 |
.. include:: replace.txt |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
2 |
.. highlight:: cpp |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
3 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
4 |
++++++++++++++++++ |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
5 |
User Documentation |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
6 |
++++++++++++++++++ |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
7 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
8 |
Using the WifiNetDevice |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
9 |
*********************** |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
10 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
11 |
The modularity provided by the implementation makes low-level configuration of |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
12 |
the WifiNetDevice powerful but complex. For this reason, we provide some helper |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
13 |
classes to perform common operations in a simple matter, and leverage the |ns3| |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
14 |
attribute system to allow users to control the parametrization of the underlying |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
15 |
models. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
16 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
17 |
Users who use the low-level |ns3| API and who wish to add a WifiNetDevice to |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
18 |
their node must create an instance of a WifiNetDevice, plus a number of |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
19 |
constituent objects, and bind them together appropriately (the WifiNetDevice is |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
20 |
very modular in this regard, for future extensibility). At the low-level API, |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
21 |
this can be done with about 20 lines of code (see ``ns3::WifiHelper::Install``, |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
22 |
and ``ns3::YansWifiPhyHelper::Create``). They also must create, at some point, a |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
23 |
WifiChannel, which also contains a number of constituent objects (see |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
24 |
``ns3::YansWifiChannelHelper::Create``). |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
25 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
26 |
However, a few helpers are available for users to add these devices and channels |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
27 |
with only a few lines of code, if they are willing to use defaults, and the |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
28 |
helpers provide additional API to allow the passing of attribute values to |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
29 |
change default values. Commonly used attribute values are listed in the |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
30 |
Attributes section. The scripts in ``examples/wireless`` can be browsed to |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
31 |
see how this is done. Next, we describe the common steps to create a WifiNetDevice |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
32 |
from the bottom layer (WifiChannel) up to the device layer (WifiNetDevice). |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
33 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
34 |
To create a WifiNetDevice, users need to configure mainly five steps: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
35 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
36 |
* Configure the WifiChannel: WifiChannel takes care of getting signal |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
37 |
from one device to other devices on the same wifi channel. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
38 |
The main configurations of WifiChannel are propagation loss model and propagation delay model. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
39 |
* Configure the WifiPhy: WifiPhy takes care of actually sending and receiving wireless |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
40 |
signal from WifiChannel. Here, WifiPhy decides whether each frame will be successfully |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
41 |
decoded or not depending on the received signal strength and noise. Thus, the main |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
42 |
configuration of WifiPhy is the error rate model, which is the one that actually |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
43 |
calculates the probability of successfully decoding the frame based on the signal. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
44 |
* Configure WifiMac: this step is more on related to the architecture and device level. |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
45 |
The users configure the wifi architecture (i.e. ad-hoc or ap-sta) and whether QoS (802.11e), HT (802.11n) and/or VHT (802.11ac) features are supported or not. |
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
46 |
* Create WifiDevice: at this step, users configure the desired wifi standard |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
47 |
(e.g. **802.11b**, **802.11g**, **802.11a**, **802.11n** or **802.11ac**) and rate control algorithm |
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
48 |
* Configure mobility: finally, mobility model is (usually) required before WifiNetDevice |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
49 |
can be used. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
50 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
51 |
YansWifiChannelHelper |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
52 |
===================== |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
53 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
54 |
The YansWifiChannelHelper has an unusual name. Readers may wonder why it is |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
55 |
named this way. The reference is to the `yans simulator |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
56 |
<http://cutebugs.net/files/wns2-yans.pdf>`_ from which this model is taken. The |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
57 |
helper can be used to create a WifiChannel with a default PropagationLoss and |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
58 |
PropagationDelay model. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
59 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
60 |
Users will typically type code such as:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
61 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
62 |
YansWifiChannelHelper wifiChannelHelper = YansWifiChannelHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
63 |
Ptr<WifiChannel> wifiChannel = wifiChannelHelper.Create (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
64 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
65 |
to get the defaults. Specifically, the default is a channel model with a |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
66 |
propagation delay equal to a constant, the speed of light (``ns3::ConstantSpeedPropagationDelayModel``), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
67 |
and a propagation loss based on a default log distance model (``ns3::LogDistancePropagationLossModel``)), using a default exponent of 3. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
68 |
Please note that the default log distance model is configured with a reference |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
69 |
loss of 46.6777 dB at reference distance of 1m. The reference loss of 46.6777 dB |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
70 |
was calculated using Friis propagation loss model at 5.15 GHz. The reference loss |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
71 |
must be changed if **802.11b**, **802.11g** or **802.11n** (at 2.4 GHz) are used since they operate at 2.4 Ghz. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
72 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
73 |
Note the distinction above in creating a helper object vs. an actual simulation |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
74 |
object. In |ns3|, helper objects (used at the helper API only) are created on |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
75 |
the stack (they could also be created with operator new and later deleted). |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
76 |
However, the actual |ns3| objects typically inherit from ``class ns3::Object`` |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
77 |
and are assigned to a smart pointer. See the chapter in the |ns3| manual for |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
78 |
a discussion of the |ns3| object model, if you are not familiar with it. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
79 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
80 |
The following two methods are useful when configuring YansWifiChannelHelper: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
81 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
82 |
* ``YansWifiChannelHelper::AddPropagationLoss`` adds a PropagationLossModel |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
83 |
to a chain of PropagationLossModel |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
84 |
* ``YansWifiChannelHelper::SetPropagationDelay`` sets a PropagationDelayModel |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
85 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
86 |
YansWifiPhyHelper |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
87 |
================= |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
88 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
89 |
Physical devices (base class ``ns3::WifiPhy``) connect to ``ns3::WifiChannel`` models in |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
90 |
|ns3|. We need to create WifiPhy objects appropriate for the YansWifiChannel; here |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
91 |
the ``YansWifiPhyHelper`` will do the work. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
92 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
93 |
The YansWifiPhyHelper class configures an object factory to create instances of |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
94 |
a ``YansWifiPhy`` and adds some other objects to it, including possibly a |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
95 |
supplemental ErrorRateModel and a pointer to a MobilityModel. The user code is |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
96 |
typically:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
97 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
98 |
YansWifiPhyHelper wifiPhyHelper = YansWifiPhyHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
99 |
wifiPhyHelper.SetChannel (wifiChannel); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
100 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
101 |
The default YansWifiPhyHelper is configured with NistErrorRateModel |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
102 |
(``ns3::NistErrorRateModel``). You can change the error rate model by |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
103 |
calling the ``YansWifiPhyHelper::SetErrorRateModel`` method. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
104 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
105 |
Optionally, if pcap tracing is needed, a user may use the following |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
106 |
command to enable pcap tracing:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
107 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
108 |
YansWifiPhyHelper::SetPcapDataLinkType (enum SupportedPcapDataLinkTypes dlt) |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
109 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
110 |
|ns3| supports RadioTap and Prism tracing extensions for 802.11. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
111 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
112 |
Note that we haven't actually created any WifiPhy objects yet; we've just |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
113 |
prepared the YansWifiPhyHelper by telling it which channel it is connected to. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
114 |
The Phy objects are created in the next step. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
115 |
|
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
116 |
802.11n/ac PHY layer can use either either long (800 ns) or short (400 ns) OFDM guard intervals. To configure this parameter, the following line of code could be used (in this example, it enables the support of a short guard interval):: |
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
117 |
|
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
118 |
wifiPhyHelper.Set ("ShortGuardEnabled", BooleanValue(true)); |
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
119 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
120 |
Furthermore, 802.11n provides an optional mode (GreenField mode) to reduce preamble durations and which is only compatible with 802.11n devices. This mode is enabled as follows:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
121 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
122 |
wifiPhyHelper.Set ("GreenfieldEnabled",BooleanValue(true)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
123 |
|
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
124 |
802.11n PHY layer can support both 20 (default) or 40 MHz channel width, and 802.11ac PHY layer can use either 20, 40, 80 (default) or 160 MHz channel width. Since the channel width value is overwritten by ``WifiHelper::SetStandard``, this should be done post-install using ``Config::Set``:: |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
125 |
|
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
126 |
WifiHelper wifi = WifiHelper::Default (); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
127 |
wifi.SetStandard (WIFI_PHY_STANDARD_80211ac); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
128 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue("VHtMcs9"), "ControlMode", StringValue("VhtMcs0")); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
129 |
VhtWifiMacHelper mac = VhtWifiMacHelper::Default (); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
130 |
|
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
131 |
//Install PHY and MAC |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
132 |
Ssid ssid = Ssid ("ns3-wifi"); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
133 |
mac.SetType ("ns3::StaWifiMac", |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
134 |
"Ssid", SsidValue (ssid), |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
135 |
"ActiveProbing", BooleanValue (false)); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
136 |
|
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
137 |
NetDeviceContainer staDevice; |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
138 |
staDevice = wifi.Install (phy, mac, wifiStaNode); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
139 |
|
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
140 |
mac.SetType ("ns3::ApWifiMac", |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
141 |
"Ssid", SsidValue (ssid)); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
142 |
|
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
143 |
NetDeviceContainer apDevice; |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
144 |
apDevice = wifi.Install (phy, mac, wifiApNode); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
145 |
|
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
146 |
//Once install is done, we overwrite the channel width value |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
147 |
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (160)); |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
148 |
|
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
149 |
WifiMacHelper |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
150 |
============= |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
151 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
152 |
The next step is to configure the MAC model. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
153 |
We use WifiMacHelper to accomplish this. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
154 |
WifiMacHelper takes care of both the MAC low model and MAC high model. |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
155 |
A user must decide if 802.11/WMM-style QoS and/or 802.11n-style High throughput (HT) and/or 802.11ac-style Very High throughput (VHT) support is required. |
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
156 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
157 |
NqosWifiMacHelper and QosWifiMacHelper |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
158 |
++++++++++++++++++++++++++++++++++++++ |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
159 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
160 |
The ``ns3::NqosWifiMacHelper`` and ``ns3::QosWifiMacHelper`` configure an |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
161 |
object factory to create instances of a ``ns3::WifiMac``. They are used to |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
162 |
configure MAC parameters like type of MAC. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
163 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
164 |
The former, ``ns3::NqosWifiMacHelper``, supports creation of MAC |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
165 |
instances that do not have 802.11e/WMM-style QoS nor 802.11n-style High throughput (HT) nor 802.11ac-style Very High throughput (VHT) support enabled. |
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
166 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
167 |
For example the following user code configures a non-QoS and non-HT MAC that |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
168 |
will be a non-AP STA in an infrastructure network where the AP has |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
169 |
SSID ``ns-3-ssid``:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
170 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
171 |
NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
172 |
Ssid ssid = Ssid ("ns-3-ssid"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
173 |
wifiMacHelper.SetType ("ns3::StaWifiMac", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
174 |
"Ssid", SsidValue (ssid), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
175 |
"ActiveProbing", BooleanValue (false)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
176 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
177 |
To create MAC instances with QoS support enabled, |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
178 |
``ns3::QosWifiMacHelper`` is used in place of |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
179 |
``ns3::NqosWifiMacHelper``. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
180 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
181 |
The following code shows an example use of ``ns3::QosWifiMacHelper`` to |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
182 |
create an AP with QoS enabled:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
183 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
184 |
QosWifiMacHelper wifiMacHelper = QosWifiMacHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
185 |
wifiMacHelper.SetType ("ns3::ApWifiMac", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
186 |
"Ssid", SsidValue (ssid), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
187 |
"BeaconGeneration", BooleanValue (true), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
188 |
"BeaconInterval", TimeValue (Seconds (2.5))); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
189 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
190 |
With QoS-enabled MAC models it is possible to work with traffic belonging to |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
191 |
four different Access Categories (ACs): **AC_VO** for voice traffic, |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
192 |
**AC_VI** for video traffic, **AC_BE** for best-effort |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
193 |
traffic and **AC_BK** for background traffic. In order for the |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
194 |
MAC to determine the appropriate AC for an MSDU, packets forwarded |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
195 |
down to these MAC layers should be marked using **ns3::QosTag** in |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
196 |
order to set a TID (traffic id) for that packet otherwise it will be |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
197 |
considered belonging to **AC_BE**. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
198 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
199 |
To create ad-hoc MAC instances, simply use ``ns3::AdhocWifiMac`` instead of ``ns3::StaWifiMac`` or ``ns3::ApWifiMac``. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
200 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
201 |
HtWifiMacHelper |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
202 |
+++++++++++++++ |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
203 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
204 |
The ``ns3::HtWifiMacHelper`` configures an |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
205 |
object factory to create instances of a ``ns3::WifiMac``. It is used to |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
206 |
supports creation of MAC instances that have 802.11n-style High throughput (HT) and QoS support enabled. In particular, this object can be also used to set: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
207 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
208 |
* an MSDU aggregator for a particular Access Category (AC) in order to use |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
209 |
802.11n MSDU aggregation feature; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
210 |
* block ack parameters like threshold (number of packets for which block ack |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
211 |
mechanism should be used) and inactivity timeout. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
212 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
213 |
For example the following user code configures a HT MAC that |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
214 |
will be a non-AP STA with QoS enabled, aggregation on AC_VO, and Block Ack on AC_BE, in an infrastructure network where the AP has |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
215 |
SSID ``ns-3-ssid``:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
216 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
217 |
HtWifiMacHelper wifiMacHelper = HtWifiMacHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
218 |
Ssid ssid = Ssid ("ns-3-ssid"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
219 |
wifiMacHelper.SetType ("ns3::StaWifiMac", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
220 |
"Ssid", SsidValue (ssid), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
221 |
"ActiveProbing", BooleanValue (false)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
222 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
223 |
wifiMacHelper.SetMsduAggregatorForAc (AC_VO, "ns3::MsduStandardAggregator", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
224 |
"MaxAmsduSize", UintegerValue (3839)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
225 |
wifiMacHelper.SetBlockAckThresholdForAc (AC_BE, 10); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
226 |
wifiMacHelper.SetBlockAckInactivityTimeoutForAc (AC_BE, 5); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
227 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
228 |
This object can be also used to set in the same way as ``ns3::QosWifiMacHelper``. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
229 |
|
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
230 |
VhtWifiMacHelper |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
231 |
+++++++++++++++ |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
232 |
|
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
233 |
The ``ns3::VhtWifiMacHelper`` configures an |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
234 |
object factory to create instances of a ``ns3::WifiMac``. It is used to |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
235 |
supports creation of MAC instances that have 802.11ac-style Very High throughput (VHT) and QoS support enabled. This object is similar to ``HtWifiMacHelper``. |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
236 |
|
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
237 |
WifiHelper |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
238 |
========== |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
239 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
240 |
We're now ready to create WifiNetDevices. First, let's create |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
241 |
a WifiHelper with default settings:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
242 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
243 |
WifiHelper wifiHelper = WifiHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
244 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
245 |
What does this do? It sets the default wifi standard to **802.11a** and sets the RemoteStationManager to |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
246 |
``ns3::ArfWifiManager``. You can change the RemoteStationManager by calling the |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
247 |
``WifiHelper::SetRemoteStationManager`` method. To change the wifi standard, call the |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
248 |
``WifiHelper::SetStandard`` method with the desired standard. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
249 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
250 |
Now, let's use the wifiPhyHelper and wifiMacHelper created above to install WifiNetDevices |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
251 |
on a set of nodes in a NodeContainer "c":: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
252 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
253 |
NetDeviceContainer wifiContainer = WifiHelper::Install (wifiPhyHelper, wifiMacHelper, c); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
254 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
255 |
This creates the WifiNetDevice which includes also a WifiRemoteStationManager, a |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
256 |
WifiMac, and a WifiPhy (connected to the matching WifiChannel). |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
257 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
258 |
The ``WifiHelper::SetStandard`` method set various default timing parameters as defined in the selected standard version, overwriting values that may exist or have been previously configured. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
259 |
In order to change parameters that are overwritten by ``WifiHelper::SetStandard``, this should be done post-install using ``Config::Set``:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
260 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
261 |
WifiHelper wifi = WifiHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
262 |
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ); |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
263 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", StringValue("HtMcs7"), "ControlMode", StringValue("HtMcs0")); |
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
264 |
HtWifiMacHelper mac = HtWifiMacHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
265 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
266 |
//Install PHY and MAC |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
267 |
Ssid ssid = Ssid ("ns3-wifi"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
268 |
mac.SetType ("ns3::StaWifiMac", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
269 |
"Ssid", SsidValue (ssid), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
270 |
"ActiveProbing", BooleanValue (false)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
271 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
272 |
NetDeviceContainer staDevice; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
273 |
staDevice = wifi.Install (phy, mac, wifiStaNode); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
274 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
275 |
mac.SetType ("ns3::ApWifiMac", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
276 |
"Ssid", SsidValue (ssid)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
277 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
278 |
NetDeviceContainer apDevice; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
279 |
apDevice = wifi.Install (phy, mac, wifiApNode); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
280 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
281 |
//Once install is done, we overwrite the standard timing values |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
282 |
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/Slot", TimeValue (MicroSeconds (slot))); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
283 |
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/Sifs", TimeValue (MicroSeconds (sifs))); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
284 |
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/AckTimeout", TimeValue (MicroSeconds (ackTimeout))); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
285 |
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/CtsTimeout", TimeValue (MicroSeconds (ctsTimeout))); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
286 |
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/Rifs", TimeValue (MicroSeconds (rifs))); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
287 |
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/BasicBlockAckTimeout", TimeValue (MicroSeconds (basicBlockAckTimeout))); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
288 |
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/CompressedBlockAckTimeout", TimeValue (MicroSeconds (compressedBlockAckTimeout))); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
289 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
290 |
There are many |ns3| attributes that can be set on the above helpers to |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
291 |
deviate from the default behavior; the example scripts show how to do some of |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
292 |
this reconfiguration. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
293 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
294 |
Mobility configuration |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
295 |
====================== |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
296 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
297 |
Finally, a mobility model must be configured on each node with Wi-Fi device. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
298 |
Mobility model is used for calculating propagation loss and propagation delay. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
299 |
Two examples are provided in the next section. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
300 |
Users are referred to the chapter on :ref:`Mobility` module for detailed information. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
301 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
302 |
Example configuration |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
303 |
===================== |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
304 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
305 |
We provide two typical examples of how a user might configure a Wi-Fi network -- |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
306 |
one example with an ad-hoc network and one example with an infrastructure network. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
307 |
The two examples were modified from the two examples in the ``examples/wireless`` folder |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
308 |
(``wifi-simple-adhoc.cc`` and ``wifi-simple-infra.cc``). |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
309 |
Users are encouraged to see examples in the ``examples/wireless`` folder. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
310 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
311 |
AdHoc WifiNetDevice configuration |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
312 |
+++++++++++++++++++++++++++++++++ |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
313 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
314 |
In this example, we create two ad-hoc nodes equipped with 802.11a Wi-Fi devices. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
315 |
We use the ``ns3::ConstantSpeedPropagationDelayModel`` as the propagation delay model and |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
316 |
``ns3::LogDistancePropagationLossModel`` with the exponent of 3.0 as the propagation loss model. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
317 |
Both devices are configured with ``ConstantRateWifiManager`` at the fixed rate of 12Mbps. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
318 |
Finally, we manually place them by using the ``ns3::ListPositionAllocator``:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
319 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
320 |
std::string phyMode ("OfdmRate12Mbps"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
321 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
322 |
NodeContainer c; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
323 |
c.Create (2); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
324 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
325 |
WifiHelper wifi; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
326 |
wifi.SetStandard (WIFI_PHY_STANDARD_80211a); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
327 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
328 |
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
329 |
// ns-3 supports RadioTap and Prism tracing extensions for 802.11 |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
330 |
wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
331 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
332 |
YansWifiChannelHelper wifiChannel; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
333 |
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
334 |
wifiChannel.AddPropagationLoss ("ns3::LogDistancePropagationLossModel", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
335 |
"Exponent", DoubleValue (3.0)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
336 |
wifiPhy.SetChannel (wifiChannel.Create ()); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
337 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
338 |
// Add a non-QoS upper mac, and disable rate control (i.e. ConstantRateWifiManager) |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
339 |
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
340 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
341 |
"DataMode",StringValue (phyMode), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
342 |
"ControlMode",StringValue (phyMode)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
343 |
// Set it to adhoc mode |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
344 |
wifiMac.SetType ("ns3::AdhocWifiMac"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
345 |
NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
346 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
347 |
// Configure mobility |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
348 |
MobilityHelper mobility; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
349 |
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
350 |
positionAlloc->Add (Vector (0.0, 0.0, 0.0)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
351 |
positionAlloc->Add (Vector (5.0, 0.0, 0.0)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
352 |
mobility.SetPositionAllocator (positionAlloc); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
353 |
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
354 |
mobility.Install (c); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
355 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
356 |
// other set up (e.g. InternetStack, Application) |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
357 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
358 |
Infrastructure (access point and clients) WifiNetDevice configuration |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
359 |
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
360 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
361 |
This is a typical example of how a user might configure an access point and a set of clients. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
362 |
In this example, we create one access point and two clients. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
363 |
Each node is equipped with 802.11b Wi-Fi device:: |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
364 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
365 |
std::string phyMode ("DsssRate1Mbps"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
366 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
367 |
NodeContainer ap; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
368 |
ap.Create (1); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
369 |
NodeContainer sta; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
370 |
sta.Create (2); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
371 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
372 |
WifiHelper wifi; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
373 |
wifi.SetStandard (WIFI_PHY_STANDARD_80211b); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
374 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
375 |
YansWifiPhyHelper wifiPhy = YansWifiPhyHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
376 |
// ns-3 supports RadioTap and Prism tracing extensions for 802.11 |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
377 |
wifiPhy.SetPcapDataLinkType (YansWifiPhyHelper::DLT_IEEE802_11_RADIO); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
378 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
379 |
YansWifiChannelHelper wifiChannel; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
380 |
// reference loss must be changed since 802.11b is operating at 2.4GHz |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
381 |
wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
382 |
wifiChannel.AddPropagationLoss ("ns3::LogDistancePropagationLossModel", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
383 |
"Exponent", DoubleValue (3.0), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
384 |
"ReferenceLoss", DoubleValue (40.0459)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
385 |
wifiPhy.SetChannel (wifiChannel.Create ()); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
386 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
387 |
// Add a non-QoS upper mac, and disable rate control |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
388 |
NqosWifiMacHelper wifiMac = NqosWifiMacHelper::Default (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
389 |
wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
390 |
"DataMode",StringValue (phyMode), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
391 |
"ControlMode",StringValue (phyMode)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
392 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
393 |
// Setup the rest of the upper mac |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
394 |
Ssid ssid = Ssid ("wifi-default"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
395 |
// setup ap. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
396 |
wifiMac.SetType ("ns3::ApWifiMac", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
397 |
"Ssid", SsidValue (ssid)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
398 |
NetDeviceContainer apDevice = wifi.Install (wifiPhy, wifiMac, ap); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
399 |
NetDeviceContainer devices = apDevice; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
400 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
401 |
// setup sta. |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
402 |
wifiMac.SetType ("ns3::StaWifiMac", |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
403 |
"Ssid", SsidValue (ssid), |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
404 |
"ActiveProbing", BooleanValue (false)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
405 |
NetDeviceContainer staDevice = wifi.Install (wifiPhy, wifiMac, sta); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
406 |
devices.Add (staDevice); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
407 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
408 |
// Configure mobility |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
409 |
MobilityHelper mobility; |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
410 |
Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> (); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
411 |
positionAlloc->Add (Vector (0.0, 0.0, 0.0)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
412 |
positionAlloc->Add (Vector (5.0, 0.0, 0.0)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
413 |
positionAlloc->Add (Vector (0.0, 5.0, 0.0)); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
414 |
mobility.SetPositionAllocator (positionAlloc); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
415 |
mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel"); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
416 |
mobility.Install (ap); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
417 |
mobility.Install (sta); |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
418 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
419 |
// other set up (e.g. InternetStack, Application) |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
420 |
|
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
421 |
Note on the current implementation |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
422 |
********************************** |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
423 |
|
11665
bb52e7eaaf33
clarify Wi-Fi short slot time implementation status
Tom Henderson <tomh@tomh.org>
parents:
11646
diff
changeset
|
424 |
* 802.11g supports a default of long slot time (20 microseconds) |
11465
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
425 |
* PHY_RXSTART is not supported |
5a50e80cdf32
enable wifi module documentation to be built standalone
Tom Henderson <tomh@tomh.org>
parents:
diff
changeset
|
426 |
* 802.11e TXOP is not supported |
11628
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
427 |
* 802.11n/ac MIMO is not supported |
243b71de25a0
add support for IEEE 802.11ac
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11465
diff
changeset
|
428 |
* 802.11n/ac beamforming is not supported |
11646
56d62956a729
Update wifi documentation
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11628
diff
changeset
|
429 |
* PLCP preamble reception is not modeled |
56d62956a729
Update wifi documentation
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11628
diff
changeset
|
430 |
* BSSBasicRateSet for 802.11b has been assumed to be 1-2 Mbit/s |
56d62956a729
Update wifi documentation
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11628
diff
changeset
|
431 |
* BSSBasicRateSet for 802.11a/g has been assumed to be 6-12-24 Mbit/s |
56d62956a729
Update wifi documentation
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11628
diff
changeset
|
432 |
* cases where RTS/CTS and ACK are transmitted using HT formats are not supported |
56d62956a729
Update wifi documentation
Sébastien Deronne <sebastien.deronne@gmail.com>
parents:
11628
diff
changeset
|
433 |
* Only ``ConstantRateWifiManager`` is supported by **802.11n** or **802.11ac** |