[ns] problem in energy consumption model

2009-01-11 Thread Nadine Chen

Hi
I wanted to compare the energy consumption of different routing protocols , so 
I used this .tcl file and in each time I modify the name of the protocol, aodv, 
dsdv...
But this  .tcl file  generates the same trace file independently of the routing 
protocol.can you tell me how can I correct this?
help me please.

###
set opt(chan)        Channel/WirelessChannel
set opt(prop)        Propagation/TwoRayGround
set opt(netif)        Phy/WirelessPhy
#set opt(mac)    Mac/802_11   ;# MAC type
set opt(mac)    Mac/802_11   ;# MAC type
set opt(ifq)        Queue/DropTail/PriQueue
set opt(ll)        LL
set opt(ant)    Antenna/OmniAntenna

set opt(x)        800    ;# X dimension of the topography
set opt(y)        800        ;# Y dimension of the topography
set opt(cp)        "../mobility/scene/cbr-50-10-4-512"
set opt(sc)        "../mobility/scene/scen-670x670-50-600-20-0"

set opt(ifqlen)        50        ;# max packet in ifq
set opt(nn)        50        ;# number of nodes
set opt(seed)        0.0
set opt(stop)        700.0        ;# simulation time
set opt(tr)        MyTest.tr    ;# trace file
set opt(nam)        MyTest.nam    ;# animation file
set opt(rp) DumbAgent   ;# routing protocol script
set opt(lm) "off"   ;# log movement
set opt(agent)  Agent/DSDV
set opt(energymodel)    EnergyModel ;
#set opt(energymodel)    RadioModel ;
set opt(radiomodel)        RadioModel ;
set opt(initialenergy)  1000    ;# Initial energy in Joules
#set opt(logenergy)  "on"   ;# log energy every 150 seconds


Mac/SMAC set syncFlag_ 1

Mac/SMAC set dutyCycle_ 10

set ns_        [new Simulator]
set topo    [new Topography]
set tracefd    [open $opt(tr) w]
set namtrace    [open $opt(nam) w]
set prop    [new $opt(prop)]

$topo load_flatgrid $opt(x) $opt(y)
ns-random 1.0
$ns_ trace-all $tracefd
#$ns_ namtrace-all-wireless $namtrace 500 500

#
# Create god
#
create-god $opt(nn)


#global node setting

    $ns_ node-config -adhocRouting DumbAgent \
             -llType $opt(ll) \
             -macType $opt(mac) \
             -ifqType $opt(ifq) \
             -ifqLen $opt(ifqlen) \
             -antType $opt(ant) \
             -propType $opt(prop) \
             -phyType $opt(netif) \
             -channelType $opt(chan) \
             -topoInstance $topo \
             -agentTrace ON \
             -routerTrace ON \
             -macTrace ON \
             -energyModel $opt(energymodel) \
             -idlePower 1..0 \
             -rxPower 1.0 \
             -txPower 1.0 \
           -sleepPower 0.001 \
           -transitionPower 0.2 \
           -transitionTime 0.005 \
             -initialEnergy $opt(initialenergy)


    
    $ns_ set WirelessNewTrace_ ON
#set AgentTrace            ON
#set RouterTrace        OFF
#set MacTrace            ON

    for {set i 0} {$i < $opt(nn) } {incr i} {
        set node_($i) [$ns_ node]    
        $node_($i) random-motion 0        ;# disable random motion
    }
    
#    $node_(1) set agentTrace ON     
#    $node_(1) set macTrace ON
#    $node_(1) set routerTrace ON         
#    $node_(0) set macTrace ON
#    $node_(0) set agentTrace ON     
#    $node_(0) set routerTrace ON

set udp_(0) [new Agent/UDP]
$ns_ attach-agent $node_(0) $udp_(0)
set null_(0) [new Agent/Null]
$ns_ attach-agent $node_(1) $null_(0)
set cbr_(0) [new Application/Traffic/CBR]
$cbr_(0) set packetSize_ 512
$cbr_(0) set interval_ 10.0
$cbr_(0) set random_ 1
$cbr_(0) set maxpkts_ 5
$cbr_(0) attach-agent $udp_(0)
$ns_ connect $udp_(0) $null_(0)



$ns_ at 1.00 "$cbr_(0) start"
#$ns_ at 177.000        "$node_(0) set ifqLen"


#
# Tell all the nodes when the simulation ends
#
for {set i 0} {$i < $opt(nn) } {incr i} {
    $ns_ at $opt(stop) "$node_($i) reset";
}
$ns_ at $opt(stop) "puts \"NS EXITING...\" ; $ns_ halt"

set b [$node_(0) set mac_(0)]
#set c [$b set freq_]
set d [Mac/SMAC set syncFlag_]

#set e [$node_(0) set netif_(0)]
 
#set c [$e set L_]
set c [Mac/SMAC set dutyCycle_]
#puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)"
#puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
#puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"
#puts $tracefd "V $b : $c : $d :"
puts "Starting Simulation..."
$ns_ run
##  



  

Re: [ns] ARQ implementation for terrestrial links

2009-01-11 Thread Teerawat Issariyakul


Dear Ioanis,

There is an example implementation of ARQ in the following book from
Springer useful.

T. Issariyakul and E. Hossain , "Introduction to Network Simulator
NS2," Springer, Oct. 2008, ISBN: 978-0-387-71759-3

http://www.springer.com/engineering/signals/book/978-0-387-71759-3?detailsPage=otherBooks&CIPageCounter=CI_MORE_BOOKS_BY_AUTHOR0

You may also find the following slides useful

http://www.ece.ubc.ca/~teerawat/NS2.htm

Best Regards,
Teerawat


On 1/10/2009, "Ioannis Komnios"  wrote:

>
>Dear ns-users,
>
>I am trying to conduct some experiments using TCP on transport layer
>and, at the same time, some reliable link layer protocol, like ARQ.
>I've been trying for days to find an ARQ implementation in ns and I
>have only found HDLC implementation for satellite links. Is there any
>ARQ implementation available for terrestrial links? Or any other
>reliable link layer protocol already implemented in ns2?
>
>I would be grateful if you could help me...
>
>Thank you in advance,
>
>Ioannis Komnios
>



[ns] LEACH Algorithm explanation....

2009-01-11 Thread naveen prabu

hi  
 i need LEACH algorithm explanation for implementing in ns2.29
...
i also need code explanations for that
please send me



[ns] how can I measure energy consumption:please help

2009-01-11 Thread Nadine Chen

Hello
Please tell me how can I measure the energy consumption? I downloaded tcl 
samples from the internet like the tcl file below but when  I change the name 
of routing protocol I have always the same trace file which means the same 
energy measurement for all the routing protocols which is illogical !
Please help me ,tell me why I have the same values ?or if you have a tcl file 
to measure energy , send it please to me.
I'm waiting for replies.
Thanks.


###
set opt(chan)        Channel/WirelessChannel
set opt(prop)        Propagation/TwoRayGround
set opt(netif)        Phy/WirelessPhy
#set opt(mac)    Mac/802_11   ;# MAC type
set opt(mac)    Mac/802_11   ;# MAC type
set opt(ifq)        Queue/DropTail/PriQueue
set opt(ll)        LL
set opt(ant)    Antenna/OmniAntenna

set opt(x)        800    ;# X dimension of the topography
set opt(y)        800        ;# Y dimension of the topography
set opt(cp)        "../mobility/scene/cbr-50-10-4-512"
set opt(sc)        "../mobility/scene/scen-670x670-50-600-20-0"

set opt(ifqlen)        50        ;# max packet in ifq
set opt(nn)        50        ;# number of nodes
set opt(seed)        0.0
set opt(stop)        700.0        ;# simulation time
set opt(tr)        MyTest.tr    ;# trace file
set opt(nam)        MyTest.nam    ;# animation file
set opt(rp) DumbAgent   ;# routing protocol script
set opt(lm) "off"   ;# log movement
set opt(agent)  Agent/DSDV
set opt(energymodel)    EnergyModel ;
#set opt(energymodel)    RadioModel ;
set opt(radiomodel)        RadioModel ;
set opt(initialenergy)  1000    ;# Initial energy in Joules
#set opt(logenergy)  "on"   ;# log energy every 150 seconds


Mac/SMAC set syncFlag_ 1

Mac/SMAC set dutyCycle_ 10

set ns_        [new Simulator]
set topo    [new Topography]
set tracefd    [open $opt(tr) w]
set namtrace    [open $opt(nam) w]
set prop    [new $opt(prop)]

$topo load_flatgrid $opt(x) $opt(y)
ns-random 1.0
$ns_ trace-all $tracefd
#$ns_ namtrace-all-wireless $namtrace 500 500

