Simulasi Dan Analisis Kinerja Zigbee Pada Jaringan Sensor Wireless

Lampiran 1 File TCL Skema Simulasi A dengan receive rate 0,95
# Generate Parameters
set val(chan)
Channel/WirelessChannel
set val(prop)
Propagation/Shadowing
set val(netif)
Phy/WirelessPhy/802_15_4
set val(mac)
Mac/802_15_4
set val(ifq)
Queue/DropTail/PriQueue
set val(ll)
LL
set val(ant)
Antenna/OmniAntenna
set val(ifqlen)
10
set val(nn)
11
set val(rp)

AODV
set val(x)
3000
set val(y)
3000
set val(stop)
120
Phy/WirelessPhy set RXThresh_ 1.87848e-11

;# channel type
;#radio-propagation model
;# network interface type
# MAC type
;# interface queue type
;# link layer type
;# antenna model
;# max packet in ifq
;# number of mobilenodes
;# protocol type
;#X dimension of topography

;#Y dimension of topography
;# simulation period
;# -r 0.95

# Header
set ns
[new Simulator]
set tracefd
[open trace-star.tr w]
set namtrace
[open nam-star.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
# Set up topography object
set topo
[new Topography]
$topo load_flatgrid $val(x) $val(y)
set god_ [create-god $val(nn)]
# Configure the 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 \
for {set i 0} {$i < $val(nn) } { incr i } {
set mnode_($i) [$ns node]
}
# Position of mobilenode
$mnode_(0) set X_ 1200.0
$mnode_(0) set Y_ 1200.0

Universitas Sumatera Utara

$mnode_(0) set Z_ 0.0

$mnode_(0) label "PAN Coord"
$mnode_(1) set X_ 1350.0
$mnode_(1) set Y_ 1200.0
$mnode_(1) set Z_ 0.0
$mnode_(2) set X_ 1050.0
$mnode_(2) set Y_ 1459.8
$mnode_(2) set Z_ 0.0
$mnode_(3) set X_ 1500.0
$mnode_(3) set Y_ 864.59
$mnode_(3) set Z_ 0.0
$mnode_(4) set X_ 1600.0
$mnode_(4) set Y_ 1647.21
$mnode_(4) set Z_ 0.0
$mnode_(5) set X_ 800.0
$mnode_(5) set Y_ 565.57
$mnode_(5) set Z_ 0.0
$mnode_(6) set X_ 300.0
$mnode_(6) set Y_ 1200.0
$mnode_(6) set Z_ 0.0
$mnode_(7) set X_ 1900.0

$mnode_(7) set Y_ 1982.62
$mnode_(7) set Z_ 0.0
$mnode_(8) set X_ 1200.0
$mnode_(8) set Y_ 0.0
$mnode_(8) set Z_ 0.0
$mnode_(9) set X_ 400.0
$mnode_(9) set Y_ 112.57
$mnode_(9) set Z_ 0.0
$mnode_(10) set X_ 1200.0
$mnode_(10) set Y_ 2700.0
$mnode_(10) set Z_ 0.0
for {set i 0} {$i < $val(nn)} { incr i } {
$ns initial_node_pos $mnode_($i) 20
}
#Setup a UDP connection
set udp1 [new Agent/UDP]

Universitas Sumatera Utara

$ns attach-agent $mnode_(2) $udp1

set sink1 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink1
$ns connect $udp1 $sink1
$udp1 set fid_ 1
set udp2 [new Agent/UDP]
$ns attach-agent $mnode_(4) $udp2
set sink2 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink2
$ns connect $udp2 $sink2
$udp2 set fid_ 2
set udp3 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp3
set sink3 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink3
$ns connect $udp3 $sink3
$udp3 set fid_ 3
set udp4 [new Agent/UDP]
$ns attach-agent $mnode_(8) $udp4
set sink4 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink4

$ns connect $udp4 $sink4
$udp4 set fid_ 4
set udp5 [new Agent/UDP]
$ns attach-agent $mnode_(10) $udp5
set sink5 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink5
$ns connect $udp5 $sink5
$udp5 set fid_ 5
#Setup a TCP connection
set tcp1 [new Agent/TCP]
$ns attach-agent $mnode_(1) $tcp1
set sink6 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink6
$ns connect $tcp1 $sink6
$tcp1 set fid_ 6
$sink6 set fid_ 6
$tcp1 set packetSize_ 24
set tcp2 [new Agent/TCP]
$ns attach-agent $mnode_(3) $tcp2
set sink7 [new Agent/TCPSink]

$ns attach-agent $mnode_(0) $sink7
$ns connect $tcp2 $sink7

Universitas Sumatera Utara

$tcp2 set fid_ 7
$sink7 set fid_ 7
$tcp2 set packetSize_ 24
set tcp3 [new Agent/TCP]
$ns attach-agent $mnode_(5) $tcp3
set sink8 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink8
$ns connect $tcp3 $sink8
$tcp3 set fid_ 8
$sink8 set fid_ 8
$tcp3 set packetSize_ 24
set tcp4 [new Agent/TCP]
$ns attach-agent $mnode_(7) $tcp4
set sink9 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink9

$ns connect $tcp4 $sink9
$tcp4 set fid_ 9
$sink9 set fid_ 9
$tcp4 set packetSize_ 24
set tcp5 [new Agent/TCP]
$ns attach-agent $mnode_(9) $tcp5
set sink10 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink10
$ns connect $tcp5 $sink10
$tcp5 set fid_ 10
$sink10 set fid_ 10
$tcp5 set packetSize_ 24
#Setup a CBR over UDP connection
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set type_ CBR
$cbr1 set packet_size_ 24
$cbr1 set rate_ 448Kb
$cbr1 set interval_ 0.5
set cbr2 [new Application/Traffic/CBR]

$cbr2 attach-agent $udp2
$cbr2 set type_ CBR
$cbr2 set packet_size_ 24
$cbr2 set rate_ 448Kb
$cbr2 set interval_ 0.5
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
$cbr3 set type_ CBR

Universitas Sumatera Utara

$cbr3 set packet_size_ 24
$cbr3 set rate_ 448Kb
$cbr3 set interval_ 0.5
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
$cbr4 set type_ CBR
$cbr4 set packet_size_ 24
$cbr4 set rate_ 448Kb
$cbr4 set interval_ 0.5

set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
$cbr5 set type_ CBR
$cbr5 set packet_size_ 24
$cbr5 set rate_ 448Kb
$cbr5 set interval_ 0.5
#Setup a FTP over TCP connection
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
set ftp4 [new Application/FTP]
$ftp4 attach-agent $tcp4
set ftp5 [new Application/FTP]
$ftp5 attach-agent $tcp5
# Time Event for -r 0.95
$ns at 1.0 "$cbr1 start"
$ns at 22.0 "$cbr1 stop"
$ns at 22.0 "$ftp1 start"
$ns at 23.0 "$ftp1 stop"
$ns at 24.0 "$cbr2 start"
$ns at 45.0 "$cbr2 stop"
$ns at 46.0 "$ftp2 start"
$ns at 47.0 "$ftp2 stop"
$ns at 48.0 "$cbr3 start"
$ns at 70.0 "$cbr3 stop"
$ns at 71.0 "$ftp3 start"
$ns at 71.5 "$ftp3 stop"
$ns at 72.0 "$cbr4 start"
$ns at 95.0 "$cbr4 stop"
$ns at 96.0 "$ftp4 start"
$ns at 97.0 "$ftp4 stop"
$ns at 98.0 "$cbr5 start"
$ns at 115.0 "$cbr5 stop"

Universitas Sumatera Utara

# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$mnode_($i) reset;"
}
# Ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at [expr $val(stop) + 0.01] "puts \"end simulation\"; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam nam-star.nam &
exec awk -f filter.awk trace-star.tr &
}
$ns run

Universitas Sumatera Utara

