please comment this TCL . when i run the tcl it has an error.. this file
called singlehop.tcl

[EMAIL PROTECTED]:/usr/local/ns2/projek$ ns singlehop.tcl
num_nodes is set 3
invalid command name "Propagation/SimpleDistance"
    while executing
"Propagation/SimpleDistance create _o24 "
    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 $propType_"
    (procedure "_o3" line 29)
    (Simulator node-config line 29)
    invoked from within
"$ns_ node-config -mobileIP OFF \
                  -adhocRouting NOAH \
                  -llType LL \
                  -macType Mac/802_11 \
       ..."
    (file "singlehop.tcl" line 22)

----------------------------------------------------------------------------------------------------------------------------------
# below is singlehop.tcl file
----------------------------------------------------------------------------------------------------------------------------------

set ns_ [new Simulator]
$ns_ node-config -addressType hierarchical

AddrParams set domain_num_ 2
lappend cluster_num 1 1
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel  1 2
AddrParams set nodes_num_ $eilastlevel

set tracefd [open output/singlehop.tr w]
$ns_ trace-all $tracefd

set topo [new Topography]
$topo load_flatgrid 60 40
set god_ [create-god 3]

# wired nodes
set node_(0) [$ns_ node 0.0.1]

set chan_ [new Channel/WirelessChannel]

$ns_ node-config -mobileIP OFF \
                  -adhocRouting NOAH \
                  -llType LL \
                  -macType Mac/802_11 \
                  -ifqType Queue/DropTail/PriQueue \
                  -ifqLen 50 \
                  -antType Antenna/OmniAntenna \
                  -propType Propagation/SimpleDistance \
                  -phyType Phy/WirelessPhy \
                  -channel $chan_ \
           -topoInstance $topo \
                  -wiredRouting ON \
          -agentTrace ON \
                  -routerTrace ON \
                  -macTrace ON

# home agents
$ns_ node-config -rxPower 0.1 -txPower 0.1
set node_(1) [$ns_ node 1.0.0]
#[$node_(1) set regagent_] priority 3

$ns_ node-config -wiredRouting OFF

# mobile agents
$ns_ node-config -rxPower 73 -txPower 73
set node_(2) [$ns_ node 1.0.1]
#[$node_(2) set regagent_] set home_agent_ [AddrParams addr2id [$node_(1)
node-addr]]

#Errormodel - ASM
#Two State Markov
#set rate [list 0.0001 0.1 ]
#set trans  [list 0.5 0.5]
#set unit pkt
#set em_ [new ErrorModel/TwoStateMarkov $rate $unit $trans ]
set tmp1 [new ErrorModel/Uniform 0 pkt]
set tmp2 [new ErrorModel/Uniform 0.9 pkt]
 set m_states [list $tmp1 $tmp2]
 set m_periods  [list 10 10] ;#[list 0.5 0.5]
 set m_transmx { {0 1} {1 0} }
 set m_trunit pkt
 set m_sttype time
 set m_nstates 2
 set m_nstart [lindex $m_states 0]
 set em_ [new ErrorModel/MultiState $m_states $m_periods $m_transmx
$m_trunit $m_sttype $m_nstates $m_nstart]


#Errormodel - ASM
#Two State
#set rate [list 0.001 0.1 ]
#set unit pkt
#set em_ [new ErrorModel/TwoState $rate $unit]


#Normal one state model
#set em_ [new ErrorModel]
#$em_ unit pkt
#$em_ set rate_ 0.1
#$em_ ranvar [new RandomVariable/Uniform]


$node_(2) install-error $em_
#Errormodel - ASM

$ns_ node-config -wiredRouting ON

# source connection-pattern and node-movement scripts
source "singlehop.scn"
source "singlehop.txt"

# Tell all nodes when the simulation ends
for {set i 0} {$i < 2 } {incr i} {
    #$ns_ at 1000.0 "$node_($i) reset";
    $ns_ at 120.0 "$node_($i) reset";
    #$ns_ at 600.0 "$node_($i) reset";
}

# Progress
#for {set t 10} {$t < 920} {incr t 10} {
#    $ns_ at $t "puts stderr \"completed through $t/920 secs...\""
#}

$ns_ at 0.0 "puts stderr \"Simulation started...\""
$ns_ at 120.0000 "puts stderr \"Simulation finished\""
$ns_ at 120.0001 "close $tracefd"
$ns_ at 120.0002 "exec run_plot_tp.sh traffic.tr 2"
$ns_ at 120.0003 "$ns_ halt"

puts $tracefd "M 0.0 nn 10 x 60 y 40 rp NOAH"
puts $tracefd "M 0.0 sc traffic.scn cp traffic.com seed 0"

$ns_ run


-- 
AZHAR MOHD ARIS

Reply via email to