[ns] Wireless Web Caching does not work

2007-11-19 Thread Francisco Javier Gonzalez Cañete

Hi all,

I have been trying to implement a very simple web caching example on a 
simple wireless
topology. There are two nodes, one is the client and the other is the 
server. The nodes doesn´t move
and they are in the coverage area of the other.
But it didnt work, though it worked fine when I used
a wired toplogy, or using the wireless toplogy with an FTP application,
below is the scrip I used.

I have tried using some rtproto sentences and disabling wired routing.

It seems to be an error with the FullTCPAgent. The client send a GET but 
it never reach the server because
there is a problem with the ACKs but I don't know how to solve it.

I am using ns allinone 2.31

I would really appreciate any help,
Francisco


# ==
# Define options
# ==
set val(chan)   Channel/WirelessChannel;# channel type
set val(prop)   Propagation/TwoRayGround   ;# radio-propagation 
model
set val(netif)  Phy/WirelessPhy;# network interface type
set val(mac)Mac/802_11 ;# MAC type
set val(ifq)Queue/DropTail/PriQueue;# interface queue type
set val(ll) LL ;# link layer type
set val(ant)Antenna/OmniAntenna;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 2  ;# number of mobilenodes
set val(rp) DSDV   ;# routing protocol

# ==
# Main Program
# ==


#
# Initialize Global Variables
#
set ns[new Simulator]
set tracefd [open simple.tr w]
set log[open http.log w]
#$ns use-newtrace
$ns trace-all $tracefd

# set up topography object
set topo   [new Topography]

$topo load_flatgrid 1500 300

#
# Create God
#
create-god $val(nn)

#
#  Create the specified number of mobilenodes [$val(nn)] and attach them
#  to the channel.
#  Here two nodes are created : node(0) and node(1)

# configure node

$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 ON \
 -routerTrace ON \
 -macTrace OFF \
 -movementTrace OFF   
 
$ns node-config -wiredRouting OFF

for {set i 0} {$i  $val(nn) } {incr i} {
set node_($i) [$ns node]   
$node_($i) random-motion 0;# disable random motion
}

#
# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
#
$node_(0) set X_ 0.0;#servidor
$node_(0) set Y_ 150.0
$node_(0) set Z_ 0.0

$node_(1) set X_ 10.0;#Cliente
$node_(1) set Y_ 150.0
$node_(1) set Z_ 0.0

#$ns rtproto Session

#Generador de páginas
set pgp [new PagePool/Math]
set tmp [new RandomVariable/Constant]
$tmp set val_ 1024;#Page size generator
$pgp ranvar-size $tmp

set tmp [new RandomVariable/Exponential]
$tmp set avg_ 5;#Page age generator
$pgp ranvar-age $tmp

set server [new Http/Server $ns $node_(0)];#Crea un servidor en el nodo0
$server set-page-generator $pgp
$server log $log

set client [new Http/Client $ns $node_(1)];#Crea un cliente en el nodo1
set tmp [new RandomVariable/Exponential]
$tmp set avg_ 5
$client set-interval-generator $tmp
$client set-page-generator $pgp
$client log $log

proc start-connection {} {
global ns server client
   
$client connect $server
$client start-session $server $server
}

proc finish {} {
global ns tracefd log
$ns flush-trace
flush $log
close $log
close $tracefd
exit 0
}

set starttime 1
set stoptime 50
$ns at $starttime start-connection
$ns at $stoptime finish

#
# Tell nodes when the simulation ends
#
for {set i 0} {$i  $val(nn) } {incr i} {
$ns at $stoptime $node_($i) reset;
}

puts Starting Simulation...
$ns run


