invalid command name “Agent/LeachAgent”

旧城冷巷雨未停 提交于 2019-12-13 03:49:21

问题


I try to implement a simple scenario for LEACH protocol but I get this error:

 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)

I use ubuntu 16.04 and ns-allinone-2.35 . when I ran my tcl file for the first time, i did not get this error.


回答1:


Change your script to use Agent/RCAgent/LeachAgent as class name:

set agent($i) [new Agent/RCAgent/LeachAgent]

From what I can see, there is no Agent/LeachAgent in ns-allinone-2.35.




回答2:


I was not successful in writing a correct code for attaching Leach protocol in my scenario, but I found that mannasim has a Mannasim Script Generator (MSG). It is a front-end for TCL simulation scripts easy creation.



来源:https://stackoverflow.com/questions/51595992/invalid-command-name-agent-leachagent

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!