[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Got errors while trying to run a tcl script!



dear ns-users,

i'm doing a study on the handoff method in mobileIP,
currently. my study is iam going to compare 3 handoff method
in mobileIP which are the original method, the fast
registration method and the extended smooth handoff method.
iam trying to improve the handoff method so that it results
with a low latency,low packet loss and low overhead  as for
a real time communications in the internet environment. i do
some research while the mobile host moving between an old
cell and a new one.
i've got this script : the ZahataScript.tcl from a
friend.(there's the attachment file).

while trying to run this script, it results with errors
which are:
     num_nodes is set 4
     no value given for parameter "errproc" to "o_34"
          (Node/MobileNode) add-interface line 1)
          invoked from within
     "$node add-interface $chan $prop $opt(ll) $opt(mac)
$opt(ifq) $opt(ifqlen) 
      $opt(netif) $opt(ant)"
          (procedure "create-dsdv-bs-node" line 5)
          invoked from within
     "create-$opt(rp)-bs-node $node $id"
          (procedure "create-base-station-node" line 21)
          invoked from within
     "create-base-station-node 1.0.0"
          invoked from within
     "set HA[create-base-station-node 1.0.0]"
          (file "ZahataScript.tcl" line 247

iam using redhat6.2 with installed ns in directory
/home/nickyma.
please if anyone had ever do asimulation on the handoff
mechanism/method before or anyone who can help me, please
help me ok!


best regards,

nickymuhammadali
telecommunication engineering majoring in networking
stttelkom
bandung
indonesia

---------------------------------------------------------
NETKUIS berhadiah ratusan juta Rupiah :  (http://netkuis.plasa.com)
Email ini dikirim oleh PlasaCom : (http://www.plasa.com)
---------------------------------------------------------


#
#                       o W1 (Correspondence Host - Sender)    WIRED NODES
#                       |
#                       o W2
#                      / \
#                     /   \                    
#--*--*--*--*--*--*- o     o base-stn nodes  --*-*-*-*-*-*-*-
#                   HA      FA               
#                       o
#                  o    WL       o          WIRELESS NODE MOVING
#                WL \              WL         FROM HA TO FA.
#
#

#options
set opt(chan)		Channel/WirelessChannel
set opt(prop)		Propagation/TwoRayGround
set opt(netif)		Phy/WirelessPhy
set opt(mac)		Mac/802_11
set opt(ifq)		Queue/DropTail/PriQueue
set opt(ll)		LL
set opt(ant)            Antenna/OmniAntenna
set opt(x)		2000	;# X & Y dimension of the topography
set opt(y)		2000     ;# hard wired for now...
set opt(rp)             dsdv    ;# routing protocls: dsdv/dsr
set opt(ifqlen)		500		;# max packet in ifq
set opt(seed)		1.0
set opt(speed)          20.0            ;# m/s
set opt(stop)		135.000000001		;# simulation time
set opt(dump)           135.0
set opt(cc)             "off"
set opt(tr)		"/dev/null"	;# trace file
set opt(cp)             ""
set opt(sc)             ""
set opt(cbr_start)      120.0
set opt(pt_bs)          0.112  ;#BS Pt power
set opt(pt_mh)          0.112   ;#MH Pt power
set opt(rxthresh)       3.652e-10 ;#RXThresh

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

set num_wired_nodes    2
set num_bs_nodes       3         ;#2 -> 3  5-28
set num_wireless_nodes 1

set opt(nn)            4         ;# total number of wireless nodes

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

# Other class settings

set AgentTrace			ON
set RouterTrace			OFF
set MacTrace			ON

LL set mindelay_		50us
LL set delay_			25us

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

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

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_ $opt(rxthresh)
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.2818
#Phy/WirelessPhy set Pt_ 0.20
Phy/WirelessPhy set freq_ 914e+6 
Phy/WirelessPhy set L_ 1.0

# ==================================================================
#source /home/nickyma/ns-allinone-2.1b8a/ns-2.1b8a/tcl/lib/ns-bsnode.tcl
#source /home/nickyma/ns-allinone-2.1b8a/ns-2.1b8a/tcl/mobility/com.tcl
#source /home/nickyma/ns-allinone-2.1b8a/ns-2.1b8a/tcl/mobility/dsr.tcl
#source /home/nickyma/ns-allinone-2.1b8a/ns-2.1b8a/tcl/lib/ns-mip.tcl
source /home/nickyma/ns-allinone-2.1b8a/ns-2.1b8a/tcl/lib/ns-wireless-mip.tcl


#
#  ZahataDump-Nickyma script
#
#
proc DumpDump {} {
    global ns rtp0  cbr0 null0 node  loss mylink myqueue mymonitor FA FA1 MH

    set ns [Simulator instance]

   
    #puts Time=[$ns now]
    
    # puts PacketNumber=[$cbr0 set seqno_]
    #puts PacketSize=[$udp0 set packetSize_]
    #puts Random=[$cbr0 set random_]

#    set time 100.0

#    puts  [$udp0 set npaket_]
#     puts  [$null0 set nlost_]
#     puts  "mh npk   [$null0 set expected_] "


#     set   expected  [$null0 set expected_] 
     
#     puts  "mh npk   [$null0 set npkts_] "   
#     set     npkts  [$null0 set npkts_]

#    puts  [expr  $npkts/$expected]

#     puts  [$udp0 set seqno_]
#      puts [$rtp0 set interval_]
#     puts  [$udp0 set seqno_]
    #    puts  [$node(g) set npkts_]    ;#
    puts  " now          [$ns now]              "
    puts  " s   seq      [$rtp0 set seqno_]     "
#    puts  " node         [$node(mh) set loss_agent_] "
#    puts  " ha bytes     [$loss(ha) set bytes_]" 
#    puts  " ha  lost     [$loss(ha) set nlost_] "
#    puts  " ha  npk      [$loss(ha) set npkts_] "
#    puts  " fa bytes     [$loss(fa) set bytes_]"    
#    puts  " fa  lost     [$loss(fa) set nlost_] "
#    puts  " fa  npk      [$loss(fa) set npkts_]"
#    puts  " fa1 bytes    [$loss(fa1) set bytes_]"
#    puts  " fa1 lost     [$loss(fa1) set nlost_]"
#    puts  " fa1 npk      [$loss(fa1) set npkts_]"
#    puts  " mh  bytes    [$null0 set bytes_]"
    puts  " mh  lost     [$null0 set nlost_]"
    puts  " mh  lost1    [$null0 set slost1_]"
    puts  " mh  lost2    [$null0 set slost2_]"
    puts  " mh  l_int    [ [$MH set regagent_] set l_int ]    "
    puts   " mh  seqno1  [ [$MH set regagent_] set seqno1_ ] "
    puts  " mh  npk      [$null0 set npkts_] "   
    puts  " mh  npex   [$null0 set expected_] "
    puts  " mh  Y        [$MH set Y_] "

puts " fa  free [ [ $FA set decap_ ]  set free ]  " ;#12-22
puts " fa1  free [ [ $FA1 set decap_ ]  set free ]  " ;#12-22


#    puts  "  mh-regagent   [ $node(mh) set regagent_ ]    "   ;#11-22


#    puts  " mh  npk-ex-B [expr 210*[$null0 set expected_]] "

#     puts  " ha  parrivals_    [$mymonitor(ha) set parrivals_] "
#     puts  " ha  pdepartures_  [$mymonitor(ha) set pdepartures_] "

#    puts  " fa  parrivals_    [$mymonitor(fa) set parrivals_] "
#    puts  " fa  pdepartures_  [$mymonitor(fa) set pdepartures_] "
    
#    puts  " fa1  parrivals_   [$mymonitor(fa1) set parrivals_] "
#    puts  " fa1  pdepartures_ [$mymonitor(fa1) set pdepartures_] "


# Dumpclear

#   $ns at [expr [$ns now] + 1.0]  DumpDump
#$null0 set expected_ 0

}

proc Dumpclear {} {
  
global ns opt  null0 loss rtp0 mymonitor

$rtp0     set seqno_    0
$null0 set expected_ 0
$null0 set npkts_ 0
$null0 set nlost_ 0
#$null0 set bytes_ 0
#$mymonitor(ha) set parrivals_ 0
#$mymonitor(ha) set pdepartures_ 0
#$mymonitor(fa) set parrivals_ 0
#$mymonitor(fa) set pdepartures_ 0
#$mymonitor(fa1) set parrivals_ 0
#$mymonitor(fa1) set pdepartures_ 0
#set $[ [ $FA set decap_ ]  set free ]  0
#set $[ [ $FA1 set decap_ ]  set free ]  0

}




# intial setup - set addressing to hierarchical
set ns [new Simulator]
$ns set-address-format hierarchical 

# set mobileIP flag
Simulator set mobile_ip_ 1

#set trace
#set namtrace [open wireless-mip.nam w]
#$ns namtrace-all $namtrace
#set trace [open wireless-mip.tr w]
#$ns trace-all $trace

#?
AddrParams set domain_num_ 4   ;# 3->4 5-28
lappend cluster_num 2 1 1 1     ;#5-28  2 wired 1*3 BS 
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 2 1 1    ;#4->1   0->1  5-28
AddrParams set nodes_num_ $eilastlevel


#?
##debug 1
## setup the wired nodes
set temp {0.0.0 0.1.0}
for {set i 0} {$i < $num_wired_nodes} {incr i} {
    set W($i) [$ns node [lindex $temp $i]] 
}

## create common objects reqd for wireless sim.
if { $opt(x) == 0 || $opt(y) == 0 } {
	puts "No X-Y boundary values given for wireless topology\n"
}
set chan        [new $opt(chan)]
set prop        [new $opt(prop)]
set topo	[new Topography]
set tracefd	[open $opt(tr) w]

# setup topography and propagation model
$topo load_flatgrid $opt(x) $opt(y)
$prop topography $topo

# Create God
create-god $opt(nn)

#
## setup ForeignAgent and HomeAgent nodes
set HA [create-base-station-node 1.0.0]
set FA [create-base-station-node 2.0.0]
set FA1 [create-base-station-node 3.0.0]   ;#5-28


#provide some co-ord (fixed) to these base-station nodes.
$HA set X_ 10.0
$HA set Y_ 10.0
$HA set Z_ 0.0

$FA set X_ 100.0
$FA set Y_ 460.0
$FA set Z_ 0.0

 
$FA1 set X_ 100.0  ;#5-28
$FA1 set Y_ 820.0  ;#5-28
$FA1 set Z_ 0.0    ;#5-28

# create a mobilenode that would be moving between HA and FA.
# note address of MH indicates its in the same domain as HA.
set MH [$opt(rp)-create-mobile-node 0 1.0.2]
set HAaddress [AddrParams set-hieraddr [$HA node-addr]]
[$MH set regagent_] set home_agent_ $HAaddress


#BS,MN
$HA  setPt  $opt(pt_bs)
$FA  setPt  $opt(pt_bs)
$FA1 setPt  $opt(pt_bs)
$MH  setPt  $opt(pt_mh)

# movement of the MH

$MH set Z_ 0.0
$MH set Y_ 101.0
$MH set X_ 100.0

# starts to move towards FA 
#
$ns at 100.0 "$MH setdest 100.0 1200.0 $opt(speed)"
# goes back to HA
#$ns at 120.0 "$MH setdest 100.0 900.0 20.0"


if { $opt(x) == 0 || $opt(y) == 0 } {
	usage $argv0
	exit 1
}

if {$opt(seed) > 0} {
#	puts "Seeding Random number generator with $opt(seed)\n"
	ns-random $opt(seed)
}

#
# Source the Connection and Movement scripts
#
if { $opt(cp) == "" } {
#	puts "*** NOTE: no  connection pattern specified."
        set opt(cp) "none"
} else {
#	puts "Loading connection pattern..."
	source $opt(cp)
}

if { $opt(sc) == "" } {
#	puts "*** NOTE: no scenario file specified."
        set opt(sc) "none"
} else {
#	puts "Loading scenario file..."
	source $opt(sc)
#	puts "Load complete..."
}

# create links between wired and BaseStation nodes
$ns duplex-link $W(0) $HA 5Mb 2ms DropTail
$ns duplex-link $HA $W(1) 5Mb 2ms DropTail
$ns duplex-link $W(1) $FA 5Mb 2ms DropTail
$ns duplex-link $W(1) $FA1 5Mb 2ms DropTail




# setup CBR connections between a wired node and the MobileHost

global ns opt rtp0 cbr0 null0
set rtp0 [new Agent/CBR/RTP]          
$ns attach-agent $W(0) $rtp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $rtp0
$rtp0 set packetSize_ 256
$cbr0 set rate_  384Kb/s

set null0 [new Agent/LossMonitor]

[$MH set regagent_] set loss_agent_ $null0
[$MH set regagent_] set rxthresh_   $opt(rxthresh)

$ns attach-agent $MH $null0
$ns connect  $rtp0  $null0
$ns at $opt(cbr_start) "$cbr0  start"

$ns at $opt(dump) DumpDump


#
# Tell all the nodes when the simulation ends
#
for {set i 0} {$i < $num_wireless_nodes } {incr i} {
    $ns_ at $opt(stop).0000010 "$node_($i) reset";
}
$ns_ at $opt(stop).0000010 "$HA reset";
$ns_ at $opt(stop).0000010 "$FA reset";

$ns_ at $opt(stop).21 "finish"
$ns_ at $opt(stop).20 "puts \"NS EXITING...\" ; "
###$ns_ halt"

proc finish {} {
	global ns_ trace namtrace
#	$ns_ flush-trace
#	close $namtrace
#	close $trace

	#puts "running nam..."
	#exec nam out.nam &
#
#        puts "Finishing ns.."
	exit 0
}


#
puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)"
puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"
puts "Starting Simulation..."

$ns_ run