Lampiran 2 File TCL Skema Simulasi A dengan receive rate 0,9
# Generate Parameters
set val(chan)
Channel/WirelessChannel
set val(prop)
Propagation/Shadowing
set val(netif)
Phy/WirelessPhy/802_15_4
set val(mac)
Mac/802_15_4
set val(ifq)
Queue/DropTail/PriQueue
set val(ll)
LL
set val(ant)
Antenna/OmniAntenna
set val(ifqlen)
10
set val(nn)
11
set val(rp)
AODV
set val(x)
3000
set val(y)
3000
set val(stop)
120
Phy/WirelessPhy set RXThresh_ 2.62499e-11

;# channel type
;#radio-propagation model
;# network interface type
;# MAC type
;# interface queue type
;# link layer type
;# antenna model
;# max packet in ifq
;# number of mobilenodes
;# protocol type
;#X dimension of topography
;#Y dimension of topography
;# simulation period
;# -r 0.9

# Header
set ns
[new Simulator]
set tracefd
[open trace-star.tr w]
set namtrace
[open nam-star.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
# Set up topography object
set topo
[new Topography]
$topo load_flatgrid $val(x) $val(y)
set god_ [create-god $val(nn)]
# Configure the 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 \
for {set i 0} {$i < $val(nn) } { incr i } {
set mnode_($i) [$ns node]
}
# Position of mobilenode
$mnode_(0) set X_ 1200.0
$mnode_(0) set Y_ 1200.0

Universitas Sumatera Utara

$mnode_(0) set Z_ 0.0
$mnode_(0) label "PAN Coord"
$mnode_(1) set X_ 1350.0
$mnode_(1) set Y_ 1200.0
$mnode_(1) set Z_ 0.0
$mnode_(2) set X_ 1050.0
$mnode_(2) set Y_ 1459.8
$mnode_(2) set Z_ 0.0
$mnode_(3) set X_ 1500.0
$mnode_(3) set Y_ 864.59
$mnode_(3) set Z_ 0.0
$mnode_(4) set X_ 1600.0
$mnode_(4) set Y_ 1647.21
$mnode_(4) set Z_ 0.0
$mnode_(5) set X_ 800.0
$mnode_(5) set Y_ 565.57
$mnode_(5) set Z_ 0.0
$mnode_(6) set X_ 300.0
$mnode_(6) set Y_ 1200.0
$mnode_(6) set Z_ 0.0
$mnode_(7) set X_ 1900.0
$mnode_(7) set Y_ 1982.62
$mnode_(7) set Z_ 0.0
$mnode_(8) set X_ 1200.0
$mnode_(8) set Y_ 0.0
$mnode_(8) set Z_ 0.0
$mnode_(9) set X_ 400.0
$mnode_(9) set Y_ 112.57
$mnode_(9) set Z_ 0.0
$mnode_(10) set X_ 1200.0
$mnode_(10) set Y_ 2700.0
$mnode_(10) set Z_ 0.0
for {set i 0} {$i < $val(nn)} { incr i } {
$ns initial_node_pos $mnode_($i) 20
}
#Setup a UDP connection
set udp1 [new Agent/UDP]

Universitas Sumatera Utara

$ns attach-agent $mnode_(2) $udp1
set sink1 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink1
$ns connect $udp1 $sink1
$udp1 set fid_ 1
set udp2 [new Agent/UDP]
$ns attach-agent $mnode_(4) $udp2
set sink2 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink2
$ns connect $udp2 $sink2
$udp2 set fid_ 2
set udp3 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp3
set sink3 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink3
$ns connect $udp3 $sink3
$udp3 set fid_ 3
set udp4 [new Agent/UDP]
$ns attach-agent $mnode_(8) $udp4
set sink4 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink4
$ns connect $udp4 $sink4
$udp4 set fid_ 4
set udp5 [new Agent/UDP]
$ns attach-agent $mnode_(10) $udp5
set sink5 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink5
$ns connect $udp5 $sink5
$udp5 set fid_ 5
#Setup a TCP connection
set tcp1 [new Agent/TCP]
$ns attach-agent $mnode_(1) $tcp1
set sink6 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink6
$ns connect $tcp1 $sink6
$tcp1 set fid_ 6
$sink6 set fid_ 6
$tcp1 set packetSize_ 24
set tcp2 [new Agent/TCP]
$ns attach-agent $mnode_(3) $tcp2
set sink7 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink7
$ns connect $tcp2 $sink7

Universitas Sumatera Utara

$tcp2 set fid_ 7
$sink7 set fid_ 7
$tcp2 set packetSize_ 24
set tcp3 [new Agent/TCP]
$ns attach-agent $mnode_(5) $tcp3
set sink8 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink8
$ns connect $tcp3 $sink8
$tcp3 set fid_ 8
$sink8 set fid_ 8
$tcp3 set packetSize_ 24
set tcp4 [new Agent/TCP]
$ns attach-agent $mnode_(7) $tcp4
set sink9 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink9
$ns connect $tcp4 $sink9
$tcp4 set fid_ 9
$sink9 set fid_ 9
$tcp4 set packetSize_ 24
set tcp5 [new Agent/TCP]
$ns attach-agent $mnode_(9) $tcp5
set sink10 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink10
$ns connect $tcp5 $sink10
$tcp5 set fid_ 10
$sink10 set fid_ 10
$tcp5 set packetSize_ 24
#Setup a CBR over UDP connection
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set type_ CBR
$cbr1 set packet_size_ 24
$cbr1 set rate_ 448Kb
$cbr1 set interval_ 0.5
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
$cbr2 set type_ CBR
$cbr2 set packet_size_ 24
$cbr2 set rate_ 448Kb
$cbr2 set interval_ 0.5
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
$cbr3 set type_ CBR

Universitas Sumatera Utara

$cbr3 set packet_size_ 24
$cbr3 set rate_ 448Kb
$cbr3 set interval_ 0.5
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
$cbr4 set type_ CBR
$cbr4 set packet_size_ 24
$cbr4 set rate_ 448Kb
$cbr4 set interval_ 0.5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
$cbr5 set type_ CBR
$cbr5 set packet_size_ 24
$cbr5 set rate_ 448Kb
$cbr5 set interval_ 0.5
#Setup a FTP over TCP connection
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
set ftp4 [new Application/FTP]
$ftp4 attach-agent $tcp4
set ftp5 [new Application/FTP]
$ftp5 attach-agent $tcp5
# Time Event for -r 0.9
$ns at 1.0 "$cbr1 start"
$ns at 22.0 "$cbr1 stop"
$ns at 22.0 "$ftp1 start"
$ns at 23.0 "$ftp1 stop"
$ns at 24.0 "$cbr2 start"
$ns at 45.0 "$cbr2 stop"
$ns at 46.0 "$ftp2 start"
$ns at 46.5 "$ftp2 stop"
$ns at 47.0 "$cbr3 start"
$ns at 70.0 "$cbr3 stop"
$ns at 71.0 "$ftp3 start"
$ns at 71.5 "$ftp3 stop"
$ns at 72.0 "$cbr4 start"
$ns at 82.0 "$cbr4 stop"
$ns at 83.0 "$ftp4 start"
$ns at 83.5 "$ftp4 stop"
$ns at 84.0 "$cbr5 start"
$ns at 110.0 "$cbr5 stop"

Universitas Sumatera Utara

$ns at 111.0 "$ftp5 start"
$ns at 111.615 "$ftp5 stop"
# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$mnode_($i) reset;"
}
# Ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at [expr $val(stop) + 0.01] "puts \"end simulation\"; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam nam-star.nam &
exec awk -f filter.awk trace-star.tr &
}
$ns run

Universitas Sumatera Utara

Lampiran 3 File TCL Skema Simulasi A dengan receive rate 0,8
# Generate Parameters
set val(chan)
Channel/WirelessChannel
set val(prop)
Propagation/Shadowing
set val(netif)
Phy/WirelessPhy/802_15_4
set val(mac)
Mac/802_15_4
set val(ifq)
Queue/DropTail/PriQueue
set val(ll)
LL
set val(ant)
Antenna/OmniAntenna
set val(ifqlen)
10
set val(nn)
11
set val(rp)
AODV
set val(x)
3000
set val(y)
3000
set val(stop)
120
Phy/WirelessPhy set RXThresh_ 3.9364e-11

