实验中可能出现的错误及其解决方法

转载自:http://peilie-coolboy.blog.163.com/blog/static/23952371201241710531592/

参考文献:

[1]马崇霄,吴长奇.基于网络仿真器NS2的Adhoc网络路由协议仿真[J].电子测量技术,2008(5):75-79

 

按照参考文献[1]所给的代码运行的时候可能出现的错误及其对应的解决方法

出现以下错误提示:

错误1:参考文章[1]中没有设置路由协议变量rp的值。

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

can't read "val(rp)": no such element in array

   while executing

"$ns_ node-config -adhocRouting $val(rp) \

-llType $val(ll) \

-macType $val(mac) \

-ifqType $val(ifq) \

-ifqLen $val(ifqlen) \

-antType $val(ant) \

-pr..."

   (file "aodv.tcl" line 30)

 

错误2:参考文章[1]中set val(prop) Propagation/TwoRayGrond;这句写错了,应该是set val(prop)  Propagation/TwoRayGround;

 

invalid command name "Propagation/TwoRayGrond"

   while executing

"Propagation/TwoRayGrond create _o12 "

   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 34)

   (Simulator node-config line 34)

   invoked from within

"$ns_ node-config -adhocRouting $val(rp) \

-llType $val(ll) \

-macType $val(mac) \

-ifqType $val(ifq) \

-ifqLen $val(ifqlen) \

-antType $val(ant) \

-pr..."

   (file "aodv.tcl" line 31)

 

错误3:参考文章[1]中set val(chan) Channel/wireless;这句写错了,应该是set val(chan)  Channel/WirelessChannel; 。

 

warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl

invalid command name "Channel/wireless"

   while executing

"Channel/wireless create _o13 "

   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 $channelType_"

   (procedure "_o3" line 44)

   (Simulator node-config line 44)

   invoked from within

"$ns_ node-config -adhocRouting $val(rp) \

-llType $val(ll) \

-macType $val(mac) \

-ifqType $val(ifq) \

-ifqLen $val(ifqlen) \

-antType $val(ant) \

-pr..."

(file "aodv.tcl" line 31)

 

错误4:代码{$ i<val(nn)}与{incr i}之间、{incr i}与{之间少了个空格符。

 

warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl

extra characters after close-brace

   while executing

"for {set i 0}{$i < val(nn)}{incr i}{

set node_($i) [$ns_ node]

$node_($i) random-motion 0

}

source $opt(cp)

source $opt(sc)

for {set i 0}{$i <$val(nn)}..."

   (file "aodv.tcl" line 46)

 

错误5:"for {set i 0} {$i <val(nn)} {incr i} { 这句代码中val(nn)前面应该加上$,即改为

"for {set i 0} {$i <$val(nn)} {incr i} {  。

 

syntax error in expression "$i < val(nn)": variable references require preceding $

   while executing

"for {set i 0} {$i < val(nn)} {incr i} {

set node_($i) [$ns_ node]

$node_($i) random-motion 0

}"

   (file "aodv.tcl" line 46)

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值