Forum Replies Created
@Sherry wrote:
Hi all
>
> I need help in running a tcl scripts and testing the performance of the
> MAODV protocol in ns2 version 2.33.
> I know that for most ns-users this is pretty prementive, but for me as I’m
> new to ns2 is a hard task. I followed the thesis ” MAODV Implementation for
> NS-2.26″ by Yufang Zhu and Thomas Kunz. step bu step and finally got this
> error message when I run ns ns.tcl in the X window:
> *****************************
> num_nodes is set 50
> INITIALIZE THE LIST xlisthead
>
> (-o17 cmd line 1)
> invoked from within
> “-o17 and port-dmux-o26”
> invoked from within
> “catch “$self cmd $args”ret”
> invoked from within
> “if [catch “$self cmd $arg”ret] {
> set cls [$self info class]
> global errorInfo
> set savedInfo $errorInfo
> error”error when calling class $cls:$args” $…”
> (procedure “-o17” line2)
> (splitObject unknown line2
> **************************
> Please help me in trying to run the script
> Thank u in advance
Please put your Tcl file, may be we can help you
You can use this command to install the gcc :
open the terminal and write this command
yum install gcc-c++
I hope this hepls
@aashika wrote:
@CharlesPandian wrote:
AODV code is already available in standard ns2 distribution.(under ns-allinone-2.33ns-2.33aodv in ns version 2.33 )
Thanks for ur reply. I saw it. but how to run it. there is no tcl file in that.There are other files like .o and .cc. pls tell me how to run it. i need to add some functionality to that.
you can use this tcl file to run aodv:
NOTE: set val(rp) AODV ; # routing protocol
# Example 4, A simple Wireless Linear Adhoc Network
# ======================================================================
# 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) 6 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(energymodel) EnergyModel
set val(initialenergy) 50
# ======================================================================
# Main Program
# ======================================================================
#
# Initialize Global Variables
#
set ns_ [new Simulator]
set tracefd [open WEx_4.tr w]
set namtrace [open WEx_4.nam w]
#$ns_ use-newtrace
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace 800 800
set topo [new Topography]
$topo load_flatgrid 800 800
#
# Create God
#
set god_ [create-god $val(nn)]
set chan_1_ [ new $val(chan) ]
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 3.652e-10
Phy/WirelessPhy set RXThresh_ 3.652e-10 ;# Receiving Threshold
Phy/WirelessPhy set Rb_ 1e6 ;# Bandwidth
Phy/WirelessPhy set Pt_ 0.0010436 ;# 40 m
Phy/WirelessPhy set freq_ 914e+6
Phy/WirelessPhy set L_ 1.0
# configure node
$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)
-channel $chan_1_
-topoInstance $topo
-agentTrace ON
-routerTrace OFF
-macTrace ON
-movementTrace OFF
-energyModel $val(energymodel)
-rxPower 0.0
-txPower 1.0
-idlePower 0.0
-sleepPower 0.00
-transitionPower 0.0
-transitionTime 0.00
-initialEnergy $val(initialenergy)
Phy/WirelessPhy set Pt_ 0.0010436
set opt(netif) Phy/WirelessPhy
$ns_ node-config
-phyType $opt(netif)
-txPower 0.173
-rxPower 0.05
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node $i ]
$ns_ initial_node_pos $node_($i) 15
$node_($i) random-motion 0 ;# disable random motion
$god_ new_node $node_($i)
}
proc coord_proc {a} {
return [expr 30.0 * $a ]
}
#Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
for {set i 0} {$i < $val(nn)} {incr i} {
$node_($i) set X_ [coord_proc $i]
$node_($i) set y_ 2.0
$node_($i) set Z_ 0.0
}
$ns_ at 1.0 “$node_(0) setdest 1 3 15.0”
for { set j 1} {$j<$val(nn)} {incr j} {
$ns_ at 1.0 “$node_($j) setdest [coord_proc $j] 3.0 15.0”
}
$ns_ at 1.0 “$node_(0) add-mark m1 blue circle”
$ns_ at 1.0 “$node_(0) label Base_station”
set null_0 [new Agent/Null]
$ns_ attach-agent $node_(0) $null_0 ;# Making Node 0 as the Base Station
###############################
## Connecting node 1 to node 0
##############################
set udp_(1) [new Agent/UDP]
$udp_(1) set class_ 1
$ns_ attach-agent $node_(1) $udp_(1)
set cbr_(1) [new Application/Traffic/CBR]
$cbr_(1) set packetSize_ 500
$cbr_(1) set interval_ 0.1
$cbr_(1) set random_ 1
$cbr_(1) set set maxpkts_ 10000
$cbr_(1) attach-agent $udp_(1)
$ns_ connect $udp_(1) $null_0
$ns_ at 5 “$cbr_(1) start”
###############################
## Connecting node 2 to node 0
##############################
set udp_(2) [new Agent/UDP]
$udp_(2) set class_ 2
$ns_ attach-agent $node_(2) $udp_(2)
set cbr_(2) [new Application/Traffic/CBR]
$cbr_(2) set packetSize_ 500
$cbr_(2) set interval_ 0.1
$cbr_(2) set random_ 1
$cbr_(2) set set maxpkts_ 10000
$cbr_(2) attach-agent $udp_(2)
$ns_ connect $udp_(2) $null_0
$ns_ at 5 “$cbr_(2) start”
###############################
## Connecting node 3 to node 0
##############################
set udp_(3) [new Agent/UDP]
$udp_(3) set class_ 3
$ns_ attach-agent $node_(3) $udp_(3)
set cbr_(3) [new Application/Traffic/CBR]
$cbr_(3) set packetSize_ 500
$cbr_(3) set interval_ 0.1
$cbr_(3) set random_ 1
$cbr_(3) set set maxpkts_ 10000
$cbr_(3) attach-agent $udp_(3)
$ns_ connect $udp_(3) $null_0
$ns_ at 5 “$cbr_(3) start”
###############################
## Connecting node 4 to node 0
##############################
set udp_(4) [new Agent/UDP]
$udp_(4) set class_ 4
$ns_ attach-agent $node_(4) $udp_(4)
set cbr_(4) [new Application/Traffic/CBR]
$cbr_(4) set packetSize_ 500
$cbr_(4) set interval_ 0.1
$cbr_(4) set random_ 1
$cbr_(4) set set maxpkts_ 10000
$cbr_(4) attach-agent $udp_(4)
$ns_ connect $udp_(4) $null_0
$ns_ at 5 “$cbr_(4) start”
###############################
## Connecting node 5 to node 0
##############################
set udp_(5) [new Agent/UDP]
$udp_(5) set class_ 5
$ns_ attach-agent $node_(5) $udp_(5)
set cbr_(5) [new Application/Traffic/CBR]
$cbr_(5) set packetSize_ 500
$cbr_(5) set interval_ 0.1
$cbr_(5) set random_ 1
$cbr_(5) set set maxpkts_ 10000
$cbr_(5) attach-agent $udp_(5)
$ns_ connect $udp_(5) $null_0
$ns_ at 5 “$cbr_(5) start”
#######################################
###################################################
$ns_ at 50.01 “stop”
$ns_ at 50.01 “puts “NS EXITING…” ; $ns_ halt”
proc stop {} {
global ns_ tracefd
$ns_ flush-trace
close $tracefd
puts “Finishing ns..”
exit 0
}
puts “Starting Simulation…”
$ns_ run[/code]
yes it is very easy, just go to this path and type ./make-scen.csh .
But you should open this patch to add your specific parameters .
Dear CharlesPandian.
you are right, but what is the correct way to use this function inside TCL file or what is the correct way to use the value which return by this function inside TCL file?
thanks
Dear CharlesPandian,
I disable energy checking in IsNeighbor function in mobile/god.cc, and run make command in order to modify the change. but I still have the same error
invalid command name “God::instance()->IsNeighbor(i”
while executing
“God::instance()->IsNeighbor(i , j)”
(“for” body line 3)
invoked from within
“for {set i 0} {$i < $num_row*$num_row} {incr i} {
for {set j 0} {$i < $num_row*$num_row} {incr j} {
God::instance()->IsNeighbor(i , j);…”
(file “pbcast_sim.tcl” line 155)
I do not where is the problem.
thank you so much for your help.