Issue with ns2 - no throughput data


 
Thread Tools Search this Thread
Special Forums IP Networking Issue with ns2 - no throughput data
# 1  
Old 04-09-2012
Issue with ns2 - no throughput data

Hello,

First time poster here hoping to get some help with ns2.

I've recently started using ns2(first time user) but I'm having difficulty getting the results I'm after.

I am trying to set up a network with wireless nodes(5-15 nodes) and then use xgraph to display a timing diagram, including throughput and packet loss.

I have the initial code for the wireless nodes but the results are showing no throughput at. As I'm new to using and programming ns2, can anyone help with this? I can't see where I'm going wrong.

Code:
# 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(x) 1000 ;# X dimension of topology
set val(y) 1000 ;# Y dimension of topology
set val(cp) "" ;# node movement model file
set val(sc) "" ;# traffic model file
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 12 ;# number of mobilenodes
set val(seed) 0.0
set val(stop) 1000.0 ;# simulation time
set val(tr) exp.tr ;# trace file name
set val(rp) DSDV ;# routing protocol
set AgentTrace ON
set RouterTrace ON
set MacTrace OFF

Mac/802_11 set CWMin_                 31
Mac/802_11 set CWMax_                 1023
Mac/802_11 set SlotTime_              0.000020  ;# 20us
Mac/802_11 set SIFS_                  0.000010  ;# 10us
Mac/802_11 set PreambleLength_        144       ;# 144 bit
Mac/802_11 set ShortPreambleLength_   72        ;# 72 bit
Mac/802_11 set PreambleDataRate_      1.0e6     ;# 1Mbps
Mac/802_11 set PLCPHeaderLength_      48        ;# 48 bits
Mac/802_11 set PLCPDataRate_          1.0e6     ;# 1Mbps
Mac/802_11 set ShortPLCPDataRate_     2.0e6     ;# 2Mbps
Mac/802_11 set RTSThreshold_          3000      ;# bytes
Mac/802_11 set ShortRetryLimit_       7         ;# retransmissions
Mac/802_11 set LongRetryLimit_        4         ;# retransmissions
Mac/802_11 set newchipset_            false     ;# use new chipset, allowing a more recent
                                                ;# packet to be correctly received in place
                                                ;# of the first sensed packet
Mac/802_11 set dataRate_ 11Mb                   ;# 802.11 data transmission rate
Mac/802_11 set basicRate_ 1Mb                   ;# 802.11 basic transmission rate 
Mac/802_11 set aarf_ true                       ;# 802.11 Auto Rate Fallback

#-------Event scheduler object creation--------#

set ns              [new Simulator]

#creating the trace file and nam file

set tracefd       [open wireless1.tr w]
set namtrace      [open wireless1.nam w]   

$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

# set up topography object
set topo [new Topography]

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

set god_ [create-god $val(nn)]

# configure the 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 ON \
                   -routerTrace ON \
                   -macTrace OFF \
                   -movementTrace ON
     
## Creating node objects..               
      for {set i 0} {$i < $val(nn) } { incr i } {
            set node_($i) [$ns node]     
      }
      for {set i 0} {$i < $val(nn) } {incr i } {
            $node_($i) color black
            $ns at 0.0 "$node_($i) color black"
      }
           
# Provide initial location of mobilenodes
      $node_(0) set X_ 27.0
      $node_(0) set Y_ 260.0
      $node_(0) set Z_ 0.0

      $node_(1) set X_ 137.0
      $node_(1) set Y_ 348.0
      $node_(1) set Z_ 0.0

      $node_(2) set X_ 294.0
      $node_(2) set Y_ 235.0
      $node_(2) set Z_ 0.0

      $node_(3) set X_ 414.0
      $node_(3) set Y_ 342.0
      $node_(3) set Z_ 0.0

      $node_(4) set X_ 562.0
      $node_(4) set Y_ 267.0
      $node_(4) set Z_ 0.0

      $node_(5) set X_ 279.0
      $node_(5) set Y_ 447.0
      $node_(5) set Z_ 0.0

      $node_(6) set X_ -128.0
      $node_(6) set Y_ 260.0
      $node_(6) set Z_ 0.0

$node_(7) set X_ 727.0
$node_(7) set Y_ 269.0
$node_(7) set Z_ 0.0
     
$node_(8) set X_ 130.0
$node_(8) set Y_ 126.0
$node_(8) set Z_ 0.0

$node_(9) set X_ 318.0
$node_(9) set Y_ 45.0
$node_(9) set Z_ 0.0

