Pengaruh Lebar Pita Rute Paket Acknowledgement Pada Transmission Control Protocol Dengan Acknowledgement Terpisah Terhadap Kinerja Transmisi Video
LAMPIRAN
set ns [new Simulator]
$ns color 0 pink
$ns color 1 red
$ns color 2 green
$ns color 3 yellow
$ns color 4 brown
$ns color 5 purple
$ns color 6 black
$ns color 7 grey
$ns color 8 maroon
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
set n6 [$ns node]
set n7 [$ns node]
set n8 [$ns node]
set n9 [$ns node]
set n10 [$ns node]
set n11 [$ns node]
set n12 [$ns node]
set n13 [$ns node]
set n14 [$ns node]
set n15 [$ns node]
set n16 [$ns node]
set n17 [$ns node]
set n18 [$ns node]
set n19 [$ns node]
set n20 [$ns node]
set n21 [$ns node]
set n22 [$ns node]
set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf
$ns duplex-link $n0 $n3 5Mb 2ms DropTail
$ns duplex-link $n1 $n3 5Mb 2ms DropTail
$ns duplex-link $n2 $n3 5Mb 2ms DropTail
$ns duplex-link $n10 $n3 1.5Mb 10ms DropTail
Universitas Sumatera Utara
$ns simplex-link $n9 $n10 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n16 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n11 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n17 1.5Mb 10ms DropTail
$ns duplex-link $n3 $n4 1.5Mb 10ms DropTail
$ns duplex-link $n4 $n5 1.5Mb 10ms DropTail
$ns duplex-link $n4 $n11 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n6 1.5Mb 10ms DropTail
$ns duplex-link $n6 $n7 1.5Mb 10ms DropTail
$ns simplex-link $n6 $n8 1.5Mb 10ms DropTail
$ns duplex-link $n11 $n12 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n13 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n14 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n15 1.5Mb 10ms DropTail
$ns duplex-link $n11 $n18 1.5Mb 10ms DropTail
$ns duplex-link $n18 $n19 1.5Mb 10ms DropTail
$ns duplex-link $n18 $n20 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n21 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n22 1.5Mb 10ms DropTail
$ns simplex-link $n8 $n9 0.1Mb 10ms DropTail
$ns duplex-link-op $n0 $n3 orient right-up
$ns duplex-link-op $n1 $n3 orient right-down
$ns duplex-link-op $n2 $n3 orient down
$ns duplex-link-op $n10 $n3 orient up
$ns simplex-link-op $n9 $n10 orient right-up
$ns duplex-link-op $n10 $n11 orient right
$ns duplex-link-op $n10 $n16 orient down
$ns duplex-link-op $n10 $n17 orient right-down
$ns duplex-link-op $n3 $n4 orient right
$ns duplex-link-op $n4 $n5 orient right-up
$ns duplex-link-op $n4 $n11 orient down
$ns duplex-link-op $n5 $n6 orient right
$ns duplex-link-op $n6 $n7 orient right-up
$ns simplex-link-op $n6 $n8 orient right
$ns duplex-link-op $n11 $n12 orient right
$ns duplex-link-op $n12 $n13 orient right-up
$ns duplex-link-op $n12 $n14 orient right
$ns duplex-link-op $n12 $n15 orient right-down
$ns duplex-link-op $n11 $n18 orient right-down
$ns duplex-link-op $n18 $n19 orient left-down
$ns duplex-link-op $n18 $n20 orient right-down
$ns duplex-link-op $n5 $n21 orient right-up
$ns duplex-link-op $n5 $n22 orient left-up
$ns simplex-link-op $n8 $n9 orient left-down
$ns duplex-link-op $n2 $n3 queuePos 0.5
Universitas Sumatera Utara
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
set udp1 [new Agent/UDP]
$ns attach-agent $n3 $udp1
$udp1 set class_ 1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
#set udp2 [new Agent/UDP]
#$ns attach-agent $n9 $udp2
#$udp2 set class_ 2
#set cbr2 [new Application/Traffic/CBR]
#$cbr2 attach-agent $udp2
set udp3 [new Agent/UDP]
$ns attach-agent $n16 $udp3
$udp3 set class_ 3
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
set udp4 [new Agent/UDP]
$ns attach-agent $n19 $udp4
$udp4 set class_ 4
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
set udp5 [new Agent/UDP]
$ns attach-agent $n7 $udp5
$udp5 set class_ 5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
set udp6 [new Agent/UDP]
$ns attach-agent $n14 $udp6
$udp6 set class_ 6
set cbr6 [new Application/Traffic/CBR]
$cbr6 attach-agent $udp6
set udp7 [new Agent/UDP]
$ns attach-agent $n13 $udp7
$udp7 set class_ 7
set cbr7 [new Application/Traffic/CBR]
$cbr7 attach-agent $udp7
set udp8 [new Agent/UDP]
Universitas Sumatera Utara
$ns attach-agent $n1 $udp8
$udp8 set class_ 8
set cbr8 [new Application/Traffic/CBR]
$cbr8 attach-agent $udp8
set null0 [new Agent/Null]
$ns attach-agent $n14 $null0
set null1 [new Agent/Null]
$ns attach-agent $n13 $null1
#set null2 [new Agent/Null]
#$ns attach-agent $n8 $null2
set null3 [new Agent/Null]
$ns attach-agent $n20 $null3
set null4 [new Agent/Null]
$ns attach-agent $n14 $null4
set null5 [new Agent/Null]
$ns attach-agent $n20 $null5
set null6 [new Agent/Null]
$ns attach-agent $n21 $null6
set null7 [new Agent/Null]
$ns attach-agent $n22 $null7
set null8 [new Agent/Null]
$ns attach-agent $n17 $null8
$ns connect $udp0 $null0
$ns connect $udp1 $null1
#$ns connect $udp2 $null2
$ns connect $udp3 $null3
$ns connect $udp4 $null4
$ns connect $udp5 $null5
$ns connect $udp6 $null6
$ns connect $udp7 $null7
$ns connect $udp8 $null8
# creation trace traffic
set max_fragmented_size 1024
#add udp header(8 bytes) and IP header (20bytes)
set packetSize 1052
set original_file_name st40_a02
set trace_file_name video1.dat
Universitas Sumatera Utara
set original_file_id [open $original_file_name r]
set trace_file_id [open $trace_file_name w]
set pre_time 0
while {[eof $original_file_id] == 0} {
gets $original_file_id current_line
scan $current_line "%d%s%d%d%f" no_ frametype_ length_ tmp1_
tmp2_
set time [expr int(($tmp2_ - $pre_time)*1000000.0)]
if { $frametype_ == "I" } {
set type_v 1
set prio_p 0
}
if { $frametype_ == "P" } {
set type_v 2
set prio_p 0
}
if { $frametype_ == "B" } {
set type_v 3
set prio_p 0
}
if { $frametype_ == "H" } {
set type_v 1
set prio_p 0
}
puts $trace_file_id "$time $length_ $type_v $prio_p
$max_fragmented_size"
set pre_time $tmp2_
}
close $original_file_id
close $trace_file_id
set end_sim_time $tmp2_
puts "$end_sim_time"
set trace_file [new Tracefile]
$trace_file filename $trace_file_name
#Attach video to server
#create source traffic
#Create a UDP agent and attach it to node n0
set udp_0 [new Agent/myUDP]
$udp_0 set_filename udpSend0
$udp_0 set packetSize_ 1052
$ns attach-agent $n2 $udp_0 ;#Server 2
set tcp_1 [new Agent/TCP]
Universitas Sumatera Utara
$tcp_1 set_filename TcpSend0
$tcp_1 set packetSize_ 1052
$ns attach-agent $n9 $tcp_1 ;#paket yang diamati
set udp_1 [new Agent/myUDP]
$udp_1 set_filename udpSend1
$udp_1 set packetSize_ 1052
$ns attach-agent $n20 $udp_1 ;#Server 20
set udp_2 [new Agent/myUDP]
$udp_2 set_filename udpSend2
$udp_2 set packetSize_ 1052
$ns attach-agent $n22 $udp_2 ;#Server 22
# Attach video traffic source
set video0 [new Application/Traffic/myEvalvid]
$video0 attach-tracefile $trace_file
$video0 attach-agent $udp_0
set video1 [new Application/Traffic/myEvalvid]
$video1 attach-tracefile $trace_file
$video1 attach-agent $tcp_1
set video2 [new Application/Traffic/myEvalvid]
$video2 attach-tracefile $trace_file
$video2 attach-agent $udp_1
set video3 [new Application/Traffic/myEvalvid]
$video3 attach-tracefile $trace_file
$video3 attach-agent $udp_2
Universitas Sumatera Utara
set ns [new Simulator]
$ns color 0 pink
$ns color 1 red
$ns color 2 green
$ns color 3 yellow
$ns color 4 brown
$ns color 5 purple
$ns color 6 black
$ns color 7 grey
$ns color 8 maroon
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
set n6 [$ns node]
set n7 [$ns node]
set n8 [$ns node]
set n9 [$ns node]
set n10 [$ns node]
set n11 [$ns node]
set n12 [$ns node]
set n13 [$ns node]
set n14 [$ns node]
set n15 [$ns node]
set n16 [$ns node]
set n17 [$ns node]
set n18 [$ns node]
set n19 [$ns node]
set n20 [$ns node]
set n21 [$ns node]
set n22 [$ns node]
set f [open out.tr w]
$ns trace-all $f
set nf [open out.nam w]
$ns namtrace-all $nf
$ns duplex-link $n0 $n3 5Mb 2ms DropTail
$ns duplex-link $n1 $n3 5Mb 2ms DropTail
$ns duplex-link $n2 $n3 5Mb 2ms DropTail
$ns duplex-link $n10 $n3 1.5Mb 10ms DropTail
Universitas Sumatera Utara
$ns simplex-link $n9 $n10 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n16 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n11 1.5Mb 10ms DropTail
$ns duplex-link $n10 $n17 1.5Mb 10ms DropTail
$ns duplex-link $n3 $n4 1.5Mb 10ms DropTail
$ns duplex-link $n4 $n5 1.5Mb 10ms DropTail
$ns duplex-link $n4 $n11 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n6 1.5Mb 10ms DropTail
$ns duplex-link $n6 $n7 1.5Mb 10ms DropTail
$ns simplex-link $n6 $n8 1.5Mb 10ms DropTail
$ns duplex-link $n11 $n12 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n13 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n14 1.5Mb 10ms DropTail
$ns duplex-link $n12 $n15 1.5Mb 10ms DropTail
$ns duplex-link $n11 $n18 1.5Mb 10ms DropTail
$ns duplex-link $n18 $n19 1.5Mb 10ms DropTail
$ns duplex-link $n18 $n20 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n21 1.5Mb 10ms DropTail
$ns duplex-link $n5 $n22 1.5Mb 10ms DropTail
$ns simplex-link $n8 $n9 0.1Mb 10ms DropTail
$ns duplex-link-op $n0 $n3 orient right-up
$ns duplex-link-op $n1 $n3 orient right-down
$ns duplex-link-op $n2 $n3 orient down
$ns duplex-link-op $n10 $n3 orient up
$ns simplex-link-op $n9 $n10 orient right-up
$ns duplex-link-op $n10 $n11 orient right
$ns duplex-link-op $n10 $n16 orient down
$ns duplex-link-op $n10 $n17 orient right-down
$ns duplex-link-op $n3 $n4 orient right
$ns duplex-link-op $n4 $n5 orient right-up
$ns duplex-link-op $n4 $n11 orient down
$ns duplex-link-op $n5 $n6 orient right
$ns duplex-link-op $n6 $n7 orient right-up
$ns simplex-link-op $n6 $n8 orient right
$ns duplex-link-op $n11 $n12 orient right
$ns duplex-link-op $n12 $n13 orient right-up
$ns duplex-link-op $n12 $n14 orient right
$ns duplex-link-op $n12 $n15 orient right-down
$ns duplex-link-op $n11 $n18 orient right-down
$ns duplex-link-op $n18 $n19 orient left-down
$ns duplex-link-op $n18 $n20 orient right-down
$ns duplex-link-op $n5 $n21 orient right-up
$ns duplex-link-op $n5 $n22 orient left-up
$ns simplex-link-op $n8 $n9 orient left-down
$ns duplex-link-op $n2 $n3 queuePos 0.5
Universitas Sumatera Utara
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
set udp1 [new Agent/UDP]
$ns attach-agent $n3 $udp1
$udp1 set class_ 1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
#set udp2 [new Agent/UDP]
#$ns attach-agent $n9 $udp2
#$udp2 set class_ 2
#set cbr2 [new Application/Traffic/CBR]
#$cbr2 attach-agent $udp2
set udp3 [new Agent/UDP]
$ns attach-agent $n16 $udp3
$udp3 set class_ 3
set cbr3 [new Application/Traffic/CBR]
$cbr3 attach-agent $udp3
set udp4 [new Agent/UDP]
$ns attach-agent $n19 $udp4
$udp4 set class_ 4
set cbr4 [new Application/Traffic/CBR]
$cbr4 attach-agent $udp4
set udp5 [new Agent/UDP]
$ns attach-agent $n7 $udp5
$udp5 set class_ 5
set cbr5 [new Application/Traffic/CBR]
$cbr5 attach-agent $udp5
set udp6 [new Agent/UDP]
$ns attach-agent $n14 $udp6
$udp6 set class_ 6
set cbr6 [new Application/Traffic/CBR]
$cbr6 attach-agent $udp6
set udp7 [new Agent/UDP]
$ns attach-agent $n13 $udp7
$udp7 set class_ 7
set cbr7 [new Application/Traffic/CBR]
$cbr7 attach-agent $udp7
set udp8 [new Agent/UDP]
Universitas Sumatera Utara
$ns attach-agent $n1 $udp8
$udp8 set class_ 8
set cbr8 [new Application/Traffic/CBR]
$cbr8 attach-agent $udp8
set null0 [new Agent/Null]
$ns attach-agent $n14 $null0
set null1 [new Agent/Null]
$ns attach-agent $n13 $null1
#set null2 [new Agent/Null]
#$ns attach-agent $n8 $null2
set null3 [new Agent/Null]
$ns attach-agent $n20 $null3
set null4 [new Agent/Null]
$ns attach-agent $n14 $null4
set null5 [new Agent/Null]
$ns attach-agent $n20 $null5
set null6 [new Agent/Null]
$ns attach-agent $n21 $null6
set null7 [new Agent/Null]
$ns attach-agent $n22 $null7
set null8 [new Agent/Null]
$ns attach-agent $n17 $null8
$ns connect $udp0 $null0
$ns connect $udp1 $null1
#$ns connect $udp2 $null2
$ns connect $udp3 $null3
$ns connect $udp4 $null4
$ns connect $udp5 $null5
$ns connect $udp6 $null6
$ns connect $udp7 $null7
$ns connect $udp8 $null8
# creation trace traffic
set max_fragmented_size 1024
#add udp header(8 bytes) and IP header (20bytes)
set packetSize 1052
set original_file_name st40_a02
set trace_file_name video1.dat
Universitas Sumatera Utara
set original_file_id [open $original_file_name r]
set trace_file_id [open $trace_file_name w]
set pre_time 0
while {[eof $original_file_id] == 0} {
gets $original_file_id current_line
scan $current_line "%d%s%d%d%f" no_ frametype_ length_ tmp1_
tmp2_
set time [expr int(($tmp2_ - $pre_time)*1000000.0)]
if { $frametype_ == "I" } {
set type_v 1
set prio_p 0
}
if { $frametype_ == "P" } {
set type_v 2
set prio_p 0
}
if { $frametype_ == "B" } {
set type_v 3
set prio_p 0
}
if { $frametype_ == "H" } {
set type_v 1
set prio_p 0
}
puts $trace_file_id "$time $length_ $type_v $prio_p
$max_fragmented_size"
set pre_time $tmp2_
}
close $original_file_id
close $trace_file_id
set end_sim_time $tmp2_
puts "$end_sim_time"
set trace_file [new Tracefile]
$trace_file filename $trace_file_name
#Attach video to server
#create source traffic
#Create a UDP agent and attach it to node n0
set udp_0 [new Agent/myUDP]
$udp_0 set_filename udpSend0
$udp_0 set packetSize_ 1052
$ns attach-agent $n2 $udp_0 ;#Server 2
set tcp_1 [new Agent/TCP]
Universitas Sumatera Utara
$tcp_1 set_filename TcpSend0
$tcp_1 set packetSize_ 1052
$ns attach-agent $n9 $tcp_1 ;#paket yang diamati
set udp_1 [new Agent/myUDP]
$udp_1 set_filename udpSend1
$udp_1 set packetSize_ 1052
$ns attach-agent $n20 $udp_1 ;#Server 20
set udp_2 [new Agent/myUDP]
$udp_2 set_filename udpSend2
$udp_2 set packetSize_ 1052
$ns attach-agent $n22 $udp_2 ;#Server 22
# Attach video traffic source
set video0 [new Application/Traffic/myEvalvid]
$video0 attach-tracefile $trace_file
$video0 attach-agent $udp_0
set video1 [new Application/Traffic/myEvalvid]
$video1 attach-tracefile $trace_file
$video1 attach-agent $tcp_1
set video2 [new Application/Traffic/myEvalvid]
$video2 attach-tracefile $trace_file
$video2 attach-agent $udp_1
set video3 [new Application/Traffic/myEvalvid]
$video3 attach-tracefile $trace_file
$video3 attach-agent $udp_2
Universitas Sumatera Utara