NS-2.27 and Leach

Saturday, May 01, 2004

Missing class variable RCALinkLayer::avoidReordering_ and RCALinkLayer::debug_

The creation of nodes is missing a variable that the program needs.

Creating sensor nodes...
0 _o12 _o13 RCALinkLayer Mac/Sensor Queue/DropTail 100 Phy/WirelessPhy Antenna/OmniAntenna _o14 {} {} {}
warning: no class variable RCALinkLayer::avoidReordering_

see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable RCALinkLayer::debug_

Looking in tcl-object.tcl, I found the following comments:

# warn if a class variable not defined
# this is in a separate method so user can nop it
# In ns, this error happens for several possible reasons:
# 1. you bound a variable in C but didn't initialize it in tcl
# To fix: put initialization code in tcl/lib/ns-default.tcl
# (and make sure that this code ends up compiled into your
# version of ns!)
# 2. You bound it in C and think you initialized it in Tcl,
# but there's an error in your class hierarchy
# (for example, the Tcl hierarchy name given in
# the XxxClass declaration in C++
# doesn't match the name used in the Tcl initialization).
# 3. you invoked something which assumed that something else had
# been built (for example, doing "new Node" without having
# first done "new Simulator")
# To fix: do new Simulator (or whatever).
# 4. You created a split object from C++ (with new)
# rather than from Tcl.
# Nitin Vaidya found this problem
# and suggested working around it either by avoiding
# binding the variable or invoking tcl to create the object.
# See the discussion at
# http://www-mash.cs.berkeley.edu/dist/archive/ns-users/9808/
# for more details.

After grepping for it, I found the following note in Changes.html

[Sally Floyd]
Thu Mar 27 2003
Adding avoidReordering_ to DelayLink, set to true to avoid reordering when changing link bandwidth or delay. The code was contributed by Andrei Gurtov, and the validation test is in ./test-all-links in the directory tcl/test. The default is for avoidReordering_ to be false, for no change in past behavior.

I added the default settings for RCALinklayer in tcl/lib/ns-default.tcl

# for MIT_uAMPS LEACH protocol
RCALinkLayer set avoidReordering_ false
RCALinkLayer set debug_ false

under the section for "Wireless simulation support"

need to recompile after making the change.


Post a Comment

<< Home