views:

17

answers:

0

I tried to run a simulation for wired-cum-wireless scenario. It is good when i use a single base station. But, when i use more than one, following error is displayed.

--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
    _o92: no target for slot 0
    _o92 type: Classifier/Port
content dump:
classifier _o92
    0 offset
    0 shift
    2147483647 mask
    1 slots
        slot 255: _o94 (CMUTrace/Recv)
---------- Finished standard no-slot{} default handler ----------

I here also paste my code i used for simulating with single base station.

Phy/WirelessPhy set freq_ 2.472e9  
Phy/WirelessPhy set RXThresh_ 2.62861e-09; #100m radius
Phy/WirelessPhy set CSThresh_ [expr 0.9*[Phy/WirelessPhy set RXThresh_]]
Phy/WirelessPhy set bandwidth_ 11.0e6 
Mac/802_11 set dataRate_ 11Mb 
Mac/802_11 set basicRate_ 2Mb


set opt(chan)           Channel/WirelessChannel
set opt(prop)           Propagation/TwoRayGround   
set opt(netif)          Phy/WirelessPhy            
set opt(mac)            Mac/802_11                 
set opt(ifq)            Queue/DropTail/PriQueue    
set opt(ll)             LL                         
set opt(ant)            Antenna/OmniAntenna        
set opt(ifqlen)         50                         
set opt(nn)             3                          
set opt(adhocRouting)   DSDV                       

set opt(cp)             "Hybrid_1Cp"                         
set opt(sc)     "Hybrid_1Sc"   

set opt(x)      150                           
set opt(y)      150                           
set opt(seed)   0.0                           
set opt(stop)   200                           

set num_wired_nodes      2
set num_bs_nodes         1

if { $opt(x) == 0 || $opt(y) == 0 } {
    puts "No X-Y boundary values given for wireless topology\n"
}
if {$opt(seed) > 0} {
    puts "Seeding Random number generator with $opt(seed)\n"
    ns-random $opt(seed)
}

set ns   [new Simulator]

$ns color 0 red
$ns color 1 green

$ns node-config -addressType hierarchical
AddrParams set domain_num_ 2           
lappend cluster_num 2 1                
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 4              
AddrParams set nodes_num_ $eilastlevel 

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

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


set topo   [new Topography]
$topo load_flatgrid $opt(x) $opt(y)

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

set temp {0.0.0 0.1.0}        
for {set i 0} {$i < $num_wired_nodes} {incr i} {
    set W($i) [$ns node [lindex $temp $i]] 
}


$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 ON \
                 -macTrace OFF \
        -movementTrace OFF


set temp {1.0.0 1.0.1 1.0.2 1.0.3}   

set BS(0) [$ns node [lindex $temp 0]]
$BS(0) random-motion 0               


$BS(0) set X_ 1.0
$BS(0) set Y_ 2.0
$BS(0) set Z_ 0.0
$BS(0) color blue
$BS(0) shape hexagon

$ns node-config -wiredRouting OFF

  for {set j 0} {$j < $opt(nn)} {incr j} {
    set node($j) [ $ns node [lindex $temp \
        [expr $j+1]] ]
    $node($j) base-station [AddrParams addr2id \
        [$BS(0) node-addr]]
}

$ns duplex-link $W(0) $W(1) 5Mb 2ms DropTail
$ns duplex-link $W(1) $BS(0) 5Mb 2ms DropTail

$ns duplex-link-op $W(0) $W(1) orient down
$ns duplex-link-op $W(1) $BS(0) orient left-down



set tcp1 [new Agent/TCP]
$tcp1 set class_ 2
set sink1 [new Agent/TCPSink]
$ns attach-agent $node(1) $tcp1
$ns attach-agent $node(0) $sink1
$ns connect $tcp1 $sink1
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
$tcp1 set fid_ 0
$sink1 set fid_ 0
$ns at 62.0 "$ftp1 start"

set tcp2 [new Agent/TCP]
$tcp2 set class_ 2
set sink2 [new Agent/TCPSink]
$ns attach-agent $W(1) $tcp2
$ns attach-agent $node(2) $sink2
$ns connect $tcp2 $sink2
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
#$tcp2 set fid_ 1
#$sink2 set fid_ 1
#$ns at 120.0 "$ftp2 start"



