• Tidak ada hasil yang ditemukan

Simulasi Dan Analisis Kinerja Zigbee Pada Jaringan Sensor Wireless

N/A
N/A
Protected

Academic year: 2017

Membagikan "Simulasi Dan Analisis Kinerja Zigbee Pada Jaringan Sensor Wireless"

Copied!
242
0
0

Teks penuh

(1)

Lampiran 1 File TCL Skema Simulasi A dengan receive rate 0,95

# Generate Parameters

set val(chan) Channel/WirelessChannel ;# channel type

set val(prop) Propagation/Shadowing ;#radio-propagation model set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type set val(mac) Mac/802_15_4 # 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) 10 ;# max packet in ifq set val(nn) 11 ;# number of mobilenodes set val(rp) AODV ;# protocol type

set val(x) 3000 ;#X dimension of topography set val(y) 3000 ;#Y dimension of topography set val(stop) 120 ;# simulation period

Phy/WirelessPhy set RXThresh_ 1.87848e-11 ;# -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]

}

(2)

$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 }

(3)

$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]

(4)

$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

(5)

$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

(6)

# 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 & }

(7)

Lampiran 2 File TCL Skema Simulasi A dengan receive rate 0,9

# Generate Parameters

set val(chan) Channel/WirelessChannel ;# channel type

set val(prop) Propagation/Shadowing ;#radio-propagation model set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type set val(mac) Mac/802_15_4 ;# 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) 10 ;# max packet in ifq set val(nn) 11 ;# number of mobilenodes set val(rp) AODV ;# protocol type

set val(x) 3000 ;#X dimension of topography set val(y) 3000 ;#Y dimension of topography set val(stop) 120 ;# simulation period

Phy/WirelessPhy set RXThresh_ 2.62499e-11 ;# -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]

}

(8)

$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 }

(9)

$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]

(10)

$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

(11)

$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

(12)

$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 & }

(13)

Lampiran 3 File TCL Skema Simulasi A dengan receive rate 0,8

# Generate Parameters

set val(chan) Channel/WirelessChannel ;# channel type

set val(prop) Propagation/Shadowing ;#radio-propagation model set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type set val(mac) Mac/802_15_4 ;# 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) 10 ;# max packet in ifq set val(nn) 11 ;# number of mobilenodes set val(rp) AODV ;# protocol type

set val(x) 3000 ;#X dimension of topography set val(y) 3000 ;#Y dimension of topography set val(stop) 120 ;# simulation period

Phy/WirelessPhy set RXThresh_ 3.9364e-11 ;# -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]

}

(14)

$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

(15)

#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]

(16)

$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

(17)

$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

(18)

$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 & }

(19)

Lampiran 4 File TCL Skema Simulasi B dengan receive rate 0,95

# Generate Parameters

set val(chan) Channel/WirelessChannel ;# channel type

set val(prop) Propagation/Shadowing ;# radio-propagation model set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type set val(mac) Mac/802_15_4 ;# 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) 10 ;# max packet in ifq set val(nn) 11 ;# number of mobilenodes set val(rp) AODV ;# protocol type

set val(x) 3000 ;# X dimension of topography set val(y) 3000 ;# Y dimension of topography set val(stop) 120 ;# simulation period

Phy/WirelessPhy set RXThresh_ 4.22658e-11 ;# -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]

}

(20)

$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]

(21)

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]

(22)

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]

(23)

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

(24)

$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

(25)

$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

(26)
(27)

# 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 & }

(28)

Lampiran 5 File TCL Skema Simulasi B dengan receive rate 0,9

# Generate Parameters

set val(chan) Channel/WirelessChannel ;# channel type

set val(prop) Propagation/Shadowing ;# radio-propagation model set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type set val(mac) Mac/802_15_4 ;# 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) 10 ;# max packet in ifq set val(nn) 11 ;# number of mobilenodes set val(rp) AODV ;# protocol type

set val(x) 3000 ;# X dimension of topography set val(y) 3000 ;# Y dimension of topography set val(stop) 120 ;# simulation period

Phy/WirelessPhy set RXThresh_ 5.90622e-11 ;# -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]

}

(29)

$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]

(30)

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]

(31)

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]

(32)

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

(33)

$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

(34)

$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

(35)
(36)

# 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 & }

(37)

Lampiran 6 File TCL Skema Simulasi B dengan receive rate 0,8

# Generate Parameters

set val(chan) Channel/WirelessChannel ;# channel type

set val(prop) Propagation/Shadowing ;# radio-propagation model set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type set val(mac) Mac/802_15_4 ;# 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) 10 ;# max packet in ifq set val(nn) 11 ;# number of mobilenodes set val(rp) AODV ;# protocol type

set val(x) 3000 ;# X dimension of topography set val(y) 3000 ;# Y dimension of topography set val(stop) 120 ;# simulation period

Phy/WirelessPhy set RXThresh_ 8.8569e-11 ;# -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]

}

(38)

$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]

(39)

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]

(40)

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]

(41)

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

(42)

$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

(43)

$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

(44)
(45)

# 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 & }

(46)

Lampiran 7 File TCL Skema Simulasi C dengan receive rate 0,95

# Generate Parameters

set val(chan) Channel/WirelessChannel ;# channel type

set val(prop) Propagation/Shadowing ;# radio-propagation model set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type set val(mac) Mac/802_15_4 ;# 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) 10 ;# max packet in ifq set val(nn) 11 ;# number of mobilenodes set val(rp) AODV ;# protocol type

set val(x) 3000 ;# X dimension of topography set val(y) 3000 ;# Y dimension of topography set val(stop) 120 ;# simulation period

Phy/WirelessPhy set RXThresh_ 1.87848e-11 ;# -r 0.95 # Header

set ns [new Simulator] set tracefd [open trace-tree.tr w] set namtrace [open nam-tree.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]

}

(47)

$mnode_(0) set Z_ 0.0 $mnode_(1) set X_ 1100.0 $mnode_(1) set Y_ 2700.0 $mnode_(1) set Z_ 0.0 $mnode_(2) set X_ 1900.0 $mnode_(2) set Y_ 2700.0 $mnode_(2) set Z_ 0.0 $mnode_(3) set X_ 500.0 $mnode_(3) set Y_ 1900.0 $mnode_(3) set Z_ 0.0 $mnode_(4) set X_ 1100.0 $mnode_(4) set Y_ 1900.0 $mnode_(4) set Z_ 0.0 $mnode_(5) set X_ 1900.0 $mnode_(5) set Y_ 1900.0 $mnode_(5) set Z_ 0.0 $mnode_(6) set X_ 2500.0 $mnode_(6) set Y_ 1900.0 $mnode_(6) set Z_ 0.0 $mnode_(7) set X_ 500.0 $mnode_(7) set Y_ 400.0 $mnode_(7) set Z_ 0.0 $mnode_(8) set X_ 1100.0 $mnode_(8) set Y_ 700.0 $mnode_(8) set Z_ 0.0 $mnode_(9) set X_ 1900.0 $mnode_(9) set Y_ 700.0 $mnode_(9) set Z_ 0.0 $mnode_(10) set X_ 2500.0 $mnode_(10) set Y_ 400.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]

(48)

set sink1 [new Agent/Null]

$ns attach-agent $mnode_(3) $sink1 $ns connect $udp1 $sink1

$udp1 set fid_ 1

set udp2 [new Agent/UDP]

$ns attach-agent $mnode_(3) $udp2 set sink2 [new Agent/Null]

$ns attach-agent $mnode_(1) $sink2 $ns connect $udp2 $sink2

$udp2 set fid_ 2

set udp3 [new Agent/UDP]

$ns attach-agent $mnode_(1) $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_(0) $udp4 set sink4 [new Agent/Null]

$ns attach-agent $mnode_(2) $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_(5) $sink5 $ns connect $udp5 $sink5

