Monday, 8 February 2021

The Enhanced Network Simulator(Release Version 1.2)

(Developed at Department of Computer Science & Engineering, Indian Institute of Technology, Kanpur, India)


The Enhanced Network Simulator (TeNs), is an extension of the existing popular networking simulation tool - Network Simulator (See 
NS homepage for details, tutorials and downloads). TeNs is an attempt to address the deficiencies of ns in the modeling of IEEE 802.11 MAC layer protocol, which is highly simplified in the original ns . Apart from a more realistic implementation of this, it also incorporates additional features like multiple interfaces support for mobile nodes, a static routing protocol for wireless scenarios, and also features inclusion of simple directional antennas (see the section Enhancements and Modifications to NS for details). The utility can be seen in the simulation of long distance links, as illustrated in the sample scripts later in this page.


1 Installation

2 Change Log

3 Features in NS-2

4 Tutorial

5 Sample Scripts

6 Credits

 

1 Instructions for Installation

  • Download the NS-2 package ns-allinone-2.1b9a-gcc32 (compatible with gcc32), from here. You could alternatively use your own source. TENS has been installed with ns-2.1b9a, so preferably you should have this version
  • Download the changes made to TENS from here.
  • Follow the instructions contained in the README of the package (its the same as available in the original NS package from NS homepage). After "./install", execute the following steps:
    •  Untar the TENS changes in the .../ns-allinone-2.1b9a/ns-2.1b9a directory. Inside the TENS directory, execute the copy.sh script to copy the relevant files into the NS2 directory. If your TENS directory is not in the .../ns-allinone-2.1b9a/ns-2.1b9a directory, you will need to change $NS_DIR(in copy.sh) to point to the ..../ns-allinone-2.1b9a/ns-2.1b9a directory.
    • After running the copy.sh script, go to the ..../ns-allinone-2.1b9a/ns-2.1b9a directory and make the following changes to the Makefile:
      • First of all check the Makefile and replace any alien path existing in it, with what you think should be for your installation. This may not be required if " ./install " has properly created the Makefile or not.
        • change variable CPP in the Makefile to " CPP = g++ "
        •  change variable NSE in the Makefile to " NSE = nse "
        • make variable BUILD_NSE empty, i.e., " BUILD_NSE = "
        • Search for the line containing " mobile/antenna.o mobile/omni-antenna.o \ " and replace it by " mobile/antenna.o mobile/omni-antenna.o mobile/dir-antenna.o\ "
        • Search for the lines " aodv/aodv_logs.o aodv/aodv.o \ aodv/aodv_rtable.o aodv/aodv_rqueue.o \ " and add the lines " wlstatic/wlstatic_logs.o wlstatic/wlstatic.o \ wlstatic/wlstatic_rtable.o wlstatic/wlstatic_rqueue.o \ " before it.
        • Search for line "mac/phy.o mac/wired-phy.o mac/wireless-phy.o \" and add "mac/wp2p-ll.o mac/wp2p-mac.o mac/wp2p-phy.o \" after it.
        • Search for NS_TCL_LIB declaration and add "tcl/lib/ns-stdma-lib.tcl \ tcl/lib/ns-stdma-link.tcl \" to it.
           
  •  Now, do " make clean " and "make depend"
  • Then execute make and you are done. In the end export an additional environment variable - "NS_ANTENNA_FILE" with its value being the path where the antenna radiation file is being stored.

                    $export NS_ANTENNA_FILE=...../ns-allinone-2.1b9a/ns-2.1b9a/mobile/antenna.txt

2 ChangeLog

The Changes in TENS fro NS-2 and in subsequent versions in TENS1.1 and TENS 1.2 are given below. These may serve as a starting point for anyone wishing to learn about the code level changes made to NS-2 and further extend NS-2

ChangeLog for TENS1.0 - A file wise description of the changes made to NS-2 code

ChangeLog for TENS1.1 - A file wise decsription of bug fixes and feature additions to TENS1.0

ChangeLog for TENS1.2 - A file wise decsription of bug fixes and feature additions to TENS1.1

3 Features in TENS 1.2

  •  Multiple interface support added
  •  Static Routing implemented for wireless nodes
  •  Co Channel interference added
  •  Adaptive data rate support for 802.11
  •  BPSK Modulation Scheme Added
  •  Directional Antenna support added (More radiation pattern added in TENS1.2)
  •  Channel Number made configurable
  •  Addition of ARP entries through script
  •  2-p protocol for point to point link added
  •  Several MAC parameters like RTS Threshold, Capture threshold made configurable. See the tutorial for full details.

 

4 Tutorial
 

In this section we provide a quick tutorial on the new feature additions and their usage. Please note that this tutorial assumes that the reader is fairly acquainted with NS-2. Extensive NS-2 tutorials can be found at the following links:

Marc Greis's tutorial
NS for Beginners
NS Manual
 

4.1 Configuring Network Components

4.2 Main Program

