[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Wired-cum-wireless-sim.tcl -> error when slightly modified




Hello,

I am trying to simulate the wired-cum-wireless scenario, but on running my
script am getting the following error:

Starting Simulation...
--- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
	_o69: no target for slot 1
	_o69 type: Classifier/Addr
content dump:
classifier _o69
	0 offset
	11 shift
	2047 mask
	1 slots
		slot 6: _o70 (Classifier/Addr)
---------- Finished standard no-slot{} default handler ----------

My tcl script is attached with this mail.

It is very similar to wired-cum-wireless-sim.tcl provided in the examples,
except that the topology is changed.

I'm not able to find out what is going wrong.

If you have any idea of what could be the problem, please let me know.

Thanks,
Gaurav.

--/\--/\--/\--/\--/\--/\--/\--/\--/\--/\--/\--/\--

 Gaurav Navlakha
 Graduate Research Assistant
 Centre for Reliable & High Performance Computing
 University of Illinois, Urbana Champaign.

--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--\/--
# 
#  Copyright (c) 1997 by the University of Southern California
#  All rights reserved.
# 
#  Permission to use, copy, modify, and distribute this software and its
#  documentation in source and binary forms for non-commercial purposes
#  and without fee is hereby granted, provided that the above copyright
#  notice appear in all copies and that both the copyright notice and
#  this permission notice appear in supporting documentation. and that
#  any documentation, advertising materials, and other materials related
#  to such distribution and use acknowledge that the software was
#  developed by the University of Southern California, Information
#  Sciences Institute.  The name of the University may not be used to
#  endorse or promote products derived from this software without
#  specific prior written permission.
# 
#  THE UNIVERSITY OF SOUTHERN CALIFORNIA makes no representations about
#  the suitability of this software for any purpose.  THIS SOFTWARE IS
#  PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
#  INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
# 
#  Other copyrights might apply to parts of this software and are so
#  noted when applicable.
# 
# $Header: /nfs/jade/vint/CVSROOT/ns-2/tcl/ex/tcpecn.tcl,v 1.7 1999/10/25 21:58:15 klan Exp $
#
# A simple example for tcp ecn simulation/animation with namgraph support
# This script is adopted from ns-2/tcl/test/test-suite-ecn.tcl

# Modified wired-cum-wireless-sim.tcl to create my topology - Gaurav Navlakha
 
set ns [new Simulator]
 
#
#
# Create a simple six node topology:
#
#      W(0)  W(3)    W(5)    node_(0)
#         \  /          \   /
# 10Mb,2ms \/ 1.5Mb,20ms \ / 10Mb,4ms
#           W(2)---------BS(0) 
# 10Mb,3ms /\             /\ 10Mb,5ms
#         /  \           /  \
#      W(1)  W(4)      W(6)  node_(1) 
#
#
#W(0) through W(6) are "wired" nodes 
#BS(0) is the base station
#node_(0) and node_(1) are the "mobile" nodes (made static by disabling movement

proc UniformErrorProc {} {
	global opt

	set errObj [new ErrorModel]
	$errObj unit bit
	$errObj FECstrength $opt(FECstrength)
	$errObj datapktsize 1000
	$errObj cntrlpktsize 80
	return $errObj
}

proc build_topology { ns } {

	global node_
	global red_queue_buffer_size
	global W
	global BS
	global node_

    $ns duplex-link $W(0) $W(2) 1Mb 2ms RED
    $ns duplex-link $W(1) $W(2) 1Mb 6ms RED
    $ns duplex-link $W(2) $BS(0) 0.5Mb 20ms RED
    $ns queue-limit $W(2) $BS(0) $red_queue_buffer_size
    $ns queue-limit $BS(0) $W(2) $red_queue_buffer_size
    #$ns duplex-link $node_(s3) $node_(r2) 1Mb 4ms RED
    #$ns duplex-link $node_(s4) $node_(r2) 1Mb 5ms RED

	#adding links for cross traffic
    $ns duplex-link $W(3) $W(2) 10Mb 5ms RED
    $ns duplex-link $W(4) $W(2) 10Mb 5ms RED
    $ns duplex-link $W(5) $BS(0) 10Mb 5ms RED
    $ns duplex-link $W(6) $BS(0) 10Mb 5ms RED
 
    $ns duplex-link-op $W(0) $W(2) orient right-down
    $ns duplex-link-op $W(1) $W(2) orient right-up
    $ns duplex-link-op $W(2) $BS(0) orient right
    $ns duplex-link-op $W(2) $BS(0) queuePos 0.5
    $ns duplex-link-op $BS(0) $W(2) queuePos 0.5
    #$ns duplex-link-op $node_(0) $W(3) orient left-down
    #$ns duplex-link-op $node_(1) $W(3) orient left-up
 
    $ns duplex-link-op $W(3) $W(2) orient down
    $ns duplex-link-op $W(4) $W(2) orient up

    $ns duplex-link-op $W(5) $BS(0) orient down
    $ns duplex-link-op $W(6) $BS(0) orient up

}

# This is 'main'

global opt
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(x)			670
set opt(y)			670
set opt(ifqlen)		50
set opt(tr)			wired-and-wireless.proj.tr
set opt(namtr)		wired-and-wireless.proj.nam
set opt(nn)				2 
	set opt(adhocRouting)	DSDV
	set opt(cp)				""
	set opt(sc)		"../mobility/scene/g_scen-3-test"
	set opt(stop)			12	
	set num_wired_nodes		7 
	set num_bs_nodes		1
	set opt(err) 			UniformErrorProc
	set opt(FECstrength)	1

# set up for hierarchical routing
	$ns node-config -addressType hierarchical
	AddrParams set domain_num_ 2
	lappend cluster_num 7 1
	AddrParams set cluster_num_ $cluster_num
	lappend eilastlevel 1 1 1 1 1 1 1 3 
	AddrParams set nodes_num_ $eilastlevel

# Set the main parameters for simulation
set ecn_setting 1
set necn_setting 1

# Set the secondary parameters for 'X' axis
# against which to measure throughput
set window_setting_ 100 
Queue/RED set thresh_ 5
Queue/RED set maxthresh_ 15
Queue/RED set mean_pktsize_ 500 
set red_queue_buffer_size 50 
#Queue/RED set curq_ 0 - can change initial value


## Open Files for tracing, etc...
if {$necn_setting == 1} \
{set data [open wcw.data.necn.tr a]} \
else \
{set data [open wcw.data.tr a]}

if {$necn_setting == 1} \
{set f [open wcw.out.necn.tr w]}\
else \
{set f [open wcw.out.tr w]}

if {$necn_setting == 1} \
{set nf [open wcw.out.necn.nam w]}\
else \
{set nf [open wcw.out.nam w]}

$ns trace-all $f
$ns namtrace-all $nf

## Wireless Topology & God creation
set topo   [new Topography]
$topo load_flatgrid $opt(x) $opt(y)
create-god $opt(nn)

#Create wired nodes
set temp {0.0.0 0.1.0 0.2.0 0.3.0 0.4.0 0.5.0 0.6.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) \
	-propInstance [new $opt(prop)] \
	-phyType $opt(netif) \
	-channel [new $opt(chan)] \
	-topoInstance $topo \
	-wiredRouting ON \
	-agentTrace ON \
	-routerTrace OFF \
	-macTrace OFF \
	-errProc $opt(err)



	# Base Station + Mobile node addresses
	set temp {1.0.0 1.0.1 1.0.2}

	# Base Station
	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

	#Mobile Nodes node_(0), node_(1)
	$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]]
	#$node_($j) random-motion 0
	}


