SHARE
TWEET

Untitled

a guest Sep 23rd, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. set stop 100
  2. set type gsm
  3. set minth 30
  4. set maxth 0
  5. set adaptive 1
  6. set flows 0
  7. set window 30
  8. set web 2
  9. set opt(wrap) 100
  10. set opt(srcTrace) is
  11. set opt(dstTrace) bs2
  12. set bwDL(gsm) 9600
  13. set bwUL(gsm) 9600
  14. set propDL(gsm) .500
  15. set propUL)gsm) .500
  16.  
  17. set ns [ new Simulator ]
  18. set tf [ open out.tr w ]
  19. $ns trace-all $tf
  20.  
  21. set nodes(is) [$ns node]
  22. set nodes(ms) [$ns node]
  23. set nodes(bs1) [$ns node]
  24. set nodes(bs2) [$ns node]
  25. set nodes(lp) [$ns node]
  26.  
  27. proc cell_topo {} {
  28. global ns nodes
  29. $ns duplex-link $nodes(lp) $nodes(bs1) 3Mbps 10nodes(ms) DropTail
  30. $ns duplex-link $nodes(bs1) $nodes(ms) 1 1 RED
  31. $ns duplex-link $nodes(ms) $nodes(bs2) 1 1 RED
  32. $ns duplex-link $nodes(bs2) $nodes(is) 3Mbps 50nodes(ms) DropTail
  33. puts "gsm cell topology"
  34. }
  35. proc set_link_para {t} {
  36. global ns nodes bwUL bwDL propUL propDL buf
  37. $ns bandwidth $nodes(bs1) $nodes(ms) $bwDL($t) duplex
  38. $ns bandwidth $nodes(ms) $nodes(bs1) $bwDL($t) duplex
  39. $ns bandwidth $nodes(bs2) $nodes(ms) $bwDL($t) duplex
  40. $ns bandwidth $nodes(ms) $nodes(bs2) $bwDL($t) duplex
  41. $ns queue-limit $nodes(bs1) $nodes(ms) 10
  42. $ns queue-limit $nodes(bs2) $nodes(ms) 10
  43. }
  44. Queue/RED set adaptive_ $adaptive
  45. Queue/RED set thresh_ $minth
  46. Queue/RED set maxthresh_ $maxth
  47. Agent/TCP set window_ $window
  48. source web.tcl
  49. switch $type {
  50. gsm -
  51. gprs -
  52. umts {cell_topo}
  53. }
  54. set_link_para $type
  55. $ns insert-delayer $nodes(ms) $nodes(bs1) [new Delayer]
  56. $ns insert-delayer $nodes(ms) $nodes(bs2) [new Delayer]
  57. if {$flows == 0} {
  58. set tcp1 [$ns create-connection TCP/Sack1 $nodes(is) TCPSink/Sack1 $nodes(lp) 0]
  59. set ftp1 [[set tcp1] attach-app FTP]
  60. $ns at 0.8 "[set ftp1] start"
  61. }
  62. if {$flows > 0} {
  63. set tcp1 [$ns create-connection TCP/Sack1 $nodes(is) TCPSink/Sack1 $nodes(lp) 0]
  64. set ftp1 [[set tcp1] attach-app FTP]
  65. $tcp1 set window_ 100
  66. $ns at 0.0 "[set ftp1] start"
  67. $ns at 3.5 "[set ftp1] stop"
  68. set tcp2 [$ns create-connection TCP/Sack1 $nodes(is) TCPSink/Sack1 $nodes(lp) 0]
  69. set ftp2 [[set tcp2] attach-app FTP]
  70. $tcp2 set window_ 3
  71. $ns at 1.0 "[set ftp2] start"
  72. $ns at 8.0 "[set ftp2] stop"
  73. }
  74. proc stop {} {
  75. global nodes opt nf
  76. set wrap $opt(wrap)
  77. set sid [$nodes($opt(srcTrace)) id]
  78. set did [$nodes($opt(dstTrace)) id]
  79. set a "out.tr"
  80. set GETRC "../../../bin/getrc"
  81. set RAW2XG "../../../bin/raw2xg"
  82. exec $GETRC -s $sid -d $did -f 0 out.tr |
  83. $RAW2XG -s 0.01 -m $wrap -r > plot.xgr
  84. exec $GETRC -s $did -d $sid -f 0 out.tr |
  85. $RAW2XG -a -s 0.01 -m $wrap >> plot.xgr
  86. exec xgraph -x time -y packets plot.xgr &
  87. exit 0
  88. }
  89. $ns at $stop "stop"
  90. $ns run
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top