$udp5 set fid_ 5

set udp6 [new Agent/UDP]

$ns attach-agent $mnode_(5) $udp6 set sink6 [new Agent/Null]

$ns attach-agent $mnode_(9) $sink6 $ns connect $udp6 $sink6

$udp6 set fid_ 6

#Setup a TCP connection set tcp1 [new Agent/TCP]

$ns attach-agent $mnode_(10) $tcp1 set sink7 [new Agent/TCPSink] $ns attach-agent $mnode_(6) $sink7 $ns connect $tcp1 $sink7

(49)

set tcp2 [new Agent/TCP]

$ns attach-agent $mnode_(6) $tcp2 set sink8 [new Agent/TCPSink] $ns attach-agent $mnode_(2) $sink8 $ns connect $tcp2 $sink8

$tcp2 set fid_ 8 $sink8 set fid_ 8 $tcp2 set packetSize_ 24 set tcp3 [new Agent/TCP]

$ns attach-agent $mnode_(2) $tcp3 set sink9 [new Agent/TCPSink] $ns attach-agent $mnode_(0) $sink9 $ns connect $tcp3 $sink9

$tcp3 set fid_ 9 $sink9 set fid_ 9 $tcp3 set packetSize_ 24 set tcp4 [new Agent/TCP]

$ns attach-agent $mnode_(0) $tcp4 set sink10 [new Agent/TCPSink] $ns attach-agent $mnode_(1) $sink10 $ns connect $tcp4 $sink10

$tcp4 set fid_ 10 $sink10 set fid_ 10 $tcp4 set packetSize_ 24 set tcp5 [new Agent/TCP]

$ns attach-agent $mnode_(1) $tcp5 set sink11 [new Agent/TCPSink] $ns attach-agent $mnode_(4) $sink11 $ns connect $tcp5 $sink11

$tcp5 set fid_ 11 $sink11 set fid_ 11 $tcp5 set packetSize_ 24 set tcp6 [new Agent/TCP]

$ns attach-agent $mnode_(4) $tcp6 set sink12 [new Agent/TCPSink] $ns attach-agent $mnode_(8) $sink12 $ns connect $tcp6 $sink12

$tcp6 set fid_ 12 $sink12 set fid_ 12 $tcp6 set packetSize_ 24

(50)

$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] $cbr6 attach-agent $udp6

$cbr6 set type_ CBR $cbr6 set packet_size_ 24 $cbr6 set rate_ 448Kb $cbr6 set interval_ 0.5

(51)

set ftp5 [new Application/FTP] $ftp5 attach-agent $tcp5 set ftp6 [new Application/FTP] $ftp6 attach-agent $tcp6 # Time Event for -r 0.95 $ns at 1.0 "$cbr1 start" $ns at 16.0 "$cbr1 stop" $ns at 17.0 "$cbr2 start" $ns at 32.0 "$cbr2 stop" $ns at 33.0 "$cbr3 start" $ns at 48.0 "$cbr3 stop" $ns at 49.0 "$cbr4 start" $ns at 64.0 "$cbr4 stop" $ns at 65.0 "$cbr5 start" $ns at 80.0 "$cbr5 stop" $ns at 81.0 "$cbr6 start" $ns at 96.0 "$cbr6 stop" $ns at 101.0 "$ftp1 start" $ns at 101.5 "$ftp1 stop" $ns at 102.0 "$ftp2 start" $ns at 102.5 "$ftp2 stop" $ns at 103.0 "$ftp3 start" $ns at 103.5 "$ftp3 stop" $ns at 104.0 "$ftp4 start" $ns at 104.4 "$ftp4 stop" $ns at 105.0 "$ftp5 start" $ns at 105.4 "$ftp5 stop" $ns at 106.0 "$ftp6 start" $ns at 106.39 "$ftp6 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-tree.nam &

exec awk -f filter.awk trace-tree.tr & }

(52)