num_nodes is set 2
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5,  distCST_ = 550.0
SORTING LISTS ...DONE!
6.877574: FullTcpAgent::recv(_o59): bad ACK for our SYN:  [3:0.01.0] (hlen:40, 
dlen:20, seq:0, ack:21, flags:0x1a (PSH,ACK,SYN), salen:0, reason:0x0)
9.877710: FullTcpAgent::recv(_o59): bad ACK for our SYN:  [6:0.01.0] (hlen:40, 
dlen:20, seq:0, ack:21, flags:0x1a (PSH,ACK,SYN), salen:0, reason:0x4)
15.877190: FullTcpAgent::recv(_o59): bad ACK for our SYN:  [13:0.01.0] 
(hlen:40, dlen:20, seq:0, ack:21, flags:0x1a (PSH,ACK,SYN), 

[ns] regarding MAC throughput

2007-11-19 Thread Basim Javed

Hi all

I need data to plot throughput at 802.11e. Could somebody guide which of the
two approaches would be better:

1. write a C++ code which can generate an output file, to be picked by
gnuplot
2. somehow generate MAC level trace file using traceall (if such thing is
possible at MAC level), post process it, and then give to gnuplot

Thank you very much.

kind regards
B


Re: [ns] regarding xgraph and gnuplot

2007-11-19 Thread Pedro Vale Estrela


Gnuplot is very powerfull, but has a complex interface. 
That's why I've made a gnuplot frontend:
http://tagus.inesc-id.pt/~pestrela/ns2/contributed_code.html#_Toc147652227

that's my recommendation!

--

Xgraph is more basic, but with a simpler interface.

Pedro Vale Estrela
http://tagus.inesc-id.pt/~pestrela/ns2/


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
 Of Basim Javed
 Sent: domingo, 18 de Novembro de 2007 1:31
 To: ns-users@ISI.EDU
 Subject: [ns] regarding xgraph and gnuplot
 
 
  hi all
 
 I am new to NS2 world, and just recently installed NS 2.31. I would really
 appreciate help regarding comparison of xgraph and gnuplot, regarding
 their
 strengths and weaknesses.
 
 Thank you in advance.
 
 regard
 
 B




[ns] why no body doesn't help !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

2007-11-19 Thread Amin Irandoost

Hi all

In wireless scenario that picture of this show at below

Node 0 is sender and node 24 is receiver

I want to use UDP agent for this nodes

I use follow code for this purpose

Please tell me is the following file correct and suitable?

Why the CBR interval has not effect on time when the nodes' energy is
finished?
picture of nam file that show my topology is :
http://rapidshare.com/files/70500344/Screenshot.png


I'm waiting for your reply
very thanks

-- 
Amin Irandoost

# ==
# Define options
# ==
#set val(lifetime)   4000;
set opt(chan)   Channel/WirelessChannel
set opt(prop)   Propagation/TwoRayGround
set opt(netif)  Phy/WirelessPhy
set opt(mac)Mac/SMAC
set opt(ifq)Queue/DropTail/PriQueue
set opt(ll) LL
set opt(ant)Antenna/OmniAntenna
set opt(x)  200.0  ;# X dimension of the topography
set opt(y)  200.0  ;# Y dimension of the topography
set opt(ifqlen) 50   ;# max packet in ifq
set opt(seed)   0.0
set opt(tr) 2.tr  ;# trace file
set opt(nam)2.nam
set opt(adhocRouting)   AODV
set opt(nn) 25  ;# how many nodes are simulated
set opt(energymodel)EnergyModel
set opt(stop)   4000.0;# simulation time
set val(initialenergy)  300.0
set val(receivepower)   0.395 ;# Receiving Power
set val(transmitpower)  0.660 ;# Transmitting Power
set val(idlepower)  0.350 ;# Idle Power
set val(sleeppower) 0.001 ;# sleep Power
LL set bandwidth_
20kb



# =


# 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_ 2.13643e-07
Phy/WirelessPhy set Rb_ 2*1e6
Phy/WirelessPhy set Pt_ 0.281838
Phy/WirelessPhy set freq_ 9.14e+8
Phy/WirelessPhy set L_ 1.0

proc finish {} {
global ns_ tracefd namtrace
$ns_ flush-trace
close $namtrace
close $tracefd
puts \n running nam...\n
 #   exec nam 1.nam 
exit 0
}



# AMAC settings
Mac/SMAC set syncFlag_ 1; # sleep wakeup cycles
Mac/SMAC set dutyCycle_ 60


set ns_[new Simulator]
$ns_ use-scheduler Heap
$ns_ set WirelessNewTrace_ ON
set topo[new Topography]
set tracefd[open $opt(tr) w]
set namtrace[open $opt(nam) w]
$ns_ trace-all $tracefd
$topo load_flatgrid $opt(x) $opt(y)
$ns_ namtrace-all-wireless $namtrace 200.0 200.0
set cha [new $opt(chan)]
#
# Create god
#
create-god $opt(nn)
$ns_ node-config -adhocRouting $opt(adhocRouting) \
 -llType $opt(ll) \
 -macType $opt(mac) \
 -ifqType $opt(ifq) \
 -ifqLen $opt(ifqlen) \
 -antType $opt(ant) \
 -propType $opt(prop) \
 -phyType $opt(netif) \
 -channel $cha \
 -topoInstance $topo \
 -WiredRouting OFF \
 -energyModel $opt(energymodel) \
 -idlePower $val(idlepower) \
 -rxPower $val(receivepower) \
 -txPower $val(transmitpower) \
 -sleepPower $val(sleeppower) \
 -initialEnergy $val(initialenergy) \
 -agentTrace ON \
 -routerTrace OFF \
 -macTrace OFF

set j 0
set k 0
for {set i 0} {$i  $opt(nn) } {incr i} {
set node_($i) [$ns_ node]
   $node_($i) random-motion 0;# disable random motion
   if {$i%5==0} {
   set j [expr $j+20]
   if {$i!=0} {
set k 0} }
   $node_($i) set X_ [set k [expr $k+20]]
$node_($i) set Y_ $j
$node_($i) set Z_ 0.0
}


for { set j 0} { $j  $opt(nn)} {incr j} {
  $ns_ initial_node_pos $node_($j) 2
  $node_($j) color blue
  $node_($j) log-energy
   }

*for { set j 0} { $j  $opt(nn)} {incr j} {
set udp_($j) [new Agent/UDP]
$ns_ attach-agent $node_($j) $udp_($j)
}

set null_(0) [new Agent/Null]
$ns_ attach-agent $node_([expr $opt(nn)-1]) $null_(0)*


*set cbr [new Application/Traffic/CBR]
$cbr set packetSize_ 50
$cbr set interval_ 3.0
$cbr attach-agent $udp_(0)
$ns_ connect $udp_(0) $null_(0)

$ns_ at 50.0 $cbr star*t

#
# Tell all the nodes when the simulation ends
#
for {set i 0} {$i  $opt(nn) } {incr i} {
$ns_ at $opt(stop) 

Re: [ns] Seg Faults

2007-11-19 Thread Leonard Tracy

Thanks for the suggestion.  I am having a problem with implementing
this.  First off, I get quite a few errors unless I do an #ifdef to
make sure that STDLIB_H gets included first. (It complains when stdlib
tries to declare abort after).  Wrapping an #ifdef STDLIB_H around the
macro definitions seems to fix this.  I define uan_abrt in a file that
is being compiled, uan-tools.cc, but I am failing in the link stage
with an undefined reference.

tools/rng.o: In function `RNG::set_seed(unsigned long const*)':
rng.cc:(.text+0x13b2): undefined reference to `uan_abrt'
tools/rng.o: In function `RNG::set_package_seed(unsigned long const*)':
rng.cc:(.text+0x1440): undefined reference to `uan_abrt'
tools/rng.o: In function `RNG::set_seed(RNG::RNGSources, int)':
rng.cc:(.text+0x14bf): undefined reference to `uan_abrt'
rng.cc:(.text+0x14e1): undefined reference to `uan_abrt'
tools/rng.o: In function `RNGTest::RNGTest()':
rng.cc:(.text+0x1b71): undefined reference to `uan_abrt'
tools/rng.o:rng.cc:(.text+0x1be4): more undefined references to
`uan_abrt' follow
collect2: ld returned 1 exit status

Note that the spelling, uan_abrt is correct.

Have I done something obvious to other people?

Leonard

On Nov 16, 2007 7:52 PM, Leonard Tracy [EMAIL PROTECTED] wrote:
 Hi all,

 Two questions:

 1.
 I've been trying to debug some seg faults I've been having.  They
 appear to be related to tracing dropped packets.  GDB's trace pack
 ends in DoWrite called by TclWrite.  Has anybody else had experience
 with this?  I am running NS 2.31 on Linux (Gutsy Ubuntu).  I am using
 the old format of wireless traces.

 This problem seems to be related to the load placed on the network.  I believe
 this has to do with a lot of Packets being dropped from the IFQ.
 The problem seems to be gone, or at least much less likely to occur,
 now that I've altered Queue::reset to use Packet::free as opposed to drop.

 2.
 As a possibly related issue.  It seems that NS often quits early.  I
 am not sure if this
 is a problem with my code or something other people have noticed.
 I've been running long
 simulations (1 seconds), and 90% (or more) of the time (after
 making the above change) NS will
 complete normally.  The other simulations will end at a random much
 earlier time, but NS still
 completes without an error code.  Does anybody have an idea of what
 would cause this?

 Leonard




Re: [ns] Seg Faults

2007-11-19 Thread Pedro Estrela

use ifdefs to NOT redefine abort in those RNG files

as such, you'll see aborts everywhere except RNG fucntions



On 11/19/07, Leonard Tracy [EMAIL PROTECTED] wrote:


 Thanks for the suggestion.  I am having a problem with implementing
 this.  First off, I get quite a few errors unless I do an #ifdef to
 make sure that STDLIB_H gets included first. (It complains when stdlib
 tries to declare abort after).  Wrapping an #ifdef STDLIB_H around the
 macro definitions seems to fix this.  I define uan_abrt in a file that
 is being compiled, uan-tools.cc, but I am failing in the link stage
 with an undefined reference.

 tools/rng.o: In function `RNG::set_seed(unsigned long const*)':
 rng.cc:(.text+0x13b2): undefined reference to `uan_abrt'
 tools/rng.o: In function `RNG::set_package_seed(unsigned long const*)':
 rng.cc:(.text+0x1440): undefined reference to `uan_abrt'
 tools/rng.o: In function `RNG::set_seed(RNG::RNGSources, int)':
 rng.cc:(.text+0x14bf): undefined reference to `uan_abrt'
 rng.cc:(.text+0x14e1): undefined reference to `uan_abrt'
 tools/rng.o: In function `RNGTest::RNGTest()':
 rng.cc:(.text+0x1b71): undefined reference to `uan_abrt'
 tools/rng.o:rng.cc:(.text+0x1be4): more undefined references to
 `uan_abrt' follow
 collect2: ld returned 1 exit status

 Note that the spelling, uan_abrt is correct.

 Have I done something obvious to other people?

 Leonard

 On Nov 16, 2007 7:52 PM, Leonard Tracy [EMAIL PROTECTED] wrote:
  Hi all,
 
  Two questions:
 
  1.
  I've been trying to debug some seg faults I've been having.  They
  appear to be related to tracing dropped packets.  GDB's trace pack
  ends in DoWrite called by TclWrite.  Has anybody else had experience
  with this?  I am running NS 2.31 on Linux (Gutsy Ubuntu).  I am using
  the old format of wireless traces.
 
  This problem seems to be related to the load placed on the network.  I
 believe
  this has to do with a lot of Packets being dropped from the IFQ.
  The problem seems to be gone, or at least much less likely to occur,
  now that I've altered Queue::reset to use Packet::free as opposed to
 drop.
 
  2.
  As a possibly related issue.  It seems that NS often quits early.  I
  am not sure if this
  is a problem with my code or something other people have noticed.
  I've been running long
  simulations (1 seconds), and 90% (or more) of the time (after
  making the above change) NS will
  complete normally.  The other simulations will end at a random much
  earlier time, but NS still
  completes without an error code.  Does anybody have an idea of what
  would cause this?
 
  Leonard