uj100 |
11-07-2012 09:41 AM |
NS2 WirelessMeshNetwork Simulation Error in add_interface
error message is
(_o34 cmd line 1)
invoked from within
"_o34 cmd add_interface _o14 _o98 LL Mac/802_11 Queue/DropTail/PriQueue 50 Phy/WirelessPhy Antenna/OmniAntenna _o10 {} {} {}"
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 "_o34" line 2)
(SplitObject unknown line 2)
invoked from within
"$node_(1) add_interface $chan_(3) $propInstance_ $val(ll) $val(mac) $val(ifq) $val(ifqlen) $val(netif) $val(ant) $topo $inerrProc_ $outerrProc_ $FECPr..."
(file "wmn.tcl" line 78)
and wmn.tcl is
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) 5 ;# number of mobilenodes
set val(nc) 5 ;# 채널 개수
set val(ni) 10 ;# 인터페이스 개수
set val(rp) AODV ;# routing protocol DSDV
set val(x) 1500
set val(y) 1500
# ======================================================================
# Main Program
# ======================================================================
#
# Initialize Global Variables
#
set ns_ [new Simulator]
set tracefd [open ./test.tr w]
$ns_ trace-all $tracefd
# set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(ni)
#채널을 생성한다.
for {set i 1} {$i <= $val(nn) } {incr i} {
set chan_($i) [new $val(chan)]
}
# 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) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace OFF \
-macTrace OFF \
-movementTrace OFF \
-channel $chan_(1)
#다섯개의 노드를 생성한다.
set node_(0) [$ns_ node]
set node_(1) [$ns_ node]
$ns_ node-config -channel $chan_(2)
set node_(2) [$ns_ node]
$ns_ node-config -channel $chan_(3)
set node_(3) [$ns_ node]
$ns_ node-config -channel $chan_(4)
set node_(4) [$ns_ node]
set inerrProc_ ""
set outerrProc_ ""
set FECProc_ ""
set propInstance_ [new $val(prop)]
set port [Node set rtagent_port_]
set agent [$node_(1) set ragent_]
$node_(1) add-interface $chan_(2) $propInstance_ $val(ll) $val(mac) $val(ifq) $val(ifqlen) $val(netif) $val(ant) $topo $inerrProc_ $outerrProc_ $FECProc_
$node_(1) adjust-target-rtagent $agent $port
$node_(1) add_interface $chan_(3) $propInstance_ $val(ll) $val(mac) $val(ifq) $val(ifqlen) $val(netif) $val(ant) $topo $inerrProc_ $outerrProc_ $FECProc_
$node_(1) adjust-target-rtagent $agent $port
set agent [$node_(2) set ragent_]
$node_(2) add-interface $chan_(5) $propInstance_ $val(ll) $val(mac) $val(ifq) $val(ifqlen) $val(netif) $val(ant) $topo $inerrProc_ $outerrProc_ $FECProc_
$node_(2) adjust-target-rtagent $agent $port
set agent [$node_(3) set ragent_]
$node_(3) add-interface $chan_(4) $propInstance_ $val(ll) $val(mac) $val(ifq) $val(ifqlen) $val(netif) $val(ant) $topo $inerrProc_ $outerrProc_ $FECProc_
$node_(3) adjust-target-rtagent $agent $port
set agent [$node_(4) set ragent_]
$node_(4) add-interface $chan_(5) $propInstance_ $val(ll) $val(mac) $val(ifq) $val(ifqlen) $val(netif) $val(ant) $topo $inerrProc_ $outerrProc_ $FECProc_
$node_(4) adjust-target-rtagent $agent $port
for {set i 0} {$i < $val(nn) } {incr i} {
$node_($i) random-motion 0
$node_($i) set Z_ 0.0
}
#각노드의 위치를 설정한다.
$node_(0) set X_ 100.0
$node_(0) set Y_ 230.0
$node_(1) set X_ 330.0
$node_(1) set Y_ 230.0
$node_(2) set X_ 330.0
$node_(2) set Y_ 1.0
$node_(3) set X_ 560.0
$node_(3) set Y_ 230.0
$node_(4) set X_ 560.0
$node_(4) set Y_ 1.0
set tcp0_4 [new Aent/TCP/Sack1]
$tcp0_4 set class_ 0
set sink0_4 [new Agent/TCPSink/Sack1]
$ns_ attach-agent $node_(0) $tcp0_4
$ns_ attach-agent $node_(4) $sink0_4
$ns_ connect $tcp0_4 $sink0_4
set ftp0_4 [new Application/FTP]
$ftp0_4 attach-agent $tcp0_4
$ns_ at 1.0 "$ftp0_4 start"
$ns_ at 50.0 "$ftp0_4 stop"
$ns_ at 50.01 "stop
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_at 50.02 "$node_($i) reset";
}
$ns_ at 50.03 "puts \"NS EXTING...\" ; $ns-halt"
proc stop {} {
grobal ns_ tracefd
$ns_ flush-trace
close $tracefd
}
#시뮬레이션 진행 상태를 출력한다.
for {set t 1} {$t <= 100} {incr t} {
set simTime [expr [expr 50.0/100.0] * $t]
$ns_ at $simTime "puts \"Current Sim Time(s) = $simTime \tCompleted = $t%\""
}
puts "Starting Simulation..."
$ns_ run
PLZ... help me...
|