Lampiran 8 File TCL Skema Simulasi C dengan receive rate 0,9

# Generate Parameters

set val(chan) Channel/WirelessChannel ;# channel type

set val(prop) Propagation/Shadowing ;# radio-propagation model set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type set val(mac) Mac/802_15_4 ;# 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) 10 ;# max packet in ifq set val(nn) 11 ;# number of mobilenodes set val(rp) AODV ;# protocol type

set val(x) 3000 ;# X dimension of topography set val(y) 3000 ;# Y dimension of topography set val(stop) 120 ;# simulation period

Phy/WirelessPhy set RXThresh_ 2.62499e-11 ;# -r 0.9 # Header

set ns [new Simulator] set tracefd [open trace-tree.tr w] set namtrace [open nam-tree.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]

}

(53)

$mnode_(0) set Z_ 0.0 $mnode_(1) set X_ 1100.0 $mnode_(1) set Y_ 2700.0 $mnode_(1) set Z_ 0.0 $mnode_(2) set X_ 1900.0 $mnode_(2) set Y_ 2700.0 $mnode_(2) set Z_ 0.0 $mnode_(3) set X_ 500.0 $mnode_(3) set Y_ 1900.0 $mnode_(3) set Z_ 0.0 $mnode_(4) set X_ 1100.0 $mnode_(4) set Y_ 1900.0 $mnode_(4) set Z_ 0.0 $mnode_(5) set X_ 1900.0 $mnode_(5) set Y_ 1900.0 $mnode_(5) set Z_ 0.0 $mnode_(6) set X_ 2500.0 $mnode_(6) set Y_ 1900.0 $mnode_(6) set Z_ 0.0 $mnode_(7) set X_ 500.0 $mnode_(7) set Y_ 400.0 $mnode_(7) set Z_ 0.0 $mnode_(8) set X_ 1100.0 $mnode_(8) set Y_ 700.0 $mnode_(8) set Z_ 0.0 $mnode_(9) set X_ 1900.0 $mnode_(9) set Y_ 700.0 $mnode_(9) set Z_ 0.0 $mnode_(10) set X_ 2500.0 $mnode_(10) set Y_ 400.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]

(54)

set sink1 [new Agent/Null]

$ns attach-agent $mnode_(3) $sink1 $ns connect $udp1 $sink1

$udp1 set fid_ 1

set udp2 [new Agent/UDP]

$ns attach-agent $mnode_(3) $udp2 set sink2 [new Agent/Null]

$ns attach-agent $mnode_(1) $sink2 $ns connect $udp2 $sink2

$udp2 set fid_ 2

set udp3 [new Agent/UDP]

$ns attach-agent $mnode_(1) $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_(0) $udp4 set sink4 [new Agent/Null]

$ns attach-agent $mnode_(2) $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_(5) $sink5 $ns connect $udp5 $sink5

$udp5 set fid_ 5

set udp6 [new Agent/UDP]

$ns attach-agent $mnode_(5) $udp6 set sink6 [new Agent/Null]

$ns attach-agent $mnode_(9) $sink6 $ns connect $udp6 $sink6

$udp6 set fid_ 6

#Setup a TCP connection set tcp1 [new Agent/TCP]

$ns attach-agent $mnode_(10) $tcp1 set sink7 [new Agent/TCPSink] $ns attach-agent $mnode_(6) $sink7 $ns connect $tcp1 $sink7

(55)

set tcp2 [new Agent/TCP]

$ns attach-agent $mnode_(6) $tcp2 set sink8 [new Agent/TCPSink] $ns attach-agent $mnode_(2) $sink8 $ns connect $tcp2 $sink8

$tcp2 set fid_ 8 $sink8 set fid_ 8 $tcp2 set packetSize_ 24 set tcp3 [new Agent/TCP]

$ns attach-agent $mnode_(2) $tcp3 set sink9 [new Agent/TCPSink] $ns attach-agent $mnode_(0) $sink9 $ns connect $tcp3 $sink9