$ns at 50.0 "$node(2) setdest 40.0 65.0 8.0"
$ns at 40.0 "$node(1) setdest 20.0 35.0 8.0"
$ns at 30.0 "$node(0) setdest 50.0 35.0 8.0"
$ns at 80.0 "$node(1) setdest 95.0 95.0 8.0"
$ns at 84.0 "$node(0) setdest 10.0 35.0 8.0"
$ns at 150.0 "$node(1) setdest 125.0 70.0 8.0"
$ns at 160.0 "$node(0) setdest 10.0 60.0 8.0"
$ns at 155.0 "$node(2) setdest 100.0 1.0 16.0"
$ns at 125.0 "$node(1) setdest 125.0 125.0 8.0"

$god set-dist 1 2 2
$god set-dist 0 2 3
$god set-dist 0 1 1

$BS(0) set Z_ 0.0
$BS(0) set Y_ 0.0
$BS(0) set X_ 80.0
$node(2) set Z_ 0.000000000000
$node(2) set Y_ 0.0
$node(2) set X_ 50.0
$node(1) set Z_ 0.000000000000
$node(1) set Y_ 0.0
$node(1) set X_ 30.0
$node(0) set Z_ 0.000000000000
$node(0) set Y_ 0.0
$node(0) set X_ 0.0

for {set i 0} {$i < $opt(nn)} {incr i} {

    $ns initial_node_pos $node($i) 5
}     

for {set i } {$i < $opt(nn) } {incr i} {
    $ns at $opt(stop).0 "$node($i) reset";
}
$ns at $opt(stop).0 "$BS(0) reset";

$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 Hybrid_1.nam &
exit 1
}

puts "Starting Simulation..."
$ns run

The changes i made in my next program trying to use two base stations.

AddrParams set domain_num_ 4
lappend cluster_num 2 1 2 1             
AddrParams set cluster_num_ $cluster_num
lappend eilastlevel 1 1 4 1 1 4
AddrParams set nodes_num_ $eilastlevel 

set temp {0.0.0 0.1.0 2.0.0 2.1.0}        
for {set i 0} {$i < $num_wired_nodes} {incr i} {
    set W($i) [$ns node [lindex $temp $i]] 
}

set temp {1.0.0 1.0.1 1.0.2 1.0.3 3.0.0 3.0.1 3.0.2 3.0.3}   

set BS(0) [$ns node [lindex $temp 0]]
$BS(0) random-motion 0               

set BS(1) [$ns node [lindex $temp 4]]
$BS(1) random-motion 0               


$BS(0) set X_ 1.0
$BS(0) set Y_ 2.0
$BS(0) set Z_ 0.0
$BS(0) color blue
$BS(0) shape hexagon

$BS(1) set X_ 101.0
$BS(1) set Y_ 102.0
$BS(1) set Z_ 0.0
$BS(1) color blue
$BS(1) shape hexagon

$ns node-config -wiredRouting OFF

  for {set j 0} {$j < 3} {incr j} {
    set node($j) [ $ns node [lindex $temp \
        [expr $j+1]] ]
    $node($j) base-station [AddrParams addr2id \
        [$BS(0) node-addr]]
}

for {set j 3} {$j < 6} {incr j} {
    set node($j) [ $ns node [lindex $temp \
        [expr $j+1]] ]
    $node($j) base-station [AddrParams addr2id \
        [$BS(1) node-addr]]
}


$ns duplex-link $W(0) $W(1) 5Mb 2ms DropTail
$ns duplex-link $W(1) $BS(0) 5Mb 2ms DropTail

$ns duplex-link-op $W(0) $W(1) orient down
$ns duplex-link-op $W(1) $BS(0) orient left-down
$ns duplex-link $W(2) $W(3) 5Mb 2ms DropTail
$ns duplex-link $W(3) $BS(1) 5Mb 2ms DropTail

$ns duplex-link-op $W(2) $W(3) orient down
$ns duplex-link-op $W(3) $BS(1) orient left-down

Including the above changes said, i also made some necessary addition of tcl code for movement of nodes and the packet transfers between base stations.

Is it not possible to simulate networks with multiple base stations using ns2.? I am using ns2.34 in ubuntu.

Thanks

Vinaychalluru