[ns] Wireless sensors Examples

2007-04-22 Thread Tareq Hmaidat


   hello Everybody.
   This is Tareq, I'm working on NS2, but I'm a new user.  Can anybody send 
me some examples about simulating wireless sensor networks.  I will be 
greatful if the examples include comments, to understand everything.
   [EMAIL PROTECTED]


  Regards.
  Tareq.

_
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



[ns] Problem in TORA Simulation

2007-04-22 Thread manpreet grewal


Dear All,

I have executed TORA successfully and made all the requisite 
changes totora.cc to enable it  work correctly  and to get rid of 
Agent/PROTO problem.
But When i execute my tcl script, there seems to be indeterminate 
delay ingetting the output.When i examine the trace file created 
by tora.tcl script,the simulation gets struck at 2.3 seconds and 
not able to movebeyond.The exact output that appears in the 
terminal is


  OUTPUT AS IT APPEARS IN THE TERMINAL**
num_nodes is set 6
INITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR 
instead
Start of simulation..
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
SORTING LISTS ...DONE!

It gets struck at this point and there is no progress beyond 
this.
**

It would immensely help me if anyone is able to correct this 
peculiar
problem.I'm using ns2.31 in Windows XP

I have enclosed my tora.tcl script below.

please help me pl.

Thank You,
With Regards,
Manpreet


**TORA.tcl***
# 
==
# Define options
# 
==
  set val(chan) Channel/WirelessChannel  ;# channel type
  set val(prop) Propagation/TwoRayGround ;# 
radio-propagation model
  set val(ant)  Antenna/OmniAntenna  ;# Antenna type
  set val(ll)   LL   ;# Link layer 
type
  set val(ifq)  Queue/DropTail/PriQueue  ;# Interface 
queue type
  set val(ifqlen)   50   ;# max packet in 
ifq
  set val(netif)Phy/WirelessPhy  ;# network 
interface type
  set val(mac)  Mac/802_11   ;# MAC type
  set val(nn)   6;# number of 
mobilenodes
  set val(rp)   TORA ;# routing 
protocol
  set val(x)800
  set val(y)800

set ns [new Simulator]
#ns-random 0