$tcp3 set fid_ 9 $sink9 set fid_ 9 $tcp3 set packetSize_ 24 set tcp4 [new Agent/TCP]

$ns attach-agent $mnode_(0) $tcp4 set sink10 [new Agent/TCPSink] $ns attach-agent $mnode_(1) $sink10 $ns connect $tcp4 $sink10

$tcp4 set fid_ 10 $sink10 set fid_ 10 $tcp4 set packetSize_ 24 set tcp5 [new Agent/TCP]

$ns attach-agent $mnode_(1) $tcp5 set sink11 [new Agent/TCPSink] $ns attach-agent $mnode_(4) $sink11 $ns connect $tcp5 $sink11

$tcp5 set fid_ 11 $sink11 set fid_ 11 $tcp5 set packetSize_ 24 set tcp6 [new Agent/TCP]

$ns attach-agent $mnode_(4) $tcp6 set sink12 [new Agent/TCPSink] $ns attach-agent $mnode_(8) $sink12 $ns connect $tcp6 $sink12

$tcp6 set fid_ 12 $sink12 set fid_ 12 $tcp6 set packetSize_ 24

(56)

$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.25

set cbr6 [new Application/Traffic/CBR] $cbr6 attach-agent $udp6

$cbr6 set type_ CBR $cbr6 set packet_size_ 24 $cbr6 set rate_ 448Kb $cbr6 set interval_ 0.25

(57)

set ftp5 [new Application/FTP] $ftp5 attach-agent $tcp5 set ftp6 [new Application/FTP] $ftp6 attach-agent $tcp6 # Time Event for -r 0.9 $ns at 1.0 "$cbr1 start" $ns at 16.0 "$cbr1 stop" $ns at 17.0 "$cbr2 start" $ns at 32.0 "$cbr2 stop" $ns at 33.0 "$cbr3 start" $ns at 48.0 "$cbr3 stop" $ns at 49.0 "$cbr4 start" $ns at 64.0 "$cbr4 stop" $ns at 65.0 "$cbr5 start" $ns at 80.0 "$cbr5 stop" $ns at 81.0 "$cbr6 start" $ns at 95.7 "$cbr6 stop" $ns at 97.0 "$ftp1 start" $ns at 99.0 "$ftp1 stop" $ns at 100.0 "$ftp2 start" $ns at 102.0 "$ftp2 stop" $ns at 103.0 "$ftp3 start" $ns at 105.0 "$ftp3 stop" $ns at 106.0 "$ftp4 start" $ns at 108.0 "$ftp4 stop" $ns at 109.0 "$ftp5 start" $ns at 111.0 "$ftp5 stop" $ns at 112.0 "$ftp6 start" $ns at 114.0 "$ftp6 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-tree.nam &

exec awk -f filter.awk trace-tree.tr & }

(58)

Lampiran 9 File TCL Skema Simulasi C dengan receive rate 0,8

# Generate Parameters

set val(chan) Channel/WirelessChannel ;# channel type

set val(prop) Propagation/Shadowing ;# radio-propagation model set val(netif) Phy/WirelessPhy/802_15_4 ;# network interface type set val(mac) Mac/802_15_4 ;# 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) 10 ;# max packet in ifq set val(nn) 11 ;# number of mobilenodes set val(rp) AODV ;# protocol type

set val(x) 3000 ;# X dimension of topography set val(y) 3000 ;# Y dimension of topography set val(stop) 120 ;# simulation period

Phy/WirelessPhy set RXThresh_ 3.9364e-11 ;# -r 0.8 # Header

set ns [new Simulator] set tracefd [open trace-tree.tr w] set namtrace [open nam-tree.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]

}

(59)

