[Ns-developers] 802.11 wireless LAN on ns-2

mathieu lacage Mathieu.Lacage at sophia.inria.fr
Sat Apr 8 12:10:23 PDT 2006

hi lavina,

On Sat, 2006-04-08 at 08:50 -0600, Lavina Jain wrote:
> Can you please provide me with some documentation of the yans code,
> specifically 802.11 functionality if you have. That would help in

There is no documentation for now except for the sample code. 

>  understanding various modules and parameters.
> I tried to go through the 80211 source code. I have some queries. 
> 1. How to simulate a particular data rate? That is, I dont want to use
> arf and transmit data at a constant data rate, say 6Mbps or 12Mbps or
> so on...

Well, arf is useless if you use a single rate :) You should use the
"cr" (where c stands for constant) rate control algorithm which uses a
single rate. I have this in my main-80211-adhoc.cc file:
        NetworkInterface80211Factory *wifi_factory;
        wifi_factory = new NetworkInterface80211Factory ();
        // force rts/cts on all the time.
        wifi_factory->set_mac_rts_cts_threshold (2200);
        wifi_factory->set_mac_fragmentation_threshold (2200);
        //wifi_factory->set_cr (5, 5);
        //wifi_factory->set_ideal (1e-5);
        wifi_factory->set_aarf ();
        //wifi_factory->set_arf ();

All you have to do is disable the call to set_aarf and enable the one to
set_cr. set_cr has two parameters: they are the data and the control
transmission modes. Here, set_cr (5,5) will set the data and control
modes to mode 5. the transmission mode is an index in the array of
TransmissionMode objects contained in phy-80211.cc.

> I see that possibly this can be done by using set_cr() instead of
> set_aarf() in the main-80211-simple.cc
> Possibly different modes of transmiision correspond to different data
> rates and these are implemented as a link list. configure_80211a() in
> phy_80211a.cc adds modes to this list. So, an integer value of mode
> maps to a particular rate. Am I correct? If yes, I could not map, what

yes, you are completely right :)

>  value of mode corresponds to what data rate?

in phy-80211.cc, I have this:
        add_tx_rx_mode (new FecBpskMode (20e6, 6000000, 0.5,   10, 11));
        add_tx_rx_mode (new FecBpskMode (20e6, 9000000, 0.75,  5, 8));
        add_tx_rx_mode (new FecQamMode (20e6, 12000000, 0.5,   4, 10, 11, 0));
        add_tx_rx_mode (new FecQamMode (20e6, 18000000, 0.75,  4, 5, 8, 31));
        //add_tx_rx_mode (new FecQamMode (20e6, 24000000, 0.5,   16, 10, 11, 0));
        add_tx_rx_mode (new FecQamMode (20e6, 36000000, 0.75,  16, 5, 8, 31));
        //add_tx_rx_mode (new FecQamMode (20e6, 48000000, 0.666, 64, 6, 1, 16));        add_tx_rx_mode (new FecQamMode (20e6, 54000000, 0.75,  64, 5, 8, 31));
the first mode inserted is BPSK 6Mbs. Thus, its index is 0. The second
mode is BPSK 9Mbs. Thus, its index is 1. aso...

This question comes back regularly so, I have filed the bug 15:

> Also, set_cr() takes two parameters, data_mode and ctl_mode. Do they
> correspond respectively to transmission rate of data frames and
> control frames?


> 2. How can I make changes to frame formats.
> Is it that data frames as well as control frames(ack frames) use
> ChunkMac80211Hdr, different frames being differentiated by type field.
> Then if I want to add a field to ack frame and not to data frame, how
> can I do that? 

You need to change the common structure. ChunkMac80211Hdr. It reflect
the real 802.11 MAC header. So, if you want to change the underlying MAC
header, you have to change this class.

Thank you for your interest. Feel free to keep on sending questions.

PS: questions would be best sent to ns-developers at isi.edu to ensure that
our email exchanges are archived.

More information about the Ns-developers mailing list