LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Location aided routing procol simulation in ns2, error in box.tcl file (https://www.linuxquestions.org/questions/linux-software-2/location-aided-routing-procol-simulation-in-ns2-error-in-box-tcl-file-4175463906/)

Dhaval Deolasi 05-29-2013 04:10 AM

Location aided routing procol simulation in ns2, error in box.tcl file
 
I want to simulate location aided routing protocol in ns-2.32 on ubuntu 12.04. I have created a mobility file and tried to run box.tcl file for simulation of location aided routing protocol.
But I am getting the error "Invalid AODV type (26)" when option "set val(rp) AODV " is used and error "segmentation fault" when option "set val(rp) DSR" is used in box.tcl file.
Plz, Help me to solve this error.

Dhaval Deolasi 06-05-2013 04:49 AM

Ok! I have solved the problem. I found that I need to add packet headers of TCP, Flags, ARP and AODV by adding lines "add-packet-header TCP,add-packet-header Flags, add-packet-header AODV, add-packet-header ARP " in box.tcl file.
Now,I am able to simulate LAR protocol and box.tcl file runs smoothly.:)

knudfl 06-05-2013 05:57 AM

# 2 .

Patch : toilers-LAR-DREAM-2.32.patch
http://www.linuxquestions.org/questi...-4175464665/#2


If you have a new patch with the TCP adds, could please upload
your files to e.g. Google Docs ?


-

Dhaval Deolasi 06-05-2013 06:33 AM

@knudfl,
Yes, I already have the patch for Location Aided Routing (LAR) and Distance Routing Effect Algorithm for Mobility (DREAM) protocol. I have downloaded that patch from http://controls.ae.gatech.edu/claus/ns_lardream.html.


This patch has been developed by Claus Christmann at Georgia Tech. The authors of related paper only want that any published research from using their code include a reference to their IEEE INFOCOM 2002 paper: T. Camp, J. Boleng, B. Williams, L. Wilcox, and W. Navidi, Performance Comparison of Two Location Based Routing Protocols for Ad Hoc Networks, Proceedings of the IEEE INFOCOM, pp. 1678-1687, 2002.


One can request that code from Dr. Tracy Camp via their website http://toilers.mines.edu/Public/Code


I don't have new patch. I just edited the box.tcl file after successfully applying the patch to ns-2.32 so that simulation of LAR protocol is possible. Here is my box.tcl file of LAR protocol:
Code:

  #*****************************************************************************#
#  File Name: box.tcl                                                        #
#  Purpose: #
#  Original Author: #
#  Modified by: #
#  Date Created: #
#
#  Copyright (C) 2004  Toilers Research Group -- Colorado School of Mines    #
#
#  Please see COPYRIGHT.TXT and LICENSE.TXT for copyright and license        #
#  details.                                                                  #
#******************************************************************************/

set val(chan)      Channel/WirelessChannel
set val(prop)      Propagation/TwoRayGround
set val(netif)      Phy/WirelessPhy
set val(mac)        Mac/802_11
#set val(ifq)        Queue/DropTail/PriQueue
set val(ll)        LL
set val(ant)        Antenna/OmniAntenna
set val(x)          300
set val(y)          600
set val(ifqlen)    50
set val(rp)        AODV
#set val(rp)          DSR
#set val(rp)        DSDV
set val(nn)        50
set val(txPower)    0.0075  ; #100 meters
set val(rxPower)    1
set val(sc)        "lar2.mob"               

set val(dataStart)  100.0
set val(dataStop)  300.0
set val(signalStop) 305.0
set val(finish)    310.0

if { $val(rp) == "DSR" } {
set val(ifq)      CMUPriQueue
} else {
 set val(ifq)      Queue/DropTail/PriQueue
}




# =====================================================================
# Other default settings

puts "setting other default settings..."

LL set mindelay_                50us
LL set delay_                  25us
LL set bandwidth_              0      ;# not used

Agent/Null set sport_          0
Agent/Null set dport_          0

Agent/CBR set sport_            0
Agent/CBR set dport_            0

Agent/TCPSink set sport_        0
Agent/TCPSink set dport_        0

Agent/TCP set sport_            0
Agent/TCP set dport_            0
Agent/TCP set packetSize_      512

Queue/DropTail/PriQueue set Prefer_Routing_Protocols    1

# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.559e-11
Phy/WirelessPhy set RXThresh_ 3.652e-10
Phy/WirelessPhy set Rb_ 2*1e6
#this was the default
#Phy/WirelessPhy set Pt_ 0.2818
# This is for 100m
Phy/WirelessPhy set Pt_ 7.214e-3
# This is for 40m
#Phy/WirelessPhy set Pt_ 8.5872e-4
# This is for 250m
#Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 914e+6
Phy/WirelessPhy set L_ 1.0

# =====================================================================
# This puts in only the headers that we need.
# =====================================================================
puts "removing unecessary packet headers..."
remove-all-packet-headers
add-packet-header IP
add-packet-header Common
add-packet-header LAR
add-packet-header LL
add-packet-header Mac
add-packet-header ARP
add-packet-header Flags
add-packet-header TCP
add-packet-header AODV


#Create a simulator object
set ns_ [new Simulator]
$ns_ use-scheduler Heap

#Open a trace file

set nt [open lar50mobi.tr w]
$ns_ use-newtrace
$ns_ trace-all $nt

set nf [open lar50mobi.nam w]
$ns_ namtrace-all-wireless $nf $val(x) $val(y)


set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)

create-god $val(nn)

# New API to config node:
# 1. Create channel (or multiple-channels);
# 2. Specify channel in node-config (instead of channelType);
# 3. Create nodes for simulations.

# Create channel #1
puts "creating channel..."
set chan_1_ [new $val(chan)]

#
# define how node should be created
#



#global node setting
puts "setting global node values..."
$ns_ node-config -adhocRouting $val(rp) \
                -llType $val(ll) \
                -macType $val(mac) \
                -ifqType $val(ifq) \
                -ifqLen $val(ifqlen) \
                -antType $val(ant) \
                -propType $val(prop) \
                -phyType $val(netif) \
                #-channelType $val(chan) \
                -channel $chan_1_ \
                -topoInstance $topo \
                -agentTrace OFF \
                -routerTrace OFF \
                -macTrace ON \
                -movementTrace OFF \
                -txPower $val(txPower) \
                -rxPower $val(rxPower)

# create the nodes
puts "creating the nodes..."

# create the nodes                       
for {set i 0} {$i < $val(nn) } {incr i} {
  set node_($i) [$ns_ node]       
  $node_($i) random-motion 0          ;# disable random motion
}

#
#Define a 'finish' procedure
proc finish {} {
        global ns_ nt
        $ns_ flush-trace
        close $nt
        exit 0
}

# Load the movement file
puts "Loading the mobility file..."
source $val(sc)

#Create lar agents and attach them to the nodes
puts "creating lar agents and attaching them to nodes..."
for {set i 0} {$i < $val(nn)} {incr i} {
  set g($i) [new Agent/LAR]
  $node_($i) attach $g($i) 254

  # need to tell the lar agents about their link layers
  set ll($i) [$node_($i) set ll_(0)]
  $ns_ at 0.0 "$g($i) set-ll $ll($i)"

  # need to tell the lar agents which nodes they're on also
  $ns_ at 0.0 "$g($i) set-node $node_($i)"
}

# the format now for the lar send is
#
# "$nodeId sendData <dest ID> <size> <method>"
#
# this will be used to test in a static configuration, and will
# change once the mobility portion is figured out.
#Schedule events

puts "Scheduling the send events"
for {set k $val(dataStart)} {$k < $val(dataStop)} {set k [expr $k + 0.25] } \
{
  $ns_ at $k "$g(0) sendData 49 64 B"
  $ns_ at [expr $k + .0001] "$g(1) sendData 48 64 B"
  $ns_ at [expr $k + .0002] "$g(2) sendData 47 64 B"
  $ns_ at [expr $k + .0003] "$g(3) sendData 46 64 B"
  $ns_ at [expr $k + .0004] "$g(4) sendData 45 64 B"
  $ns_ at [expr $k + .0005] "$g(5) sendData 44 64 B"
  $ns_ at [expr $k + .0006] "$g(6) sendData 43 64 B"
  $ns_ at [expr $k + .0007] "$g(7) sendData 42 64 B"
  $ns_ at [expr $k + .0008] "$g(8) sendData 41 64 B"
  $ns_ at [expr $k + .0009] "$g(9) sendData 40 64 B"
  $ns_ at [expr $k + .0010] "$g(10) sendData 39 64 B"
  $ns_ at [expr $k + .0011] "$g(11) sendData 38 64 B"
  $ns_ at [expr $k + .0012] "$g(12) sendData 37 64 B"
  $ns_ at [expr $k + .0013] "$g(13) sendData 36 64 B"
  $ns_ at [expr $k + .0014] "$g(14) sendData 35 64 B"
  $ns_ at [expr $k + .0015] "$g(15) sendData 34 64 B"
  $ns_ at [expr $k + .0016] "$g(16) sendData 33 64 B"
  $ns_ at [expr $k + .0017] "$g(17) sendData 32 64 B"
  $ns_ at [expr $k + .0018] "$g(18) sendData 31 64 B"
  $ns_ at [expr $k + .0019] "$g(19) sendData 30 64 B"
}


# this is done to make the simulator continue running and "settle" things out
for {set i 0} {$i < $val(nn)} {incr i} {
  $ns_ at $val(signalStop) "$g($i) larDone"
}

$ns_ at $val(finish) "finish"
$ns_ at [expr $val(finish) + 0.1] "puts \"NS Exiting...\" ; $ns_ halt"


# Create some feedback for hov far we are into the simulation
for {set i 0} {$i < 100} {incr i} {
        $ns_ at [expr $i * $val(finish) / 100] "puts \" ... $i % into sim ....\""
}


#Run the simulation
puts ""
puts ""
puts "***********************************************"
puts "***********************************************"
puts "***********************************************"
puts ""
puts "Running the simulation"
puts ""
puts "***********************************************"
puts "***********************************************"
puts "***********************************************"
puts ""
puts ""
$ns_ run


knudfl 06-05-2013 08:09 AM

# 4 .

OK, thank you. So now we have three <box.tcl> files :
"orig-box.tcl", Helen-box.tcl, and your file "ARP_TCP-box.tcl".

How did you generate the file "lar2.mob" ? ?

-

Dhaval Deolasi 06-05-2013 09:46 AM

#5.

After applying the toilers-LAR-DREAM-2.32.patch to ns-2.32, it created two folders lar and dream. In lar folder, original box.tcl file was located. But, lar folder didn't contained the mobility file.

So, I used setdest utility of ns2 available under ~ns/indep-utils/cmu-scen-gen/setdest directory to generate mobility file. I traversed to that directory via command prompt and run the following command to generate mobility file "lar2.mob".

./setdest -n 50 -p 10.0 -M 10.0 -t 200.0 -x 300.0 -y 600.0 > lar2.mob


Reference: Section XI of Marc Greis tutorial available at http://www.isi.edu/nsnam/ns/tutorial/nsscript7.html

knudfl 06-05-2013 01:00 PM

# 6 .

OK, my reason for asking is that those setdest generated files
don't seem to work with your box.tcl : $ ns box.tcl
Code:

.
.
INITIALIZE THE LIST xListHead
Loading the mobility file...
can't read "god_": no such variable
    while executing
"$god_ set-dist 0 1 2"
    (file "lar2.mob" line 154)
.
.


Dhaval Deolasi 06-06-2013 05:06 AM

#7.

Plz, refer this link http://khaledben.wordpress.com/2011/...iles-is-wrong/

Helen jameel 06-10-2013 05:04 AM

To solve this problem
you have to add this line before Loading the mobility file
set god_ [God instance]
source $val(sc)

snegi 02-21-2014 01:05 AM

NAM
 
nam is not working on this any idea why?
file is being created but exex nam filename.nam & does nothing

knudfl 02-21-2014 01:12 AM

# 10 .

To have a usable nam you must first install a 'nam'.

32bits : nam-1.14.i586.tar.gz
https://docs.google.com/uc?id=0B7S25...=CLPiyxo&hl=en

64bits https://docs.google.com/uc?id=0B7S25...CN3jzIcL&hl=en

Unpack the file : $ tar xvf nam*
And : $ cd nam*/
# cp nam /usr/local/bin/

-

snegi 02-21-2014 03:53 AM

NAM
 
nam is installed . I can run it on terminal and open the specific nam file and it works but not working for same file from tcl script

knudfl 02-21-2014 04:47 AM

# 12 .

Some files.tcl have like "exec nam out.nam &"
With all the other files.tcl, you will have to do $ nam out.nam


All times are GMT -5. The time now is 03:55 AM.