Hai Everybody,

                   I hav written tcl script for creating 10 nodes in wireless 
topology.But while running the script the xgraph is not generated and i has 
open nam file in animater then it shows the simulation.I hereby attached my tcl 
script with this mail.pls suggest me some guidelines regarding the trace and 
nam files.




set
val(chan)   Channel/WirelessChannel

set
val(prop)   Propagation/TwoRayGround

set
val(netif)  Phy/WirelessPhy

set val(mac)    Mac/802_11

set val(ifq)    Queue/DropTail/PriQueue

set val(ll)     LL

set val(ant)    Antenna/OmniAntenna

set val(ifqlen)
50

set val(nn)     10

set val(rp)     DSDV

set val(x)      500

set val(y)      400

set
val(stop)   150

set ns [new
Simulator]

set tracefd [open
fwd.tr w]

set windowVsTime2
[open fwdg.tr w]

set namtrace
[open fwd.nam w]

$ns trace-all
$tracefd

$ns namtrace-all-wireless
$namtrace $val(x) $val(y)

set topo [new
Topography]

$topo
load_flatgrid $val(x) $val(y)

set god
[create-god 10]

set chan_1_ [new
$val(chan)]

set chan_2_ [new
$val(chan)]

$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 $chan_1_\

                -topoInstance $topo\

                -agentTrace ON\

                -routerTrace ON\

                -macTrace ON\

                -movementTrace ON

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

        set node_($i) [$ns node]

}

$node_(0) set X_
5.0

$node_(0) set Y_
5.0

$node_(1) set X_
200.0

$node_(1) set Y_
5.0

$node_(2) set X_
272.0

$node_(2) set Y_
349.0

$node_(3) set X_
40.0

$node_(3) set Y_
263

$node_(4) set X_
110.0

$node_(4) set Y_
210.0

$node_(5) set X_
450.0

$node_(5) set Y_
300.0

$node_(6) set X_
185.0

$node_(6) set Y_
400.0

$node_(7) set X_
20.0

$node_(7) set Y_
220.0

$node_(8) set X_
100.0

$node_(8) set Y_
120.0

$node_(9) set X_
300.0

$node_(9) set Y_
270.0

$ns duplex-link
$node_(0) $node_(1) 1Mb 10ms DropTail

$ns duplex-link
$node_(0) $node_(2) 1Mb 10ms SFQ

$ns duplex-link
$node_(1) $node_(2) 1Mb 10ms DropTail

$ns duplex-link
$node_(1) $node_(3) 1Mb 10ms SFQ

$ns duplex-link
$node_(2) $node_(3) 1Mb 10ms DropTail

$ns duplex-link
$node_(3) $node_(4) 1Mb 10ms SFQ

$ns duplex-link
$node_(4) $node_(5) 1Mb 10ms DropTail

$ns duplex-link
$node_(5) $node_(6) 1Mb 10ms SFQ

$ns duplex-link
$node_(6) $node_(7) 1Mb 10ms DropTail

$ns duplex-link
$node_(7) $node_(8) 1Mb 10ms SFQ

$ns duplex-link
$node_(8) $node_(9) 1Mb 10ms DropTail

$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 $chan_1_\

                -topoInstance $topo\

                -agentTrace ON\

                -routerTrace ON\

                -macTrace ON\

                -movementTrace ON

$ns duplex-link-op
$node_(0) $node_(1) orient right

$ns
duplex-link-op $node_(0) $node_(2) orient left-up

$ns
duplex-link-op $node_(1) $node_(2) orient left-up

$ns
duplex-link-op $node_(1) $node_(3) orient right-up

$ns
duplex-link-op $node_(2) $node_(3) orient right-up

$ns
duplex-link-op $node_(3) $node_(4) orient right-up

$ns
duplex-link-op $node_(4) $node_(5) orient right

$ns
duplex-link-op $node_(5) $node_(6) orient right

$ns
duplex-link-op $node_(6) $node_(7) orient right-down

$ns
duplex-link-op $node_(7) $node_(8) orient left-down

$ns
duplex-link-op $node_(8) $node_(9) orient left-down

#$ns rtproto
Static

set tcp0 [new
Agent/TCP/Newreno]

$tcp0 set class_
2

#$tcp set window_
2000

#Agent/TCPSink/DelAck
set interval_ 100ms

set sink [new
Agent/TCPSink]

$ns attach-agent
$node_(0) $tcp0

$ns attach-agent
$node_(9) $sink

$ns connect $tcp0
$sink

$tcp0 set fid_ 1

set ftp [new
Application/FTP]

$ftp attach-agent
$tcp0

$ns at 1.0
"$ftp start"

proc record {tcp
file} {

        global ns

        set time 0.1

        set cwnd [$tcp set cwnd_]

        set now [$ns now]

        puts $file "$now $cwnd"

        $ns at [expr $now+$time] "record
$tcp $file" }

        $ns at 1.1 "record $tcp0
$windowVsTime2"

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

$ns
initial_node_pos $node_($i) 30

}

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

        $ns at $val(stop) "$node_($i)
reset";

}

$ns at $val(stop)
"$ns nam-end-wireless $val(stop)"

$ns at $val(stop)
"stop"

$ns at 150.01
"puts \"end simulation\" ; $ns halt"

proc stop {} {

        global ns tracefd namtrace

        $ns flush-trace

        close $tracefd

        close $namtrace

        exec nam $namtrace &

        exec xgraph $tracefd -t "Packet
flow" -x "Time" -y "Packets" &

        exit 0

}

$ns run

 

 Thanks

 





      Try the new Yahoo! India Homepage. Click here. http://in.yahoo.com/trynew

Reply via email to