$mnode_(0) set Z_ 0.0 $mnode_(1) set X_ 1100.0 $mnode_(1) set Y_ 2700.0 $mnode_(1) set Z_ 0.0 $mnode_(2) set X_ 1900.0 $mnode_(2) set Y_ 2700.0 $mnode_(2) set Z_ 0.0 $mnode_(3) set X_ 500.0 $mnode_(3) set Y_ 1900.0 $mnode_(3) set Z_ 0.0 $mnode_(4) set X_ 1100.0 $mnode_(4) set Y_ 1900.0 $mnode_(4) set Z_ 0.0 $mnode_(5) set X_ 1900.0 $mnode_(5) set Y_ 1900.0 $mnode_(5) set Z_ 0.0 $mnode_(6) set X_ 2500.0 $mnode_(6) set Y_ 1900.0 $mnode_(6) set Z_ 0.0 $mnode_(7) set X_ 500.0 $mnode_(7) set Y_ 400.0 $mnode_(7) set Z_ 0.0 $mnode_(8) set X_ 1100.0 $mnode_(8) set Y_ 700.0 $mnode_(8) set Z_ 0.0 $mnode_(9) set X_ 1900.0 $mnode_(9) set Y_ 700.0 $mnode_(9) set Z_ 0.0 $mnode_(10) set X_ 2500.0 $mnode_(10) set Y_ 400.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]

(60)

set sink1 [new Agent/Null]

$ns attach-agent $mnode_(3) $sink1 $ns connect $udp1 $sink1

$udp1 set fid_ 1

set udp2 [new Agent/UDP]

$ns attach-agent $mnode_(3) $udp2 set sink2 [new Agent/Null]

$ns attach-agent $mnode_(1) $sink2 $ns connect $udp2 $sink2

$udp2 set fid_ 2

set udp3 [new Agent/UDP]

$ns attach-agent $mnode_(1) $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_(0) $udp4 set sink4 [new Agent/Null]

$ns attach-agent $mnode_(2) $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_(5) $sink5 $ns connect $udp5 $sink5

$udp5 set fid_ 5

set udp6 [new Agent/UDP]

$ns attach-agent $mnode_(5) $udp6 set sink6 [new Agent/Null]

$ns attach-agent $mnode_(9) $sink6 $ns connect $udp6 $sink6

$udp6 set fid_ 6

#Setup a TCP connection set tcp1 [new Agent/TCP]

$ns attach-agent $mnode_(10) $tcp1 set sink7 [new Agent/TCPSink] $ns attach-agent $mnode_(6) $sink7 $ns connect $tcp1 $sink7

(61)

set tcp2 [new Agent/TCP]

$ns attach-agent $mnode_(6) $tcp2 set sink8 [new Agent/TCPSink] $ns attach-agent $mnode_(2) $sink8 $ns connect $tcp2 $sink8

$tcp2 set fid_ 8 $sink8 set fid_ 8 $tcp2 set packetSize_ 24 set tcp3 [new Agent/TCP]

$ns attach-agent $mnode_(2) $tcp3 set sink9 [new Agent/TCPSink] $ns attach-agent $mnode_(0) $sink9 $ns connect $tcp3 $sink9

$tcp3 set fid_ 9 $sink9 set fid_ 9 $tcp3 set packetSize_ 24 set tcp4 [new Agent/TCP]

$ns attach-agent $mnode_(0) $tcp4 set sink10 [new Agent/TCPSink] $ns attach-agent $mnode_(1) $sink10 $ns connect $tcp4 $sink10

$tcp4 set fid_ 10 $sink10 set fid_ 10 $tcp4 set packetSize_ 24 set tcp5 [new Agent/TCP]

$ns attach-agent $mnode_(1) $tcp5 set sink11 [new Agent/TCPSink] $ns attach-agent $mnode_(4) $sink11 $ns connect $tcp5 $sink11

$tcp5 set fid_ 11 $sink11 set fid_ 11 $tcp5 set packetSize_ 24 set tcp6 [new Agent/TCP]

$ns attach-agent $mnode_(4) $tcp6 set sink12 [new Agent/TCPSink] $ns attach-agent $mnode_(8) $sink12 $ns connect $tcp6 $sink12

