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

[ns] error



Hi all,
  I am trying to introduce a two state markovian error model on a wireless
link.
The procedure which does this is as follows...

Node/MobileNode instproc interface-errormodel { em { index 0 } } {
$self instvar mac_ ll_ em_  netif_ channel_ ;#linkhead_
$netif_($index) up-target $em
$em target $mac_($index)
$em drop-target [new Agent/Null]; # otherwise, packet is only marked
set em_($index) $em
}                

And I am inserting in the errormodel in the interface of all the mobile
nodes i create as follows:

for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0              ;# disable random motion
#insertion of error model
if {$val(err) != ""} {
set rv0($i) [new RandomVariable/Exponential]
set rv1($i) [new RandomVariable/Exponential]
$rv1($i) set avg_ $val(bad)    ;# state with error
$rv0($i) set avg_ $val(good)   ;# state without error
set em_($i) [new ErrorModel/TwoState $rv0($i) $rv1($i)]
$em_($i) ranvar 0 $rv0($i)
$em_($i) ranvar 1 $rv1($i)
$em_($i) unit $val(unit)  ;# unit is either byte, time or pkt
$node_($i) interface-errormodel $em_($i)
}
}                          

I am getting this following error when trying to run the script....

(_o14 cmd line 1)
    invoked from within
"_o14 cmd interface-errormodel _o32"
    invoked from within
"catch "$self cmd $args" ret"
    (procedure "_o14" line 2)
    (SplitObject unknown line 2)
    invoked from within
"$node_($i) interface-errormodel $em_($i)"
    (file "trial_scr.tcl" line 95)

I will greatly appreciate it if someone is able to help me with debugging
this script since I am not very familiar with tcl..

Thanks.
Jeyandran