Monday, 27 January 2014

AOMDV in ns2

AOMDV is a multi-path extension of the well-known Ad hoc On Distance Vector (AODV) protocol.



Here i have given a tcl code for creation of MANET using AOMDV as a routing protocol.


 #------------------------------------------------------------------------------
# Marco Fiore's Patch
# ------------------------------------------------------------------------------
#remove-all-packet-headers                                                     ;# removes all except common
#add-packet-header IP LL Mac AODV AOMDV ATR DSDV DSR OLSR UDP TCP CBR FTP      ;# needed headers
Mac/802_11 set CWMin_                 31
Mac/802_11 set CWMax_                 1023
Mac/802_11 set SlotTime_              0.000020                     ;# 20us
Mac/802_11 set SIFS_                  0.000010                     ;# 10us
Mac/802_11 set PreambleLength_        144                         ;# 144 bit
Mac/802_11 set ShortPreambleLength_   72                           ;# 72 bit
Mac/802_11 set PreambleDataRate_      1.0e6                        ;# 1Mbps
Mac/802_11 set PLCPHeaderLength_      48                           ;# 48 bits
Mac/802_11 set PLCPDataRate_          1.0e6                        ;# 1Mbps
Mac/802_11 set ShortPLCPDataRate_     2.0e6                        ;# 2Mbps
Mac/802_11 set RTSThreshold_          3000                         ;# bytes
Mac/802_11 set ShortRetryLimit_       7                            ;# retransmissions
Mac/802_11 set LongRetryLimit_        4                            ;# retransmissions
Mac/802_11 set newchipset_            false                        ;# use new chipset, allowing a more recent  packet to be correctly received in place of the first sensed packet
Mac/802_11 set dataRate_ 11Mb                                      ;# 802.11 data transmission rate
Mac/802_11 set basicRate_ 1Mb                                      ;# 802.11 basic transmission rate 
Mac/802_11 set aarf_ false                                         ;# 802.11 Auto Rate Fallback
#------------------------------------------------------------------------------
# Defining options
# ------------------------------------------------------------------------------
set val(chan) Channel/WirelessChannel                              ;# channel type
set val(ant) Antenna/OmniAntenna                                   ;# antenna type
set val(propagation) Shado ;# propagation model
set val(netif) Phy/WirelessPhy                                     ;# network interface type
set val(ll) LL                                                     ;# link layer type
set val(ifq) Queue/DropTail/PriQueue                               ;# interface queue type
set val(ifqlen) 50                                                 ;# max packet in ifq
set val(mac) Mac/802_11                                            ;# MAC type
set val(rp) AOMDV ;# routing protocol
set val(n) 16.0 ;# node number
set val(density) 4096 ;# node density [node/km^2]
set val(end) 2060.0                                                ;# simulation time [s]
set val(mobility) Static ;# mobility model
set val(minSpeed) 0.5                                              ;# movement minimum speed [m/s]
set val(maxSpeed) 1.5                                              ;# movement maximum speed [m/s]
set val(minPause) 0.0                                              ;# movement minimum pause time [s]
set val(maxPause) 0.0                                              ;# movement maximum pause time [s]
set val(movementStart) 950.0                                       ;# movement start time [s]
set val(traffic) Node-UDP ;# data pattern
set val(dataStart) 1000.0                                          ;# data start time [s]
set val(dataStop) [expr $val(end) - 60.0]                          ;# data stop time [s]
set val(seed) 1 ;# general pseudo-random sequence generator
set val(macFailed) true                                            ;# ATR protocol: ns2 MAC failed callback
set val(etxMetric) true                                            ;# ATR protocol: ETX route metric
set val(throughput) 5.4 ;# CBR rate (<= 5.4Mb/s)
set val(flow) 100                                                  ;# number of concurrent data flow for FLOW-**P data pattern
set val(nodes) $val(n)                                             ;# number of concurrent transmitting nodes for NODE-**P data pattern



