Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 n4 [$ns node]
- set n1 [$ns node]
- set n2 [$ns node]
- set n3 [$ns node]
- $ns duplex-link $n1 $n2 1Gb 1.67ms DropTail
- $ns duplex-link $n3 $n4 6.9Mb 2.31s DropTail
- $ns duplex-link-op $n1 $n2 orient right-up
- $ns duplex-link-op $n3 $n4 orient right-down
- #Novo UDP
- set udp1 [new Agent/UDP]
- $ns attach-agent $n1 $udp1
- #Novo CBR
- set cbr1 [new Application/Traffic/CBR]
- $cbr1 set packetSize_ 16000000
- $cbr1 set interval_ 0.005s
- $cbr1 set maxpkts_ 1
- $cbr1 attach-agent $udp1
- #Novo UDP
- set udp2 [new Agent/UDP]
- $ns attach-agent $n3 $udp2
- #Novo CBR
- set cbr2 [new Application/Traffic/CBR]
- $cbr2 set packetSize_ 16000000
- $cbr2 set interval_ 0.005s
- $cbr2 set maxpkts_ 1
- $cbr2 attach-agent $udp2
- #Novo Null
- set null1 [new Agent/Null]
- $ns attach-agent $n2 $null1
- #Novo Null
- set null2 [new Agent/Null]
- $ns attach-agent $n4 $null2
- $ns connect $udp1 $null1
- $ns connect $udp2 $null2
- $udp1 set class_ 1
- $udp2 set class_ 2
- $ns color 1 red
- $ns color 2 blue
- $ns at 0.5 "$cbr1 start"
- $ns at 0.5 "$cbr2 start"
- $ns at 4.5 "$cbr1 stop"
- $ns at 4.5 "$cbr2 stop"
- $ns at 5.0 "fim"
- $ns run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement