I'm trying a very simple wireless simulation while I'm learning to use
ns-2. The output of it seems to show the wireless transmissions happening
instantly:
s 10.000000000 _0_ AGT --- 4 cbr 1000 [0 0 0 0] ------- [0:0 1:0 32 0]
[0] 0 0
r 10.000000000 _0_ RTR --- 4 cbr 1000 [0 0 0 0] ------- [0:0 1:0 32 0]
[0] 0 0
s 10.000000000 _0_ AGT --- 5 cbr 500 [0 0 0 0] ------- [0:0 1:0 32 0] [1]
0 0
r 10.000000000 _0_ RTR --- 5 cbr 500 [0 0 0 0] ------- [0:0 1:0 32 0] [1]
0 0
s 11.000000000 _0_ AGT --- 8 cbr 1000 [0 0 0 0] ------- [0:0 1:0 32 0]
[2] 0 0
r 11.000000000 _0_ RTR --- 8 cbr 1000 [0 0 0 0] ------- [0:0 1:0 32 0]
[2] 0 0
s 11.000000000 _0_ AGT --- 9 cbr 500 [0 0 0 0] ------- [0:0 1:0 32 0] [3] 0
I'm actually trying to simulate down to 1200 baud, but it just appears to
ignore the speed setting. Could anyone help with what I am missing? My
script is attached at the end.
Paul Vincent Craven
[EMAIL PROTECTED]
# ======================================================================
# Define options
# ======================================================================
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
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ll) LL ;# link layer type
set val(ant) Antenna/OmniAntenna ;# antenna model
set val(ifqlen) 50 ;# max packet in ifq
set val(nn) 2 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
# ======================================================================
# Main Program
# ======================================================================
#
# Initialize Global Variables
#
set ns_ [new Simulator]
set tracefd [open simple.tr w]
$ns_ trace-all $tracefd
# set up topography object
set topo [new Topography]
$topo load_flatgrid 500 500
Mac/802_11 set PLCPDataRate_ 1200
Mac/802_11 set debug_ 1
#
# Create God
#
create-god $val(nn)
# 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) \
-channelType $val(chan) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF
# Create 2 nodes
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0 ;# disable random motion
}
# Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0
$node_(1) set X_ 390.0
$node_(1) set Y_ 385.0
$node_(1) set Z_ 0.0
# Set data transmission
set tcp1 [new Agent/UDP]
set sink1 [new Agent/Null]
$ns_ attach-agent $node_(0) $tcp1
$ns_ attach-agent $node_(1) $sink1
$ns_ connect $tcp1 $sink1
set data1 [new Application/Traffic/CBR]
$data1 set packetSize_ 1500
$data1 set interval_ 1.0
$data1 attach-agent $tcp1
$ns_ at 10.0 "$data1 start"
#
# Tell nodes when the simulation ends
#
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 150.0 "$node_($i) reset";
}
$ns_ at 150.0 "stop"
$ns_ at 150.01 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
global ns_ tracefd
$ns_ flush-trace
close $tracefd
}
puts "Starting Simulation..."
$ns_ run