我尝试为LEACH协议实现一个简单的方案,但出现此错误:
Creating Sensors ...
invalid command name "Agent/LeachAgent"
while executing
"Agent/LeachAgent create _o2340 "
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 Agent/LeachAgent"
("for" body line 3)
invoked from within
"for {set i 1} {$i <= $val(nsn)} {incr i} {
set agent($i) [new Agent/LeachAgent]
$ns attach-agent $node_($i) $agent($i)
$agent($i) set packetSize_..."
(file "newleach3.tcl" line 187)
我使用ubuntu 16.04
和ns-allinone-2.35
。第一次运行tcl
文件时,没有出现此错误。
答案 0 :(得分:0)
更改脚本以使用Agent/RCAgent/LeachAgent
作为类名:
set agent($i) [new Agent/RCAgent/LeachAgent]
据我所见,Agent/LeachAgent
中没有ns-allinone-2.35
。
答案 1 :(得分:0)
在我的方案中,我未能成功编写用于附加Leach协议的正确代码,但我发现mannasim具有Mannasim脚本生成器(MSG)。它是TCL
仿真脚本易于创建的前端。