Advertisement
Guest User

exemplo1.tcl

a guest
Sep 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. set ns [new Simulator]
  2. set nf [open out.nam w]
  3. $ns namtrace-all $nf
  4. proc fim {} {
  5. global ns nf
  6. $ns flush-trace
  7. close $nf
  8. exec nam out.nam
  9. exit 0
  10. }
  11. set n0 [$ns node]
  12. set n1 [$ns node]
  13. $ns duplex-link $n0 $n1 1Mb 10ms DropTail
  14.  
  15. #Cria um agente UDP e liga-o ao nó n0
  16. set udp0 [new Agent/UDP]
  17. $ns attach-agent $n0 $udp0
  18. #Cria uma fonte de tráfego CBR e liga-a ao udp0
  19. set cbr0 [new Application/Traffic/CBR]
  20. $cbr0 set packetSize_ 500
  21. $cbr0 set interval_ 0.005
  22. $cbr0 attach-agent $udp0
  23.  
  24. #Cria um agente Null e liga-o ao nó n1
  25. set null0 [new Agent/Null]
  26. $ns attach-agent $n1 $null0
  27.  
  28. $ns connect $udp0 $null0
  29.  
  30. $ns at 0.5 "$cbr0 start"
  31. $ns at 4.5 "$cbr0 stop"
  32.  
  33. $ns at 5.0 fim
  34.  
  35. $ns run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement