http://old.nabble.com/file/p34269615/mytopo1.png 
http://old.nabble.com/file/p34269615/mine7.tcl mine7.tcl 


# 
#  w(0)==BS(0)--N0--N1--BS(1)==W(1)
#
# simulation of a wired-cum-wireless scenario 
# ======================================================================
# 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)             2                          ;# number of
wirelessnodes
set opt(adhocRouting)   DSDV                       ;# routing protocol
set opt(x)              1000                       ;# x coordinate of
topology
set opt(y)              700                        ;# y coordinate of
topology
set opt(stop)           250                        ;# time to stop
simulation
set opt(ftp1-start)     10.0
set num_wired_nodes      2
set num_bs_nodes         2
#
============================================================================

# create simulator instance
set ns_   [new Simulator]

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

set tracefd  [open wireless2-out.tr w]
set namtrace [open wireless2-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 3.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 1.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
#provide some co-ord (fixed) to base station node
$BS(0) set X_ 100.0
$BS(0) set Y_ 100.0
$BS(0) set Z_ 0.0

set temp1 {2.0 2.1 }   ;
set BS(1) [$ns_ node [lindex $temp1 0]]
$BS(1) random-motion 0               ;# disable random motion
#provide some co-ord (fixed) to base station node
$BS(1) set X_ 700.0
$BS(1) set Y_ 100.0
$BS(1) set Z_ 0.0


# create mobilenodes in the same domain as BS(0)  
#configure for mobilenodes
$ns_ node-config -wiredRouting OFF
set node_(0) [ $ns_ node [lindex $temp 1]
$node_(0) base-station [AddrParams addr2id \[$BS(0) node-addr]]
$node_(0) random-motion 0 

set node_(1) [ $ns_ node [lindex $temp1 1]
$node_(1) base-station [AddrParams addr2id \[$BS(1) node-addr]]
$node_(1) random-motion 0

#create links between wired and BS nodes
$ns_ duplex-link $W(0) $BS(0) 5Mb 2ms DropTail
$ns_ duplex-link $W(1) $BS(1) 5Mb 2ms DropTail
$ns_ duplex-link-op $W(0) $BS(0) orient right
$ns_ duplex-link-op $W(1) $BS(1) orient right

# setup TCP connections
set tcp1 [new Agent/TCP]
$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns_ attach-agent $w(0) $tcp1
$ns_ attach-agent $W(1) $sink1
$ns_ connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
$ns_ at $opt(ftp1-start) "$ftp1 start"

# Define initial node position in nam
$ns_ initial_node_pos $node_(0) 10
$ns_ initial_node_pos $node_(1) 10

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

proc stop {} {
    global ns_ tracefd namtrace
    $ns_ flush-trace
    close $tracefd
    close $namtrace
    exec nam wireless2-out.nam &
    exit 0
}

puts "Starting Simulation..."
$ns_ run

i cant find any mistake where i'm exceeding the number of nodes
created.please help.
-- 
View this message in context: 
http://old.nabble.com/Address-761623648-outside-range-of-address-field-length-2048-tp34269615p34269615.html
Sent from the ns-users mailing list archive at Nabble.com.

Reply via email to