Debian Codegraph @

tcl/scenario-generation/scen-lib/rmcc-2.tcl

raw
1 # rmcc-2.tcl
2 # Competing with TCP scenario
3
4 # RM sender
5 # topology: 2 o o 5 RM recv1
6 # \ 0 1 /
7 # TCP send1 3 o--o-------o--o 6 RM rec 2
8 # / |\
9 # TCP send2 4 o | o 7 TCP recv 1
10 # o 8 TCP recv 2
11
12
13 # TCP sender 1 starts to send at t=0sec
14 # SRM sender starts to send at t=10s
15 # tcp sender 2 starts to send at t=20s
16 # BW of link 0-1 = 1 Mbps and delay is 20ms . For rest of the
17 # topology BW = 10Mbps and delay of 5ms.
18 # flowmonitors compare thruput of TCP and rm flows in links 1-5, 1-6,
19 # 1-7 and 1-8.
20 #
21 # usage: ns rmcc-2.tcl
22 #
23
24 source rmcc.tcl
25
26 ScenLib/RM instproc make_topo2 { time } {
27 global ns n t opts
28 $self make_nodes 9
29 #color them
30 $n(0) color "red"
31 $n(1) color "red"
32 $n(2) color "orchid"
33 $n(5) color "orchid"
34 $n(6) color "orchid"
35 $n(3) color "green"
36 $n(4) color "green"
37 $n(7) color "green"
38 $n(8) color "green"
39
40 #now setup topology
41 # First the bottle-neck link
42 $ns duplex-link $n(0) $n(1) $opts(bottleneckBW) \
43 $opts(bottleneckDelay) DropTail
44 $ns duplex-link-op $n(0) $n(1) queuePos 0.5
45 $ns duplex-link $n(0) $n(2) 10Mb 10ms DropTail
46 $ns duplex-link $n(0) $n(3) 10Mb 10ms DropTail
47 $ns duplex-link $n(0) $n(4) 10Mb 10ms DropTail
48 $ns duplex-link $n(1) $n(5) 10Mb 10ms DropTail
49 $ns duplex-link $n(1) $n(6) 10Mb 10ms DropTail
50 $ns duplex-link $n(1) $n(7) 10Mb 10ms DropTail
51 $ns duplex-link $n(1) $n(8) 10Mb 10ms DropTail
52
53 $ns duplex-link-op $n(0) $n(1) orient right
54 $ns duplex-link-op $n(0) $n(2) orient left-up
55 $ns duplex-link-op $n(0) $n(3) orient left
56 $ns duplex-link-op $n(0) $n(4) orient left-down
57 $ns duplex-link-op $n(1) $n(5) orient rightup
58 $ns duplex-link-op $n(1) $n(6) orient right
59 $ns duplex-link-op $n(1) $n(7) orient right-down
60 $ns duplex-link-op $n(1) $n(8) orient down
61
62 $ns queue-limit $n(0) $n(1) $opts(bottleneckQSize)
63 $ns queue-limit $n(1) $n(0) $opts(bottleneckQSize)
64
65 $self make_flowmon $time $n(1) $n(5) flowStats_1_5.$t \
66 $n(1) $n(6) flowStats_1_6.$t \
67 $n(1) $n(7) flowStats_1_7.$t \
68 $n(1) $n(8) flowStats_1_8.$t
69 }
70
71
72
73 proc main {} {
74 global ns n
75 set test_scen [new ScenLib/RM]
76 $test_scen make_topo2 1.0
77 $test_scen create_mcast 2 8.3 9.0 10.0 5 6
78 $test_scen create_tcp 3 7 0.0
79 $test_scen create_tcp 4 8 20.0
80 $test_scen dump_flowmon $n(1) $n(7) 10.0
81 $test_scen dump_flowmon $n(1) $n(5) 20.0
82 $test_scen dump_flowmon $n(1) $n(7) 20.0
83 $test_scen dump_flowmon $n(1) $n(5) 30.0
84 $test_scen dump_flowmon $n(1) $n(6) 30.0
85 $test_scen dump_flowmon $n(1) $n(7) 30.0
86 $test_scen dump_flowmon $n(1) $n(8) 30.0
87 $ns at 30.0 "finish"
88 $ns run
89 }
90
91 global argv prog opts t mflag
92 set mflag 0
93 if [string match {*.tcl} $argv0] {
94 set prog [string range $argv0 0 [expr [string length $argv0] - 5]]
95 } else {
96 set prog $argv0
97 }
98
99 process_args $argv
100 set t $prog
101 main
102
103