FAQ of NS2
| Home |
How to change transmission range
First, you need to compile threshold.cc. Then you can obtain corresponding value of RXThresh_, and set the value. In the following example, you can get RxThresh_ value corresponding to 100 meter.
$ cd ns-2.??/indep-utils/propagation/
$ g++ -lm threshold.cc -o threshold
$ ./threshold -m TwoRayGround 100
$ g++ -lm threshold.cc -o threshold
$ ./threshold -m TwoRayGround 100
Then, set the variable in your TCL file, for example:
Phy/WirelessPhy set RxThresh_ 3.65262e-10
How to access a routing agent from a TCL file
The instance of mobilenode defined in tcl/lib/ns-mobilenode.tcl has a variable, "ragent", which is the instance of routing agent. You can add a method which returns the instance of routing agent at the tcl/lib/ns-mobilenode.tcl.
Node/MobileNode instproc get-ragent {} {
$self instvar ragent_
return $ragent_
}
$self instvar ragent_
return $ragent_
}
The, you can directly access a routing agent from your tcl script.
Copyright (C) 2009-2013 Kazuya Sakai, All Right Received.