NS-2.27 and Leach

Saturday, May 01, 2004

dst_ is deprecated

Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
Use dst_addr_ and dst_port_ instead

I replaced:

[$self agent] set dst_ $mac_dst

with this:

[$self agent] set dst_addr_ $mac_dst

Port is assumed to be zero.

Hella yeah it's running!

hella yeah, the leach code is running now. It's complaining about a depracated function, but I'll fix that later.

data_ doesn't exist

Tcl files don't run cuz when it asks for the data for the base station app code, it complains that there's not $data_

Freaking, the number of nodes is set to 101, and that can't be changed to 5, the way I had it. number of nodes passed in must be 101 for now. don't know intricacies of what you'd need to do to change the base station's stuff.

Does ns-packet.tcl need to have changes?

'tcl/lib/ns-packet.tcl' format has changed. now you can specify which protocols to load.

"# By default, ns includes ALL packet headers of ALL protocols in ns in
# EVERY packet in your simulation. This is a LOT, and will increase as more
# protocols are added into ns. For "packet-intensive" simulations, this could
# be a huge overhead."
# To include only a specific set of headers in your simulation, e.g., AODV
# and ARP, follow this pattern:
# remove-all-packet-headers
# add-packet-header AODV ARP
# ...
# set ns [new Simulator]

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.