全部博文(46)
分类: 系统运维
2009-04-22 18:29:24
This chapter describes the radio propagation models implemented in ns. These models are used to predict the received signal power of each packet. At the physical layer of each wireless node, there is a receiving threshold. When a packet is received, if its signal power is below the receiving threshold, it is marked as error and dropped by the MAC layer.
Up to now there are three propagation models in ns, which are the free space model, two-ray ground reflection model and the shadowing model. Their implementation can be found in ~ns/propagation.{cc,h}, ~ns/tworayground.{cc,h} and ~ns/shadowing.{cc,h}. This documentation reflects the APIs in ns-2.1b7.
The free space propagation model assumes the ideal propagation condition that there is only one clear line-of-sight path between the transmitter and receiver. H. T. Friis presented the following equation to calculate the received signal power in free space at distance from the transmitter [].
(18.1) |
where is the transmitted signal power. and are the antenna gains of the transmitter and the receiver respectively. is the system loss, and is the wavelength. It is common to select and in ns simulations.
The free space model basically represents the communication range as a circle around the transmitter. If a receiver is within the circle, it receives all packets. Otherwise, it loses all packets
The OTcl interface for utilizing a propagation model is the node-config command. One way to use it here is
$ns_ node-config -propType Propagation/FreeSpace
Another way is
set prop [new Propagation/FreeSpace]
$ns_ node-config -propInstance $prop
A single line-of-sight path between two mobile nodes is seldom the only means of propation. The two-ray ground reflection model considers both the direct path and a ground reflection path. It is shown [] that this model gives more accurate prediction at a long distance than the free space model. The received power at distance is predicted by
(18.2) |
where and are the heights of the transmit and receive antennas respectively. Note that the original equation in [] assumes . To be consistent with the free space model, is added here.
The above equation shows a faster power loss than Eqn. () as distance increases. However, The two-ray model does not give a good result for a short distance due to the oscillation caused by the constructive and destructive combination of the two rays. Instead, the free space model is still used when is small.
Therefore, a cross-over distance is calculated in this model. When , Eqn. () is used. When , Eqn. () is used. At the cross-over distance, Eqns. () and () give the same result. So can be calculated as
(18.3) |
Similarly, the OTcl interface for utilizing the two-ray ground reflection model is as follows.
$ns_ node-config -propType Propagation/TwoRayGroundAlternatively, the user can use
set prop [new Propagation/TwoRayGround] $ns_ node-config -propInstance $propThe free space model and the two-ray model predict the received power as a deterministic function of distance. They both represent the communication range as an ideal circle. In reality, the received power at certain distance is a random variable due to multipath propagation effects, which is also known as fading effects. In fact, the above two models predicts the mean received power at distance . A more general and widely-used model is called the shadowing model [].
The shadowing model consists of two parts. The first one is known as path loss model, which also predicts the mean received power at distance , denoted by . It uses a close-in distance as a reference. is computed relative to as follows.
(18.4) |
is called the path loss exponent, and is usually empirically determined by field measurement. From Eqn. () we know that for free space propagation. Table gives some typical values of . Larger values correspond to more obstructions and hence faster decrease in average received power as distance becomes larger. can be computed from Eqn. ().
|
|
The path loss is usually measured in dB. So from Eqn. () we have
(18.5) |
The second part of the shadowing model reflects the variation of the received power at certain distance. It is a log-normal random variable, that is, it is of Gaussian distribution if measured in dB. The overall shadowing model is represented by
(18.6) |
where is a Gaussian random variable with zero mean and standard deviation . is called the shadowing deviation, and is also obtained by measurement. Table shows some typical values of . Eqn. () is also known as a log-normal shadowing model.
The shadowing model extends the ideal circle model to a richer statistic model: nodes can only probabilistically communicate when near the edge of the communication range.
Before using the model, the user should select the values of the path loss exponent and the shadowing deviation according to the simulated environment.
The OTcl interface is still the node-config command. One way to use it is as follows, and the values for these parameters are just examples.
# first set values of shadowing model
Propagation/Shadowing set pathlossExp_ 2.0 ;# path loss exponent
Propagation/Shadowing set std_db_ 4.0 ;# shadowing deviation (dB)
Propagation/Shadowing set dist0_ 1.0 ;# reference distance (m)
Propagation/Shadowing set seed_ 0 ;# seed for RNG
$ns_ node-config -propType Propagation/Shadowing
The shadowing model creates a random number generator (RNG) object. The RNG has three types of seeds: raw seed, pre-defined seed (a set of known good seeds) and the huristic seed (details in Section ). The above API only uses the pre-defined seed. If a user want different seeding method, the following API can be used.
set prop [new Propagation/Shadowing]
$prop set pathlossExp_ 2.0
$prop set std_db_ 4.0
$prop set dist0_ 1.0
$prop seed \0 ;# user can specify seeding method
$ns_ node-config -propInstance $prop
The seed-type above can be raw, predef or heuristic.
In some applications, a user may want to specify the communication range of wireless nodes. This can be done by set an appropriate value of the receiving threshold in the network interface, ,
Phy/WirelessPhy set RXThresh_ \
A separate C program is provided at ~ns/indep-utils/propagation/threshold.cc to compute the receiving threshold. It can be used for all the propagation models discussed in this chapter. Assume you have compiled it and get the excutable named as threshold. You can use it to compute the threshold as follows
threshold -m \[other-options] distance
where propagation-model is either FreeSpace, TwoRayGround or Shadowing, and the distance is the communication range in meter.
[other-options] are used to specify parameters other than their default values. For the shadowing model there is a necessary parameter, -r receive-rate, which specifies the rate of correct reception at the distance. Because the communication range in the shadowing model is not an ideal circle, an inverse Q-function [] is used to calculate the receiving threshold. For example, if you want 95% of packets can be correctly received at the distance of 50m, you can compute the threshold by
threshold -m Shadowing -r 0.95 50
Other available values of [other-options] are shown below
-pl \-std \ -Pt \
-fr \-Gt \ -Gr \
-L \-ht \ -hr \
-d0 \
Following is a list of commands for propagation models.