hi all,

i am trying to send packets from one mobile node in domain 1t o sink node in
domain 2... but  i get route to base station not found error...
this is the code ....
# set global variables
#set nb_mn [lindex $argv 0]                ;# 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 5
set traffic_stop  120
set simulation_stop 8
set diuc 7 ;#modulation for MNs

#define debug values
Mac/802_16 set debug_ 0
Mac/802_16 set rtg_ 20
Mac/802_16 set ttg_ 20
Mac/802_16 set frame_duration_ 0.005
Mac/802_16 set client_timeout_ 50 ;#to avoid BS disconnecting the SS
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(namtr)        new-comm.nam           ;# for nam tracing
set opt(tr)        new-comm.tr           ;# for trace file

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 output_dir nb_mn nf
        $ns flush-trace
        close $tf
    close $nf
    exec nam new-comm.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/$opt(tr) w]
set nf [open $output_dir/$opt(namtr) w]
$ns trace-all $tf
$ns namtrace-all-wireless $nf $opt(x) $opt(y)
puts "Output file configured"

# 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 2 3                ;# number of nodes for each cluster
(1 for sink and one for mobile nodes + base station
AddrParams set nodes_num_ $eilastlevel
puts "Configuration of hierarchical addressing done"

# Create God
create-god 4            ;# nb_mn + 2 (base station and sink node)
puts "God node created"


$ns node-config -adhocRouting $opt(adhocRouting) \
                 -llType $opt(ll) \
                 -macType Mac/802_16/SS \
                 -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

#creates the sink node in first addressing space.
set sinkNode [$ns node 0.0.0]
$sinkNode set X_ 200.0
$sinkNode set Y_ 200.0
$sinkNode set Z_ 0.0
#puts "sink node created"
#creates the Access Point (Base station)

set sinkNode1 [$ns node 0.0.1]
$sinkNode1 set X_ 300.0
$sinkNode1 set Y_ 200.0
$sinkNode1 set Z_ 0.0

$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 1.0.0]
$bstation1 random-motion 0
puts "Base-Station node created"
#provide some co-ord (fixed) to base station node
$bstation1 set X_ 250.0
$bstation1 set Y_ 250.0
$bstation1 set Z_ 0.0
[$bstation1 set mac_(0)] set-channel 0
set bs1addr [$bstation1 node-addr]
puts "bstation1=$bs1addr"

# creation of the mobile nodes

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

#create a node that sends data to other domain
set node1 [$ns node 1.0.1]
set node2 [$ns node 1.0.2]
$node1 random-motion 0
$node2 random-motion 0
$node1 set X_ 200.0
$node1 set Y_ 150.0
$node1 set Z_ 0.0

$node2 set X_ 300.0
$node2 set Y_ 150.0
$node2 set Z_ 0.0

$node1 base-station [AddrParams addr2id [$bstation1 node-addr]]
[$node1 set mac_(0)] set-channel 0
[$node1 set mac_(0)] set-diuc $diuc
set node1addr [$node1 node-addr]
puts "Address of node1 in domain 1 : $node1addr"

$node2 base-station [AddrParams addr2id [$bstation1 node-addr]]
[$node2 set mac_(0)] set-channel 0
[$node2 set mac_(0)] set-diuc $diuc

#create an agent and the cbr traffic source and attach it to node1
set udp [new Agent/UDP]
$udp set packetSize_ $packet_size
$ns attach-agent $node1 $udp

set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ $packet_size
$cbr1 set rate_ 5Mb
$cbr1 attach-agent $udp

set udp1 [new Agent/UDP]
$udp set packetSize_ $packet_size
$ns attach-agent $node2 $udp1

set cbr2 [new Application/Traffic/CBR]
$cbr2 set packetSize_ $packet_size
$cbr2 set rate_ 5Mb
$cbr2 attach-agent $udp1

set null [new Agent/Null]
$ns attach-agent $sinkNode $null

set null1 [new Agent/Null]
$ns attach-agent $sinkNode1 $null1

$ns connect $udp $null
$ns connect $udp1 $null1

$ns duplex-link $sinkNode $bstation1 100Mb 1ms DropTail
$ns duplex-link $sinkNode1 $bstation1 100Mb 1ms DropTail
#$sinkNode base-station [AddrParams addr2id [$bstation1 node-addr]]
#$sinkNode1 base-station [AddrParams addr2id [$bstation1 node-addr]]



puts "starting the flows"

$ns at 5.0 "$cbr1 start"
$ns at 5.0 "$cbr2 start"
$ns at 7.0 "$cbr2 stop"
$ns at 7.0 "$cbr1 stop"



$ns at $simulation_stop "finish"
puts "Running simulation......"
$ns run

and one more thing.. what is this wiredRouting in node-config... for mobile
nodes if i make the wiredRouting OFF... it gives me an error saying that
mobiles nodes have not be defined...
anyone plz help.. its urgent for my project...

thanks all
Manoj Srivatsav

Reply via email to