76563

invalid command name “Agent/LeachAgent”

Question:

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.

Answer1:

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.

Answer2:

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.

Recommend

  • Can not send mail through PHPMailer
  • How to use PHPMailer without composer?
  • PHP to connect to Hotmail to send email?
  • Error authenticating using LinkedIn iOS SDK
  • How do I check if System::Collections:ArrayList is empty / nullptr / null?
  • converter json to two dimensional array
  • Updating Dojo provide
  • Defined variables not working in javascript files when I use getScript
  • How can I display the parent menu item's description using Wordpress walkers?
  • How to Cache Real-time Data?
  • preg_replace Double Spaces to tab (\\t) at the beginning of a line
  • Extracting HTML between tags
  • MongoDB in PHP using aggregate to group by _id is null not working
  • Spring Data JPA custom method causing PropertyReferenceException
  • Adding a button at the bottom of a table view
  • Getting last autonumber in access
  • jQuery show() function is not executed in Safari if submit handler returns true
  • Azure Cloud Service Web Role web pages do not load
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Possible to stop flickering java tooltip in heavyweight mode?
  • Delete MySQLi record without showing the id in the URL
  • GridView Sorting works once only
  • 0x202A in filename: Why?
  • AT Commands to Send SMS not working in Windows 8.1
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Trying to get generic when generic is not available
  • embed rChart in Markdown
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • apache spark aggregate function using min value
  • Checking variable from a different class in C#
  • Django query for large number of relationships
  • Sorting a 2D array using the second column C++
  • costura.fody for a dll that references another dll
  • Why is Django giving me: 'first_name' is an invalid keyword argument for this function?
  • Observable and ngFor in Angular 2
  • How can I use `wmic` in a Windows PE script?
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal
  • How to push additional view controllers onto NavigationController but keep the TabBar?