# ------------------------------------------------------------------------------
# Fixing DSR bug
# ------------------------------------------------------------------------------
if {$val(rp) == "DSR"} {
set val(ifq) CMUPriQueue
}
# ------------------------------------------------------------------------------
# Channel model
# ------------------------------------------------------------------------------
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1                                      ;# transmitter antenna gain
Antenna/OmniAntenna set Gr_ 1                                      ;# receiver antenna gain
Phy/WirelessPhy set L_ 1.0                                         ;# system loss factor (mostly 1.0)
if {$val(propagation) == "TwoRay"} {                               ;# range tx = 250m 
set val(prop) Propagation/TwoRayGround
set prop [new $val(prop)]
Phy/WirelessPhy set CPThresh_ 10.0                         ;# capture threshold in Watt
Phy/WirelessPhy set CSThresh_ 1.559e-11                    ;# Carrier Sensing threshold
Phy/WirelessPhy set RXThresh_ 3.652e-10                    ;# receiver signal threshold
Phy/WirelessPhy set freq_ 2.4e9                            ;# channel frequency (Hz)
Phy/WirelessPhy set Pt_ 0.28                               ;# transmitter signal power (Watt)
}
if {$val(propagation) == "Shado"} {
set val(prop) Propagation/Shadowing
set prop [new $val(prop)]
$prop set pathlossExp_ 3.8                                 ;# path loss exponent
$prop set std_db_ 2.0                                      ;# shadowing deviation (dB)
$prop set seed_ 1                                          ;# seed for RNG
$prop set dist0_ 1.0                                       ;# reference distance (m)
$prop set CPThresh_ 10.0                                   ;# capture threshold in Watt
$prop set RXThresh_ 2.37e-13                               ;# receiver signal threshold
$prop set CSThresh_ [expr 2.37e-13 * 0.0427]               ;# Carrier Sensing threshold
$prop set freq_ 2.4e9                                      ;# channel frequency (Hz)
Phy/WirelessPhy set Pt_ 0.28
}
# ------------------------------------------------------------------------------
# Topology definition
# ------------------------------------------------------------------------------
#Creazione dello scenario in funzione della densita' di nodo scelta
set val(dim) [expr $val(n) / $val(density)] 
set val(x) [expr [expr sqrt($val(dim))] * 1000]
set val(y) [expr [expr sqrt($val(dim))] * 1000]

# ------------------------------------------------------------------------------
# Pseudo-random sequence generator
# ------------------------------------------------------------------------------

# General pseudo-random sequence generator
set genSeed [new RNG]
$genSeed seed $val(seed)
set randomSeed [new RandomVariable/Uniform]
$randomSeed use-rng $genSeed
$randomSeed set min_ 1.0
$randomSeed set max_ 100.0

# Mobility model: x node position [m]
set genNodeX [new RNG]
$genNodeX seed [expr [$randomSeed value]]
set randomNodeX [new RandomVariable/Uniform]
$randomNodeX use-rng $genNodeX
$randomNodeX set min_ 1.0
$randomNodeX set max_ [expr $val(x) - 1.0]

# Mobility model: y node position [m]
set posNodeY [new RNG]
$posNodeY seed [expr [$randomSeed value]]
set randomNodeY [new RandomVariable/Uniform]
$randomNodeY use-rng $posNodeY
$randomNodeY set min_ 1.0
$randomNodeY set max_ [expr $val(y) - 1.0]

# Mobility model: node speed [m/s]
set genNodeSpeed [new RNG]
$genNodeSpeed seed [expr [$randomSeed value]]
set randomNodeSpeed [new RandomVariable/Uniform]
$randomNodeSpeed use-rng $genNodeSpeed
$randomNodeSpeed set min_ $val(minSpeed)
$randomNodeSpeed set max_ $val(maxSpeed)

# Mobility model: node movement pause [s] 
set genNodePause [new RNG]
$genNodePause seed [expr [$randomSeed value]]
set randomNodePause [new RandomVariable/Uniform]
$randomNodePause use-rng $genNodePause
$randomNodePause set min_ $val(minPause)
$randomNodePause set max_ $val(maxPause)

# Data pattern: node
set genNode [new RNG]
$genNode seed [expr [$randomSeed value]]
set randomNode [new RandomVariable/Uniform]
$randomNode use-rng $genNode
$randomNode set min_ 0
$randomNode set max_ [expr $val(n) - 1]

# Data pattern "Random": flow start time [s]
set genStartData [new RNG]
$genStartData seed [expr [$randomSeed value]]
set randomStartData [new RandomVariable/Uniform]
$randomStartData use-rng $genStartData
$randomStartData set min_ $val(dataStart)
$randomStartData set max_ $val(dataStop)

# Data pattern "Full: flow start time [s]
set genStartDataFull [new RNG]
$genStartDataFull seed [expr [$randomSeed value]]
set randomStartDataFull [new RandomVariable/Uniform]
$randomStartDataFull use-rng $genStartDataFull
$randomStartDataFull set min_ 0
$randomStartDataFull set max_ [expr ($val(n) * ($val(n) - 1)) - 1]

# Data pattern: flow end time [s]
set genEndData [new RNG]
$genEndData seed [expr [$randomSeed value]]
set randomEndData [new RandomVariable/Uniform]
$randomEndData use-rng $genEndData
$randomEndData set min_ 0.0
$randomEndData set max_ [expr $val(end) - $val(dataStart) - 20]



# ------------------------------------------------------------------------------
# General definition
# ------------------------------------------------------------------------------
;#Instantiate the simulator
set ns [new Simulator]
;#Define topology
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
;#Create channel
set chan [new $val(chan)]
$prop topography $topo
;#Create God
create-god $val(n)
;#Global node setting
$ns node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propInstance $prop \
-phyType $val(netif) \
-channel $chan \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF

# ------------------------------------------------------------------------------
# Trace file definition
# ------------------------------------------------------------------------------

#New format for wireless traces
$ns use-newtrace

#Create trace object for ns, nam, monitor and Inspect
set nsTrc [open ns.trc w]
$ns trace-all $nsTrc
set namTrc [open nam.trc w] 
$ns namtrace-all-wireless $namTrc $val(x) $val(y)
set scenarioTrc [open scenario.trc w]

proc fileTrace {} {
global ns nsTrc namTrc
global ns nsTrc scenarioTrc
$ns flush-trace 
close $nsTrc
close $scenarioTrc
close $namTrc
exec nam nam.trc &
}



# ------------------------------------------------------------------------------
# Nodes definition
# ------------------------------------------------------------------------------
;#  Create the specified number of nodes [$val(n)] and "attach" them to the channel.
for {set i 0} {$i < $val(n) } {incr i} {
set node($i) [$ns node] 
$node($i) random-motion 0        ;# disable random motion
}

# ------------------------------------------------------------------------------
# Nodes mobility
# ------------------------------------------------------------------------------
#parameters for trace Inspect
puts $scenarioTrc "# nodes: $val(n), max time: $val(end)"
puts $scenarioTrc "# nominal range: 250"

if {$val(mobility) == "Static"} {
for {set i 0} {$i < $val(n)} {incr i} { 
set X [expr [$randomNodeX value] ]
$node($i) set X_ $X
set Y [expr [$randomNodeY value] ]
$node($i) set Y_ $Y
$node($i) set Z_ 0.0
$ns initial_node_pos $node($i) 20
puts $scenarioTrc "\$node_($i) set X_ $X"
puts $scenarioTrc "\$node_($i) set Y_ $Y"
puts $scenarioTrc "\$node_($i) set Z_ 0.0"
}
}



# ------------------------------------------------------------------------------
# Data load
# ------------------------------------------------------------------------------
if {$val(traffic) == "Node-UDP"} {
for {set i 0} {$i < $val(nodes)} {incr i} {
set udp($i) [new Agent/UDP]
$ns attach-agent $node($i) $udp($i)
set dest [expr round([$randomNode value])]
while {$dest == $i} {
set dest [expr round([$randomNode value])]
}
set monitor($dest) [new Agent/LossMonitor]
$ns attach-agent $node($dest) $monitor($dest)
$ns connect $udp($i) $monitor($dest)
set cbr($i) [new Application/Traffic/CBR]
$cbr($i) attach-agent $udp($i)
$cbr($i) set packetSize_ 1000
$cbr($i) set random_ false
$cbr($i) set rate_ [expr $val(throughput) / [expr $val(n) * sqrt($val(n))]]Mb
# $cbr($i) set rate_ [expr $val(throughput)]Mb
$ns at [expr $val(dataStart) + [$randomSeed value]] "$cbr($i) start"
$ns at $val(dataStop) "$cbr($i) stop"
# $ns at [expr [$randomStartData value]] "$cbr($i) start"
# set endData [expr [$randomStartData value] + [$randomEndData value]]
# if {$endData > $val(dataStop)} {
# set endData $val(dataStop)
# }
# $ns at $endData "$cbr($i) stop"
}
}



# ------------------------------------------------------------------------------
# Tracing
# ------------------------------------------------------------------------------

# printing simulation time
proc timeTrace { tracePause} {
global ns
    set now [$ns now]
    $ns at [expr $now + $tracePause] "timeTrace $tracePause"
    puts "$now simulation seconds"
}

$ns at 10.0 "timeTrace 10.0"

#$ns at 500 "[$node(0) agent 255] storeInfo id1 tex#t1"
#$ns at 500 "[$node(0) agent 255] storeInfo id2 text2"

#$ns at 520 "[$node(0) agent 255] requestInfo id1"

# ------------------------------------------------------------------------------
# Starting & ending
# ------------------------------------------------------------------------------
for {set i 0} {$i < $val(n) } {incr i} {
    $ns at $val(end) "$node($i) reset";
}

$ns at $val(end) "fileTrace"
$ns at $val(end) "$ns halt"

$ns run

the output of the above code is,






Friday, 24 January 2014

Cloud Simulation using netbeans and java

Step1
open Netbeans (any version greater then 5.0) ,Go to  file-->>new project
   
Step 2


 select "Java" folder then select first option java Application ,Press next


Step3
Now give name to the project as you wish ,then un-check the "create main class" press next.

                                                                               Step 4
Now your project is been created as shown.
Step5

 Go to library ,right click on it ,a menu will come ,click on "Add jars/Folders"
                                                                          Step6
Now browse the cloudsim folder which you have extracted from zip file .and go to  "cloudsim-2.1.1\jars" and select "cloudsim-2.1.1.jar" .
Step 7
Now simply copy the  "org" folder in "cloudsim-2.1.1\examples" and paste it to net beans source folder as shown.go to source and right click select paste.
Step 8
To run the example go to source ->> org.cloudbus.cloudsim.examples->>select any example ,right click on it and select "run" option the output will be displayed in the output window at the bottom.


         TO RUN EXAMPLE CODE FROM SOURCE CODE

Step 1,2,3,4 remain the same  in step 5 copy and paste   "org" folder from "cloudsim-2.1.1\source" and paste it into the source folder of  your netbeans project as you copied the example folder.

Thursday, 23 January 2014

Simple MANET topology in ns2

This is a sample Tcl script for simple manet topology creation,


# ======================================================================

# Define options for 

# ======================================================================

 set val(chan)         Channel/WirelessChannel  ;# channel type

 set val(prop)         Propagation/TwoRayGround ;# radio-propagation model

 set val(ant)          Antenna/OmniAntenna      ;# Antenna type

 set val(ll)           LL                       ;# Link layer type

 set val(ifq)          Queue/DropTail/PriQueue  ;# Interface queue type

 set val(ifqlen)       200                      ;# max packet in ifq

 set val(netif)        Phy/WirelessPhy          ;# network interface type

 set val(mac)          Mac/802_11               ;# MAC type

 set val(nn)           7                       ;# number of mobilenodes

 set val(rp)           AODV                     ;# Bio sensor routing protocol

 set val(x)            670

 set val(y)            510
source config        

set n(0) [$ns node]

$ns at 0.0 "$n(0) color red"

$n(0) color green

$n(0) shape "circle"
$ns at 0.0 "$n(0) label sensor"
set n(1) [$ns node]

$ns at 0.0 "$n(1) color red"

$n(1) color green

$n(1) shape "circle"
$ns at 0.0 "$n(1) label sensor"
set n(2) [$ns node]

$ns at 0.0 "$n(2) color red"

$n(2) color green