$tcp6 set fid_ 12 $sink12 set fid_ 12 $tcp6 set packetSize_ 24

(62)

$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] $cbr6 attach-agent $udp6

$cbr6 set type_ CBR $cbr6 set packet_size_ 24 $cbr6 set rate_ 448Kb $cbr6 set interval_ 0.5

(63)

set ftp5 [new Application/FTP] $ftp5 attach-agent $tcp5 set ftp6 [new Application/FTP] $ftp6 attach-agent $tcp6 # Time Event for -r 0.8 $ns at 1.0 "$cbr1 start" $ns at 16.0 "$cbr1 stop" $ns at 17.0 "$cbr2 start" $ns at 32.0 "$cbr2 stop" $ns at 33.0 "$cbr3 start" $ns at 48.0 "$cbr3 stop" $ns at 49.0 "$cbr4 start" $ns at 64.0 "$cbr4 stop" $ns at 65.0 "$cbr5 start" $ns at 80.0 "$cbr5 stop" $ns at 81.0 "$cbr6 start" $ns at 96.0 "$cbr6 stop" $ns at 101.0 "$ftp1 start" $ns at 102.0 "$ftp1 stop" $ns at 103.0 "$ftp2 start" $ns at 104.0 "$ftp2 stop" $ns at 105.0 "$ftp3 start" $ns at 105.86 "$ftp3 stop" $ns at 107.0 "$ftp4 start" $ns at 107.5 "$ftp4 stop" $ns at 109.0 "$ftp5 start" $ns at 109.5 "$ftp5 stop" $ns at 111.0 "$ftp6 start" $ns at 111.3687 "$ftp6 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-tree.nam &

exec awk -f filter.awk trace-tree.tr & }

(64)

Lampiran 10 Tabel B Hasil Simulasi Skema Simulasi A dengan receive rate 0,95

Data Source Node

Destination Node Link

Packet Size (bit) Sent Time (s) Received Time (s) End-to-end Delay (s) Throughput (kbit/s)

1 2 0 UDP 24 1 3.039377 2.039377 0.0117683

2 2 0 UDP 24 1.5 3.044307 1.544307 0.015540951

3 2 0 UDP 24 2 3.049841 1.049841 0.022860605

4 2 0 UDP 24 2.5 3.062081 0.562081 0.042698472

5 2 0 UDP 24 3 3.071441 0.071441 0.335941546

6 2 0 UDP 24 3.5 3.504659 0.004659 5.151320026

7 2 0 UDP 24 4 4.004339 0.004339 5.531228394

8 2 0 UDP 24 4.5 4.504659 0.004659 5.151320026

9 2 0 UDP 24 5 5.004659 0.004659 5.151320026

10 2 0 UDP 24 5.5 5.505619 0.005619 4.271222637

11 2 0 UDP 24 6 6.004339 0.004339 5.531228394

12 2 0 UDP 24 6.5 6.503379 0.003379 7.102693104

13 2 0 UDP 24 7 7.003379 0.003379 7.102693104

14 2 0 UDP 24 7.5 7.505619 0.005619 4.271222637

15 2 0 UDP 24 8 8.004979 0.004979 4.820245029

16 2 0 UDP 24 8.5 8.505619 0.005619 4.271222637

17 2 0 UDP 24 9 9.005299 0.005299 4.529156445

18 2 0 UDP 24 9.5 9.504019 0.004019 5.971634735

19 2 0 UDP 24 10 10.004019 0.004019 5.971634735

20 2 0 UDP 24 10.5 10.504339 0.004339 5.531228394

21 2 0 UDP 24 11 11.004979 0.004979 4.820245029

22 2 0 UDP 24 11.5 11.503379 0.003379 7.102693104

23 2 0 UDP 24 12 12.004339 0.004339 5.531228394

24 2 0 UDP 24 12.5 12.504019 0.004019 5.971634735

25 2 0 UDP 24 13 13.004019 0.004019 5.971634735