4.3 Configuration Of Nodes

        4.3.1 Setting up Multiple interfaces

        4.3.2 Attaching a directional antenna

        4.3.3 Setting the Transmit Power

        4.3.4 Channel Number Setting

        4.3.5 Capture Threshold Setting

        4.3.6 Carrier Sense Threshold Setting

        4.3.7 Rx Threshold Setting

        4.3.8 Modulation Scheme Settings

        4.3.9 Frequency settings and Loss factor

4.4 Adding Static Routes

4.5  Setting up parameters for MAC

4.6 Adding ARP  entries

4.7 Using the 2P Iimplementation    

        4.7.1 Link Layer Configurations

        4.7.2 MAC Layer Configurations
    

 


4.1 Configuring Network Components

A mobilenode consists of network components like Link Layer (LL), Interface Queue (IfQ), MAC layer, the wireless channel nodes transmit and receive signals from etc. At the beginning of a wireless simulation, we need to define the type for each of these network components. Additionally, we need to define other parameters like the type of antenna, the radio-propagation model, the type of ad-hoc routing protocol used by mobilenodes etc. The following snippet of code will usually be there. Look at the comments for a decsription of the variable and changes from NS-2.

 

 

set val(chan) Channel/Channel_802_11                          ;# channel type, NS-2 used Channel/WirelessChannel
set val(prop) Propagation/Shadowing                             ;# radio-propagation model, TwoRayGround and FreeSpace also possible
set val(netif) Phy/WirelessPhy/Wireless_802_11_Phy     ;# network interface type, Wireless_802_11_Phy is a subclass in Phy/WirelessPhy
set val(mac) Mac/802_11                                              ;# MAC type, like in NS-2
set val(ifq) Queue/DropTail/PriQueue                             ;# interface queue type, same as NS-2
set val(ll) LL                                                                  ;# link layer type, same as NS-2
set val(ant) Antenna/DirAntenna                                     ;# antenna model, Directional antenna added, configuration methodology defined later
set val(ifqlen) 50                                                            ;# max packet in ifq
set val(nn) 4                                                                   ;# number of mobilenodes, same as NS-2
set val(rp) WLSTATIC                                                  ;# AODV also works, no other protocol works as of now
set val(ni) 1
set opt(mod) Modulation/BPSK                                     ;#Modulation type added, only BPSK supported till now

4.2 Main Program

The main programme can be started in the same manner as NS-2, when a new simulator is started, trace files are opened, creation of GOD object and creation of topology. All these remain unchanged in NS-2. So, the following code will  start the script. Also, higher layers implementation remain unchanged. So, one could attach a CBR, FTP or a TCP connection with a node.

4.3. Configuration of Nodes.

4.3.1 Setting up Multiple Interfaces

Nodes in TENS may be configured to have multiple interfaces. This may be done by the following line in your tcl script.

$ns  node-config  -numif   1

Subsequent parameter additions for different interfaces can be done by using the following format:

$node  set  netif_(<interface number>)  set  <parameter>  <value>

4.3.2 Attaching a directional antenna

Directional Antenna may be created and setup as follows:

set a [Antenna/DirAntenna]

$a setType 0 # types can vary upto 2 currently
$a setAngle 85 # Angle from horizon of antennas axis
$a setWidth 10 # width of the antenna
 

Width is needed only for type 0. For type 0, the antenna returns a gain of 1 multiplied by the solid angle, if the node falls inside the cone of coverage formed.
The following antenna types are also present:

Type 1 HG2424G            See data sheet over here.
Type 2 HG2414P            See data sheet over here.

Type 3 HG2418P            See data sheet over here

Type 4 HG2417P-090    See data sheet over here

Type 5 HG2417P-120    See data sheet over here
 

Only radiation pattern and gain values are relevant in the data sheet. If you add a new antenna radiation pattern, please mail in your antenna file to abagri@cse.iitk.ac.in along with a radiation pattern graph image or data sheet of the antenna.

An antenna can then be attached to a nodes interface in the following manner:
 

[$node_(0) set netif_(0)] dir-antenna $a


The directional antenna module takes its input from a antenna file which is expected to be in the NS_ANTENNA_FILE enviroment variable. the default exists in ...../ns-allinone-2.1b9a/ns-2.1b9a/mobile/antenna.txt. The format of this file is lines of antenna gains for differnet angles and antenna types. This can be replaced by ones own antennas file where each line has the following format
 

<type> <angle> <gain>


4.3.3 Setting the Transmit Power

The transmit power of an interface may be set by using the following:
 

[$node set netif_(<interface number>)] set Pt_ <transmit power in W>



4.3.4 Channel Number Setting

Channel Number for a node/interface may be set up by the following:
 

[$node set netif_(<interface number>)] set channel_number_ <channel number>


TENS implements co-channel interference and this should be noted while setting up channels for interfaces. The co channel interference is implemented as follows:

If a node is receiving and sending simultaeously on two different channels, difference of their frequency is calculated and normalized by dividing the difference by 5e+6. If the normalized value is greater than 5 then Tx power is reduced to 0, For 4, it is reduced to 20%, 40% for 3, 60% for 4, 80% for 4.