#create links between wired nodes and BS
build_topology $ns

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

	#$ns at $opt(stop).1 "puts \"NS EXITING...\" ; $ns halt"
	$ns at $opt(stop).1 "puts \"NS EXITING...\" ; finish"


#This is to enable RED 'marking' with ECN as opposed to 'dropping' of packets
set redq [[$ns link $W(2) $BS(0)] queue]
$redq set setbit_ true

# Use nam trace format for TCP variable trace 
Agent/TCP set nam_tracevar_ true

#set tcp1 [$ns create-connection TCP/Reno $node_(s1) TCPSink $node_(s3) 0]
set tcp1 [$ns create-connection TCP $W(0) TCPSink $node_(0) 2]
$tcp1 set window_ $window_setting_
$tcp1 set ecn_ $ecn_setting
$tcp1 set necn_ $necn_setting
 
#set tcp2 [$ns create-connection TCP/Reno $node_(s2) TCPSink $node_(s3) 1]
set tcp2 [$ns create-connection TCP $W(1) TCPSink $node_(0) 2]
$tcp2 set window_ $window_setting_
$tcp2 set ecn_ $ecn_setting
$tcp2 set necn_ $necn_setting
 
set tcp3 [$ns create-connection TCP $W(3) TCPSink $W(4) 2]
$tcp3 set window_ $window_setting_
$tcp3 set ecn_ $ecn_setting
$tcp3 set necn_ $necn_setting 
 
set tcp4 [$ns create-connection TCP $W(5) TCPSink $W(6) 2]
$tcp4 set window_ $window_setting_
$tcp4 set ecn_ $ecn_setting
$tcp4 set necn_ $necn_setting

set ftp1 [$tcp1 attach-app FTP]    
set ftp2 [$tcp2 attach-app FTP]

#ftp sources for cross traffic
set ftp3 [$tcp3 attach-app FTP]    
set ftp4 [$tcp4 attach-app FTP]


# Add agent traces and variable trace
$ns add-agent-trace $tcp1 tcp1
$ns add-agent-trace $tcp2 tcp2
$ns monitor-agent-trace $tcp1
$ns monitor-agent-trace $tcp2
$tcp1 tracevar cwnd_
$tcp2 tracevar cwnd_
 
	puts "tcp1 t_seqno = [$tcp1 set t_seqno_]"
	puts "tcp2 t_seqno = [$tcp2 set t_seqno_]"

#$ns at 0.0 "$ftp3 start"
#$ns at 0.0 "$ftp4 start"