;# channel type
;#radio-propagation model
;# network interface type
;# MAC type
;# interface queue type
;# link layer type
;# antenna model
;# max packet in ifq
;# number of mobilenodes
;# protocol type
;#X dimension of topography
;#Y dimension of topography
;# simulation period
;# -r 0.8

# Header
set ns
[new Simulator]
set tracefd
[open trace-star.tr w]
set namtrace
[open nam-star.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)

# Set up topography object
set topo
[new Topography]
$topo load_flatgrid $val(x) $val(y)
set god_ [create-god $val(nn)]
# Configure the 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 \
for {set i 0} {$i < $val(nn) } { incr i } {
set mnode_($i) [$ns node]
}
# Position of mobilenode
$mnode_(0) set X_ 1200.0

Universitas Sumatera Utara

$mnode_(0) set Y_ 1200.0
$mnode_(0) set Z_ 0.0
$mnode_(0) label "PAN Coord"
$mnode_(1) set X_ 1350.0
$mnode_(1) set Y_ 1200.0
$mnode_(1) set Z_ 0.0
$mnode_(2) set X_ 1050.0
$mnode_(2) set Y_ 1459.8
$mnode_(2) set Z_ 0.0
$mnode_(3) set X_ 1500.0
$mnode_(3) set Y_ 864.59
$mnode_(3) set Z_ 0.0
$mnode_(4) set X_ 1600.0
$mnode_(4) set Y_ 1647.21
$mnode_(4) set Z_ 0.0
$mnode_(5) set X_ 800.0
$mnode_(5) set Y_ 565.57
$mnode_(5) set Z_ 0.0
$mnode_(6) set X_ 300.0
$mnode_(6) set Y_ 1200.0
$mnode_(6) set Z_ 0.0
$mnode_(7) set X_ 1900.0
$mnode_(7) set Y_ 1982.62
$mnode_(7) set Z_ 0.0
$mnode_(8) set X_ 1200.0
$mnode_(8) set Y_ 0.0
$mnode_(8) set Z_ 0.0
$mnode_(9) set X_ 400.0
$mnode_(9) set Y_ 112.57
$mnode_(9) set Z_ 0.0
$mnode_(10) set X_ 1200.0
$mnode_(10) set Y_ 2700.0
$mnode_(10) set Z_ 0.0
for {set i 0} {$i < $val(nn)} { incr i } {
$ns initial_node_pos $mnode_($i) 20
}

Universitas Sumatera Utara

#Setup a UDP connection
set udp1 [new Agent/UDP]
$ns attach-agent $mnode_(2) $udp1
set sink1 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink1
$ns connect $udp1 $sink1
$udp1 set fid_ 1
set udp2 [new Agent/UDP]
$ns attach-agent $mnode_(4) $udp2
set sink2 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink2
$ns connect $udp2 $sink2
$udp2 set fid_ 2
set udp3 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp3
set sink3 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink3
$ns connect $udp3 $sink3
$udp3 set fid_ 3
set udp4 [new Agent/UDP]
$ns attach-agent $mnode_(8) $udp4
set sink4 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink4
$ns connect $udp4 $sink4
$udp4 set fid_ 4
set udp5 [new Agent/UDP]
$ns attach-agent $mnode_(10) $udp5
set sink5 [new Agent/Null]
$ns attach-agent $mnode_(0) $sink5
$ns connect $udp5 $sink5
$udp5 set fid_ 5
#Setup a TCP connection
set tcp1 [new Agent/TCP]
$ns attach-agent $mnode_(1) $tcp1
set sink6 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink6
$ns connect $tcp1 $sink6
$tcp1 set fid_ 6
$sink6 set fid_ 6
$tcp1 set packetSize_ 24
set tcp2 [new Agent/TCP]
$ns attach-agent $mnode_(3) $tcp2
set sink7 [new Agent/TCPSink]

Universitas Sumatera Utara

$ns attach-agent $mnode_(0) $sink7
$ns connect $tcp2 $sink7
$tcp2 set fid_ 7
$sink7 set fid_ 7
$tcp2 set packetSize_ 24
set tcp3 [new Agent/TCP]
$ns attach-agent $mnode_(5) $tcp3
set sink8 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink8
$ns connect $tcp3 $sink8
$tcp3 set fid_ 8
$sink8 set fid_ 8
$tcp3 set packetSize_ 24
set tcp4 [new Agent/TCP]
$ns attach-agent $mnode_(7) $tcp4
set sink9 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink9
$ns connect $tcp4 $sink9
$tcp4 set fid_ 9
$sink9 set fid_ 9
$tcp4 set packetSize_ 24
set tcp5 [new Agent/TCP]
$ns attach-agent $mnode_(9) $tcp5
set sink10 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink10
$ns connect $tcp5 $sink10
$tcp5 set fid_ 10
$sink10 set fid_ 10
$tcp5 set packetSize_ 24
#Setup a CBR over UDP connection
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set type_ CBR
$cbr1 set packet_size_ 24
$cbr1 set rate_ 448Kb
$cbr1 set interval_ 0.5
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
$cbr2 set type_ CBR
$cbr2 set packet_size_ 24
$cbr2 set rate_ 448Kb
$cbr2 set interval_ 0.5
set cbr3 [new Application/Traffic/CBR]

Universitas Sumatera Utara

$cbr3 attach-agent $udp3
$cbr3 set type_ CBR
$cbr3 set packet_size_ 24
$cbr3 set rate_ 448Kb
$cbr3 set interval_ 0.5
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
$cbr4 set type_ CBR
$cbr4 set packet_size_ 24
$cbr4 set rate_ 448Kb
$cbr4 set interval_ 0.5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
$cbr5 set type_ CBR
$cbr5 set packet_size_ 24
$cbr5 set rate_ 448Kb
$cbr5 set interval_ 0.5
#Setup a FTP over TCP connection
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
set ftp4 [new Application/FTP]
$ftp4 attach-agent $tcp4
set ftp5 [new Application/FTP]
$ftp5 attach-agent $tcp5
Time Event for -r 0.8
$ns at 1.0 "$cbr1 start"
$ns at 22.0 "$cbr1 stop"
$ns at 22.0 "$ftp1 start"
$ns at 23.0 "$ftp1 stop"
$ns at 24.0 "$cbr2 start"
$ns at 45.0 "$cbr2 stop"
$ns at 46.0 "$ftp2 start"
$ns at 46.5 "$ftp2 stop"
$ns at 47.0 "$cbr3 start"
$ns at 70.0 "$cbr3 stop"
$ns at 71.0 "$ftp3 start"
$ns at 71.5 "$ftp3 stop"
$ns at 72.0 "$cbr4 start"
$ns at 95.0 "$cbr4 stop"
$ns at 96.0 "$ftp4 start"
$ns at 96.5 "$ftp4 stop"

Universitas Sumatera Utara

$ns at 97.0 "$cbr5 start"
$ns at 109.0 "$cbr5 stop"
$ns at 110.0 "$ftp5 start"
$ns at 110.25 "$ftp5 stop"
# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$mnode_($i) reset;"
}
# Ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at [expr $val(stop) + 0.01] "puts \"end simulation\"; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam nam-star.nam &
exec awk -f filter.awk trace-star.tr &
}
$ns run

Universitas Sumatera Utara

Lampiran 4 File TCL Skema Simulasi B dengan receive rate 0,95
# Generate Parameters
set val(chan)
Channel/WirelessChannel
set val(prop)
Propagation/Shadowing
set val(netif)
Phy/WirelessPhy/802_15_4
set val(mac)
Mac/802_15_4
set val(ifq)
Queue/DropTail/PriQueue
set val(ll)
LL
set val(ant)
Antenna/OmniAntenna
set val(ifqlen)
10
set val(nn)
11
set val(rp)
AODV
set val(x)
3000
set val(y)
3000
set val(stop)
120
Phy/WirelessPhy set RXThresh_ 4.22658e-11

;# channel type
;# radio-propagation model
;# network interface type
;# MAC type
;# interface queue type
;# link layer type
;# antenna model
;# max packet in ifq
;# number of mobilenodes
;# protocol type
;# X dimension of topography
;# Y dimension of topography
;# simulation period
;# -r 0.95

# Header
set ns
[new Simulator]
set tracefd
[open trace-mesh.tr w]
set namtrace
[open nam-mesh.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
# Set up topography object
set topo
[new Topography]
$topo load_flatgrid $val(x) $val(y)
set god_ [create-god $val(nn)]
# Configure the 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 \
for {set i 0} {$i < $val(nn) } { incr i } {
set mnode_($i) [$ns node]
}
# Position of mobilenode
$mnode_(0) set X_ 331.66
$mnode_(0) set Y_ 2500.0

Universitas Sumatera Utara

$mnode_(0) set Z_ 0.0
$mnode_(1) set X_ 1331.66
$mnode_(1) set Y_ 2500.0
$mnode_(1) set Z_ 0.0
$mnode_(2) set X_ 2331.66
$mnode_(2) set Y_ 2500.0
$mnode_(2) set Z_ 0.0
$mnode_(3) set X_ 0.0
$mnode_(3) set Y_ 2000.0
$mnode_(3) set Z_ 0.0
$mnode_(4) set X_ 1000.0
$mnode_(4) set Y_ 2000.0
$mnode_(4) set Z_ 0.0
$mnode_(5) set X_ 1500.0
$mnode_(5) set Y_ 2000.0
$mnode_(5) set Z_ 0.0
$mnode_(6) set X_ 2000.0
$mnode_(6) set Y_ 2000.0
$mnode_(6) set Z_ 0.0
$mnode_(7) set X_ 3000.0
$mnode_(7) set Y_ 2000.0
$mnode_(7) set Z_ 0.0
$mnode_(8) set X_ 624.5
$mnode_(8) set Y_ 1500.0
$mnode_(8) set Z_ 0.0
$mnode_(9) set X_ 1624.5
$mnode_(9) set Y_ 1500.0
$mnode_(9) set Z_ 0.0
$mnode_(10) set X_ 2624.5
$mnode_(10) set Y_ 1500.0
$mnode_(10) set Z_ 0.0
for {set i 0} {$i < $val(nn)} { incr i } {
$ns initial_node_pos $mnode_($i) 20
}
#Setup a UDP connection
set udp1 [new Agent/UDP]
$ns attach-agent $mnode_(0) $udp1

Universitas Sumatera Utara

set sink1 [new Agent/Null]
$ns attach-agent $mnode_(1) $sink1
$ns connect $udp1 $sink1
$udp1 set fid_ 1
set udp2 [new Agent/UDP]
$ns attach-agent $mnode_(1) $udp2
set sink2 [new Agent/Null]
$ns attach-agent $mnode_(2) $sink2
$ns connect $udp2 $sink2
$udp2 set fid_ 2
set udp3 [new Agent/UDP]
$ns attach-agent $mnode_(2) $udp3
set sink3 [new Agent/Null]
$ns attach-agent $mnode_(7) $sink3
$ns connect $udp3 $sink3
$udp3 set fid_ 3
set udp4 [new Agent/UDP]
$ns attach-agent $mnode_(7) $udp4
set sink4 [new Agent/Null]
$ns attach-agent $mnode_(10) $sink4
$ns connect $udp4 $sink4
$udp4 set fid_ 4
set udp5 [new Agent/UDP]
$ns attach-agent $mnode_(2) $udp5
set sink5 [new Agent/Null]
$ns attach-agent $mnode_(6) $sink5
$ns connect $udp5 $sink5
$udp5 set fid_ 5
set udp6 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp6
set sink6 [new Agent/Null]
$ns attach-agent $mnode_(9) $sink6
$ns connect $udp6 $sink6
$udp6 set fid_ 6
set udp7 [new Agent/UDP]
$ns attach-agent $mnode_(10) $udp7
set sink7 [new Agent/Null]
$ns attach-agent $mnode_(6) $sink7
$ns connect $udp7 $sink7
$udp7 set fid_ 7
set udp8 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp8

Universitas Sumatera Utara

set sink8 [new Agent/Null]
$ns attach-agent $mnode_(1) $sink8
$ns connect $udp8 $sink8
$udp8 set fid_ 8
set udp9 [new Agent/UDP]
$ns attach-agent $mnode_(7) $udp9
set sink9 [new Agent/Null]
$ns attach-agent $mnode_(6) $sink9
$ns connect $udp9 $sink9
$udp9 set fid_ 9
set udp10 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp10
set sink10 [new Agent/Null]
$ns attach-agent $mnode_(5) $sink10
$ns connect $udp10 $sink10
$udp10 set fid_ 10
#Setup a TCP connection
set tcp1 [new Agent/TCP]
$ns attach-agent $mnode_(1) $tcp1
set sink11 [new Agent/TCPSink]
$ns attach-agent $mnode_(4) $sink11
$ns connect $tcp1 $sink11
$tcp1 set fid_ 11
$sink11 set fid_ 11
$tcp1 set packetSize_ 24
set tcp2 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp2
set sink12 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink12
$ns connect $tcp2 $sink12
$tcp2 set fid_ 12
$sink12 set fid_ 12
$tcp2 set packetSize_ 24
set tcp3 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp3
set sink13 [new Agent/TCPSink]
$ns attach-agent $mnode_(5) $sink13
$ns connect $tcp3 $sink13
$tcp3 set fid_ 13
$sink13 set fid_ 13
$tcp3 set packetSize_ 24
set tcp4 [new Agent/TCP]
$ns attach-agent $mnode_(0) $tcp4

Universitas Sumatera Utara

set sink14 [new Agent/TCPSink]
$ns attach-agent $mnode_(3) $sink14
$ns connect $tcp4 $sink14
$tcp4 set fid_ 14
$sink14 set fid_ 14
$tcp4 set packetSize_ 24
set tcp5 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp5
set sink15 [new Agent/TCPSink]
$ns attach-agent $mnode_(3) $sink15
$ns connect $tcp5 $sink15
$tcp5 set fid_ 15
$sink15 set fid_ 15
$tcp5 set packetSize_ 24
set tcp6 [new Agent/TCP]
$ns attach-agent $mnode_(3) $tcp6
set sink16 [new Agent/TCPSink]
$ns attach-agent $mnode_(8) $sink16
$ns connect $tcp6 $sink16
$tcp6 set fid_ 16
$sink16 set fid_ 16
$tcp6 set packetSize_ 24
set tcp7 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp7
set sink17 [new Agent/TCPSink]
$ns attach-agent $mnode_(8) $sink17
$ns connect $tcp7 $sink17
$tcp7 set fid_ 17
$sink17 set fid_ 17
$tcp7 set packetSize_ 24
set tcp8 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp8
set sink18 [new Agent/TCPSink]
$ns attach-agent $mnode_(9) $sink18
$ns connect $tcp8 $sink18
$tcp8 set fid_ 18
$sink18 set fid_ 18
$tcp8 set packetSize_ 24
set tcp9 [new Agent/TCP]
$ns attach-agent $mnode_(8) $tcp9
set sink19 [new Agent/TCPSink]
$ns attach-agent $mnode_(9) $sink19
$ns connect $tcp9 $sink19
$tcp9 set fid_ 19

Universitas Sumatera Utara

$sink19 set fid_ 19
$tcp9 set packetSize_ 24
set tcp10 [new Agent/TCP]
$ns attach-agent $mnode_(9) $tcp10
set sink20 [new Agent/TCPSink]
$ns attach-agent $mnode_(10) $sink20
$ns connect $tcp10 $sink20
$tcp10 set fid_ 20
$sink20 set fid_ 20
$tcp10 set packetSize_ 24
#Setup a CBR over UDP connection
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set type_ CBR
$cbr1 set packet_size_ 24
$cbr1 set rate_ 448Kb
$cbr1 set interval_ 0.5
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
$cbr2 set type_ CBR
$cbr2 set packet_size_ 24
$cbr2 set rate_ 448Kb
$cbr2 set interval_ 0.5
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
$cbr3 set type_ CBR
$cbr3 set packet_size_ 24
$cbr3 set rate_ 448Kb
$cbr3 set interval_ 0.5
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
$cbr4 set type_ CBR
$cbr4 set packet_size_ 24
$cbr4 set rate_ 448Kb
$cbr4 set interval_ 0.5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
$cbr5 set type_ CBR
$cbr5 set packet_size_ 24
$cbr5 set rate_ 448Kb
$cbr5 set interval_ 0.5
set cbr6 [new Application/Traffic/CBR]

Universitas Sumatera Utara

$cbr6 attach-agent $udp6
$cbr6 set type_ CBR
$cbr6 set packet_size_ 24
$cbr6 set rate_ 448Kb
$cbr6 set interval_ 0.5
set cbr7 [new Application/Traffic/CBR]
$cbr7 attach-agent $udp7
$cbr7 set type_ CBR
$cbr7 set packet_size_ 24
$cbr7 set rate_ 448Kb
$cbr7 set interval_ 0.5
set cbr8 [new Application/Traffic/CBR]
$cbr8 attach-agent $udp8
$cbr8 set type_ CBR
$cbr8 set packet_size_ 24
$cbr8 set rate_ 448Kb
$cbr8 set interval_ 0.5
set cbr9 [new Application/Traffic/CBR]
$cbr9 attach-agent $udp9
$cbr9 set type_ CBR
$cbr9 set packet_size_ 24
$cbr9 set rate_ 448Kb
$cbr9 set interval_ 0.5
set cbr10 [new Application/Traffic/CBR]
$cbr10 attach-agent $udp10
$cbr10 set type_ CBR
$cbr10 set packet_size_ 24
$cbr10 set rate_ 448Kb
$cbr10 set interval_ 0.5
#Setup a FTP over TCP connection
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
set ftp4 [new Application/FTP]
$ftp4 attach-agent $tcp4
set ftp5 [new Application/FTP]
$ftp5 attach-agent $tcp5
set ftp6 [new Application/FTP]
$ftp6 attach-agent $tcp6
set ftp7 [new Application/FTP]
$ftp7 attach-agent $tcp7

Universitas Sumatera Utara

set ftp8 [new Application/FTP]
$ftp8 attach-agent $tcp8
set ftp9 [new Application/FTP]
$ftp9 attach-agent $tcp9
set ftp10 [new Application/FTP]
$ftp10 attach-agent $tcp10
# Time Event for -r 0.95
$ns at 1.0 "$cbr1 start"
$ns at 10.0 "$cbr1 stop"
$ns at 11.0 "$cbr2 start"
$ns at 20.0 "$cbr2 stop"
$ns at 21.0 "$cbr3 start"
$ns at 30.0 "$cbr3 stop"
$ns at 31.0 "$cbr4 start"
$ns at 40.0 "$cbr4 stop"
$ns at 41.0 "$cbr5 start"
$ns at 50.0 "$cbr5 stop"
$ns at 51.0 "$cbr6 start"
$ns at 60.0 "$cbr6 stop"
$ns at 61.0 "$cbr7 start"
$ns at 70.0 "$cbr7 stop"
$ns at 71.0 "$cbr8 start"
$ns at 80.0 "$cbr8 stop"
$ns at 81.0 "$cbr9 start"
$ns at 90.0 "$cbr9 stop"
$ns at 91.0 "$cbr10 start"
$ns at 100.0 "$cbr10 stop"
#$ns at 101.0 "$ftp1 start"
#$ns at 101.6 "$ftp1 stop"
#$ns at 102.0 "$ftp2 start"
#$ns at 102.6 "$ftp2 stop"
#$ns at 103.0 "$ftp3 start"
#$ns at 103.6 "$ftp3 stop"
#$ns at 104.0 "$ftp4 start"
#$ns at 104.5 "$ftp4 stop"
#$ns at 105.0 "$ftp5 start"
#$ns at 105.5 "$ftp5 stop"
#$ns at 106.0 "$ftp6 start"
#$ns at 106.5 "$ftp6 stop"
#$ns at 107.0 "$ftp7 start"
#$ns at 107.5 "$ftp7 stop"
#$ns at 108.0 "$ftp8 start"
#$ns at 108.5 "$ftp8 stop"
#$ns at 109.0 "$ftp9 start"
#$ns at 114.0 "$ftp9 stop"
#$ns at 115.0 "$ftp10 start"
#$ns at 119.0 "$ftp10 stop"

Universitas Sumatera Utara

# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$mnode_($i) reset;"
}
# Ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at [expr $val(stop) + 0.01] "puts \"end simulation\"; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam nam-mesh.nam &
exec awk -f filter.awk trace-mesh.tr &
}
$ns run

