[ns] Switch Node On or Off
Santhosh Kumar
vsantu88 at gmail.com
Sat Jul 18 22:13:53 PDT 2009
Though there were many threads asking the same question, there were no clear
answers for this question.
How to switch off the node using the command() function.
If we do something like
"$ns at 5.0 "$Node_(0) off"
we end up catching Segmentation fault. The problem is, the functions "Off"
or "Shutdown" try to modify the energy parameters of the Node, so we are
required to define the Energy parameters previously.
These can be declared in node-config using
-energyModel "EnergyModel" \
-initialEnergy 1000000 \
-rxPower 0.3 \
-txPower 0.3 \
Now, we can safely use any command like shutdown or off or sleep. Also note
that to use the off command you may have to comment out the line
"tcl.evalf("%s reset-state", str);" in the file mobilenode.cc in the member
function MobileNode::command.
Hope this Helps.
--
Santhosh Kumar
More information about the Ns-users
mailing list