set f [open 1_out.tr w]
$ns trace-all $f
set namtrace [open 1_out.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
set f0 [open proj_out0.tr w]
set f1 [open proj_out1.tr w]
set f2 [open proj_out2.tr w]
set f3 [open proj_out3.tr w]

set topo [new Topography]
$topo load_flatgrid 800 800

create-god $val(nn)

set chan_1 [new $val(chan)]
set chan_2 [new $val(chan)]
set chan_3 [new $val(chan)]
set chan_4 [new $val(chan)]
set chan_5 [new $val(chan)]
set chan_6 [new $val(chan)]

# CONFIGURE AND CREATE NODES

$ns node-config  -adhocRouting $val(rp) \
   -llType $val(ll) \
  -macType $val(mac) \
  -ifqType $val(ifq) \
  -ifqLen $val(ifqlen) \
  -antType $val(ant) \
  -propType $val(prop) \
  -phyType $val(netif) \
  #-channelType $val(chan) \
  -topoInstance $topo \
  -agentTrace OFF \
  -routerTrace ON \
  -macTrace ON \
  -movementTrace OFF \
  -channel $chan_1  # \
  #-channel $chan_2   \
  #-channel $chan_3   \
  #-channel $chan_4   \
  #-channel $chan_5   \
  #-channel $chan_6


proc finish {} {
 global ns f f0 f1 f2 f3 namtrace
 $ns flush-trace
 close $namtrace
 close $f0
 close $f1
  close $f2
 close $f3
# exec xgraph proj_out0.tr proj_out1.tr
  # proj_out2.tr 
proj_out3.tr
 exec nam -r 5m 1_out.nam 
 exit 0
}

proc record {} {
   global sink0 sink1 sink2 sink3 sink4 sink5 f0 f1 f2 f3
#Get An Instance Of The Simulator
set ns [Simulator instance]

#Set The Time After Which The Procedure Should Be Called 
Again
set time 0.05
#How Many Bytes Have Been Received By The Traffic Sinks?
set bw0 [$sink5 set npkts_]
set bw1 [$sink5 set nlost_]
#set bw2 [$sink2 set npkts_]
#set bw3 [$sink3 set npkts_]

#Get The Current Time
set now [$ns now]

#Save Data To The Files
puts $f0 $now [expr $bw0]
puts $f1 $now [expr $bw1]
#puts $f2 $now [expr $bw2]
#puts $f3 $now [expr $bw3]

#Re-Schedule The Procedure
$ns at [expr $now+$time] record
   }

# define color index
$ns color 0 blue
$ns color 1 red
$ns color 2 chocolate
$ns color 3 red
$ns color 4 brown
$ns color 5 tan
$ns color 6 gold
$ns color 7 black

set n(0) [$ns node]
#$ns at 0.0 $n(0) color red
$n(0) color 0
$n(0) shape circle
set n(1) [$ns node]
$n(1) color blue
$n(1) shape circle
set n(2) [$ns node]
$n(2) color tan
$n(2) shape circle
set n(3) [$ns node]
$n(3) color red
$n(3) shape circle
set n(4) [$ns node]
$n(4) color tan
$n(4) shape circle
set n(5) [$ns node]
$n(5) color red
$n(5) shape circle






for 

[ns] Problem in TORA Simulation

2007-04-22 Thread manpreet grewal


Dear All,

I have executed TORA successfully and made all the requisite 
changes totora.cc to enable it  work correctly  and to get rid of 
Agent/PROTO problem.
But When i execute my tcl script, there seems to be indeterminate 
delay ingetting the output.When i examine the trace file created 
by tora.tcl script,the simulation gets struck at 2.3 seconds and 
not able to movebeyond.The exact output that appears in the 
terminal is


  OUTPUT AS IT APPEARS IN THE TERMINAL**
num_nodes is set 6
INITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR 
instead
Start of simulation..
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
SORTING LISTS ...DONE!

It gets struck at this point and there is no progress beyond 
this.
**

It would immensely help me if anyone is able to correct this 
peculiar
problem.I'm using ns2.31 in Windows XP

I have enclosed my tora.tcl script below.

please help me pl.

Thank You,
With Regards,
Manpreet


**TORA.tcl***
# 
==
# Define options
# 
==
  set val(chan) Channel/WirelessChannel  ;# channel type
  set val(prop) Propagation/TwoRayGround ;# 
radio-propagation model
  set val(ant)  Antenna/OmniAntenna  ;# Antenna type
  set val(ll)   LL   ;# Link layer 
type
  set val(ifq)  Queue/DropTail/PriQueue  ;# Interface 
queue type
  set val(ifqlen)   50   ;# max packet in 
ifq
  set val(netif)Phy/WirelessPhy  ;# network 
interface type
  set val(mac)  Mac/802_11   ;# MAC type
  set val(nn)   6;# number of 
mobilenodes
  set val(rp)   TORA ;# routing 
protocol
  set val(x)800
  set val(y)800

set ns [new Simulator]
#ns-random 0

set f [open 1_out.tr w]
$ns trace-all $f
set namtrace [open 1_out.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
set f0 [open proj_out0.tr w]
set f1 [open proj_out1.tr w]
set f2 [open proj_out2.tr w]
set f3 [open proj_out3.tr w]

set topo [new Topography]
$topo load_flatgrid 800 800

create-god $val(nn)

set chan_1 [new $val(chan)]
set chan_2 [new $val(chan)]
set chan_3 [new $val(chan)]
set chan_4 [new $val(chan)]
set chan_5 [new $val(chan)]
set chan_6 [new $val(chan)]

# CONFIGURE AND CREATE NODES

$ns node-config  -adhocRouting $val(rp) \
   -llType $val(ll) \
  -macType $val(mac) \
  -ifqType $val(ifq) \
  -ifqLen $val(ifqlen) \
  -antType $val(ant) \
  -propType $val(prop) \
  -phyType $val(netif) \
  #-channelType $val(chan) \
  -topoInstance $topo \
  -agentTrace OFF \
  -routerTrace ON \
  -macTrace ON \
  -movementTrace OFF \
  -channel $chan_1  # \
  #-channel $chan_2   \
  #-channel $chan_3   \
  #-channel $chan_4   \
  #-channel $chan_5   \
  #-channel $chan_6


proc finish {} {
 global ns f f0 f1 f2 f3 namtrace
 $ns flush-trace
 close $namtrace
 close $f0
 close $f1
  close $f2
 close $f3
# exec xgraph proj_out0.tr proj_out1.tr
  # proj_out2.tr 
proj_out3.tr
 exec nam -r 5m 1_out.nam 
 exit 0
}

proc record {} {
   global sink0 sink1 sink2 sink3 sink4 sink5 f0 f1 f2 f3
#Get An Instance Of The Simulator
set ns [Simulator instance]

#Set The Time After Which The Procedure Should Be Called 
Again
set time 0.05
#How Many Bytes Have Been Received By The Traffic Sinks?
set bw0 [$sink5 set npkts_]
set bw1 [$sink5 set nlost_]
#set bw2 [$sink2 set npkts_]
#set bw3 [$sink3 set npkts_]

#Get The Current Time
set now [$ns now]

#Save Data To The Files
puts $f0 $now [expr $bw0]
puts $f1 $now [expr $bw1]
#puts $f2 $now [expr $bw2]
#puts $f3 $now [expr $bw3]

#Re-Schedule The Procedure
$ns at [expr $now+$time] record
   }

# define color index
$ns color 0 blue
$ns color 1 red
$ns color 2 chocolate
$ns color 3 red
$ns color 4 brown
$ns color 5 tan
$ns color 6 gold
$ns color 7 black

set n(0) [$ns node]
#$ns at 0.0 $n(0) color red
$n(0) color 0
$n(0) shape circle
set n(1) [$ns node]
$n(1) color blue
$n(1) shape circle
set n(2) [$ns node]
$n(2) color tan
$n(2) shape circle
set n(3) [$ns node]
$n(3) color red
$n(3) shape circle
set n(4) [$ns node]
$n(4) color tan
$n(4) shape circle
set n(5) [$ns node]
$n(5) color red
$n(5) shape circle






for 

[ns] Problem in TORA Simulation!!!

2007-04-22 Thread manpreet grewal


Dear All,

I have executed TORA successfully and made all the requisite 
changes totora.cc to enable it  work correctly  and to get rid of 
Agent/PROTO problem.
But When i execute my tcl script, there seems to be indeterminate 
delay ingetting the output.When i examine the trace file created 
by tora.tcl script,the simulation gets struck at 2.3 seconds and 
not able to movebeyond.The exact output that appears in the 
terminal is


  OUTPUT AS IT APPEARS IN THE TERMINAL**
num_nodes is set 6
INITIALIZE THE LIST xListHead
using backward compatible Agent/CBR; use Application/Traffic/CBR 
instead
Start of simulation..
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
SORTING LISTS ...DONE!

It gets struck at this point and there is no progress beyond 
this.
**

It would immensely help me if anyone is able to correct this 
peculiar
problem.I'm using ns2.31 in Windows XP

I have enclosed my tora.tcl script below.

please help me pl.

Thank You,
With Regards,
Manpreet


**TORA.tcl***
# 
==
# Define options
# 
==
  set val(chan) Channel/WirelessChannel  ;# channel type
  set val(prop) Propagation/TwoRayGround ;# 
radio-propagation model
  set val(ant)  Antenna/OmniAntenna  ;# Antenna type
  set val(ll)   LL   ;# Link layer 
type
  set val(ifq)  Queue/DropTail/PriQueue  ;# Interface 
queue type
  set val(ifqlen)   50   ;# max packet in 
ifq
  set val(netif)Phy/WirelessPhy  ;# network 
interface type
  set val(mac)  Mac/802_11   ;# MAC type
  set val(nn)   6;# number of 
mobilenodes
  set val(rp)   TORA ;# routing 
protocol
  set val(x)800
  set val(y)800

set ns [new Simulator]
#ns-random 0

set f [open 1_out.tr w]
$ns trace-all $f
set namtrace [open 1_out.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
set f0 [open proj_out0.tr w]
set f1 [open proj_out1.tr w]
set f2 [open proj_out2.tr w]
set f3 [open proj_out3.tr w]

set topo [new Topography]
$topo load_flatgrid 800 800

create-god $val(nn)

set chan_1 [new $val(chan)]
set chan_2 [new $val(chan)]
set chan_3 [new $val(chan)]
set chan_4 [new $val(chan)]
set chan_5 [new $val(chan)]
set chan_6 [new $val(chan)]

# CONFIGURE AND CREATE NODES

$ns node-config  -adhocRouting $val(rp) \
   -llType $val(ll) \
  -macType $val(mac) \
  -ifqType $val(ifq) \
  -ifqLen $val(ifqlen) \
  -antType $val(ant) \
  -propType $val(prop) \
  -phyType $val(netif) \
  #-channelType $val(chan) \
  -topoInstance $topo \
  -agentTrace OFF \
  -routerTrace ON \
  -macTrace ON \
  -movementTrace OFF \
  -channel $chan_1  # \
  #-channel $chan_2   \
  #-channel $chan_3   \
  #-channel $chan_4   \
  #-channel $chan_5   \
  #-channel $chan_6


proc finish {} {
 global ns f f0 f1 f2 f3 namtrace
 $ns flush-trace
 close $namtrace
 close $f0
 close $f1
  close $f2
 close $f3
# exec xgraph proj_out0.tr proj_out1.tr
  # proj_out2.tr 
proj_out3.tr
 exec nam -r 5m 1_out.nam 
 exit 0
}

proc record {} {
   global sink0 sink1 sink2 sink3 sink4 sink5 f0 f1 f2 f3
#Get An Instance Of The Simulator
set ns [Simulator instance]

#Set The Time After Which The Procedure Should Be Called 
Again
set time 0.05
#How Many Bytes Have Been Received By The Traffic Sinks?
set bw0 [$sink5 set npkts_]
set bw1 [$sink5 set nlost_]
#set bw2 [$sink2 set npkts_]
#set bw3 [$sink3 set npkts_]

#Get The Current Time
set now [$ns now]

#Save Data To The Files
puts $f0 $now [expr $bw0]
puts $f1 $now [expr $bw1]
#puts $f2 $now [expr $bw2]
#puts $f3 $now [expr $bw3]

#Re-Schedule The Procedure
$ns at [expr $now+$time] record
   }

# define color index
$ns color 0 blue
$ns color 1 red
$ns color 2 chocolate
$ns color 3 red
$ns color 4 brown
$ns color 5 tan
$ns color 6 gold
$ns color 7 black

set n(0) [$ns node]
#$ns at 0.0 $n(0) color red
$n(0) color 0
$n(0) shape circle
set n(1) [$ns node]
$n(1) color blue
$n(1) shape circle
set n(2) [$ns node]
$n(2) color tan
$n(2) shape circle
set n(3) [$ns node]
$n(3) color red
$n(3) shape circle
set n(4) [$ns node]
$n(4) color tan
$n(4) shape circle
set n(5) [$ns node]
$n(5) color red
$n(5) shape circle






for 

[ns] how to create a new packet and set/get data?

2007-04-22 Thread Anuradha Sehgal

hello ns-users

I am using ns-allinone-2.31 installed on cygwin.
I have added some encryption and decryption functions by creating a new
class in ns2.
I have also used it in a script file by calling it from there. Its working
fine. The script file is

#myTcl.tcl
set encdec [new Agent/EncDecOtcl]
$encdec call-my-priv-func2
#end of tcl file=


Now i want to create a new packet and want to call that function from there
so that data get encrypted and decrypted while sending and receiving.
any help will be greatly appreiciated.

Thanks in advance

With best regards,
Anuradha Sehgal