Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if {$argc == 3} {
- set protocol [lindex $argv 0]
- set traffic [lindex $argv 1]
- set wind [lindex $argv 2]
- } else {
- puts "-->Stuff"
- puts "protocol"
- puts "traffic"
- puts "TCP_window"
- exit 1
- }
- set ns [new Simulator]
- set nf [open out.nam w]
- $ns namtrace-all $nf
- proc fim {} {
- global ns nf
- $ns flush-trace
- close $nf
- exec nam out.nam
- exit 0
- }
- set n0 [$ns node]
- set n1 [$ns node]
- set n2 [$ns node]
- set n3 [$ns node]
- #SATELITE HERE
- set n4 [$ns node]
- set n5 [$ns node]
- set n6 [$ns node]
- set n7 [$ns node]
- $ns duplex-link $n0 $n2 200Mb 0.001ms DropTail
- $ns duplex-link $n1 $n2 200Mb 0.001ms DropTail
- $ns duplex-link $n2 $n3 200Mb 0.001ms DropTail
- $ns duplex-link $n3 $n4 0.2Mb 0.23ms DropTail
- $ns duplex-link $n4 $n5 100Mb 0.0005ms DropTail
- $ns duplex-link $n5 $n6 200Mb 0.001ms DropTail
- $ns duplex-link $n5 $n7 200Mb 0.001ms DropTail
- $ns queue-limit $n0 $n2 2098
- $ns queue-limit $n0 $n2 2098
- if {$protocol == "TCP"} {
- set tcp0 [new Agent/TCP]
- $tcp0 set window_ $wind
- $ns attach-agent $n0 $tcp0
- set cbr0 [new Application/Traffic/CBR]
- $cbr0 set packetSize_ 2097152
- $cbr0 set maxpkts_ 1
- $cbr0 attach-agent $tcp0
- set null [new Agent/TCPSink]
- $ns attach-agent $n6 $null
- $ns connect $tcp0 $null
- }
- if {$protocol == "UDP"} {
- set udp0 [new Agent/UDP]
- $ns attach-agent $n0 $udp0
- set cbr0 [new Application/Traffic/CBR]
- $cbr0 set packetSize_ 2097152
- $cbr0 set maxpkts_ 1
- $cbr0 attach-agent $udp0
- set null0 [new Agent/NULL]
- $ns attach-agent $n6 $null0
- $ns connect $udp0 $null0
- }
- if {$traffic == "low"} {
- set udpt [new Agent/UDP]
- $ns attach-agent $n1 $udpt
- set cbrt [new Application/Traffic/CBR]
- $cbrt set rate_ 1
- $cbrt attach-agent $udpt
- set nullt [new Agent/TCPSink]
- $ns attach-agent $n6 $nullt
- $ns connect $udpt $nullt
- }
- if {$traffic == "high"} {
- set udpt [new Agent/UDP]
- $ns attach-agent $n1 $udpt
- set cbrt [new Application/Traffic/CBR]
- $cbrt set rate_ 10
- $cbrt attach-agent $udpt
- set nullt [new Agent/TCPSink]
- $ns attach-agent $n6 $nullt
- $ns connect $udpt $nullt
- }
- $ns at 1.0 "$cbr0 start"
- $ns at 1.0 "$cbrt start"
- $ns at 4.0 "$cbr0 stop"
- $ns at 4.0 "$cbrt stop"
- $ns at 5.0 "fim"
- $ns run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement