Hello everyone,

I need some help regarding wimax simulation.

I
 have written a wimax simulation script with 2 base stations. My 
flow is something like this :

WL(0) --> BS(0) ---> BS(1) 
---> WL(3).

But my code is always skipping BS(1).  I am not 
getting the problem. Can you help me in this regard?


I am using NIST Wimax Patch and using NS 2.31.  

Thanks in 
advance..

My code is below:


# Test file for wimax
#
 Topology scenario:
#
#            |-----|        |-----|  
#   
 ; 0.0.1 | MN1 |        | MN2 |       ; 0.0.2
#            
|-----|        |-----|
#
#
#          (^)           (^)
#   
        |        |
#              |---------------|
#                
 |
 Base Station 1|         ; 0.0.0
#                 |---------------|


#   
             (^)           
#                 |
            (V)   
     
#              |---------------|
#                 | Base 
Station 2|         ; 1.0.0
#                 |---------------|
#   
        
    |        |
#              (V)           (V)
#
#
#    
        |-----|        |-----|  
#    ; 1.0.1 | MN3 |        | MN4 
|        ; 1.0.2 
#            |-----|        |-----|
#
#

#check
 input parameters
if {$argc != 0} {
    puts ""
    puts "Wrong
 Number of Arguments! No arguments in this topology"
    puts ""
   
 exit (1)
}

# set global variables
set nb_mn 4            
    ;# max number
 of mobile node
#set packet_size    1500            ;# packet size in
 bytes at CBR applications 
set output_dir .
set gap_size 1 
;#compute gap size between packets
puts "gap size=$gap_size"
#set 
traffic_start 100
#set traffic_stop  200
set simulation_stop 210

#define
 debug values
Mac/802_16 set debug_ 1
Mac/802_16 set rtg_ 20
Mac/802_16
 set ttg_ 20
Mac/802_16 set frame_duration_ 0.004
Mac/802_16 set 
client_timeout_ 110 ;#to avoid BS disconnecting the SS since the traffic
 starts a 10s
Phy/WirelessPhy/OFDM set g_ 0.25

#define 
coverage area for base station: 20m coverage 
Phy/WirelessPhy set Pt_
 0.025
#Phy/WirelessPhy set freq_ 2412e+6
#Phy/WirelessPhy set 
RXThresh_ 2.90781e-09
Phy/WirelessPhy set RXThresh_ 2.025e-12 ;#500m 
radius
Phy/WirelessPhy set CSThresh_ [expr 0.9*[Phy/WirelessPhy set 
RXThresh_]]

# Parameter for
 wireless nodes
set opt(chan)           Channel/WirelessChannel    ;#
 channel type
set opt(prop)           Propagation/TwoRayGround   ;# 
radio-propagation model
set opt(netif)          
Phy/WirelessPhy/OFDM       ;# network interface type
set 
opt(mac)            Mac/802_16/BS              ;# MAC type
set 
opt(ifq)            Queue/DropTail/PriQueue    ;# interface queue type
set
 opt(ll)            
 LL                         ;# link layer type
set 
opt(ant)            Antenna/OmniAntenna        ;# antenna model
set 
opt(ifqlen)         50                     ;# max packet in ifq
set 
opt(adhocRouting)   DSDV                       ;# routing protocol

set
 opt(x)        1100               ;# X dimension of the topography
set
 opt(y)        1100   
            ;# Y dimension of the topography

Mac/802_11 set 
basicRate_ 11Mb
Mac/802_11 set dataRate_ 11Mb
Mac/802_11 set 
bandwidth_ 11Mb

#defines function for flushing and closing files
proc
 finish {} {
        global ns tf ntf output_dir nb_mn
        $ns
 flush-trace
        close $tf
    close $ntf
    exec nam 
cubic_4_node_2_bs.nam &
        exit 0
}

#create the 
simulator
set ns [new Simulator]
$ns use-newtrace

#create 
the topography
set topo [new Topography]
$topo load_flatgrid 
$opt(x) $opt(y)
#puts "Topology created"

#open file for trace
set
 tf [open $output_dir/cubic_4_node_2_bs.tr w]
$ns trace-all $tf
#puts
 "Output file configured"

#Open file for
 Nam Trace
set ntf [open $output_dir/cubic_4_node_2_bs.nam w]
$ns 
namtrace-all-wireless $ntf $opt(x) $opt(y)

set winfile1 [open 
cubic_2_bs_WinFile_0_3 w]


# set up for hierarchical routing 
(needed for routing over a basestation)
#puts "start hierarchical 
addressing"
$ns node-config -addressType hierarchical
AddrParams 
set domain_num_ 2                      ;# domain number
lappend 
cluster_num 1 1                        ;# cluster number for each domain
 
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 3 
3          ;# number of nodes for each cluster (2 mobile nodes + 1 base 
station)
AddrParams set nodes_num_ $eilastlevel
puts 
"Configuration of hierarchical addressing
 done"

# Create God
create-god [expr ($nb_mn + 2)]            
    ;# nb_mn + 2 (2 base stations and mobile nodes)
#puts "God node 
created"

#creates the Access Point (Base station)
$ns 
node-config -adhocRouting $opt(adhocRouting) \
                 
-llType $opt(ll) \
                 -macType Mac/802_16/BS \
                
 -ifqType $opt(ifq) \
                 -ifqLen $opt(ifqlen) \
                
 -antType $opt(ant)
 \
                 -propType $opt(prop)    \
                 
