#call
source costtest1.tcl
for { set x 5} { $x <6} { incr x } {
input_Protocol_pramerters 20 $x 2.0 $x
}
puts "Done"
-
proc input_Protocol_pramerters {No_node No_connaction Rate iter} {
set cbr "cbr-"
set secn "scan-"
append cbr $iter
append secn $iter
set DSR_fileTr "DSR"
append DSR_fileTr $iter ".tr"
set DSR_fileNam "DSR"
append DSR_fileNam $iter ".nam"
puts $iter
#---- Generate Movement file ----
puts [eval exec "./setdest -v 1 -n $No_node -p 5 -M $No_connaction -t 100 -x 1000 -y 1000 >$secn"]
#---- Generate Movement file ----
puts [eval exec "ns cbrgen.tcl -type cbr -nn $No_node -seed 1.0 -mc $No_connaction -rate $Rate >$cbr"]
#---- Main simulation file to generate DSR.tr and DSR.nam
#----------------------------------------------------------------
# Definition of the physical layer
#----------------------------------------------------------------
set val(chan) Channel/WirelessChannel
set val(prop) Propagation/TwoRayGround
set val(netif) Phy/WirelessPhy
set val(mac) Mac/802_11
set val(ifq) CMUPriQueue
set val(ll) LL
set val(ant) Antenna/OmniAntenna
#-----------------------------------------------------------------
# Scenario parameters
#------------------------------------------------------------------
set val(x) 1500 ;# X dimension of the topography
set val(y) 1500 ;# Y dimension of the topography
set val(ifqlen) 50 ;# max packet in queue
set val(seed) 1.0 ;#random seed
set val(adhocRouting) DSR
set val(nn) $No_node ;# how many nodes are simulated
set val(cp) $cbr
set val(sc) $secn
set val(stop) 50 ;# simulation time
#----------------------------------------------------------------------
# Set up simulator objects
#----------------------------------------------------------------------
# create simulator instance
set ns_ [new Simulator]
# setup topography object
set topo [new Topography]
# create trace object for ns and nam
set tracefd [open $DSR_fileTr w]
$ns_ use-newtrace ;# use the new wireless trace file format
set namtrace [open $DSR_fileNam w]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
# define topology
$topo load_flatgrid $val(x) $val(y)
# Create God
set god_ [create-god $val(nn)]
$ns_ node-config -adhocRouting $val(adhocRouting) \
-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 ON
# Create the specified number of nodes [$val(nn)] and "attach" them
# to the channel.
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}
# Define node movement model
puts "Loading connection pattern..."
source $val(cp)
# Define traffic model
puts "Loading scenario file..."
source $val(sc)
# Define node initial position in nam
for {set i 0} {$i < $val(nn)} {incr i} {
# 50 defines the node size in nam, must adjust it according to your scenario
# The function must be called after mobility model is defined
# puts "Processing node $i"
$ns_ initial_node_pos $node_($i) 50
}
#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop).0 "$node_($i) reset";
}
$ns_ at $val(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
# dump the initial simulation info to the trace file
puts $tracefd "M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(adhocRouting)"
puts $tracefd "M 0.0 sc $val(sc) cp $val(cp) seed $val(seed)"
puts $tracefd "M 0.0 prop $val(prop) ant $val(ant)"
puts "Starting Simulation..."
$ns_ run
# end Mail file
# Evaluate parametrs
puts [eval exec "awk -f End2endDelay_RoutingPackets.awk $DSR_fileTr"]
}
-
5
num_nodes is set 20
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
Loading connection pattern...
Loading scenario file...
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
NS EXITING...
Packet Sent = 136.00
Packet Receive = 82.00
routingpkts = 123.00
Packet Delivery Ratio = 60.29
NRL = 1.50
Average end-to-end Delay (ms)= 13219.08
No. of dropped data (packets) = 21
No. of dropped data (bytes) = 11172
-
6
num_nodes is set 20
invalid command name "_o491 _o4"
while executing
"$ns_ get-nodetype"
(procedure "_o501" line 22)
(Object next line 22)
invoked from within
"_o501 next"
("eval" body line 1)
invoked from within
"eval $self next $args"
(procedure "_o501" line 3)
(Object next line 3)
invoked from within
"_o501 next"
("eval" body line 1)
invoked from within
"eval $self next $args "
(procedure "_o501" line 6)
(SRNodeNew init line 6)
invoked from within
"_o501 init "
(Class create line 1)
invoked from within
"SRNodeNew create _o501 "
invoked from within
"catch "$className create $o $args" msg"
invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
(procedure "new" line 3)
invoked from within
"new SRNodeNew"
("eval" body line 1)
invoked from within
"eval new $nodeclass $args"
(procedure "_o491" line 8)
(Simulator create-node-instance line 8)
invoked from within
"_o491 create-node-instance"
("eval" body line 1)
invoked from within
"eval $self create-node-instance $args"
(procedure "_o491" line 6)
(Simulator create-wireless-node line 6)
invoked from within
"_o491 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o491" line 23)
(Simulator node line 23)
invoked from within
"$ns_ node"
(procedure "input_Protocol_pramerters" line 61)
invoked from within
"input_Protocol_pramerters 20 6 2.0 6"
(file "call.tcl" line 5)
-