[ns] URGENT!!! "WIRED--BASESTATION--WIRELESS--BASESTATION--WIRED SCENARIO"

patrice siatchoua siat_pat at yahoo.fr
Thu Jan 22 06:26:48 PST 2004


Hi dears,
I am having a probleme with a wired-cum-wireless scenario. The scenario should consist of 1 node W(0) connected to a basestation Node BS(0) and another basestation node 
BS(1) connected to another node W(1). There should exist between BS(0) and BS(1) a wireless connection.
 
                                W(0)----BS(0)  <wireless>   BS(1)----W(1)
 
>From my understanding i defined 3 domains D(i) /  D(0) = {W(0)};  D(1) = {BS(0),BS(1)} and D(2) = {W(1)}.
 
This is what i get when trying to simulate the tcl script below. Please HELP me i cannot understand what i'm doing wrong
--------------------------------------------------------------------------------------------------------------------------------

    (_o3 cmd line 1)
    invoked from within
"_o3 cmd duplex_link _o57 _o23 1Mb 10ms DropTail"
    invoked from within
"catch "$self cmd $args" ret"
    (procedure "_o3" line 2)
    (SplitObject unknown line 2)
    invoked from within
"$ns_ duplex_link $BS(1) $W(1)  1Mb 10ms DropTail"
    (file "nsuser.tcl" line 105)

--------------------------------------------------------------------------------------------------------------------------------
 here the tcl script
 
##################  "nsuser.tcl"  #######################################

# ======================================================================
# Define options
# ======================================================================
set opt(chan)           Channel/WirelessChannel    ;# channel type
set opt(prop)           Propagation/TwoRayGround   ;# radio-propagation model
set opt(netif)          Phy/WirelessPhy            ;# network interface type
set opt(mac)            Mac/802_11                 ;# 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(nn)             0                          ;# number of mobilenodes
set opt(adhocRouting)   DSDV                       ;# routing protocol

set opt(cp)             ""                         ;# connection pattern file
set opt(sc)             ""                         ;#scenario file
set opt(x)      500                            ;# x coordinate of topology
set opt(y)      500                            ;# y coordinate of topology
set opt(seed)   0.0                            ;# seed for random number gen.
set opt(stop)   5                            ;# time to stop simulation

set num_wired_nodes      2
set num_bs_nodes         2


# create simulator instance
set ns_   [new Simulator]
$ns_ color 1 Blue
$ns_ color 2 Red

# set up for hierarchical routing
$ns_ node-config -addressType hierarchical
AddrParams set domain_num_ 3           ;# number of domains
lappend cluster_num 1 1 1                ;# number of clusters in each domain
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 2 1             ;# number of nodes in each cluster 
AddrParams set nodes_num_ $eilastlevel ;# of each domain

set tracefd  [open wireless-wired2-out.tr w]
set namtrace [open wireless-wired2-out.nam w]
$ns_ trace-all $tracefd
$ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y)

# Create topography object
set topo   [new Topography]

# define topology
$topo load_flatgrid $opt(x) $opt(y)

# create God
create-god [expr $opt(nn) + $num_bs_nodes]

#create wired nodes
set temp {0.0.0 2.0.0}        ;# hierarchical addresses for wired domain
for {set i 0} {$i < $num_wired_nodes} {incr i} {
    set W($i) [$ns_ node [lindex $temp $i]] 
}

# configure for base-station node
$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) \
                 -channelType $opt(chan) \
             -topoInstance $topo \
                 -wiredRouting ON \
             -agentTrace ON \
                 -routerTrace OFF \
                 -macTrace OFF 

#create base-station node
set temp {1.0.0 1.0.1}   ;# hier address to be used for wireless
                                     ;# domain
set BS(0) [$ns_ node [lindex $temp 0]]
$BS(0) random-motion 0               ;# disable random motion
set BS(1) [$ns_ node [lindex $temp 1]]
$BS(1) random-motion 0

#configure for basestation node

$BS(0) base-station [AddrParams addr2id [$BS(1) node-addr]]

#create links between wired and BS nodes

$ns_ duplex-link $W(0) $BS(0) 1Mb 10ms DropTail
$ns_ duplex_link $BS(1) $W(1)  1Mb 10ms DropTail

$ns_ duplex-link-op $W(0) $BS(0) orient right
$ns_ duplex-link-op $BS(1) $W(1) orient right

#Create a UDP agent and attach it to node W0
set udp0 [new Agent/UDP]
$udp0 set class_ 1
$udp0 set prio_ 1
$ns_ attach-agent $W(0) $udp0

# Create a CBR traffic source and attach it to udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.005
$cbr0 attach-agent $udp0

#Create a UDP agent and attach it to base station node BS0
set udp1 [new Agent/UDP]
$udp1 set class_ 2
$udp1 set prio_ 2
$ns_ attach-agent $BS(0) $udp1

# Create a CBR traffic source and attach it to udp1
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.005
$cbr1 attach-agent $udp1

#Create a Null agent (a traffic sink) and attach it to node BS1
set null0 [new Agent/Null]
$ns_ attach-agent $BS(1) $null0

#create a Null agent and attach it to node W1
set null1 [new Agent/Null]
$ns_ attach-agent $W(1) $null1

#Connect the traffic sources with the traffic sink
$ns_ connect $udp0 $null0  
$ns_ connect $udp1 $null1

#Schedule events for the CBR agents
$ns_ at 0.5 "$cbr0 start"
$ns_ at 0.5 "$cbr1 start"
$ns_ at 4.5 "$cbr1 stop"
$ns_ at 4.5 "$cbr0 stop"

# source connection-pattern and node-movement scripts
if { $opt(cp) == "" } {
      puts "*** NOTE: no connection pattern specified."
        set opt(cp) "none"
} else {
      puts "Loading connection pattern..."
      source $opt(cp)
}
if { $opt(sc) == "" } {
      puts "*** NOTE: no scenario file specified."
        set opt(sc) "none"
} else {
      puts "Loading scenario file..."
      source $opt(sc)
      puts "Load complete..."
}

# reset the Basestations
$ns_ at $opt(stop).0 "$BS(0) reset";
$ns_ at $opt(stop).0 "$BS(1) reset";

$ns_ at $opt(stop).0002 "puts \"NS EXITING...\" ; $ns_ halt"
$ns_ at $opt(stop).0001 "stop"

# Define the "stop" procedure
proc stop {} {
    global ns_ tracefd namtrace
    $ns_ flush-trace
    close $tracefd
    close $namtrace
    #execute nam on the trace file
    exec nam wireless-wired2-out.nam &
    exit 0

}
puts "Starting Simulation..."

$ns_ run
##########################################################################

 

 

Best regards

 

Patrice





---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gamma.isi.edu/pipermail/ns-users/attachments/20040122/833dbe16/attachment.html


More information about the Ns-users mailing list