-phyType $opt(netif) \
                 -channel [new $opt(chan)] \
                
 -topoInstance $topo \
                 -wiredRouting ON \
                
 -agentTrace ON \
                 -routerTrace ON
 \
                 -macTrace ON  \
                 
-movementTrace OFF
#puts "Configuration of base station"

set 
bstation1 [$ns node 0.0.0]  ;# Base station is in cluster 0 (node 0) 
Domain 0
$bstation1 random-motion 0
#puts "Base-Station node 
created"
#provide some co-ord (fixed) to base station node
$bstation1
 set X_ 400.0
$bstation1 set Y_ 500.0
$bstation1 set Z_ 0.0
[$bstation1
 set mac_(0)] set-channel 0

set bstation2 [$ns node 1.0.0]  ;# 
Base station is in cluster 0 (node 0) Domain 1
$bstation2 
random-motion 0
#puts "Base-Station node created"
#provide some 
co-ord (fixed) to base station node
$bstation2 set X_ 700.0
$bstation2
 set Y_ 600.0
$bstation2 set Z_ 0.0
[$bstation2 set mac_(0)] 
set-channel 1


#
 creation of the mobile nodes
$ns node-config -macType Mac/802_16/SS \
               
 -wiredRouting OFF \
                -macTrace ON                  ;#
 Mobile nodes cannot do routing.

for {set i 0} {$i < 2} {incr 
i} {
    set wl_node_($i) [$ns node 0.0.[expr $i+1]]     ;# create 
the node with given @.    
    $wl_node_($i) random-motion 0        
    ;# disable random motion
    $wl_node_($i) base-station 
[AddrParams addr2id [$bstation1 node-addr]] ;#attach mn to basestation
   
 

        [$wl_node_($i) set mac_(0)] set-channel 0 ;#do i
 need to use diffenet channel for each wireless node ??
        
[$wl_node_($i) set mac_(0)] set-diuc 7   ;# Change the node profile here
 (7=64QAM_3_4)
    
}

for {set i 2} {$i < 4} {incr i} {
   
 set wl_node_($i) [$ns node 1.0.[expr $i-1]]     ;# create the node with
 given @.    
    $wl_node_($i) random-motion 0            ;# disable
 random motion
    $wl_node_($i) base-station [AddrParams addr2id 
[$bstation2 node-addr]] ;#attach mn to basestation
    

       
 [$wl_node_($i) set mac_(0)] set-channel 0 ;#do i need to use diffenet 
channel for each wireless node ??
        [$wl_node_($i) set mac_(0)]
 set-diuc 7   ;# Change the node profile here
 (7=64QAM_3_4)
    
}

#compute position of the node
       
 $wl_node_(0) set X_ 300.0
    $wl_node_(0) set Y_ 400.0
    
$wl_node_(0) set Z_ 0.0
        $ns at 0 "$wl_node_(0) setdest 300.0 
350.0 1.0"
        puts "wireless node 0 created ..."            ;# 
debug info

    $wl_node_(1) set X_ 250.0
    $wl_node_(1) set 
Y_ 700.0
    $wl_node_(1) set Z_ 0.0
        $ns at 0 
"$wl_node_(1) setdest 200.0 650.0 1.0"
        puts "wireless node 1 
created ..."            ;# debug info


#compute position of 
the node
       
 $wl_node_(2) set X_ 800.0
        $wl_node_(2) set Y_ 300.0
     
   $wl_node_(2) set Z_ 0.0
        $ns at 0 "$wl_node_(2) setdest 
700.0 300.0 1.0"
        puts "wireless node 2 created ..."        
    ;# debug info

        $wl_node_(3) set X_ 800.0
        
$wl_node_(3) set Y_ 800.0
        $wl_node_(3) set Z_ 0.0
        
$ns at 0 "$wl_node_(3) setdest 860.0 650.0 1.0"
        puts 
"wireless node 3 created ..."            ;# debug info

#Create 
TCP Traffic MN0 -->  MN3

    set tcp(0) [new
 Agent/TCP]
    $ns attach-agent $wl_node_(0) $tcp(0)

    #set
 up receiver side
    set sink(0) [new Agent/TCPSink/Sack1]
    
#$sink(0) set ts_echo_rfc1323_ true
    $ns attach-agent $wl_node_(3)
 $sink(0)

    #logical connection
      $ns connect $tcp(0) 
$sink(0)

    #Setup a FTP over TCP connection
    set ftp(0) 
[new Application/FTP]
    $ftp(0) attach-agent $tcp(0)
    $ftp(0)
 set type_ FTP

      $ns at 50 "$ftp(0) start"
       $ns at 
150 "$ftp(0) stop"

################################################################
#
 Plot Congestion Window       
                        #
################################################################
proc
 plotWindow {tcpSource file} {
global ns
set time 0.1
set now 
[$ns now]
set cwnd [$tcpSource set cwnd_]
puts $file "$now $cwnd"
$ns
 at [expr $now+$time] "plotWindow $tcpSource $file"
}

$ns at 
0.1 "plotWindow $tcp(0) $winfile1"
#$ns at 0.1 "plotWindow $tcp(1) 
$winfile2"

$ns at $simulation_stop "finish"
#$ns at 
$simulation_stop "$ns halt"
# Run the simulation
puts "Running 
simulation for $nb_mn mobile nodes..."
$ns run
puts "Simulation 
done."


, Sajeeb Saha
10th
 Batch,CSEDU
+8801914754181

Reply via email to