Escolar Documentos
Profissional Documentos
Cultura Documentos
Oleh:
Faizal Haris M. Fandi Yusuf N. Febri Santo S. (L2F008119) (L2F008121) (L2F008122)
$ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -channelType $val(chan) \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace ON #Create eight nodes for {set i 0} {$i < $val(nn) } { incr i } { set node_($i) [$ns node] } # Provide $node_(0) $node_(0) $node_(0) initial location of mobilenodes set X_ 30.0 set Y_ 50.0 set Z_ 0.0
$node_(1) set X_ 60.0 $node_(1) set Y_ 65.0 $node_(1) set Z_ 0.0 $node_(2) set X_ 140.0 $node_(2) set Y_ 40.0 $node_(2) set Z_ 0.0 $node_(3) set X_ 50.0 $node_(3) set Y_ 30.0 $node_(3) set Z_ 0.0 $node_(4) set X_ 60.0 $node_(4) set Y_ 50.0 $node_(4) set Z_ 0.0 $node_(5) set X_ 75.0 $node_(5) set Y_ 120.0 $node_(5) set Z_ 0.0 $node_(6) set X_ 40.0 $node_(6) set Y_ 25.0
$node_(6) set Z_ 0.0 $node_(7) set X_ 120.0 $node_(7) set Y_ 58.0 $node_(7) set Z_ 0.0 $node_(8) set X_ 70.0 $node_(8) set Y_ 25.0 $node_(8) set Z_ 0.0 $node_(9) set X_ 115.0 $node_(9) set Y_ 35.0 $node_(9) set Z_ 0.0 # unity gain, omni-directional antennas # set up the antennas to be centered in the node and 40.0 meters above it Antenna/OmniAntenna set X_ 0 Antenna/OmniAntenna set Y_ 0 Antenna/OmniAntenna set Z_ 40.0 Antenna/OmniAntenna set Gt_ 10.0 Antenna/OmniAntenna set Gr_ 10.0 # Initialize the SharedMedia interface with parameters to make # it work like the 2,4GHz Lucent WaveLAN DSSS radio interface Phy/WirelessPhy set CPThresh_ 10.0 Phy/WirelessPhy set CSThresh_ 1.559e-11 Phy/WirelessPhy set RXThresh_ 3.652e-10 Phy/WirelessPhy set Rb_ 2*1e6 Phy/WirelessPhy set Pt_ 0.2818 Phy/WirelessPhy set freq_ 2400e+6 Phy/WirelessPhy set L_ 1.0 # Generation Movement $ns at 1.0 "$node_(1) $ns at 1.5 "$node_(2) $ns at 2.0 "$node_(3) $ns at 2.5 "$node_(4) $ns at 3.0 "$node_(5) $ns at 3.5 "$node_(6) $ns at 4.0 "$node_(7) $ns at 4.5 "$node_(8) $ns at 5.0 "$node_(9)
230.0 280.0 5.0" 160.0 170.0 5.0" 265.0 120.0 5.0" 320.0 280.0 5.0" 410.0 180.0 5.0" 50.0 110.0 3.0" 220.0 400.0 5.0" 110.0 180.0 5.0" 360.0 160.0 10.0"
# Back Movement $ns at 1.0 "$node_(1) setdest 60.0 65.0 5.0" $ns at 1.5 "$node_(2) setdest 140.0 40.0 5.0"
$ns at 2.0 "$node_(3) setdest 50.0 30.0 5.0" $ns at 2.5 "$node_(4) setdest 60.0 50.0 5.0" $ns at 3.0 "$node_(5) setdest 75.0 120.0 5.0" $ns at 3.5 "$node_(6) setdest 40.0 25.0 5.0" $ns at 4.0 "$node_(7) setdest 120.0 58.0 5.0" $ns at 4.5 "$node_(8) setdest 70.0 25.0 5.0" $ns at 5.0 "$node_(9) setdest 115.0 160.0 5.0" #===================================== # Set Connection #===================================== # Pengirim 1 set tcp [new Agent/TCP] $tcp set window_ 2000 $tcp set fid_ 0 $ns color 0 blue set $ns $ns $ns sink [new Agent/TCPSink] attach-agent $node_(0) $tcp attach-agent $node_(4) $sink connect $tcp $sink
set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 0.5 "$ftp start" $ns at 200 "$ftp stop" #================================== # Pengirim 2 set udp [new Agent/UDP] $udp set window_ 2000 $udp set fid_ 1 $ns color 1 red set $ns $ns $ns null [new Agent/Null] attach-agent $node_(1) $udp attach-agent $node_(6) $null connect $udp $null
set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $ns at 0.2 "$cbr start" $ns at 200 "$cbr stop" #===================================== # Pengirim 3 set udp1 [new Agent/UDP] $udp1 set window_ 2000
$udp1 set fid_ 2 $ns color 2 green set $ns $ns $ns null1 [new Agent/Null] attach-agent $node_(2) $udp1 attach-agent $node_(5) $null1 connect $udp1 $null1
set voip [new Application/Traffic/Exponential] $voip attach-agent $udp1 $ns at 0.8 "$voip start" $ns at 200 "$voip stop" #===================================== # Pengirim 4 set udp2 [new Agent/UDP] $udp2 set window_ 2000 $udp2 set fid_ 3 $ns color 3 orange set $ns $ns $ns null2 [new Agent/Null] attach-agent $node_(6) $udp2 attach-agent $node_(9) $null2 connect $udp2 $null2
set cbr1 [new Application/Traffic/CBR] $cbr1 attach-agent $udp2 $ns at 1.5 "$cbr1 start" $ns at 200 "$cbr1 stop" # Printing the window size proc plotWindow {tcpSource file} { global ns set time 0.01 set now [$ns now] set cwnd [$tcpSource set cwnd_ ] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file"} $ns at 1.1 "plotWindow $tcp $window" #Define node initial position for {set i 0} {$i < $val(nn) } { incr # 20 define the size node for nam $ns initial_node_pos $node_($i) 20 }
i } {
# Telling nodes when the simulation ends for {set i 0} {$i < $val(nn) } { incr i } { $ns at $val(stop) "$node_($i) reset"; } # ending nam when the simulation end $ns at $val(stop) "$ns nam-end-wireless $val(stop)" $ns at $val(stop) "stop" $ns at 200.0 "puts \"end simulation\" ; $ns halt" #end program proc stop {} { global ns tracefd namtrace $ns flush-trace #close the trace file close $tracefd close $namtrace #Execute nam on the trace file exec nam out.nam & exit 0 }
set topo [new Topography] $topo load_flatgrid $val(x) $val(y) create-god $val(nn) #========================================================= # Create nn mobilenodes [$val(nn)] and attach them to the channel. #========================================================= #configuration the nodes $ns node-config -adhocRouting $val(rp) \ -llType $val(ll) \ -macType $val(mac) \ -ifqType $val(ifq) \ -ifqLen $val(ifqlen) \ -antType $val(ant) \ -propType $val(prop) \ -phyType $val(netif) \ -channelType $val(chan) \ -topoInstance $topo \ -agentTrace ON \ -routerTrace ON \ -macTrace OFF \ -movementTrace ON #Create eight nodes for {set i 0} {$i < $val(nn) } { incr i } { set node_($i) [$ns node] } # Provide $node_(0) $node_(0) $node_(0) initial location of mobilenodes set X_ 30.0 set Y_ 50.0 set Z_ 0.0
$node_(1) set X_ 60.0 $node_(1) set Y_ 65.0 $node_(1) set Z_ 0.0 $node_(2) set X_ 140.0 $node_(2) set Y_ 40.0 $node_(2) set Z_ 0.0 $node_(3) set X_ 50.0 $node_(3) set Y_ 30.0 $node_(3) set Z_ 0.0
$node_(4) set X_ 60.0 $node_(4) set Y_ 50.0 $node_(4) set Z_ 0.0 $node_(5) set X_ 75.0 $node_(5) set Y_ 120.0 $node_(5) set Z_ 0.0 $node_(6) set X_ 40.0 $node_(6) set Y_ 25.0 $node_(6) set Z_ 0.0 $node_(7) set X_ 120.0 $node_(7) set Y_ 58.0 $node_(7) set Z_ 0.0 $node_(8) set X_ 70.0 $node_(8) set Y_ 25.0 $node_(8) set Z_ 0.0 $node_(9) set X_ 115.0 $node_(9) set Y_ 35.0 $node_(9) set Z_ 0.0 # unity gain, omni-directional antennas # set up the antennas to be centered in the node and 40.0 meters above it Antenna/OmniAntenna set X_ 0 Antenna/OmniAntenna set Y_ 0 Antenna/OmniAntenna set Z_ 40.0 Antenna/OmniAntenna set Gt_ 10.0 Antenna/OmniAntenna set Gr_ 10.0 # Initialize the SharedMedia interface with parameters to make # it work like the 2,4GHz Lucent WaveLAN DSSS radio interface Phy/WirelessPhy set CPThresh_ 10.0 Phy/WirelessPhy set CSThresh_ 1.559e-11 Phy/WirelessPhy set RXThresh_ 3.652e-10 Phy/WirelessPhy set Rb_ 2*1e6 Phy/WirelessPhy set Pt_ 0.2818 Phy/WirelessPhy set freq_ 2400e+6 Phy/WirelessPhy set L_ 1.0 # Generation Movement $ns at 1.0 "$node_(1) setdest 230.0 280.0 5.0" $ns at 1.5 "$node_(2) setdest 160.0 170.0 5.0" $ns at 2.0 "$node_(3) setdest 265.0 120.0 5.0"
at at at at at at
320.0 280.0 5.0" 410.0 180.0 5.0" 50.0 110.0 3.0" 220.0 400.0 5.0" 110.0 180.0 5.0" 360.0 160.0 10.0"
# Back $ns at $ns at $ns at $ns at $ns at $ns at $ns at $ns at $ns at
Movement 1.0 "$node_(1) 1.5 "$node_(2) 2.0 "$node_(3) 2.5 "$node_(4) 3.0 "$node_(5) 3.5 "$node_(6) 4.0 "$node_(7) 4.5 "$node_(8) 5.0 "$node_(9)
30.0 50.0 5.0" 60.0 65.0 5.0" 140.0 40.0 5.0" 50.0 30.0 5.0" 75.0 120.0 5.0" 40.0 25.0 5.0" 120.0 58.0 5.0" 70.0 25.0 5.0" 115.0 35.0 5.0"
#===================================== # Set Connection #===================================== # Pengirim 1 set tcp [new Agent/TCP] $tcp set window_ 2000 $tcp set fid_ 0 $ns color 0 blue set $ns $ns $ns sink [new Agent/TCPSink] attach-agent $node_(0) $tcp attach-agent $node_(4) $sink connect $tcp $sink
set ftp [new Application/FTP] $ftp attach-agent $tcp $ns at 0.5 "$ftp start" $ns at 200 "$ftp stop" #================================== # Pengirim 2 set udp [new Agent/UDP] $udp set window_ 2000 $udp set fid_ 1 $ns color 1 red set null [new Agent/Null] $ns attach-agent $node_(1) $udp
$ns attach-agent $node_(6) $null $ns connect $udp $null set cbr [new Application/Traffic/CBR] $cbr attach-agent $udp $ns at 0.2 "$cbr start" $ns at 200 "$cbr stop" #===================================== # Pengirim 3 set udp1 [new Agent/UDP] $udp1 set window_ 2000 $udp1 set fid_ 2 $ns color 2 green set $ns $ns $ns null1 [new Agent/Null] attach-agent $node_(2) $udp1 attach-agent $node_(5) $null1 connect $udp1 $null1
set voip [new Application/Traffic/Exponential] $voip attach-agent $udp1 $ns at 0.8 "$voip start" $ns at 200 "$voip stop" #===================================== # Pengirim 4 set udp2 [new Agent/UDP] $udp2 set window_ 2000 $udp2 set fid_ 3 $ns color 3 orange set $ns $ns $ns null2 [new Agent/Null] attach-agent $node_(6) $udp2 attach-agent $node_(9) $null2 connect $udp2 $null2
set cbr1 [new Application/Traffic/CBR] $cbr1 attach-agent $udp2 $ns at 1.5 "$cbr1 start" $ns at 200 "$cbr1 stop" # Printing the window size proc plotWindow {tcpSource file} global ns set time 0.01 set now [$ns now]
set cwnd [$tcpSource set cwnd_ ] puts $file "$now $cwnd" $ns at [expr $now+$time] "plotWindow $tcpSource $file"} $ns at 1.1 "plotWindow $tcp $window" #Define node initial position for {set i 0} {$i < $val(nn) } { incr # 20 define the size node for nam $ns initial_node_pos $node_($i) 20 } # Telling nodes when the simulation ends for {set i 0} {$i < $val(nn) } { incr i } { $ns at $val(stop) "$node_($i) reset"; } # ending nam when the simulation end $ns at $val(stop) "$ns nam-end-wireless $val(stop)" $ns at $val(stop) "stop" $ns at 200.0 "puts \"end simulation\" ; $ns halt" #end program proc stop {} { global ns tracefd namtrace $ns flush-trace #close the trace file close $tracefd close $namtrace #Execute nam on the trace file exec nam out.nam & exit 0 }
i } {
DSDV
Dari kedua tampilan congestion window DSDV dan AODV dapat kita bandingkan jenis routing dari keduanya, bahwa pada DSDV tidak dapat melakukan multipath routing sehingga pada saat pengiriman paket ketujun terbatas pada jaraknya, saat destination berada jauh diluar jangkauan dari pengirim maka pengiriman paket akan berhenti, tetapi saat jaraknya dapat di jangkau pengiriman pun akan diteruskan kembali. Berbeda dengan AODV yang mampu melakukan multipath routing, ketika destination jauh dari pengirim maka akan mengirim route request pada node lain sehingga paket tetap dikirim dengan perantara node lain, sehingga pengiriman paket hanya terhenti sebentar saja.