4.3.5 Capture Threshold Setting

Settings for Capture Threshold may be setup for a node/interface may be set up by the following:
 

[$node set netif_(<interface number>)] set CPThresh_ <value>



4.3.6 Carrier Sense Threshold Setting


Settings for Carrier Sense Threshold may be setup for a node/interface may be set up by the following:
 

[$node set netif_(<interface number>)] set CSThresh_ <value>


4.3.7 Rx Threshold Setting

Threshold settings for receiving a packet may be setup different from the capture packet threshold as follows. Unless, receiving power is less than this value, packet will not be sent up the layers
 

[$node set netif_(<interface number>)] set RXThresh_ <value>


4.3.8 Modulation Scheme Settings

Modulation Scheme of an interface may be changed as follows:
 

[$node set netif_(<interface number>)] set modulationscheme_<value>


The value may be 1 for BPSK and 0 for no modulation. No other modulation scheme is supported as of now.

4.3.9 Frequency settings and Loss factor

The frequency of operation and Loss factor may be setup as follows:
 

[$node set netif_(<interface number>)] set freq_ <value>     ; #frequency settings
[$node set netif_(<interface number>)] set L_ <value>         ; #Loss factor


4.4 Adding Static Routes


Static routes may be added by lines in the following format:
 

[$node set ragent_] addstaticroute <number of hops> <next hop> <destination node> <interface>


4.5 Setting up parameters for MAC


MAC Parameters for 802.11 may be setup using following lines of code:
 

Mac/802_11 set dataRate_ 11mb                 ;# Setting the data rate
Mac/802_11 set basicRate_ 1mb                 ;# Setting the basic data rate
Mac/802_11 set isAdaptive_ 1                     ;# Uses an adaptive rate scheme Mac/802_11 MAC_RTSThreshold 3000     ;# Setting the RTS threhold

Similarly, the following parameters may be configured for 802.11 by using the command:

Mac/802_11 <parameter name> <value>

Each of the parameters is self explanatory by its name:

MAC_ShortRetryLimit
MAC_LongRetryLimit
MAC_FragmentationThreshold
MAC_MaxTransmitMSDULifetime
MAC_MaxReceiveLifetime
DSSS_CWMin
DSSS_CWMax
DSSS_CCATime
DSSS_RxTxTurnaroundTime
DSSS_PreambleLength
DSSS_PLCPHeaderLength
DSSS_PLCPDataRate
DSSS_RxRFDelay
DSSS_RxPLPCDelay
DSSS_MACProcessingDelay

4.6 Adding ARP entries

One could add ARP entries as follows:

$ll add-arp-entry <node-address> <mac-address>

4.7 Using the 2p Implementation

For 2p implementation while configuring netwrok components, set Link Layer to 2P link Layer and MAC to 2p Link Layer

set val(mac)           Mac/WP2P_MAC ;
set val(ll)                LL/WP2P_LL ;

After making link layer and mac layer configuration with each node, one may attach either a tcp or ftp agent and send packets

4.7.1 Link Layer Configurations

The following settings may be made for a point to point link:

$ll set-my-node-id <id>                   ;set the node's id
$ll set-nbr-node-id <id>                   ;set the neighbouring node's id
$ll set-my-mac-id <id>                     ;set the node's mac address
$ll set-nbr-mac-id <id>                    ;set the neighbouring node's mac address
$ll set-dummy-packet-size <size>     ;set the size of the dummy packet
$ll set-mac $mac                              ;set the mac as Mac/WP2P_MAC
$ll set-limit <value>                           ;set the link layer buffer limit value


4.7.2 MAC Layer configurations
 

$mac link-up                       ; activate the link/interface
$mac link-down                   ; deactivate the link/interface
$mac set-ifa-nbr <value>     ; set MAC of the neighbouring links of this node
$mac set-ll $ll                       ; set link layer as LL/WP2P_LL, different configurations at different node is possible
$mac set-delay <value>        ; set delay value

5 Sample Scripts

two-node.tcl:     A sample script for two nodes interacting over a type 1 antenna. A good starting point to understand TENS

sample.tcl:   A four node network with multiple interfaces and static routing.

topo.tcl :         A more dense topology simulation.

2-p.tcl:               A script using the 2-p protocol

 

sample_long.tcl This script shows how directional antennas can be used for simulating long distance links. It is same as four node network except that the last hop is 6 Kms

6 Credits

TENS was output of the thesis of Siddharth Saha in.. during his maters at Indian institute of Technology, Kanpur. It was then extended by Sabyasachi Roy and Ashwinias a part of their Bachelor's project at IIT Kanpur. Dr Bhaskaran Raman of Computer science and Engineering Department and Dr Kameswari Chebrolu of electrical Engineering Department have been involved in upgrade of TENS since 1.0 with a lot of bug fixes and feature addition, the most significant being the 2-p implementation.


 

No comments:

Post a Comment