Universitas Sumatera Utara

Lampiran 5 File TCL Skema Simulasi B dengan receive rate 0,9
# Generate Parameters
set val(chan)
Channel/WirelessChannel
set val(prop)
Propagation/Shadowing
set val(netif)
Phy/WirelessPhy/802_15_4
set val(mac)
Mac/802_15_4
set val(ifq)
Queue/DropTail/PriQueue
set val(ll)
LL
set val(ant)
Antenna/OmniAntenna
set val(ifqlen)
10
set val(nn)
11
set val(rp)
AODV
set val(x)
3000
set val(y)
3000
set val(stop)
120
Phy/WirelessPhy set RXThresh_ 5.90622e-11

;# channel type
;# radio-propagation model
;# network interface type
;# MAC type
;# interface queue type
;# link layer type
;# antenna model
;# max packet in ifq
;# number of mobilenodes
;# protocol type
;# X dimension of topography
;# Y dimension of topography
;# simulation period
;# -r 0.9

# Header
set ns
[new Simulator]
set tracefd
[open trace-mesh.tr w]
set namtrace
[open nam-mesh.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
# Set up topography object
set topo
[new Topography]
$topo load_flatgrid $val(x) $val(y)
set god_ [create-god $val(nn)]
# Configure the 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 \
for {set i 0} {$i < $val(nn) } { incr i } {
set mnode_($i) [$ns node]
}
# Position of mobilenode
$mnode_(0) set X_ 331.66
$mnode_(0) set Y_ 2500.0

Universitas Sumatera Utara

$mnode_(0) set Z_ 0.0
$mnode_(1) set X_ 1331.66
$mnode_(1) set Y_ 2500.0
$mnode_(1) set Z_ 0.0
$mnode_(2) set X_ 2331.66
$mnode_(2) set Y_ 2500.0
$mnode_(2) set Z_ 0.0
$mnode_(3) set X_ 0.0
$mnode_(3) set Y_ 2000.0
$mnode_(3) set Z_ 0.0
$mnode_(4) set X_ 1000.0
$mnode_(4) set Y_ 2000.0
$mnode_(4) set Z_ 0.0
$mnode_(5) set X_ 1500.0
$mnode_(5) set Y_ 2000.0
$mnode_(5) set Z_ 0.0
$mnode_(6) set X_ 2000.0
$mnode_(6) set Y_ 2000.0
$mnode_(6) set Z_ 0.0
$mnode_(7) set X_ 3000.0
$mnode_(7) set Y_ 2000.0
$mnode_(7) set Z_ 0.0
$mnode_(8) set X_ 624.5
$mnode_(8) set Y_ 1500.0
$mnode_(8) set Z_ 0.0
$mnode_(9) set X_ 1624.5
$mnode_(9) set Y_ 1500.0
$mnode_(9) set Z_ 0.0
$mnode_(10) set X_ 2624.5
$mnode_(10) set Y_ 1500.0
$mnode_(10) set Z_ 0.0
for {set i 0} {$i < $val(nn)} { incr i } {
$ns initial_node_pos $mnode_($i) 20
}
#Setup a UDP connection
set udp1 [new Agent/UDP]
$ns attach-agent $mnode_(0) $udp1

Universitas Sumatera Utara

set sink1 [new Agent/Null]
$ns attach-agent $mnode_(1) $sink1
$ns connect $udp1 $sink1
$udp1 set fid_ 1
set udp2 [new Agent/UDP]
$ns attach-agent $mnode_(1) $udp2
set sink2 [new Agent/Null]
$ns attach-agent $mnode_(2) $sink2
$ns connect $udp2 $sink2
$udp2 set fid_ 2
set udp3 [new Agent/UDP]
$ns attach-agent $mnode_(2) $udp3
set sink3 [new Agent/Null]
$ns attach-agent $mnode_(7) $sink3
$ns connect $udp3 $sink3
$udp3 set fid_ 3
set udp4 [new Agent/UDP]
$ns attach-agent $mnode_(7) $udp4
set sink4 [new Agent/Null]
$ns attach-agent $mnode_(10) $sink4
$ns connect $udp4 $sink4
$udp4 set fid_ 4
set udp5 [new Agent/UDP]
$ns attach-agent $mnode_(2) $udp5
set sink5 [new Agent/Null]
$ns attach-agent $mnode_(6) $sink5
$ns connect $udp5 $sink5
$udp5 set fid_ 5
set udp6 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp6
set sink6 [new Agent/Null]
$ns attach-agent $mnode_(9) $sink6
$ns connect $udp6 $sink6
$udp6 set fid_ 6
set udp7 [new Agent/UDP]
$ns attach-agent $mnode_(10) $udp7
set sink7 [new Agent/Null]
$ns attach-agent $mnode_(6) $sink7
$ns connect $udp7 $sink7
$udp7 set fid_ 7
set udp8 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp8

Universitas Sumatera Utara

set sink8 [new Agent/Null]
$ns attach-agent $mnode_(1) $sink8
$ns connect $udp8 $sink8
$udp8 set fid_ 8
set udp9 [new Agent/UDP]
$ns attach-agent $mnode_(7) $udp9
set sink9 [new Agent/Null]
$ns attach-agent $mnode_(6) $sink9
$ns connect $udp9 $sink9
$udp9 set fid_ 9
set udp10 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp10
set sink10 [new Agent/Null]
$ns attach-agent $mnode_(5) $sink10
$ns connect $udp10 $sink10
$udp10 set fid_ 10
#Setup a TCP connection
set tcp1 [new Agent/TCP]
$ns attach-agent $mnode_(1) $tcp1
set sink11 [new Agent/TCPSink]
$ns attach-agent $mnode_(4) $sink11
$ns connect $tcp1 $sink11
$tcp1 set fid_ 11
$sink11 set fid_ 11
$tcp1 set packetSize_ 24
set tcp2 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp2
set sink12 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink12
$ns connect $tcp2 $sink12
$tcp2 set fid_ 12
$sink12 set fid_ 12
$tcp2 set packetSize_ 24
set tcp3 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp3
set sink13 [new Agent/TCPSink]
$ns attach-agent $mnode_(5) $sink13
$ns connect $tcp3 $sink13
$tcp3 set fid_ 13
$sink13 set fid_ 13
$tcp3 set packetSize_ 24
set tcp4 [new Agent/TCP]
$ns attach-agent $mnode_(0) $tcp4

Universitas Sumatera Utara

set sink14 [new Agent/TCPSink]
$ns attach-agent $mnode_(3) $sink14
$ns connect $tcp4 $sink14
$tcp4 set fid_ 14
$sink14 set fid_ 14
$tcp4 set packetSize_ 24
set tcp5 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp5
set sink15 [new Agent/TCPSink]
$ns attach-agent $mnode_(3) $sink15
$ns connect $tcp5 $sink15
$tcp5 set fid_ 15
$sink15 set fid_ 15
$tcp5 set packetSize_ 24
set tcp6 [new Agent/TCP]
$ns attach-agent $mnode_(3) $tcp6
set sink16 [new Agent/TCPSink]
$ns attach-agent $mnode_(8) $sink16
$ns connect $tcp6 $sink16
$tcp6 set fid_ 16
$sink16 set fid_ 16
$tcp6 set packetSize_ 24
set tcp7 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp7
set sink17 [new Agent/TCPSink]
$ns attach-agent $mnode_(8) $sink17
$ns connect $tcp7 $sink17
$tcp7 set fid_ 17
$sink17 set fid_ 17
$tcp7 set packetSize_ 24
set tcp8 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp8
set sink18 [new Agent/TCPSink]
$ns attach-agent $mnode_(9) $sink18
$ns connect $tcp8 $sink18
$tcp8 set fid_ 18
$sink18 set fid_ 18
$tcp8 set packetSize_ 24
set tcp9 [new Agent/TCP]
$ns attach-agent $mnode_(8) $tcp9
set sink19 [new Agent/TCPSink]
$ns attach-agent $mnode_(9) $sink19
$ns connect $tcp9 $sink19
$tcp9 set fid_ 19

Universitas Sumatera Utara

$sink19 set fid_ 19
$tcp9 set packetSize_ 24
set tcp10 [new Agent/TCP]
$ns attach-agent $mnode_(9) $tcp10
set sink20 [new Agent/TCPSink]
$ns attach-agent $mnode_(10) $sink20
$ns connect $tcp10 $sink20
$tcp10 set fid_ 20
$sink20 set fid_ 20
$tcp10 set packetSize_ 24
#Setup a CBR over UDP connection
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set type_ CBR
$cbr1 set packet_size_ 24
$cbr1 set rate_ 448Kb
$cbr1 set interval_ 0.5
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
$cbr2 set type_ CBR
$cbr2 set packet_size_ 24
$cbr2 set rate_ 448Kb
$cbr2 set interval_ 0.5
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
$cbr3 set type_ CBR
$cbr3 set packet_size_ 24
$cbr3 set rate_ 448Kb
$cbr3 set interval_ 0.5
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
$cbr4 set type_ CBR
$cbr4 set packet_size_ 24
$cbr4 set rate_ 448Kb
$cbr4 set interval_ 0.5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
$cbr5 set type_ CBR
$cbr5 set packet_size_ 24
$cbr5 set rate_ 448Kb
$cbr5 set interval_ 0.5
set cbr6 [new Application/Traffic/CBR]

Universitas Sumatera Utara

$cbr6 attach-agent $udp6
$cbr6 set type_ CBR
$cbr6 set packet_size_ 24
$cbr6 set rate_ 448Kb
$cbr6 set interval_ 0.5
set cbr7 [new Application/Traffic/CBR]
$cbr7 attach-agent $udp7
$cbr7 set type_ CBR
$cbr7 set packet_size_ 24
$cbr7 set rate_ 448Kb
$cbr7 set interval_ 0.5
set cbr8 [new Application/Traffic/CBR]
$cbr8 attach-agent $udp8
$cbr8 set type_ CBR
$cbr8 set packet_size_ 24
$cbr8 set rate_ 448Kb
$cbr8 set interval_ 0.5
set cbr9 [new Application/Traffic/CBR]
$cbr9 attach-agent $udp9
$cbr9 set type_ CBR
$cbr9 set packet_size_ 24
$cbr9 set rate_ 448Kb
$cbr9 set interval_ 0.5
set cbr10 [new Application/Traffic/CBR]
$cbr10 attach-agent $udp10
$cbr10 set type_ CBR
$cbr10 set packet_size_ 24
$cbr10 set rate_ 448Kb
$cbr10 set interval_ 0.5
#Setup a FTP over TCP connection
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
set ftp4 [new Application/FTP]
$ftp4 attach-agent $tcp4
set ftp5 [new Application/FTP]
$ftp5 attach-agent $tcp5
set ftp6 [new Application/FTP]
$ftp6 attach-agent $tcp6
set ftp7 [new Application/FTP]
$ftp7 attach-agent $tcp7

Universitas Sumatera Utara

set ftp8 [new Application/FTP]
$ftp8 attach-agent $tcp8
set ftp9 [new Application/FTP]
$ftp9 attach-agent $tcp9
set ftp10 [new Application/FTP]
$ftp10 attach-agent $tcp10
# Time Event for -r 0.9
$ns at 1.0 "$cbr1 start"
$ns at 10.0 "$cbr1 stop"
$ns at 11.0 "$cbr2 start"
$ns at 20.0 "$cbr2 stop"
$ns at 21.0 "$cbr3 start"
$ns at 30.0 "$cbr3 stop"
$ns at 31.0 "$cbr4 start"
$ns at 40.0 "$cbr4 stop"
$ns at 41.0 "$cbr5 start"
$ns at 50.0 "$cbr5 stop"
$ns at 51.0 "$cbr6 start"
$ns at 60.0 "$cbr6 stop"
$ns at 61.0 "$cbr7 start"
$ns at 70.0 "$cbr7 stop"
$ns at 71.0 "$cbr8 start"
$ns at 80.0 "$cbr8 stop"
$ns at 81.0 "$cbr9 start"
$ns at 90.0 "$cbr9 stop"
$ns at 91.0 "$cbr10 start"
$ns at 100.0 "$cbr10 stop"
$ns at 101.0 "$ftp1 start"
$ns at 101.6 "$ftp1 stop"
$ns at 102.0 "$ftp2 start"
$ns at 102.6 "$ftp2 stop"
$ns at 103.0 "$ftp3 start"
$ns at 103.6 "$ftp3 stop"
$ns at 104.0 "$ftp4 start"
$ns at 104.6 "$ftp4 stop"
$ns at 105.0 "$ftp5 start"
$ns at 105.6 "$ftp5 stop"
$ns at 106.0 "$ftp6 start"
$ns at 106.6 "$ftp6 stop"
$ns at 107.0 "$ftp7 start"
$ns at 107.6 "$ftp7 stop"
$ns at 108.0 "$ftp8 start"
$ns at 108.6 "$ftp8 stop"
$ns at 109.0 "$ftp9 start"
$ns at 109.6 "$ftp9 stop"
$ns at 110.0 "$ftp10 start"
$ns at 110.72 "$ftp10 stop"

Universitas Sumatera Utara

# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$mnode_($i) reset;"
}
# Ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at [expr $val(stop) + 0.01] "puts \"end simulation\"; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam nam-mesh.nam &
exec awk -f filter.awk trace-mesh.tr &
}
$ns run