$node_(10) set X_ 505.0
$node_(10) set Y_ 446.0
$node_(10) set Z_ 0.0

$node_(11) set X_ 421.0
$node_(11) set Y_ 158.0
$node_(11) set Z_ 0.0

 
#set up a UDP connection
set udp [new Agent/UDP]
$udp set fid_ 1
$udp set packetSize_ 1000
$ns attach-agent $node_(0) $udp
set null [new Agent/Null]
$ns attach-agent $node_(0) $null
$ns connect $udp $null  
#end


#set up a CBR over UDP connection
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 11mb
$cbr set random_ false
$ns at 0.1 "$cbr start" 

#end


# Define node initial position in nam
for {set i 0} {$i < $val(nn)} { incr i } {
# 30 defines the node size for nam
$ns initial_node_pos $node_($i) 30
}

# Telling nodes when the simulation ends
#for {set i 0} {$i < $val(nn) } { incr i } {
#    $ns at $val(stop) "$node_($i) reset";
#}

# ending nam and the simulation
#$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
#$ns at 10.01 "puts \"end simulation\" ; $ns halt"
proc stop {} {
    global ns tracefd namtrace
    $ns flush-trace
    close $tracefd
    close $namtrace
exec nam wireless1.nam &
}

puts "Starting Simulation..."

$ns run

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

regarding adding fields to DSR protocol in ns2.34

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: want to add field to route cache and packet of DSR routing protocol in ns2.34, add field, DSR package in ns2.34... (2 Replies)
Discussion started by: khubalkar
2 Replies

2. Programming

regarding adding fields to DSR protocol in ns2.34

hi i am student doing project in ns2.34. i hav to add field in route cache and packet of DSR routing protocol. which files hv to be changed...pl help me (1 Reply)
Discussion started by: khubalkar
1 Replies

3. IP Networking

Issue with Ns2.29

Hello, I am a beginner in Ns2 . I'am trying to run the example attached bu I have this errors : Simulation is running ... please wait ... can't read "Node_(7)": no such element in array while executing "return $Node_($id)" (procedure "_o3" line 3) (Simulator get-node-by-id... (0 Replies)
Discussion started by: Yotta15
0 Replies

4. IP Networking

OLSR simulation in ns2

# Create the simulator object that we need in order to run NS set ns # Set the parameters that we will use for wireless communications set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set... (0 Replies)
Discussion started by: amithkhandakar
0 Replies

5. UNIX for Advanced & Expert Users

ns2 simulator with gcc compiler using only 1 processor(?)

Hi! I am using the ns2.31 simulator in Ubuntu 9.04. I have developed my program and when I simulate it (calling ns2 from Ubuntu default shell, that uses gcc), I notice that only 1 of the 2 processors available in my notebook seems to be used (simulations are very heavy and my notebook stays... (5 Replies)
Discussion started by: Alice236
5 Replies

6. IP Networking

How to improve throughput?

I have a 10Gbps network link connecting two machines A and B. I want to transfer 20GB data from A to B using TCP. With default setting, I can use 50% bandwidth. How to improve the throughput? Is there any way to make throughput as close to 10Gbps as possible? thanks~ :) (3 Replies)
Discussion started by: andrewust
3 Replies

7. Shell Programming and Scripting

TCL in NS2

Hi all, I wrote a TCL script in NS2 which involves running multiple Voice and video sessions. Am not able to troubleshoot one error at all. Can anyone please help me please. I am ready to send the documents if possible. please please help me guys !! I am trying to solve the problem since... (0 Replies)
Discussion started by: mehera
0 Replies

8. IP Networking

Gigabit Link throughput

As a rule of thumb in doing calculations, what figure would you use in Mbytes/sec? I know the answer varies grealty on the topolgy of the network but I wonde what newteok engineers use a rough rule of thumb? Many thanks. (1 Reply)
Discussion started by: debd
1 Replies

9. IP Networking

Installing NS2 On Ubuntu Machine

I have to work with NS2 (Network Simulator)and i have to install it beforeusing it on Manets Simulations. Can some one Help me on this topic? Thank's (1 Reply)
Discussion started by: hakim19
1 Replies

10. Shell Programming and Scripting

AWK help for traces in NS2

Hello Everyone, I'm a very new user to both NS-2 and awk and struggling quite a bit. I have a created a wireless trace in NS2 which is of the format as given below: s 0.029290548 _1_ RTR --- 0 message 32 ------- s 1.119926192 _0_ RTR --- 1 message 32 ------- M 10.00000 0 (5.00,... (2 Replies)
Discussion started by: cyberalienfreak
2 Replies
Login or Register to Ask a Question