Hi,
my tcl script....
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation
model
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
Mac/802_11 set dataRate_ 11Mb ;# Data Rate 11
Mbps
Mac/802_11 set basicRate_ 1Mb ;# Basic Rate 1
Mbps
Mac/802_11 set SlotTime_ 0.000020 ;# 20us
Mac/802_11 set sifs_ 0.000010 ;# 10us
Mac/802_11 set PreambleLenght_ 144 ;# 144 bits
Mac/802_11 set PLCPHeaderLength_ 48 ;# 48 bits
Mac/802_11 set PLCPDataRate_ 1Mb ;# 1Mbps
set val(ifq) Queue/DropTail ;# interface queue type/PriQueue
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 10 ;# max packet in ifq
set val(nn) 2 ;# number of mobilenodes
set val(rp) DSDV ;# routing protocol DSDV
set ns [new Simulator]
$ns color 0 blue
$ns color 1 red
# set up topography object
set topo [new Topography]
$topo load_flatgrid 400 200
#Open the trace file
set tf [open out.tr w]
#$ns use-newtrace
$ns trace-all $tf
#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all-wireless $nf 400 200
# Create God
create-god $val(nn)
Agent/DSDV set perup_ 15000000 ;# ~ infinite periodic update
$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) \
-channelType $val(chan) \
-topoInstance $topo \
#-agentTrace OFF \
-agentTrace ON \
-routerTrace OFF \
-macTrace ON \
-movementTrace OFF
# Create and configure nodes
set nodeA [$ns node]
$nodeA random-motion 0
$nodeA set X_ 100.0
$nodeA set Y_ 100.0
$nodeA set Z_ 0.0
set nodeB [$ns node]
$nodeB random-motion 0
$nodeB set X_ 300.0
$nodeB set Y_ 100.0
$nodeB set Z_ 0.0
$ns at 0.0 "$nodeA setdest 100.0 100.0 0.0"
$ns at 0.0 "$nodeB setdest 300.0 100.0 0.0"
# Setup UDP Connection
set udpA [new Agent/UDP]
$ns attach-agent $nodeA $udpA
$udpA set packetSize_ 1024
set udpSinkB [new Agent/Null]
$ns attach-agent $nodeB $udpSinkB
$ns connect $udpA $udpSinkB
# Setup CBR over UDP Connection
set cbrA [new Application/Traffic/CBR]
$cbrA attach-agent $udpA
$cbrA set type_ CBR
$cbrA set packetSize_ 1004
$cbrA set rate_ 11Mb
$cbrA set random_ false
# Schedule simulation events
$ns at 1.0 "$cbrA start"
$ns at 31.0 "$cbrA stop"
$ns at 31.0000001 "stop"
$ns at 31.0000002 "puts \"NS EXITING...\" ; $ns halt"
proc stop {} {
global ns tf nf
$ns flush-trace
close $nf
close $tf
exit 0
}
puts "Starting Simulation..."
$ns run
_________________________________________________________________
Customise your home page with RSS feeds at MSN Ireland! http://ie.msn.com/