Universitas Sumatera Utara

Lampiran 6 File TCL Skema Simulasi B dengan receive rate 0,8
# Generate Parameters
set val(chan)
Channel/WirelessChannel
set val(prop)
Propagation/Shadowing
set val(netif)
Phy/WirelessPhy/802_15_4
set val(mac)
Mac/802_15_4
set val(ifq)
Queue/DropTail/PriQueue
set val(ll)
LL
set val(ant)
Antenna/OmniAntenna
set val(ifqlen)
10
set val(nn)
11
set val(rp)
AODV
set val(x)
3000
set val(y)
3000
set val(stop)
120
Phy/WirelessPhy set RXThresh_ 8.8569e-11

;# channel type
;# radio-propagation model
;# network interface type
;# MAC type
;# interface queue type
;# link layer type
;# antenna model
;# max packet in ifq
;# number of mobilenodes
;# protocol type
;# X dimension of topography
;# Y dimension of topography
;# simulation period
;# -r 0.8

# Header
set ns
[new Simulator]
set tracefd
[open trace-mesh.tr w]
set namtrace
[open nam-mesh.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
# Set up topography object
set topo
[new Topography]
$topo load_flatgrid $val(x) $val(y)
set god_ [create-god $val(nn)]
# Configure the 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 \
for {set i 0} {$i < $val(nn) } { incr i } {
set mnode_($i) [$ns node]
}
# Position of mobilenode
$mnode_(0) set X_ 331.66
$mnode_(0) set Y_ 2500.0

Universitas Sumatera Utara

$mnode_(0) set Z_ 0.0
$mnode_(1) set X_ 1331.66
$mnode_(1) set Y_ 2500.0
$mnode_(1) set Z_ 0.0
$mnode_(2) set X_ 2331.66
$mnode_(2) set Y_ 2500.0
$mnode_(2) set Z_ 0.0
$mnode_(3) set X_ 0.0
$mnode_(3) set Y_ 2000.0
$mnode_(3) set Z_ 0.0
$mnode_(4) set X_ 1000.0
$mnode_(4) set Y_ 2000.0
$mnode_(4) set Z_ 0.0
$mnode_(5) set X_ 1500.0
$mnode_(5) set Y_ 2000.0
$mnode_(5) set Z_ 0.0
$mnode_(6) set X_ 2000.0
$mnode_(6) set Y_ 2000.0
$mnode_(6) set Z_ 0.0
$mnode_(7) set X_ 3000.0
$mnode_(7) set Y_ 2000.0
$mnode_(7) set Z_ 0.0
$mnode_(8) set X_ 624.5
$mnode_(8) set Y_ 1500.0
$mnode_(8) set Z_ 0.0
$mnode_(9) set X_ 1624.5
$mnode_(9) set Y_ 1500.0
$mnode_(9) set Z_ 0.0
$mnode_(10) set X_ 2624.5
$mnode_(10) set Y_ 1500.0
$mnode_(10) set Z_ 0.0
for {set i 0} {$i < $val(nn)} { incr i } {
$ns initial_node_pos $mnode_($i) 20
}
#Setup a UDP connection
set udp1 [new Agent/UDP]
$ns attach-agent $mnode_(0) $udp1

Universitas Sumatera Utara

set sink1 [new Agent/Null]
$ns attach-agent $mnode_(1) $sink1
$ns connect $udp1 $sink1
$udp1 set fid_ 1
set udp2 [new Agent/UDP]
$ns attach-agent $mnode_(1) $udp2
set sink2 [new Agent/Null]
$ns attach-agent $mnode_(2) $sink2
$ns connect $udp2 $sink2
$udp2 set fid_ 2
set udp3 [new Agent/UDP]
$ns attach-agent $mnode_(2) $udp3
set sink3 [new Agent/Null]
$ns attach-agent $mnode_(7) $sink3
$ns connect $udp3 $sink3
$udp3 set fid_ 3
set udp4 [new Agent/UDP]
$ns attach-agent $mnode_(7) $udp4
set sink4 [new Agent/Null]
$ns attach-agent $mnode_(10) $sink4
$ns connect $udp4 $sink4
$udp4 set fid_ 4
set udp5 [new Agent/UDP]
$ns attach-agent $mnode_(2) $udp5
set sink5 [new Agent/Null]
$ns attach-agent $mnode_(6) $sink5
$ns connect $udp5 $sink5
$udp5 set fid_ 5
set udp6 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp6
set sink6 [new Agent/Null]
$ns attach-agent $mnode_(9) $sink6
$ns connect $udp6 $sink6
$udp6 set fid_ 6
set udp7 [new Agent/UDP]
$ns attach-agent $mnode_(10) $udp7
set sink7 [new Agent/Null]
$ns attach-agent $mnode_(6) $sink7
$ns connect $udp7 $sink7
$udp7 set fid_ 7
set udp8 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp8

Universitas Sumatera Utara

set sink8 [new Agent/Null]
$ns attach-agent $mnode_(1) $sink8
$ns connect $udp8 $sink8
$udp8 set fid_ 8
set udp9 [new Agent/UDP]
$ns attach-agent $mnode_(7) $udp9
set sink9 [new Agent/Null]
$ns attach-agent $mnode_(6) $sink9
$ns connect $udp9 $sink9
$udp9 set fid_ 9
set udp10 [new Agent/UDP]
$ns attach-agent $mnode_(6) $udp10
set sink10 [new Agent/Null]
$ns attach-agent $mnode_(5) $sink10
$ns connect $udp10 $sink10
$udp10 set fid_ 10
#Setup a TCP connection
set tcp1 [new Agent/TCP]
$ns attach-agent $mnode_(1) $tcp1
set sink11 [new Agent/TCPSink]
$ns attach-agent $mnode_(4) $sink11
$ns connect $tcp1 $sink11
$tcp1 set fid_ 11
$sink11 set fid_ 11
$tcp1 set packetSize_ 24
set tcp2 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp2
set sink12 [new Agent/TCPSink]
$ns attach-agent $mnode_(0) $sink12
$ns connect $tcp2 $sink12
$tcp2 set fid_ 12
$sink12 set fid_ 12
$tcp2 set packetSize_ 24
set tcp3 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp3
set sink13 [new Agent/TCPSink]
$ns attach-agent $mnode_(5) $sink13
$ns connect $tcp3 $sink13
$tcp3 set fid_ 13
$sink13 set fid_ 13
$tcp3 set packetSize_ 24
set tcp4 [new Agent/TCP]
$ns attach-agent $mnode_(0) $tcp4

Universitas Sumatera Utara

set sink14 [new Agent/TCPSink]
$ns attach-agent $mnode_(3) $sink14
$ns connect $tcp4 $sink14
$tcp4 set fid_ 14
$sink14 set fid_ 14
$tcp4 set packetSize_ 24
set tcp5 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp5
set sink15 [new Agent/TCPSink]
$ns attach-agent $mnode_(3) $sink15
$ns connect $tcp5 $sink15
$tcp5 set fid_ 15
$sink15 set fid_ 15
$tcp5 set packetSize_ 24
set tcp6 [new Agent/TCP]
$ns attach-agent $mnode_(3) $tcp6
set sink16 [new Agent/TCPSink]
$ns attach-agent $mnode_(8) $sink16
$ns connect $tcp6 $sink16
$tcp6 set fid_ 16
$sink16 set fid_ 16
$tcp6 set packetSize_ 24
set tcp7 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp7
set sink17 [new Agent/TCPSink]
$ns attach-agent $mnode_(8) $sink17
$ns connect $tcp7 $sink17
$tcp7 set fid_ 17
$sink17 set fid_ 17
$tcp7 set packetSize_ 24
set tcp8 [new Agent/TCP]
$ns attach-agent $mnode_(4) $tcp8
set sink18 [new Agent/TCPSink]
$ns attach-agent $mnode_(9) $sink18
$ns connect $tcp8 $sink18
$tcp8 set fid_ 18
$sink18 set fid_ 18
$tcp8 set packetSize_ 24
set tcp9 [new Agent/TCP]
$ns attach-agent $mnode_(8) $tcp9
set sink19 [new Agent/TCPSink]
$ns attach-agent $mnode_(9) $sink19
$ns connect $tcp9 $sink19
$tcp9 set fid_ 19

Universitas Sumatera Utara

$sink19 set fid_ 19
$tcp9 set packetSize_ 24
set tcp10 [new Agent/TCP]
$ns attach-agent $mnode_(9) $tcp10
set sink20 [new Agent/TCPSink]
$ns attach-agent $mnode_(10) $sink20
$ns connect $tcp10 $sink20
$tcp10 set fid_ 20
$sink20 set fid_ 20
$tcp10 set packetSize_ 24
#Setup a CBR over UDP connection
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
$cbr1 set type_ CBR
$cbr1 set packet_size_ 24
$cbr1 set rate_ 448Kb
$cbr1 set interval_ 0.5
set cbr2 [new Application/Traffic/CBR]
$cbr2 attach-agent $udp2
$cbr2 set type_ CBR
$cbr2 set packet_size_ 24
$cbr2 set rate_ 448Kb
$cbr2 set interval_ 0.5
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
$cbr3 set type_ CBR
$cbr3 set packet_size_ 24
$cbr3 set rate_ 448Kb
$cbr3 set interval_ 0.5
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
$cbr4 set type_ CBR
$cbr4 set packet_size_ 24
$cbr4 set rate_ 448Kb
$cbr4 set interval_ 0.5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
$cbr5 set type_ CBR
$cbr5 set packet_size_ 24
$cbr5 set rate_ 448Kb
$cbr5 set interval_ 0.5
set cbr6 [new Application/Traffic/CBR]

Universitas Sumatera Utara

$cbr6 attach-agent $udp6
$cbr6 set type_ CBR
$cbr6 set packet_size_ 24
$cbr6 set rate_ 448Kb
$cbr6 set interval_ 0.5
set cbr7 [new Application/Traffic/CBR]
$cbr7 attach-agent $udp7
$cbr7 set type_ CBR
$cbr7 set packet_size_ 24
$cbr7 set rate_ 448Kb
$cbr7 set interval_ 0.5
set cbr8 [new Application/Traffic/CBR]
$cbr8 attach-agent $udp8
$cbr8 set type_ CBR
$cbr8 set packet_size_ 24
$cbr8 set rate_ 448Kb
$cbr8 set interval_ 0.5
set cbr9 [new Application/Traffic/CBR]
$cbr9 attach-agent $udp9
$cbr9 set type_ CBR
$cbr9 set packet_size_ 24
$cbr9 set rate_ 448Kb
$cbr9 set interval_ 0.5
set cbr10 [new Application/Traffic/CBR]
$cbr10 attach-agent $udp10
$cbr10 set type_ CBR
$cbr10 set packet_size_ 24
$cbr10 set rate_ 448Kb
$cbr10 set interval_ 0.5
#Setup a FTP over TCP connection
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
set ftp4 [new Application/FTP]
$ftp4 attach-agent $tcp4
set ftp5 [new Application/FTP]
$ftp5 attach-agent $tcp5
set ftp6 [new Application/FTP]
$ftp6 attach-agent $tcp6
set ftp7 [new Application/FTP]
$ftp7 attach-agent $tcp7

Universitas Sumatera Utara

set ftp8 [new Application/FTP]
$ftp8 attach-agent $tcp8
set ftp9 [new Application/FTP]
$ftp9 attach-agent $tcp9
set ftp10 [new Application/FTP]
$ftp10 attach-agent $tcp10
# Time Event for -r 0.8
$ns at 1.0 "$cbr1 start"
$ns at 10.0 "$cbr1 stop"
$ns at 11.0 "$cbr2 start"
$ns at 20.0 "$cbr2 stop"
$ns at 21.0 "$cbr3 start"
$ns at 30.0 "$cbr3 stop"
$ns at 31.0 "$cbr4 start"
$ns at 40.0 "$cbr4 stop"
$ns at 41.0 "$cbr5 start"
$ns at 50.0 "$cbr5 stop"
$ns at 51.0 "$cbr6 start"
$ns at 60.0 "$cbr6 stop"
$ns at 61.0 "$cbr7 start"
$ns at 70.0 "$cbr7 stop"
$ns at 71.0 "$cbr8 start"
$ns at 80.0 "$cbr8 stop"
$ns at 81.0 "$cbr9 start"
$ns at 87.5 "$cbr9 stop"
$ns at 91.0 "$cbr10 start"
$ns at 100.0 "$cbr10 stop"
$ns at 101.0 "$ftp1 start"
$ns at 101.7 "$ftp1 stop"
$ns at 102.0 "$ftp2 start"
$ns at 102.6 "$ftp2 stop"
$ns at 103.0 "$ftp3 start"
$ns at 103.5 "$ftp3 stop"
$ns at 104.0 "$ftp4 start"
$ns at 104.3 "$ftp4 stop"
$ns at 105.0 "$ftp5 start"
$ns at 105.5 "$ftp5 stop"
$ns at 106.0 "$ftp6 start"
$ns at 106.5 "$ftp6 stop"
$ns at 107.0 "$ftp7 start"
$ns at 107.5 "$ftp7 stop"
$ns at 108.0 "$ftp8 start"
$ns at 108.5 "$ftp8 stop"
$ns at 109.0 "$ftp9 start"
$ns at 109.5 "$ftp9 stop"
$ns at 110.0 "$ftp10 start"
$ns at 110.5 "$ftp10 stop"

Universitas Sumatera Utara

# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$mnode_($i) reset;"
}
# Ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at [expr $val(stop) + 0.01] "puts \"end simulation\"; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
exec nam nam-mesh.nam &
exec awk -f filter.awk trace-mesh.tr &
}
$ns run

Universitas Sumatera Utar