Wireless Channel 802.11 in NS-3: Technical Note
Wireless Channel 802.11 in NS-3: Technical Note
v1
Technical Note
Wireless Channel 802.11 in NS-3
Lesly Maygua-Marcillo1 , Luis Urquiza-Aguiar1 , Martha Paredes-Paredes1
1
Departamento de Electrónica, Telecomunicaciones y Redes de Información, Facultad de Eléctrica y
Electrónica, Escuela Politécnica Nacional (EPN), C. Ladrón de Guevara E11-253, Quito PO.Box
17-01-2759, Ecuador; lesly.maygua@epn.edu.ec, cecilia.paredes@epn.edu.ec.
* Correspondence: luis.urquiza@epn.edu.ec; Tel.: +593-2-2976300 ext 2311
Abstract: Network Simulators (NS) is typically used to study services and applications in complex
scenarios due to the infeasibility of deploying real testbeds. This is the case of Mobile Ad hoc Networks
(MANETs) which can be extensively used in emergency situations or to gather information without
infraestructure. An important factor to get realiable results in the MANETs’ simulations is the wireless
channel module of NSs. In this report, we explain how thw wireless channel is implemented in NS-3
and it can be configured.
1. Introduction
A wireless communication allows sending a signal or a certain amount of data from one point
to another (transmitter and receiver) without the need for a guided medium.A wireless channel uses
a specific frequency band to transmit information. The wireless channel of IEEE 802.11, one of the
enabled technologies for MANETs, employs the 2.4 GHz or 5.9 GHz band. The Wireless Channel 802.11
in NS-3 tries to model the real functionality of the standard.
2. Overview
Wireless Channel 802.11 in NS-3 is modeled by the class YansWifiChannel which works together
with WifiPhy class. WifiChannel includes the helper class YansWifiChannelHelper. By means of the
latter, we can configure predefined channels with propagation and delay models [1].
Each channel use two models for its configuration. These are:
− PropagationLossModel
− PropagationDelayModel
In NS-3, the default 802.11 channel considers the following models: A delay propagation model
equal to a constant and a propagation loss model based on log normal distribution. More specifically,
they are named: ConstantSpeedPropagationDelayModel and LogDistancePropagationLossModel [1].
Now, we analyze the propagation and delay models in NS-3.
PropagationLossModel
These models calculate the reception power considering the transmission power and position of
transmitting and receiving antennas.
• Cost231PropagationLossModel: This model extends to the range of 1500 MHz to 2000 MHz.
It is designed for suburban area.
2 of 7
To configure this model in a NS-3 simulation need only an attribute. This attribute is Rss and
we can use the following command line:
wifiChannel.AddPropagationLoss("ns3::FixedRssLossModel","Rss",DoubleValue
(-80));
Pr λ2
= (1)
Pt (4π ∗ d)2
Update we have:
Pt Gt Gr λ2
Pr = L (2)
(4π ∗ d)2
Implementing, f = c/λ , where C is the speed of light in vacuum, and f is the frequency in Hz. This
model is valid only for propagation in free space. This model is used for small to medium distances.
Pt Gt Gr (Ht2 ∗ Hr2 )
Pr = (3)
d4 ∗ L
This model does not give good results for short distances due to the oscillations caused by the
constructive and destructive combination of the two rays.
To use this model in ns-3 in necessary to consider the following attributes:
Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 19 September 2018 doi:10.20944/preprints201809.0367.v1
3 of 7
wifiChannel.AddPropagationLoss("ns3::TwoRayGroundPropagationLossModel",
"Frequency",DoubleValue (), "HeightAboveZ", DoubleValue
(1.5),"MinDistance",DoubleValue ());
• MatrixPropagationLossModel: The propagation loss is fixed for each pair of nodes and does
not depend on their actual positions. Useful for synthetic tests. By default it is assumed that the
propagation loss is symmetric.
4 of 7
for the path loss due to the distance traveled by the signal. In a simulation, it is recommended to
using it in combination with other models that take into account the path loss [4].
The Nakagami distribution applied to the power level is implemented with GammaRandomVariable
or ErlangRandomVariable. [5].
Rayleigh model [6] is a special case of Nakagami model. In fact, Nakagami model describes
different fading equations. Nakagami-m only gives us the fast fading effect which simply vary the
reception power according to a Nakagami distribution.
This model include several parameters to its configuration in ns-3 which are described below:
- Distance 1: Begin the second distance field. Initial value: 80m by default.
- Distance 2: Begin the third distance field. Initial value: 200m by default.
- m0 : Used for distances smaller than Distance 1. Initial value: 1.5 by default.
- m1 : For distances smaller than Distance 2. Default is 0.75.
- m2 : For distances greater than Distance 2. Initial value: 0.75 by default.
- ErlangRv: Access to the underlying ErlangRandomVariable.
- GammaRv: Access to the underlying GammaRandomVariable.
As already mentioned above, in order to have also the effect of distance, you can add any other
model you want. In this case we show Log Distance model on top of the Nakagami. The following
command lines are necessary to set theses models.
YansWifiChannelHelper wifiChannel;
wifiChannel.AddPropagationLoss("ns3::LogDistancePropagationLossModel");
wifiChannel.AddPropagationLoss("ns3::NakagamiPropagationLossModel","m0",
DoubleValue(1),"m1", DoubleValue(1),"m2", DoubleValue(1));
You can also add any other parameters/attributes to each of the models [7].
• OkumuraHataPropagationLossModel: It is used for trajectory losses in open area and long
distances (> 1km). The original Okumura Hata model is designed for frequencies of 150 MHz
to 1500 MHz [8]. Almost all models are designed for urban areas. Therefore, the model can not
cover all scenarios in all frequencies.
• RandomPropagationLossModel: It considers a loss of random propagation; It changes every
time the model is called. As a consequence, all packages (even those that are sent between two
fixed nodes) experience a random propagation loss.
• Shadowing Model: It is modeled according to a log-normal distribution with variable standard
deviation as function of the relative position (indoor or outdoor). One random value is drawn
for each pair of MobilityModels, and stays constant for that pair during the whole simulation.
Thus,it is appropriate for static nodes only. This model considers that the mean of the shadowing
loss in dB is always 0. For the variance, there are three possibilities of standard deviation,
5 of 7
Table 1. My caption
PropagationDelayModels
For this case NS-3 can implement the following two models:
6 of 7
and finally add the different stacks and applications. Fig. 1 shows the structure that the script must
have. The green box indicates the class that is used to configure the wireless channel.
In general, to configure a propagation loss or delay model in ns-3 is necessary the following
command line:
wifiChannel.AddPropagationLoss("ns3::PropagationLossModel","Parameter
1",DoubleValue(),"Parameter 2",DoubleValue(), "Parameter 3",DoubleValue());
This command will be modified based on the selected model and parameters.
To configure a default wireless channel in NS-3 we can use the following lines:
YansWifiChannelHelper channel=YansWifiChannelHelper::Default()
The tables 2 and 3 show the propagation and delay model used for each channel simulation.
CHANNEL 1
Propagation model LogDistancePropagationLossModel
Delay model ConstantSpeedPropagationDelayModel
CHANNEL 2
Propagation model Fixed Rss Loss Model
Delay model ConstantSpeedPropagationDelayModel
The results of the transmission are shown in Fig.2 and Fig.3. Using channel N°1 there is a loss of
60% of packets, while using channel N°2 there is a packet loss of 0%. This difference is due to the fact
that channel 2 implements a propagation loss model that allows to directly configure the reception
power without relating to the transmission power.
In order that the configuration can be analyzed by our readers at the end of the tutorial, we add
the scripts as. This concludes our tutorial.
4. Conclusions
In this note, we have reviewed how to configure a wireless channel in NS-3. We provide a review
of wireless channel available in NS-3 and provide a useful example of their configuration in a 802.11
Preprints (www.preprints.org) | NOT PEER-REVIEWED | Posted: 19 September 2018 doi:10.20944/preprints201809.0367.v1
7 of 7
MANET simulations. Our toy example shows that the configuration of this parameters can change the
results of the simulations drastically.
Supplementary Materials: The following are available with this note: the simulation file for simulating
wireless channel in a MANET example in NS-3.
Acknowledgments: The authors gratefully acknowledge the financial support provided by the Escuela
Politécnica Nacional, for the development of the project PIJ-16-01 - “Modelamiento de la Packet Error Rate
(PER) incluyendo condiciones de Peak-to-Average Power Ratio (PAPR) para transmisiones Ad-Hoc”.
Bibliography
1. Propagation Loss Models NS-3 (2016), [Online]. Available:https://www.nsnam.org/docs/models/html/
propagation.html
2. Friis, H.T., “A Note on a Simple Transmission Formula,” Proceedings of the IRE , vol.34, no.5, pp.254,256,
May 1946
3. Jakes process (2017), [Online]. Available:https://www.nsnam.org/doxygen/classns3_1_1_jakes_process.
html#a09be54eafd7e13b6dde28dae03f27a35
4. Nakagami propagation (2017), [Online]. Available:https://www.nsnam.org/doxygen/classns3_1_1_
nakagami_propagation_loss_model.html#details
5. F.Ikegami, T.Takeuchi, and S.Yoshida, “Theoretical prediction of mean field strength for Urban Mobile
Radio”, in IEEE Trans. Antennas Propagat., Vol.39, No.3, 1991
6. M. Nakagami, “The m-Distribution, A General Formula of Intensity Distribution of Rapid Fading,” Statistical
Methods in Radio Wave Propagation, pp. 3–36, 1960.
7. Add Propagation Loss Models - NS3, (2017), [Online]. Available:https://www.nsnam.org/doxygen/classns3_
1_1_yans_wifi_channel_helper.html#a71c64d54e148b43698c65736e1c77156
8. M.Hata, “Empirical formula for propagation loss in land mobile radio services”, IEEE Trans. on Vehicular
Technology, vol. 29, pp. 317-325, 1980
9. M. Stoffers, G. Riley, "Comparing the ns–3 Propagation Models", Georgia, 2012.