26 2 0 UDP 24 13.5 13.504019 0.004019 5.971634735

27 2 0 UDP 24 14 14.004979 0.004979 4.820245029

28 2 0 UDP 24 14.5 14.504019 0.004019 5.971634735

29 2 0 UDP 24 15 15.005619 0.005619 4.271222637

30 2 0 UDP 24 15.5 15.505619 0.005619 4.271222637

31 2 0 UDP 24 16 16.003699 0.003699 6.488240065

32 2 0 UDP 24 16.5 16.503379 0.003379 7.102693104

33 2 0 UDP 24 17 17.004659 0.004659 5.151320026

34 2 0 UDP 24 17.5 17.505299 0.005299 4.529156445

35 2 0 UDP 24 18 18.004339 0.004339 5.531228394

36 2 0 UDP 24 18.5 18.504979 0.004979 4.820245029

37 2 0 UDP 24 19 19.004979 0.004979 4.820245029

38 2 0 UDP 24 19.5 19.504979 0.004979 4.820245029

39 2 0 UDP 24 20 20.005299 0.005299 4.529156445

40 2 0 UDP 24 20.5 20.505619 0.005619 4.271222637

41 2 0 UDP 24 21 21.004979 0.004979 4.820245029

42 2 0 UDP 24 21.5 21.503699 0.003699 6.488240065

43 1 0 TCP 24 22 22.03912461 0.03912461 0.613424645

44 1 0 TCP 24 22.04461511 22.04863361 0.0040185 5.972377753

45 1 0 TCP 24 22.04461511 22.06213861 0.0175235 1.369589409

46 1 0 TCP 24 22.06597911 22.07282861 0.0068495 3.503905395

47 1 0 TCP 24 22.06597911 22.08004761 0.0140685 1.705938799

48 1 0 TCP 24 22.06854011 22.08990461 0.0213645 1.123358843

49 1 0 TCP 24 22.06854011 22.09323361 0.0246935 0.971915686

50 1 0 TCP 24 22.07607911 22.10072261 0.0246435 0.973887638

51 1 0 TCP 24 22.07607911 22.11429361 0.0382145 0.628033861

52 1 0 TCP 24 22.09643411 22.11826261 0.0218285 1.099480038

(65)

54 1 0 TCP 24 22.10456311 22.13868261 0.0341195 0.703410073

55 1 0 TCP 24 22.10456311 22.14654161 0.0

Referensi

Dokumen terkait

Pencahayaan merupakan faktor yang sangat penting dalam suatu rumah sakit karena dapat memperlancar pekerjaan di rumah sakit. Apalagi seorang perawat yang pekerjaannya berkaitan

Hanya beberapa perusahaan yang memandang bahwa program pemagangan memiliki tujuan sosial, yang berarti bahwa perusahaan akan mengambil peserta magang lebih banyak dari pada yang

[r]

Dengan aplikasi ini, pengguna dapat dengan mudah memperoleh pelayanan dan informasi seluruh kegiatan yang ada khususnya dalam hal manajemen farmasi pada apotek dimanapun dan

Undang-Undang Nomor 8 Tahun 1956 tentang Pembentukan Daerah Otonom Kota Kecil dalam Lingkungan Daerah Propinsi Sumatera Tengah jo Peraturan Menteri Dalam Negeri

Teknologi dan informasi dari waktu ke waktu meningkat pesat, sehingga banyak pihak yang sangat dimudahkan dengan adanya perkembangan ini. Terlebih lagi dengan perkembangan

Bahan yang harus dihindari Tidak diketahui adanya reaksi berbahaya di bawah kondisi penggunaan normal.. Kemungkinan Reaksi Berbahaya Reaksi berbahaya belum dilaporkan Produk

• Wilayah laut adalah bagian wilayah negara yang berupa perairan/laut. Negara yang memiliki atau berbatasan dengan. laut disebut negara pantai atau ada sebutan negara kepulauan. •