src/wifi/doc/wifi.rst
author Nicola Baldo <nbaldo@cttc.es>
Mon, 04 Jul 2011 12:12:43 +0200
changeset 7332 5ff75a2fe637
parent 7204 052d30ceb700
child 7665 a9d19a94df20
permissions -rw-r--r--
added ref to [pei80211ofdm] in wifi doc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
.. include:: replace.txt
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
     3
Wifi
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
     4
----
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
|ns3| nodes can contain a collection of NetDevice objects, much like an actual
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
computer contains separate interface cards for Ethernet, Wifi, Bluetooth, etc.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
This chapter describes the |ns3| WifiNetDevice and related models. By adding
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
WifiNetDevice objects to |ns3| nodes, one can create models of 802.11-based
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
infrastructure and ad hoc networks.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
Overview of the model
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
*********************
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
The WifiNetDevice models a wireless network interface controller based
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    16
on the IEEE 802.11 standard [ieee80211]_. We will go into more detail below but in brief,
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
|ns3| provides models for these aspects of 802.11:
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
* basic 802.11 DCF with **infrastructure** and **adhoc** modes
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    20
* **802.11a**, **802.11b** and **802.11g** physical layers
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
* QoS-based EDCA and queueing extensions of **802.11e**
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
* various propagation loss models including **Nakagami, Rayleigh, Friis,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
  LogDistance, FixedRss, Random**
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
* two propagation delay models, a distance-based and random model
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
* various rate control algorithms including **Aarf, Arf, Cara, Onoe, Rraa,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
  ConstantRate, and Minstrel**
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
* 802.11s (mesh), described in another chapter
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
The set of 802.11 models provided in |ns3| attempts to provide an accurate
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
MAC-level implementation of the 802.11 specification and to provide a
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
not-so-slow PHY-level model of the 802.11a specification.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
The implementation is modular and provides roughly four levels of models:
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
* the **PHY layer models**
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
* the so-called **MAC low models**: they implement DCF and EDCAF
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
* the so-called **MAC high models**: they implement the MAC-level beacon
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
  generation, probing, and association state machines, and
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
* a set of **Rate control algorithms** used by the MAC low models
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    41
There are presently three **MAC high models** that provide for the three
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    42
(non-mesh; the mesh equivalent, which is a sibling of these with common
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    43
parent ``ns3::RegularWifiMac``, is not discussed here) Wi-Fi topological
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    44
elements - Access Point (AP) (implemented in class ``ns3::ApWifiMac``, 
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    45
non-AP Station (STA) (``ns3::StaWifiMac``), and STA in an Independent
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    46
Basic Service Set (IBSS - also commonly referred to as an ad hoc
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    47
network (``ns3::AdhocWifiMac``).
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    49
The simplest of these is ``ns3::AdhocWifiMac``, which implements a
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    50
Wi-Fi MAC that does not perform any kind of beacon generation,
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    51
probing, or association. The ``ns3::StaWifiMac`` class implements
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    52
an active probing and association state machine that handles automatic
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    53
re-association whenever too many beacons are missed. Finally,
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    54
``ns3::ApWifiMac`` implements an AP that generates periodic
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    55
beacons, and that accepts every attempt to associate.
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    56
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    57
These three MAC high models share a common parent in
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    58
``ns3::RegularWifiMac``, which exposes, among other MAC
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    59
configuration, an attribute ``QosSupported`` that allows
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    60
configuration of 802.11e/WMM-style QoS support. With QoS-enabled MAC
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    61
models it is possible to work with traffic belonging to four different
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    62
Access Categories (ACs): **AC_VO** for voice traffic,
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    63
**AC_VI** for video traffic, **AC_BE** for best-effort
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    64
traffic and **AC_BK** for background traffic.  In order for the
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    65
MAC to determine the appropriate AC for an MSDU, packets forwarded
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    66
down to these MAC layers should be marked using **ns3::QosTag** in
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    67
order to set a TID (traffic id) for that packet otherwise it will be
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    68
considered belonging to **AC_BE**.
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
The **MAC low layer** is split into three components:
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
#. ``ns3::MacLow`` which takes care of RTS/CTS/DATA/ACK transactions.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
#. ``ns3::DcfManager`` and ``ns3::DcfState`` which implements the DCF and EDCAF
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
   functions.
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    75
#. ``ns3::DcaTxop`` and ``ns3::EdcaTxopN`` which handle the packet queue,
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
   packet fragmentation, and packet retransmissions if they are needed.
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    77
   The ``ns3::DcaTxop`` object is used high MACs that are not QoS-enabled,
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    78
   and for transmission of frames (e.g., of type Management)
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    79
   that the standard says should access the medium using the DCF. 
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    80
   ``ns3::EdcaTxopN`` is is used by QoS-enabled high MACs and also
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
    81
   performs QoS operations like 802.11n-style MSDU aggregation.
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
There are also several **rate control algorithms** that can be used by the Mac low layer:
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    84
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    85
* ``OnoeWifiManager``
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    86
* ``IdealWifiManager``
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    87
* ``AarfcdWifiManager``
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    88
* ``AarfWifiManager``
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    89
* ``ArfWifiManager``
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    90
* ``AmrrWifiManager``
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    91
* ``ConstantRateWifiManager``
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    92
* ``MinstrelWifiManager``
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    93
* ``CaraWifiManager``
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
    94
* ``RraaWifiManager``
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
The PHY layer implements a single model in the ``ns3::WifiPhy class``: the
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
physical layer model implemented there is described fully in a paper entitled
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
`Yet Another Network Simulator <http://cutebugs.net/files/wns2-yans.pdf>`_
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
Validation results for 802.11b are available in this
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
`technical report <http://www.nsnam.org/~pei/80211b.pdf>`_
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   102
In |ns3|, nodes can have multiple WifiNetDevices on separate channels, and the
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   103
WifiNetDevice can coexist with other device types; this removes an architectural
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   104
limitation found in ns-2. Presently, however, there is no model for
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   105
cross-channel interference or coupling.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
The source code for the Wifi NetDevice lives in the directory
7145
a925e518220b Rescan wifi's bindings and fix some paths in the documentation
Mitch Watrous <watrous@u.washington.edu>
parents: 7138
diff changeset
   108
``src/wifi``.
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   110
.. _wifi-architecture:
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   112
.. figure:: figures/WifiArchitecture.*
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   113
   
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   114
   Wifi NetDevice architecture.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   115
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   116
Using the WifiNetDevice
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   117
***********************
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
The modularity provided by the implementation makes low-level configuration of
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   120
the WifiNetDevice powerful but complex. For this reason, we provide some helper
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   121
classes to perform common operations in a simple matter, and leverage the |ns3|
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   122
attribute system to allow users to control the parametrization of the underlying
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   123
models.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
Users who use the low-level |ns3| API and who wish to add a WifiNetDevice to
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
their node must create an instance of a WifiNetDevice, plus a number of
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   127
constituent objects, and bind them together appropriately (the WifiNetDevice is
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
very modular in this regard, for future extensibility). At the low-level API,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
this can be done with about 20 lines of code (see ``ns3::WifiHelper::Install``,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
and ``ns3::YansWifiPhyHelper::Create``). They also must create, at some point, a
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
WifiChannel, which also contains a number of constituent objects (see
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   132
``ns3::YansWifiChannelHelper::Create``).
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
However, a few helpers are available for users to add these devices and channels
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   135
with only a few lines of code, if they are willing to use defaults, and the
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   136
helpers provide additional API to allow the passing of attribute values to
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   137
change default values. The scripts in ``src/examples`` can be browsed to see how
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
this is done.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   139
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   140
YansWifiChannelHelper
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   141
+++++++++++++++++++++
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   142
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   143
The YansWifiChannelHelper has an unusual name. Readers may wonder why it is
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   144
named this way. The reference is to the `yans simulator
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   145
<http://cutebugs.net/files/wns2-yans.pdf>`_ from which this model is taken. The
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   146
helper can be used to create a WifiChannel with a default PropagationLoss and
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   147
PropagationDelay model.  Specifically, the default is a channel model with a
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   148
propagation delay equal to a constant, the speed of light, and a propagation
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   149
loss based on a log distance model with a reference loss of 46.6777 dB at
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
reference distance of 1m.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   152
Users will typically type code such as:::
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   154
  YansWifiChannelHelper wifiChannelHelper = YansWifiChannelHelper::Default ();
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   155
  Ptr<WifiChannel> wifiChannel = wifiChannelHelper.Create ();
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
to get the defaults.  Note the distinction above in creating a helper object vs.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
an actual simulation object.  In |ns3|, helper objects (used at the helper API
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   159
only) are created on the stack (they could also be created with operator new and
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   160
later deleted).  However, the actual |ns3| objects typically inherit from 
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
``class ns3::Object`` and are assigned to a smart pointer.  See the chapter on
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   162
:ref:`Object model` for a discussion of the |ns3| object model, if you are not
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   163
familiar with it.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   164
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   165
*Todo: Add notes about how to configure attributes with this helper API*
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   166
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   167
YansWifiPhyHelper
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   168
+++++++++++++++++
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   169
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   170
Physical devices (base class ``ns3::Phy``) connect to ``ns3::Channel`` models in
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   171
|ns3|.  We need to create Phy objects appropriate for the YansWifiChannel; here
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   172
the ``YansWifiPhyHelper`` will do the work.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   173
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   174
The YansWifiPhyHelper class configures an object factory to create instances of
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   175
a ``YansWifiPhy`` and adds some other objects to it, including possibly a
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   176
supplemental ErrorRateModel and a pointer to a MobilityModel. The user code is
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   177
typically:::
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   178
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   179
  YansWifiPhyHelper wifiPhyHelper = YansWifiPhyHelper::Default ();
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   180
  wifiPhyHelper.SetChannel (wifiChannel);
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   181
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   182
Note that we haven't actually created any WifiPhy objects yet; we've just
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   183
prepared the YansWifiPhyHelper by telling it which channel it is connected to.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   184
The phy objects are created in the next step.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   185
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   186
NqosWifiMacHelper and QosWifiMacHelper
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   187
++++++++++++++++++++++++++++++++++++++
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   188
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   189
The ``ns3::NqosWifiMacHelper`` and ``ns3::QosWifiMacHelper`` configure an
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   190
object factory to create instances of a ``ns3::WifiMac``. They are used to
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   191
configure MAC parameters like type of MAC.  
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   192
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   193
The former, ``ns3::NqosWifiMacHelper``, supports creation of MAC
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   194
instances that do not have 802.11e/WMM-style QoS support enabled. 
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   195
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   196
For example the following user code configures a non-QoS MAC that
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   197
will be a non-AP STA in an infrastructure network where the AP has
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   198
SSID ``ns-3-ssid``:::
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   199
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   200
    NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default ();
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   201
    Ssid ssid = Ssid ("ns-3-ssid");
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   202
    wifiMacHelper.SetType ("ns3::StaWifiMac",
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   203
                          "Ssid", SsidValue (ssid),
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   204
                          "ActiveProbing", BooleanValue (false));
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   205
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   206
To create MAC instances with QoS support enabled,
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   207
``ns3::QosWifiMacHelper`` is used in place of
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   208
``ns3::NqosWifiMacHelper``.  This object can be also used to set:
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   209
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   210
* a MSDU aggregator for a particular Access Category (AC) in order to use 
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   211
  802.11n MSDU aggregation feature;
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   212
* block ack parameters like threshold (number of packets for which block ack
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   213
  mechanism should be used) and inactivity timeout.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   214
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   215
The following code shows an example use of ``ns3::QosWifiMacHelper`` to 
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   216
create an AP with QoS enabled, aggregation on AC_VO, and Block Ack on AC_BE:::
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   217
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   218
  QosWifiMacHelper wifiMacHelper = QosWifiMacHelper::Default ();
6751
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   219
  wifiMacHelper.SetType ("ns3::ApWifiMac",
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   220
                         "Ssid", SsidValue (ssid),
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   221
                         "BeaconGeneration", BooleanValue (true),
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   222
                         "BeaconInterval", TimeValue (Seconds (2.5)));
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   223
  wifiMacHelper.SetMsduAggregatorForAc (AC_VO, "ns3::MsduStandardAggregator",
700a92acb8ec add back manual changes made since ns-3.9
Tom Henderson <tomh@tomh.org>
parents: 6742
diff changeset
   224
                                        "MaxAmsduSize", UintegerValue (3839));
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   225
  wifiMacHelper.SetBlockAckThresholdForAc (AC_BE, 10);
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   226
  wifiMacHelper.SetBlockAckInactivityTimeoutForAc (AC_BE, 5);
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   227
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   228
WifiHelper
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   229
++++++++++
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   230
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   231
We're now ready to create WifiNetDevices. First, let's create
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   232
a WifiHelper with default settings:::
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   233
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   234
  WifiHelper wifiHelper = WifiHelper::Default ();
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   235
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   236
What does this do?  It sets the RemoteStationManager to
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   237
``ns3::ArfWifiManager``.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   238
Now, let's use the wifiPhyHelper and wifiMacHelper created above to install WifiNetDevices
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   239
on a set of nodes in a NodeContainer "c":::
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   240
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   241
  NetDeviceContainer wifiContainer = WifiHelper::Install (wifiPhyHelper, wifiMacHelper, c);
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   242
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   243
This creates the WifiNetDevice which includes also a WifiRemoteStationManager, a
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   244
WifiMac, and a WifiPhy (connected to the matching WifiChannel).
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   245
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   246
There are many |ns3| :ref:`Attributes` that can be set on the above helpers to
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   247
deviate from the default behavior; the example scripts show how to do some of
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   248
this reconfiguration.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   249
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   250
AdHoc WifiNetDevice configuration 
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   251
+++++++++++++++++++++++++++++++++
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   252
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   253
This is a typical example of how a user might configure an adhoc network.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   254
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   255
*To be completed*
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   256
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   257
Infrastructure (Access Point and clients) WifiNetDevice configuration 
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   258
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   259
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   260
This is a typical example of how a user might configure an access point and a
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   261
set of clients. 
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   262
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   263
*To be completed*
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   264
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   265
The WifiChannel and WifiPhy models
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   266
**********************************
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   267
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   268
The WifiChannel subclass can be used to connect together a set of
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   269
``ns3::WifiNetDevice`` network interfaces. The class ``ns3::WifiPhy`` is the
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   270
object within the WifiNetDevice that receives bits from the channel.  
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   271
For the channel propagation modeling, the propagation module is used; see section :ref:`propagation` for details.
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   272
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   273
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   274
This section summarizes the description of the BER calculations found in the
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   275
yans paper taking into account the Forward Error Correction present in 802.11a
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   276
and describes the algorithm we implemented to decide whether or not a packet can
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   277
be successfully received. See `"Yet Another Network Simulator"
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   278
<http://cutebugs.net/files/wns2-yans.pdf>`_ for more details.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   279
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   280
The PHY layer can be in one of three states:
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   281
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   282
#. TX: the PHY is currently transmitting a signal on behalf of its associated
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   283
   MAC
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   284
#. RX: the PHY is synchronized on a signal and is waiting until it has received
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   285
   its last bit to forward it to the MAC.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   286
#. IDLE: the PHY is not in the TX or RX states.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   287
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   288
When the first bit of a new packet is received while the PHY is not IDLE (that
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   289
is, it is already synchronized on the reception of another earlier packet or it
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   290
is sending data itself), the received packet is dropped. Otherwise, if the PHY
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   291
is IDLE, we calculate the received energy of the first bit of this new signal
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   292
and compare it against our Energy Detection threshold (as defined by the Clear
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   293
Channel Assessment function mode 1). If the energy of the packet k is higher,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   294
then the PHY moves to RX state and schedules an event when the last bit of the
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   295
packet is expected to be received. Otherwise, the PHY stays in IDLE state and
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   296
drops the packet.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   297
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   298
The energy of the received signal is assumed to be zero outside of the reception
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   299
interval of packet k and is calculated from the transmission power with a
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   300
path-loss propagation model in the reception interval.  where the path loss
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   301
exponent, :math:`n`, is chosen equal to :math:`3`, the reference distance,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   302
:math:`d_0` is choosen equal to :math:`1.0m` and the reference energy is based
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   303
based on a Friis propagation model.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   304
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   305
When the last bit of the packet upon which the PHY is synchronized is received,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   306
we need to calculate the probability that the packet is received with any error
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   307
to decide whether or not the packet on which we were synchronized could be
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   308
successfully received or not: a random number is drawn from a uniform
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   309
distribution and is compared against the probability of error.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   310
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   311
To evaluate the probability of error, we start from the piecewise linear 
6766
4caf532b12c3 formatting cleanup
Tom Henderson <tomh@tomh.org>
parents: 6751
diff changeset
   312
functions shown in Figure :ref:`snir` and calculate the 
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   313
SNIR function. 
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   314
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   315
.. _snir:
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   316
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   317
.. figure:: figures/snir.*
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   318
   
6766
4caf532b12c3 formatting cleanup
Tom Henderson <tomh@tomh.org>
parents: 6751
diff changeset
   319
   *SNIR function over time.*
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   320
7332
5ff75a2fe637 added ref to [pei80211ofdm] in wifi doc
Nicola Baldo <nbaldo@cttc.es>
parents: 7204
diff changeset
   321
From the SNIR function we can derive the Bit Error Rate (BER) and Packet Error Rate (PER) for the modulation and coding scheme being used for the transmission.  Please refer to [pei80211ofdm]_, [pei80211b]_ and [lacage2006yans]_ for a detailed description of the available BER/PER models.
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   322
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   323
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   324
WifiChannel configuration
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   325
++++++++++++++++++++++++++
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   326
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   327
The WifiChannel implementation uses the propagation loss and delay models provided within the ns-3 *propagation* module.
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   328
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   329
The MAC model
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   330
*************
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   331
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   332
The 802.11 Distributed Coordination Function is used to calculate when to grant
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   333
access to the transmission medium. While implementing the DCF would have been
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   334
particularly easy if we had used a recurring timer that expired every slot, we
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   335
chose to use the method described in [ji2004sslswn]_
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   336
where the backoff timer duration is lazily calculated whenever needed since it
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   337
is claimed to have much better performance than the simpler recurring timer
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   338
solution.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   339
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   340
The higher-level MAC functions are implemented in a set of other C++ classes and
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   341
deal with:
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   342
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   343
* packet fragmentation and defragmentation,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   344
* use of the rts/cts protocol,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   345
* rate control algorithm,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   346
* connection and disconnection to and from an Access Point,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   347
* the MAC transmission queue,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   348
* beacon generation,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   349
* msdu aggregation,
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   350
* etc.
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   351
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   352
Wifi Attributes
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   353
***************
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   354
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   355
Should link to the list of attributes exported by Doxygen
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   356
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   357
Wifi Tracing
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   358
************
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   359
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   360
Should link to the list of traces exported by Doxygen
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   361
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   362
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   363
References
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   364
**********
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   365
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   366
.. [ieee80211] IEEE Std 802.11-2007 *Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications*
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   367
7332
5ff75a2fe637 added ref to [pei80211ofdm] in wifi doc
Nicola Baldo <nbaldo@cttc.es>
parents: 7204
diff changeset
   368
.. [pei80211b] \G. Pei and Tom Henderson, `Validation of ns-3 802.11b PHY model <http://www.nsnam.org/~pei/80211b.pdf>`__ 
5ff75a2fe637 added ref to [pei80211ofdm] in wifi doc
Nicola Baldo <nbaldo@cttc.es>
parents: 7204
diff changeset
   369
5ff75a2fe637 added ref to [pei80211ofdm] in wifi doc
Nicola Baldo <nbaldo@cttc.es>
parents: 7204
diff changeset
   370
.. [pei80211ofdm] \G. Pei and Tom Henderson, `Validation of OFDM error rate model in ns-3 <http://www.nsnam.org/~pei/80211ofdm.pdf>`__ 
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   371
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   372
.. [lacage2006yans] \M. Lacage and T. Henderson, `Yet another Network Simulator <http://cutebugs.net/files/wns2-yans.pdf>`__ 
6742
a1759a95842c convert manual to sphinx format
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   373
7138
90f585e0fcea generic wifi doc only in manual
Nicola Baldo <nbaldo@cttc.es>
parents: 6766
diff changeset
   374
.. [ji2004sslswn] \Z. Ji, J. Zhou, M. Takai and R. Bagrodia, *Scalable simulation of large-scale wireless networks with bounded inaccuracies*, in Proc. of the Seventh ACM Symposium on Modeling, Analysis and Simulation of Wireless and Mobile Systems, October 2004.