#$ns at 2.0 "$ftp3 stop"
#$ns at 2.0 "$ftp4 stop"

#$ns at 4.0 "$ftp3 start"
#$ns at 4.0 "$ftp4 start"

#$ns at 6.0 "$ftp3 stop"
#$ns at 6.0 "$ftp4 stop"

#$ns at 8.0 "$ftp3 start"
#$ns at 8.0 "$ftp4 start"

#$ns at 10.0 "$ftp3 stop"
#$ns at 10.0 "$ftp4 stop"

$ns at 1.0 "$ftp1 start"
$ns at 1.0 "$ftp2 start"

$ns at 12.0 "$ftp1 stop"
$ns at 12.0 "$ftp2 stop"

$ns at 2.0 {
	puts "at 2 seconds"
		puts "tcp1 t_seqno = [$tcp1 set t_seqno_]"
		puts "tcp2 t_seqno = [$tcp2 set t_seqno_]"
		puts "tcp3 t_seqno = [$tcp3 set t_seqno_]"
		puts "tcp4 t_seqno = [$tcp4 set t_seqno_]"
		#puts "tcp3 cwnd_ = [$tcp3 set cwnd_]"
		#puts "tcp4 cwnd_ = [$tcp4 set cwnd_]"
	}
$ns at 4.0 {
	puts "at 4 seconds"
		puts "tcp1 t_seqno = [$tcp1 set t_seqno_]"
		puts "tcp2 t_seqno = [$tcp2 set t_seqno_]"
		puts "tcp3 t_seqno = [$tcp3 set t_seqno_]"
		puts "tcp4 t_seqno = [$tcp4 set t_seqno_]"
		#puts "tcp3 cwnd_ = [$tcp3 set cwnd_]"
		#puts "tcp4 cwnd_ = [$tcp4 set cwnd_]"
	}
$ns at 5.9 {
	puts "at 5.9 seconds"
		puts "tcp1 t_seqno = [$tcp1 set t_seqno_]"
		puts "tcp2 t_seqno = [$tcp2 set t_seqno_]"
		puts "tcp3 t_seqno = [$tcp3 set t_seqno_]"
		puts "tcp4 t_seqno = [$tcp4 set t_seqno_]"
		#puts "tcp3 cwnd_ = [$tcp3 set cwnd_]"
		#puts "tcp4 cwnd_ = [$tcp4 set cwnd_]"
		set current [Queue/RED set curq_]
		puts "average queue r1 = $current"
	}
$ns at 8.0 {
	puts "at 8.0 seconds"
		puts "tcp1 t_seqno = [$tcp1 set t_seqno_]"
		puts "tcp2 t_seqno = [$tcp2 set t_seqno_]"
		puts "tcp3 t_seqno = [$tcp3 set t_seqno_]"
		puts "tcp4 t_seqno = [$tcp4 set t_seqno_]"
		#puts "tcp3 cwnd_ = [$tcp3 set cwnd_]"
		#puts "tcp4 cwnd_ = [$tcp4 set cwnd_]"
	}
$ns at 11.9 {
	puts $data "at 11.9 seconds"
		puts $data "tcp1 t_seqno = [set t1 [$tcp1 set t_seqno_]]"
		puts $data "tcp2 t_seqno = [set t2 [$tcp2 set t_seqno_]]"
		puts $data "tcp3 t_seqno = [set t3 [$tcp3 set t_seqno_]]"
		puts $data "tcp4 t_seqno = [set t4 [$tcp4 set t_seqno_]]"
		puts "tcp1 t_seqno = [set t1 [$tcp1 set t_seqno_]]"
		puts "tcp2 t_seqno = [set t2 [$tcp2 set t_seqno_]]"
		puts "tcp3 t_seqno = [set t3 [$tcp3 set t_seqno_]]"
		puts "tcp4 t_seqno = [set t4 [$tcp4 set t_seqno_]]"
		set tt [ expr $t1 + $t2 + $t3 + $t4]
		set tt_relevant [expr $t1 + $t2]
		puts $data "Total Throughput = $tt"
		puts "Total Throughput = $tt"
		puts $data "Total 1+2 Throughput = $tt_relevant"
		puts "Total 1+2 Throughput = $tt_relevant"
		puts $data "-----------------------------------"
		#puts "tcp3 cwnd_ = [$tcp3 set cwnd_]"
		#puts "tcp4 cwnd_ = [$tcp4 set cwnd_]"
		close $data
	}

puts "Starting Simulation..."
$ns run

proc finish {} {
        global ns f nf
        $ns flush-trace
        close $f
        close $nf
 
        #XXX
        #puts "Filtering ..."
	#exec tclsh8.0 ../nam/bin/namfilter.tcl out.nam

        #puts "running nam..."
        #exec nam out.nam &

        exit 0
}

set god_ [God instance]
$node_(1) set Z_ 0.000000000000
$node_(1) set Y_ 100.00
$node_(1) set X_ 500.00
$node_(0) set Z_ 0.00
$node_(0) set Y_ 0.00
$node_(0) set X_ 0.00