$n(2) shape "circle"
$ns at 0.0 "$n(2) label sensor"
set n(3) [$ns node]

$ns at 0.0 "$n(3) color darkgreen"

$n(3) color green

$n(3) shape "circle"

$ns at 0.0 "$n(3) label Sink"
set n(4) [$ns node]

$ns at 0.0 "$n(4) color red"

$n(4) color green

$n(4) shape "circle"
$ns at 0.0 "$n(4) label sensor"

set n(5) [$ns node]

$ns at 0.0 "$n(5) color red"

$n(5) color green

$n(5) shape "circle"
$ns at 0.0 "$n(5) label sensor"
set n(6) [$ns node]

$ns at 0.0 "$n(6) color red"

$n(6) color green

$n(6) shape "circle"

$ns at 0.0 "$n(6) label sensor"

for {set i 0} {$i < $val(nn)} {incr i} {

        $ns initial_node_pos $n($i) 30

}

$ns at 0.0 "$n(0) setdest 645.0 378.0 30000.0"

$ns at 0.0 "$n(1) setdest 233.0 371.0 30000.0"

$ns at 0.0 "$n(2) setdest 113.0 366.0 30000.0"

$ns at 0.0 "$n(3) setdest 392.0 474.0 30000.0"
                                                                                         

$ns at 0.0 "$n(4) setdest 415.0 184.0 30000.0"

$ns at 0.0 "$n(5) setdest 410.0 65.0 30000.0"

$ns at 0.0 "$n(6) setdest 413.0 259.0 20000.0"

# CONFIGURE AND SET UP A FLOW
set sink0 [new Agent/LossMonitor]

set sink1 [new Agent/LossMonitor]

set sink2 [new Agent/LossMonitor]

set sink3 [new Agent/LossMonitor]

set sink4 [new Agent/LossMonitor]

set sink5 [new Agent/LossMonitor]

set sink6 [new Agent/LossMonitor]
#==========

$ns attach-agent $n(0) $sink0

$ns attach-agent $n(1) $sink1

$ns attach-agent $n(2) $sink2

$ns attach-agent $n(3) $sink3

$ns attach-agent $n(4) $sink4

$ns attach-agent $n(5) $sink5

$ns attach-agent $n(6) $sink6

#==============

#$ns attach-agent $sink2 $sink3

set tcp0 [new Agent/TCP]

$ns attach-agent $n(0) $tcp0

set tcp1 [new Agent/TCP]

$ns attach-agent $n(1) $tcp1

set tcp2 [new Agent/TCP]

$ns attach-agent $n(2) $tcp2

set tcp3 [new Agent/TCP]

$ns attach-agent $n(3) $tcp3

set tcp4 [new Agent/TCP]

$ns attach-agent $n(4) $tcp4

set tcp5 [new Agent/TCP]

$ns attach-agent $n(5) $tcp5

set tcp6 [new Agent/TCP]

$ns attach-agent $n(6) $tcp5

proc attach-CBR-traffic { node sink size interval } {

   #Get an instance of the simulator

   set ns [Simulator instance]

   #Create a CBR  agent and attach it to the node

   set cbr [new Agent/CBR]

   $ns attach-agent $node $cbr

   $cbr set packetSize_ $size

   $cbr set interval_ $interval



   #Attach CBR source to sink;

   $ns connect $cbr $sink

   return $cbr

  }
$ns color 0 brown
proc finish {} {

        global ns f namtrace

        $ns flush-trace

        close $namtrace

        #close $f0

        exec nam log.nam &

        exit 0

}
$ns at 5.0 "$n(1) setdest 323.0 371.0 30.0"

$ns at 5.0 "$n(2) setdest 11.0 366.0 30.0"                                                                              

$ns at 2.0 "$n(4) setdest 195.0 234.0 30.0"

$ns at 3.0 "$n(5) setdest 41.0 135.0 30.0"

$ns at 4.0 "$n(6) setdest 443.0 259.0 20.0"

#===

set data [attach-CBR-traffic $n(5) $sink3 500 .2]



set data1 [attach-CBR-traffic $n(1) $sink3 500 .05]


#==

$ns at 0.3 "$data start"

$ns at 4.0 "$data1 start"


