[ns] Throughput value difference in 802.11

2009-02-17 Thread Иван

Hi!
I am using 802.11 Ext model and when I plot the througput in Xgraph it turns 
out to be different depending on how many traces (e.g. MAC trace, Agent trace, 
PHY trace) are turned ON. But the thoughput can't change. 
So the question is how can I know where there is   a REAL throughput value?
Thanks in advance!
Ivan.


[ns] setting the node as an AP in 802_11Ext Model

2009-02-15 Thread Иван

Hi!
I am using 802_11Ext model with multirate support. I need to use it AP-mode. 
Who knows how to declare an AP in this model? I tried to do it like in the 
Infra example but I failed (I got a failure: ap lookup failed).
Can anyone help me, please? 


[ns] dynamic library problem in ns-allinone-2.33

2009-02-12 Thread Иван

Hi!
Can anyone help me, please, with the dynamic library problem in 
ns-allinone-2.33 ?
During the installation I got the following warning:
*** Warning: linker path does not have real file for library -lns.
*** I have the capability to make that library automatically link in
when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libns and none of the candidates passed a file format test
*** using a file magic. Last file checked:
/home/spchuah/ns-allinone-2.33/ns-2.33/libns.dll.a
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.Help me, Please!!!Ivan.


[ns] Throughput and collision measurement in 802.11 AP-mode

2009-01-16 Thread Иван

Hi! 
I am a beginner in Ns-2, but I managed to alter infra.tcl script to my needs 
- I had to model several independent 802.11 g networks. Now I have to calculate 
the throughput of each of them and to see how the throughput is affected by 
collision (because networls affect each other). Can anyone help we with 
throughpu and collision (bit error rate) measurement? Thanks in advance! 
This is my script: 


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 ;# 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) 20 ;# number of mobilenodes 
set val(rp) DumbAgent ;# routing protocol 
set val(x) 50 
set val(y) 50 

Mac/802_11 set dataRate_ 11Mb 

#Phy/WirelessPhy set CSThresh_ 10.00e-12 
#Phy/WirelessPhy set RXThresh_ 10.00e-11 
#Phy/WirelessPhy set Pt_ 0.1 
#Phy/WirelessPhy set Pt_ 7.214e-3 

# Initialize Global Variables 
set ns_ [new Simulator] 
set tracefd [open infra.tr w] 
set namtrace [open infra.nam w] 
$ns_ trace-all $tracefd 
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y) 

#Open the output files 
set f0 [open out0.tr w] 


#Define a 'finish' procedure 
proc finish {} { 
global f0 #Close the output files 
close $f0 
#Call xgraph to display the results 
exec xgraph out0.tr -geometry 800x400  
exit 0 
} 



# set up topography object 
set topo [new Topography] 

$topo load_flatgrid $val(x) $val(y) 

# Create God 
create-god $val(nn) 

# Create channel 
set chan_1_ [new $val(chan)] 


$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) \ 
-topoInstance $topo \ 
-agentTrace OFF \ 
-routerTrace OFF \ 
-macTrace ON \ 
-movementTrace OFF \ 
-channel $chan_1_ 


for {set i 0} {$i  [expr $val(nn)]} {incr i} { 
set node_($i) [$ns_ node] 

$node_($i) random-motion 0 ;# disable random motion 
set mac_($i) [$node_($i) getMac 0] 


$mac_($i) set RTSThreshold_ 3000 
} 

set sizeRNG [new RNG] 
for {set j 0} {$j  $val(nn) } {incr j} { 
set randX [$sizeRNG uniform 0 $val(x)]; 
set randY [$sizeRNG uniform 0 $val(y)]; 
$node_($j) set X_ $randX 
$node_($j) set Y_ $randY 
$node_($j) set Z_ 0. 
} 


#Set Node 0, Node 10 and Node $val(nn) as the APs. 


set AP_ADDR1 [$mac_(0) id] 
$mac_(0) ap $AP_ADDR1 
set AP_ADDR2 [$mac_([expr $val(nn) - 1]) id] 
$mac_([expr $val(nn) - 1]) ap $AP_ADDR2 
set AP_ADDR3 [$mac_([expr $val(nn) - 10]) id] 
$mac_([expr $val(nn) - 10]) ap $AP_ADDR3 


#$mac_([expr $val(nn) - 1]) set BeaconInterval_ 0.2 


$mac_(1) ScanType Passive ;#изменил на Passive, было Active 

for {set i 2} {$i  [expr $val(nn) - 1]} {incr i} { ;# было ещё  $i != 10 
$mac_($i) ScanType PASSIVE ;#Passive 
} 


;#$ns_ at 1.0 $mac_(2) ScanType ACTIVE 

Application/Traffic/CBR set packetSize_ 1023 
Application/Traffic/CBR set rate_ 256Kb 



# TCP connections between node_(10) and node_{11, 16} 

set tcp [new Agent/TCP] 
$tcp set class_ 2 
set sink [new Agent/TCPSink] 

for {set i [expr $val(nn) - 10] } {$i  17 } {incr i} { 

$ns_ attach-agent $node_($i) $tcp 
$ns_ attach-agent $node_([expr $val(nn) - 10]) $sink 
$ns_ connect $tcp $sink 
set ftp [new Application/FTP] 
$ftp attach-agent $tcp 

} 

for {set i 0 } {$i  [expr $val(nn) - 10] } {incr i} { 

$ns_ attach-agent $node_($i) $tcp 
$ns_ attach-agent $node_(0) $sink 
$ns_ connect $tcp $sink 
set ftp [new Application/FTP] 
$ftp attach-agent $tcp 

} 

for {set i [expr $val(nn) - 10]} {$i  [expr $val(nn) - 1] } {incr i} { 

$ns_ attach-agent $node_($i) $tcp 
$ns_ attach-agent $node_(10) $sink 
$ns_ connect $tcp $sink 
set ftp [new Application/FTP] 
$ftp attach-agent $tcp 

} 
#Define a procedure which periodically records the bandwidth received by the 
#three traffic sinks sink0/1/2 and writes it to the three files f0/1/2. 
proc record {} { 
global sink_(0) f0 #Get an instance of the simulator 
set ns [Simulator instance] 
#Set the time after which the procedure should be called again 
set time 0.5 
#How many bytes have been received by the traffic sinks? 
set bw0 [$sink_(0) set bytes_] 
#Get the current time 
set now [$ns now] 
#Calculate the bandwidth (in MBit/s) and write it to the files 
puts $f0 $now [expr $bw0/$time*8/100] 
#Reset the bytes_ values on the traffic sinks 
$sink(0) set bytes_ 0 
#Re-schedule the procedure 
$ns at [expr $now+$time] record 
} 



# Define node initial position in nam 

for {set i 0} {$i  $val(nn)} {incr i} { 

# 2 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) 3 
} 

$ns_ at 5.0 $ftp start 

$ns_ at 20.0 stop 
$ns_ at 20.0 puts \NS EXITING...\ ; $ns_ halt 
$ns_