asking about random movement waypoint in ns2

923 views
Skip to first unread message

Irvan Supradana

unread,
Apr 2, 2010, 9:38:29 AM4/2/10
to Network Simulator - 2 (NS-2)
Hello

Im irvan.I want to analysis performance of AODV using ns2. I want to
make random movement scenario and using energy model. I found that
this random movement can use in ~ns/indep-utils/cmu-scen-gen/setdest/
but i confused using in tcl script. Is there somebody who can help me
step by step or maybe share tcl script that used random movement
model.

Thank you so much

Regard

Mohit P. Tahiliani

unread,
Apr 8, 2010, 12:05:38 AM4/8/10
to Network Simulator - 2 (NS-2)
Hello Irvan,

You can find the tcl script on the following link which may be useful
for you.

http://hpds.ee.ncku.edu.tw/~smallko/ns2/adhoc_routing.htm

If you have any queries please let me know.

Hope it helps.

Regards,
Mohit P. Tahiliani

Irvan Supradana

unread,
Apr 10, 2010, 3:39:21 AM4/10/10
to ns-...@googlegroups.com
Dear Mr Mohit

I have succed use random and traffic movement in my tcl script. And with awk script i can measured pdf and total packet receive and sent. But when i try using energi model, there was no indication in trace file about energy and finally i cannot measure energy remained each node.

traffic that i deployed is ns cbergen.tcl -type cbr -nn 10 -seed 1.0 -mc 6 -rate 4
and movement is ./setdest -nn 10 -p 2.0 -M10 -t100 -x1000 -y1000

and this is my tcl

Sir i really need your help to advice what should i do. Thank you so much
Salam
# ======================================================================
# Define options
# ======================================================================
 
set val(chan)       Channel/WirelessChannel
set val(prop)       Propagation/TwoRayGround
set val(netif)      Phy/WirelessPhy
set val(mac)        Mac/802_11
set val(ifq)        Queue/DropTail/PriQueue
set val(ll)         LL
set val(ant)        Antenna/OmniAntenna
set val(x)              1000   ;# X dimension of the topography
set val(y)              1000  ;# Y dimension of the topography
set val(ifqlen)         50            ;# max packet in ifq
set val(seed)           0.0
set val(adhocRouting)   AODV
set val(nn)             10             ;# how many nodes are simulated
set val(cp)             "../ns-allinone-2.31/ns-2.31/indep-utils/cmu-scen-gen/cbr-10-test"
set val(sc)             "../ns-allinone-2.31/ns-2.31/indep-utils/cmu-scen-gen/setdest/scen-10-TA"
set val(stop)           100.0           ;# simulation time
set val(energymodel)   EnergyModel    ;# Energy Model
set val(initialenergy) 50    ;# value
 
# =====================================================================
# Main Program
# ======================================================================
 
#
# Initialize Global Variables
#
 
# create simulator instance
 
set ns_              [new Simulator]
 
# setup topography object
 
set topo    [new Topography]
 
# create trace object for ns and nam
 
set tracefd        [open wireless1-out.tr w]
set namtrace    [open wireless1-out.nam w]
 
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
 
# define topology
$topo load_flatgrid $val(x) $val(y)
 
#
# Create God
#
set god_ [create-god $val(nn)]
 
# create channel
set chan [new $val(chan)]
 
#
# define how node should be created
#
 
#global node setting
 
$ns_ node-config -adhocRouting $val(adhocRouting) \
                 -llType $val(ll) \
                 -macType $val(mac) \
                 -ifqType $val(ifq) \
                 -ifqLen $val(ifqlen) \
                 -antType $val(ant) \
                 -propType $val(prop) \
                 -phyType $val(netif) \
                 -channel $chan \
                         -topoInstance $topo \
                         -agentTrace ON \
                 -routerTrace ON \
                 -macTrace OFF\
-movement Trace OFF\
-energyModel $val(energymodel) \
             -initialEnergy $val(initialenergy) \
             -rxPower 35.28e-3 \
             -txPower 31.32e-3 \
    -idlePower 712e-6 \
    -sleepPower 144e-9 
 
 
# unity gain, omni-directional antennas
# set up the antennas to be centered in the node and 1.5 meters above it
Antenna/OmniAntenna set X_ 0
Antenna/OmniAntenna set Y_ 0
Antenna/OmniAntenna set Z_ 1.5
Antenna/OmniAntenna set Gt_ 1.0
Antenna/OmniAntenna set Gr_ 1.0

# Initialize the SharedMedia interface with parameters to make
# it work like the 914MHz Lucent WaveLAN DSSS radio interface
Phy/WirelessPhy set CPThresh_ 10.0
Phy/WirelessPhy set CSThresh_ 1.559e-11
Phy/WirelessPhy set RXThresh_ 3.652e-10
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.2818
Phy/WirelessPhy set freq_ 914e+6 
Phy/WirelessPhy set L_ 1.0
 
#
#  Create the specified number of nodes [$val(nn)] and "attach" them
#  to the channel.
 
for {set i 0} {$i < $val(nn) } {incr i} {
        set node_($i) [$ns_ node]
       
}
 
 
#
# Define node movement model
#
puts "Loading connection pattern..."
source $val(cp)
 
#
# Define traffic model
#
puts "Loading scenario file..."
source $val(sc)
 
# Define node initial position in nam
 
for {set i 0} {$i < $val(nn)} {incr i} {
 
    # 20 defines the node size in nam, must adjust it according to your scenario
    # The function must be called after mobility model is defined
   
    $ns_ initial_node_pos $node_($i) 20
}
 
#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
    $ns_ at $val(stop).0 "$node_($i) reset";
}
 
$ns_ at  $val(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
 
puts $tracefd "M 0.0 nn $val(nn) x $val(x) y $val(y) rp $val(adhocRouting)"
puts $tracefd "M 0.0 sc $val(sc) cp $val(cp) seed $val(seed)"
puts $tracefd "M 0.0 prop $val(prop) ant $val(ant)"
 
puts "Starting Simulation..."
$ns_ run



--
You received this message because you are subscribed to the Google Groups "Network Simulator - 2 (NS-2)" group.
To post to this group, send an email to ns-...@googlegroups.com.
To unsubscribe from this group, send email to ns-user+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-user?hl=en-GB.


S M Imran

unread,
Apr 13, 2010, 7:35:20 AM4/13/10
to ns-...@googlegroups.com
Hai I am doing project on ns 2 for Dynamic Address Routing for
scalable adhoc and mesh networks please help me

Reply all
Reply to author
Forward
0 new messages