[ns] Help .. Error running wireless protocols in ns2.

2012-10-13 Thread Marllus Lustosa

Em 13/10/12 21:00, ns-users-requ...@isi.edu escreveu:

Hi, Vivek!

Please, post your script file .tcl.

 Message: 1
 Date: Sat, 13 Oct 2012 10:25:56 +0530
 From: vivek arya 1viveka...@gmail.com
 Subject: [ns] Help .. Error running wireless protocols in ns2.
 To: ns-users@isi.edu
 Message-ID:
   cahp5+uzy4wfzu6pbt3urwbxznw1xh+nkolyb-yfwkr_5m+p...@mail.gmail.com
 Content-Type: text/plain; charset=ISO-8859-1

 I get the following error in terminal when i execute my file..

 ns dsdv-example.tcl
 num_nodes is set 3
 invalid command name -macType
 while executing
 -macType $val(mac) \
 -ifqType $val(ifq) \
 -ifqLen $val(ifqlen) \
 -antType $val(ant) \
 -propType $val(prop) \
 -phyType $val(netif) \
 -chann...
 (file dsdv-example.tcl line 39)

 what is this error.. can anybody help..
 Google did not help..
 Thnx in advance


 --

 Message: 2
 Date: Sat, 13 Oct 2012 03:06:28 -0700 (PDT)
 From: sukhalid sukha...@gmail.com
 Subject: [ns]  How to patch GPSR routing protocol to ns-2.35
 To: ns-users@isi.edu
 Message-ID: 34541231.p...@talk.nabble.com
 Content-Type: text/plain; charset=us-ascii


 Hi,
 I have patched GPSR to ns-2.35 using keliu' code. It works fine with given
 tcl file. I need to move nodes according to mine own mobility scenario and
 compare them to AODV protocol.
 I have two problems
 1. I don't understand what this command in gpsr.tcl file means

 proc gpsr-create-mobile-node { id args } {
   .   
 if [info exists opt(energy)] {
   $node addenergymodel [new $opt(energy) $node 10 0.5 0.2]}
   .

 What are these figures (0.5, 0.2), are these energy consumed in reception
 and transmission or some thing else.

 Secondly I want move mobile node created using proc defined in gpsr.tcl file
 according to my own mobility plan e.g.

 $ns_ at 0. $node_(0) setdest 144.816950690450 20.073824649527
 0.324133202939
 $ns_ at 0. $node_(1) setdest 93.957720171475 192.140808646867
 1.452613500562
 $ns_ at 12.158688172971 $node_(23) setdest 113.137798368154 39.443538618334
 0.902003496971
 $ns_ at 14.805074599534 $node_(2) setdest 152.227654369397 20.766089279052
 1.742469780423

 But when I run simulation it gives error like this:

 Load complete...
 Starting Simulation...
 ns: _o18 setdest 144.816950690450 20.073824649527 0.324133202939:
 (_o18 cmd line 1)
 invoked from within
 _o18 cmd setdest 144.816950690450 20.073824649527 0.324133202939
 invoked from within
 catch $self cmd $args ret
 invoked from within
 if [catch $self cmd $args ret] {
 set cls [$self info class]
 global errorInfo
 set savedInfo $errorInfo
 error error when calling class $cls: $args $...
 (procedure _o18 line 2)
 (SplitObject unknown line 2)
 invoked from within
 _o18 setdest 144.816950690450 20.073824649527 0.324133202939

 Urgent help is needed please







Re: [ns] Help .. Error running wireless protocols in ns2.

2012-10-13 Thread metagoth


Here is the code..

# Define options
set val(chan)   Channel/WirelessChannel;# channel type
set val(prop)   Propagation/TwoRayGround   ;# radio-propagation
model
set val(netif)  Phy/WirelessPhy;# network interface type
set val(mac)Mac/802_11 ;# MAC type
set val(ifq)Queue/DropTail/PriQueue;# interface queue type
set val(ll) LL ;# link layer type
set val(ant)Antenna/OmniAntenna;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 3  ;# number of mobilenodes
set val(rp) DSDV   ;# routing protocol
set val(x)  500;# X dimension of topography
set val(y)  400;# Y dimension of topography 
 
set val(stop)   150;# time of simulation end

set ns[new Simulator]
set tracefd   [open simple.tr w]
set windowVsTime2 [open win.tr w] 
set namtrace  [open simwrls.nam w]

$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

# set up topography object
set topo   [new Topography]

$topo load_flatgrid $val(x) $val(y)

create-god $val(nn)

#
#  Create nn mobilenodes [$val(nn)] and attach them to the channel. 
#

# configure the nodes
$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) \
 -topoInstance $topo \
 -agentTrace ON \
 -routerTrace ON \
 -macTrace OFF \
 -movementTrace ON
 
for {set i 0} {$i  $val(nn) } { incr i } {
set node_($i) [$ns node]
}

# Provide initial location of mobilenodes
$node_(0) set X_ 5.0
$node_(0) set Y_ 5.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 490.0
$node_(1) set Y_ 285.0
$node_(1) set Z_ 0.0

$node_(2) set X_ 150.0
$node_(2) set Y_ 240.0
$node_(2) set Z_ 0.0

# Generation of movements
$ns at 10.0 $node_(0) setdest 250.0 250.0 3.0
$ns at 15.0 $node_(1) setdest 45.0 285.0 5.0
$ns at 110.0 $node_(0) setdest 480.0 300.0 5.0 

# Set a TCP connection between node_(0) and node_(1)
set tcp [new Agent/TCP/Newreno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $node_(0) $tcp
$ns attach-agent $node_(1) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 10.0 $ftp start 

# Printing the window size
proc plotWindow {tcpSource file} {
global ns
set time 0.01
set now [$ns now]
set cwnd [$tcpSource set cwnd_]
puts $file $now $cwnd
$ns at [expr $now+$time] plotWindow $tcpSource $file }
$ns at 10.1 plotWindow $tcp $windowVsTime2  

# Define node initial position in nam
for {set i 0} {$i  $val(nn)} { incr i } {
# 30 defines the node size for nam
$ns initial_node_pos $node_($i) 30
}

# Telling nodes when the simulation ends
for {set i 0} {$i  $val(nn) } { incr i } {
$ns at $val(stop) $node_($i) reset;
}

# ending nam and the simulation 
$ns at $val(stop) $ns nam-end-wireless $val(stop)
$ns at $val(stop) stop
$ns at 150.01 puts \end simulation\ ; $ns halt
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
}

$ns run

Thnx mate
-- 
View this message in context: 
http://old.nabble.com/Help-..-Error-running-wireless-protocols-in-ns2.-tp34552799p34553135.html
Sent from the ns-users mailing list archive at Nabble.com.



[ns] Help .. Error running wireless protocols in ns2.

2012-10-12 Thread vivek arya

I get the following error in terminal when i execute my file..

ns dsdv-example.tcl
num_nodes is set 3
invalid command name -macType
while executing
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-chann...
(file dsdv-example.tcl line 39)

what is this error.. can anybody help..
Google did not help..
Thnx in advance