#
# Create god
#
create-god $opt(nn)


#global node setting

    $ns_ node-config -adhocRouting DumbAgent \
             -llType $opt(ll) \
             -macType $opt(mac) \
             -ifqType $opt(ifq) \
             -ifqLen $opt(ifqlen) \
             -antType $opt(ant) \
             -propType $opt(prop) \
             -phyType $opt(netif) \
             -channelType $opt(chan) \
             -topoInstance $topo \
             -agentTrace ON \
             -routerTrace ON \
             -macTrace ON \
             -energyModel $opt(energymodel) \
             -idlePower 1...0 \
             -rxPower 1.0 \
             -txPower 1.0 \
           -sleepPower 0.001 \
           -transitionPower 0.2 \
           -transitionTime 0.005 \
             -initialEnergy $opt(initialenergy)


    
    $ns_ set WirelessNewTrace_ ON
#set AgentTrace            ON
#set RouterTrace        OFF
#set MacTrace            ON

    for {set i 0} {$i < $opt(nn) } {incr i} {
        set node_($i) [$ns_ node]    
        $node_($i) random-motion 0        ;# disable random motion
    }
    
#    $node_(1) set agentTrace ON     
#    $node_(1) set macTrace ON
#    $node_(1) set routerTrace ON         
#    $node_(0) set macTrace ON
#    $node_(0) set agentTrace ON     
#    $node_(0) set routerTrace ON

set udp_(0) [new Agent/UDP]
$ns_ attach-agent $node_(0) $udp_(0)
set null_(0) [new Agent/Null]
$ns_ attach-agent $node_(1) $null_(0)
set cbr_(0) [new Application/Traffic/CBR]
$cbr_(0) set packetSize_ 512
$cbr_(0) set interval_ 10.0
$cbr_(0) set random_ 1
$cbr_(0) set maxpkts_ 5
$cbr_(0) attach-agent $udp_(0)
$ns_ connect $udp_(0) $null_(0)



$ns_ at 1.00 "$cbr_(0) start"
#$ns_ at 177.000        "$node_(0) set ifqLen"


#
# Tell all the nodes when the simulation ends
#
for {set i 0} {$i < $opt(nn) } {incr i} {
    $ns_ at $opt(stop) "$node_($i) reset";
}
$ns_ at $opt(stop) "puts \"NS EXITING...\" ; $ns_ halt"

set b [$node_(0) set mac_(0)]
#set c [$b set freq_]
set d [Mac/SMAC set syncFlag_]

#set e [$node_(0) set netif_(0)]
 
#set c [$e set L_]
set c [Mac/SMAC set dutyCycle_]
#puts $tracefd "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)"
#puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
#puts $tracefd "M 0.0 prop $opt(prop) ant $opt(ant)"
#puts $tracefd "V $b : $c : $d :"
puts "Starting Simulation..."
$ns_ run
##  



  

[ns] ns-2.26 [tclsh] Error 1 tcl8.3.2 make failed!

2009-01-11 Thread Jermain Montella

Hello Dear Users,

Please help me in this problem. I`m trying to install NS-2.26 over cygwin
but I obtein the next error:

/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld:
warning: au
to-importing has been activated without --enable-auto-import specified on
the co
mmand line.
This should work unless it involves constant data structures referencing
symbols
 from auto-imported DLLs.fu01.o:(.idata$2+0xc): undefined reference to
`_lib
c_iname'
Info: resolving __timezone by linking to __imp___timezone (auto-import)
collect2: ld returned 1 exit status
make: *** [tclsh] Error 1
tcl8.3.2 make failed! Exiting ...
For problems with Tcl/Tk see http://www.scriptics.com

To solve this problem I´ve used the patchs that appear in
www.isi.edu/nsnam/ns/ns-*cygwin*-old.html, also a patch named
"ns-allinone-2.26-cygwin-binaries.zip" (
http://www.isi.edu/nsnam/dist/binary/) but the result is always this error.
I haven´t worked with other version of NS because the module obs-0.9a is,
according the web source, compatible only with NS-2.26.

I hope you can help me.Thanks.


[ns] How to execute graph in wireless environment?

2009-01-11 Thread Panks PB

hi,

 I'm working in NS2.33. I'm working in wireless scenario. I don't know
how to execute the graph in wireless environment. I have worked in wired
environment by using the statement

exec xgraph

in the finish procedure.

Plz help with the statement to work in wireless environment.

Thank u