$ns at 15.0 "finish"

#===========

puts "Start of simulation.."

$ns run

#==============

Linux TCP implementation for NS2



This is a patch that can run Linux TCP congestion control algorithms on NS2, with similar simulation speed and memory usages as other NS2 TCPs (e.g. Sack1). The implementation loosely follows the Linux TCP implementation, and can produce results comparable to Linux experimental results. The patch is for NS-2.31 and compatible with 2.29 and 2.30. You may need some modification if you want to install it for other versions.


Patch for NS-2.31:

The patch can be downloaded from here. It is for NS-2.31 and compatible with 2.29 and 2.30. To install the patch, you need to take the following steps, assuming you have successfully installed and run NS-2.31 in your computer:
  1. Copy the patch to ns-allinone-2.31/ns-2.31
  2. In the directory of ns-allinone-2.31/ns-2.31 , run: make clean
  3. In the directory of ns-allinone-2.31/ns-2.31 , run: patch -p1 < ns-linux-v2.patch
  4. (Optional) delete the patch file by rm ns-linux-v2.patch
  5. recompile the ns2 by make and make install
The patch changes the following files:
  • tcp/tcp-linux.h, tcp/tcp-linux.cc: (new files) the NS-2 TCP Linux module
  • tcp/tcp.cc: (modifiying old file) fixed a bug in sending timestamp array (for delay-based algorithms)
  • tcp/scoreboard1.h and tcp/scoreboard1.cc: (new files) the Linux-like scoreboard implementation
  • tcp/linux/: (new files) this directory is added to hold the linkages between C++ codes in NS2 and C codes in Linux
  • tcp/linux/src/: (new files) this directory is added to hold source codes of Linux TCP congestion control modules
  • Makefile: (modifying old file) to include a list of new files to be compiled
  • tcl/lib/ns-default.tcl: (modifying old file) to add default values to control variables in TCP-Linux
  • tcl/test/test-all-tcpLinux and tcl/test/test-suite-tcpLinux.tcl: (new files) added for NS-2 compatible validation tests
  • tcl/ex/tcp-linux/ (new files): two example files on running TCP-Linux
  • doc/ns.bib and doc/tcp.tex (modifying old files): documentation files
  • This patch also includes a scheduler improvement patch to speed up the simulation.

Legacy patch for NS-2.29 with interface in Linux-2.6.16 kernels

The old patch for NS-2.29 with congestion control interface for Linux 2.6.13-2.6.20 kernels can be found here. (Linux changes its congestion control interface in 2.6.22.) This old version is no longer supported. However, bug fixes and patches from other contributors to this project will still be published.

Usage:

This section serves as a quick reference for users who want to run different Linux TCP algorithms in the TCP Linux patch.
There is a mini-tutorial for TCP Linux . Please read the mini-tutorial for details if you want to design your own algorithms or port new algorithms from Linux to NS-2.
If you find some performance problem of some Linux algorithms, please check the known Linux bugs page to make sure it is really the problem of the algorithm, not a bug in Linux implementation.

1. Normal Usage:

The TCP-Linux module is call "Agent/TCP/Linux".  If you have an existing script that runs TCP and want to change to TCP-Linux, what you need to do is:
  1. Change the TCP Agent's name (e.g. Agent/TCP/Sack1) to Agent/TCP/Linux.
  2. Make sure the TCP Sink has Sack1 support. That is, either you are using Agent/TCPSink/Sack1 or Agent/TCPSink/Sack1/DelAck . Currently, TCP-Linux does not support receivers without SACK.
  3. Optional but recommended: change the window_ option in tcp agent to be large enough. This option is the upper bound of congestion window. It is 20 by default in NS-2. Most congestion control algorithms work the same if the congestion window is bounded by 20. The recommended value is at least bandwidth-delay-product.
  4. Before starting the simulation, add one command:
$ns at 0 "$tcp select_ca $TCP_Name"
where $ns is the NS-2 scheduler you are using in the script, and $TCP_Name is the congestion control algorithm you want to select. 

2. Basic behavior:

The patch comes with 14 different congestion control algorithms from Linux-2.6.22.6, as listed in the following table.
Please see the tcl script for the simulation details; see the control shell script for the configuration of the simulations; and the gnuplot script for how the figures are generated.
$TCP_NameCongestion Control Algorithmcwnd dynamic of a single flow (RTT=128ms, BW=100Mbps, buffer=220pkt)
bicBinary Increase Congestion control for TCP 
cubicTCP CUBIC: Binary Increase Congestion control for TCP v2.0 , an extension of BIC-TCP
highspeedSally Floyd's High Speed TCP (HS-TCP RFC 3649) congestion control
htcpHamilton TCP (H-TCP) congestion control
hyblaTCP-HYBLA Congestion control algorithm
renoTCP NewReno
Note that this "NewReno" also includes implementation of SACK and Fack.
scalableTom Kelly's Scalable TCP
vegasTCP Vegas congestion control
westwoodTCP Westwood+
venoTCP Veno
lpTCP Low-Priority (TCP-LP)
yeahYeAH-TCP 
illinoisTCP Illinois 
compoundTCP Compound (C-TCP)(Last updated for 2.6.22.9 kernel.) Please be very careful about compound module as this module has been discontinued in the kernel code base since 2.6.17. It is here for research purpose only and the interface of this module might be out-dated for the latest kernel. We do try our best to keep the module's interface up-to-date. Extra care is still recommended for validating the results with this module. And please let us know if there is any problem.

3. Advanced Usage 

Changing parameters in a congestion control module in the simulation
You can change the parameters of a congestion control module during the simulation.
Add a command to change the global value of a parameter for all flows running a congestion control module:
$ns at $ChangeTime "$tcp set_ca_default_param $TCP_Name $Parameter_Name $Parameter_Value"
where $ns is the NS-2 scheduler you are using in the script, $TCP_Name is the congestion control algorithm in concern, $Parameter_Name is the variable name of the parameter, and $Parameter_Value is the new value of the parameter.
Effect is taken on all the flows which run the $TCP_Name and without defining their own local value for this parameter. (Flows which has used set_ca_param to define a local value for this parameter will not be affected.)

Add a command to change the local value of a parameter for a particular flow running a congestion control module:
$ns at $ChangeTime "$tcp set_ca_param $TCP_Name $Parameter_Name $Parameter_Value"
where $ns is the NS-2 scheduler you are using in the script, $TCP_Name is the congestion control algorithm in concern, $Parameter_Name is the variable name of the parameter, and $Parameter_Value is the new value of the parameter. Effect is taken on this particular flow ($tcp). Other flows are not affected. And the value of this parameter for this particular flow ($tcp) will not be affected by any future command ofset_ca_default_param.
For details, please refer to the tutorial.
Adding your own congestion control module
You can add your own congestion control module once you develop the module in Linux.
If you decide to do so, take the following steps:
  1. Make sure your implementation is compliant to the congestion control structure in Linux (struct tcp_congestion_ops);
  2. Make sure this patch has been applied to your NS2 code base
  3. Follow the migration step in tutorial to migrate your whole Linux congestion control modules (including your own) to NS-2 code base.
  4. add a record in Makefile by adding an item to let compiler know your code:
    tcp/linux/YourCode.o
  5. compile, run and compare the simulation results with Linux experiments results
You might encounter one of the following problems in the last step:
  1. If your algorithm requires access to many new fields in Linux TCP structure, you might need to add more fields to struct tcp_sock in tcp/linux/ns-linux-util.h .

WARNING: After adding a new congestion control algorithm, please verify the simulation results extensively and carefully to make sure the simulation is running as expected.


Here is a list of known problems:
  1. The implementation does not change receiver part. The delayed ack implementation in Linux might be different from the one in NS-2. This may results in some performance difference
  2. D-SACK: This may leads to performance difference in scenarios with packet reordering.
  3. F-RTO: Not yet implemented. Will be included very soon.
  4. ECN: The implementation is not extensively verified.
  5. TCP Segmentation: Not implemented. Will NOT be covered in the near future.
  6. Buffer tuning: Not implemented. Will NOT be covered in the near future.
For more details,

http://netlab.caltech.edu/projects/ns2tcplinux/ns2linux/