try the following modified code of u r program...it will work. b4 that you
just verfiy whether u have set environment varible in .bashrc or not. all
the beast.
#
#
#This is a sample Tcl script file for using with TeNs
#
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/Shadowing ;# radio-propagation
model
set val(netif) Phy/WirelessPhy;# network interface type
set val(mac)Mac/802_11 ;# MAC type
set val(ifq)Queue/DropTail/PriQueue;# interface queue type
set val(ll) LL ;# link layer type
set val(ant)Antenna/DirAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 4 ;# number of mobilenodes
#One can use AODV also , all other wireless protocols currently don't work
set val(rp) AODV ;# routing protocol
set val(ni) 1
#This type of modulation is a new addition
set opt(mod)Modulation/BPSK
# ==
# Main Program
# ==
#
# Initialize Global Variables
#
set ns_ [new Simulator]
set tracefd [open simple.tr w]
#set par[open param.tr w]
$ns_ trace-all $tracefd
$ns_ use-newtrace
# set up topography object
set topo [new Topography]
$topo load_flatgrid 1 1
#$val(nn)
#
# Create the specified number of mobilenodes [$val(nn)] and attach them
# to the channel.
# Here two nodes are created : node(0) and node(1)
# configure node
$ns_ node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-channel [new $val(chan)] \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-numif $val(ni) \
create-god 6
proc create_node { x y z } {
global ns_
#Mac/802_11 MAC_RTSThreshold 2000
#Mac/802_11 MAC_FragmentationThreshold 2500
#Mac/802_11 DSSS_AirPropagationTime 0.03
Mac/802_11 set dataRate_11mb
Mac/802_11 set basicRate_ 1mb
# This statement can be used to enable BPSK Modulation scheme
# If one does not want to use this then it can be set to zero.
# By default it is set to zero.
Phy/WirelessPhy set modulationscheme_ 1
set newnode [$ns_ node]
$newnode random-motion 0
$newnode set X_ $x
$newnode set Y_ $y
$newnode set Z_ $z
return $newnode
}
proc create_cbr_connection { from to startTime interval packetSize } {
global ns_
set udp0 [new Agent/UDP]
set src [new Application/Traffic/CBR]
$udp0 set packetSize_ $packetSize
$src set packetSize_ $packetSize
$src set interval_ $interval
set sink [new Agent/Null]
$ns_ attach-agent $from $udp0
$src attach-agent $udp0
$ns_ attach-agent $to $sink
$ns_ connect $udp0 $sink
$ns_ at $startTime $src start
return $udp0
}
proc create_tcp_connection { from to startTime } {
#global ns_ par
set tcp [new Agent/TCP]
$tcp set packetSize_ 1500
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns_ attach-agent $from $tcp
$ns_ attach-agent $to $sink
$ns_ connect $tcp $sink
set ftp [new Application/FTP]
$ftp set packetSize_ 1500
$ftp attach-agent $tcp
$ns_ at $startTime $ftp start
$tcp attach $par
$tcp trace cwnd_
$tcp trace maxseq_
$tcp trace rtt_
$tcp trace dupacks_
$tcp trace ack_
$tcp trace ndatabytes_
$tcp trace ndatapack_
$tcp trace nrexmit_
$tcp trace nrexmitpack_
return $tcp
}
$ns_ node-config -numif 1
set node_(0) [create_node 1010 0]
[$node_(0) set netif_(0)] set channel_number_ 1
[$node_(0) set netif_(0)] set Pt_ 0.1
set a [new Antenna/DirAntenna]
$a setType 1
$a setAngle 90
#$a setWidth10
[$node_(0) set netif_(0)] dir-antenna $a
#This is to set the number of interfaces in one node, in this case the no.
of
#interfaces in node is set to 1
$ns_ node-config -numif 2
#This is the way a node is created (situated at